aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c185
1 files changed, 120 insertions, 65 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 9033d164c4ec..c59ad76c84b1 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -66,6 +66,7 @@ const struct ata_port_operations ata_sff_port_ops = {
66 66
67 .port_start = ata_sff_port_start, 67 .port_start = ata_sff_port_start,
68}; 68};
69EXPORT_SYMBOL_GPL(ata_sff_port_ops);
69 70
70const struct ata_port_operations ata_bmdma_port_ops = { 71const struct ata_port_operations ata_bmdma_port_ops = {
71 .inherits = &ata_sff_port_ops, 72 .inherits = &ata_sff_port_ops,
@@ -77,6 +78,14 @@ const struct ata_port_operations ata_bmdma_port_ops = {
77 .bmdma_stop = ata_bmdma_stop, 78 .bmdma_stop = ata_bmdma_stop,
78 .bmdma_status = ata_bmdma_status, 79 .bmdma_status = ata_bmdma_status,
79}; 80};
81EXPORT_SYMBOL_GPL(ata_bmdma_port_ops);
82
83const struct ata_port_operations ata_bmdma32_port_ops = {
84 .inherits = &ata_bmdma_port_ops,
85
86 .sff_data_xfer = ata_sff_data_xfer32,
87};
88EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops);
80 89
81/** 90/**
82 * ata_fill_sg - Fill PCI IDE PRD table 91 * ata_fill_sg - Fill PCI IDE PRD table
@@ -166,8 +175,9 @@ static void ata_fill_sg_dumb(struct ata_queued_cmd *qc)
166 blen = len & 0xffff; 175 blen = len & 0xffff;
167 ap->prd[pi].addr = cpu_to_le32(addr); 176 ap->prd[pi].addr = cpu_to_le32(addr);
168 if (blen == 0) { 177 if (blen == 0) {
169 /* Some PATA chipsets like the CS5530 can't 178 /* Some PATA chipsets like the CS5530 can't
170 cope with 0x0000 meaning 64K as the spec says */ 179 cope with 0x0000 meaning 64K as the spec
180 says */
171 ap->prd[pi].flags_len = cpu_to_le32(0x8000); 181 ap->prd[pi].flags_len = cpu_to_le32(0x8000);
172 blen = 0x8000; 182 blen = 0x8000;
173 ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000); 183 ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000);
@@ -200,6 +210,7 @@ void ata_sff_qc_prep(struct ata_queued_cmd *qc)
200 210
201 ata_fill_sg(qc); 211 ata_fill_sg(qc);
202} 212}
213EXPORT_SYMBOL_GPL(ata_sff_qc_prep);
203 214
204/** 215/**
205 * ata_sff_dumb_qc_prep - Prepare taskfile for submission 216 * ata_sff_dumb_qc_prep - Prepare taskfile for submission
@@ -217,6 +228,7 @@ void ata_sff_dumb_qc_prep(struct ata_queued_cmd *qc)
217 228
218 ata_fill_sg_dumb(qc); 229 ata_fill_sg_dumb(qc);
219} 230}
231EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep);
220 232
221/** 233/**
222 * ata_sff_check_status - Read device status reg & clear interrupt 234 * ata_sff_check_status - Read device status reg & clear interrupt
@@ -233,6 +245,7 @@ u8 ata_sff_check_status(struct ata_port *ap)
233{ 245{
234 return ioread8(ap->ioaddr.status_addr); 246 return ioread8(ap->ioaddr.status_addr);
235} 247}
248EXPORT_SYMBOL_GPL(ata_sff_check_status);
236 249
237/** 250/**
238 * ata_sff_altstatus - Read device alternate status reg 251 * ata_sff_altstatus - Read device alternate status reg
@@ -275,7 +288,7 @@ static u8 ata_sff_irq_status(struct ata_port *ap)
275 status = ata_sff_altstatus(ap); 288 status = ata_sff_altstatus(ap);
276 /* Not us: We are busy */ 289 /* Not us: We are busy */
277 if (status & ATA_BUSY) 290 if (status & ATA_BUSY)
278 return status; 291 return status;
279 } 292 }
280 /* Clear INTRQ latch */ 293 /* Clear INTRQ latch */
281 status = ap->ops->sff_check_status(ap); 294 status = ap->ops->sff_check_status(ap);
@@ -319,6 +332,7 @@ void ata_sff_pause(struct ata_port *ap)
319 ata_sff_sync(ap); 332 ata_sff_sync(ap);
320 ndelay(400); 333 ndelay(400);
321} 334}
335EXPORT_SYMBOL_GPL(ata_sff_pause);
322 336
323/** 337/**
324 * ata_sff_dma_pause - Pause before commencing DMA 338 * ata_sff_dma_pause - Pause before commencing DMA
@@ -327,7 +341,7 @@ void ata_sff_pause(struct ata_port *ap)
327 * Perform I/O fencing and ensure sufficient cycle delays occur 341 * Perform I/O fencing and ensure sufficient cycle delays occur
328 * for the HDMA1:0 transition 342 * for the HDMA1:0 transition
329 */ 343 */
330 344
331void ata_sff_dma_pause(struct ata_port *ap) 345void ata_sff_dma_pause(struct ata_port *ap)
332{ 346{
333 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) { 347 if (ap->ops->sff_check_altstatus || ap->ioaddr.altstatus_addr) {
@@ -341,6 +355,7 @@ void ata_sff_dma_pause(struct ata_port *ap)
341 corruption. */ 355 corruption. */
342 BUG(); 356 BUG();
343} 357}
358EXPORT_SYMBOL_GPL(ata_sff_dma_pause);
344 359
345/** 360/**
346 * ata_sff_busy_sleep - sleep until BSY clears, or timeout 361 * ata_sff_busy_sleep - sleep until BSY clears, or timeout
@@ -396,6 +411,7 @@ int ata_sff_busy_sleep(struct ata_port *ap,
396 411
397 return 0; 412 return 0;
398} 413}
414EXPORT_SYMBOL_GPL(ata_sff_busy_sleep);
399 415
400static int ata_sff_check_ready(struct ata_link *link) 416static int ata_sff_check_ready(struct ata_link *link)
401{ 417{
@@ -422,6 +438,7 @@ int ata_sff_wait_ready(struct ata_link *link, unsigned long deadline)
422{ 438{
423 return ata_wait_ready(link, deadline, ata_sff_check_ready); 439 return ata_wait_ready(link, deadline, ata_sff_check_ready);
424} 440}
441EXPORT_SYMBOL_GPL(ata_sff_wait_ready);
425 442
426/** 443/**
427 * ata_sff_dev_select - Select device 0/1 on ATA bus 444 * ata_sff_dev_select - Select device 0/1 on ATA bus
@@ -449,6 +466,7 @@ void ata_sff_dev_select(struct ata_port *ap, unsigned int device)
449 iowrite8(tmp, ap->ioaddr.device_addr); 466 iowrite8(tmp, ap->ioaddr.device_addr);
450 ata_sff_pause(ap); /* needed; also flushes, for mmio */ 467 ata_sff_pause(ap); /* needed; also flushes, for mmio */
451} 468}
469EXPORT_SYMBOL_GPL(ata_sff_dev_select);
452 470
453/** 471/**
454 * ata_dev_select - Select device 0/1 on ATA bus 472 * ata_dev_select - Select device 0/1 on ATA bus
@@ -513,6 +531,7 @@ u8 ata_sff_irq_on(struct ata_port *ap)
513 531
514 return tmp; 532 return tmp;
515} 533}
534EXPORT_SYMBOL_GPL(ata_sff_irq_on);
516 535
517/** 536/**
518 * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. 537 * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt.
@@ -534,6 +553,7 @@ void ata_sff_irq_clear(struct ata_port *ap)
534 553
535 iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); 554 iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS);
536} 555}
556EXPORT_SYMBOL_GPL(ata_sff_irq_clear);
537 557
538/** 558/**
539 * ata_sff_tf_load - send taskfile registers to host controller 559 * ata_sff_tf_load - send taskfile registers to host controller
@@ -593,6 +613,7 @@ void ata_sff_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
593 613
594 ata_wait_idle(ap); 614 ata_wait_idle(ap);
595} 615}
616EXPORT_SYMBOL_GPL(ata_sff_tf_load);
596 617
597/** 618/**
598 * ata_sff_tf_read - input device's ATA taskfile shadow registers 619 * ata_sff_tf_read - input device's ATA taskfile shadow registers
@@ -633,6 +654,7 @@ void ata_sff_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
633 WARN_ON(1); 654 WARN_ON(1);
634 } 655 }
635} 656}
657EXPORT_SYMBOL_GPL(ata_sff_tf_read);
636 658
637/** 659/**
638 * ata_sff_exec_command - issue ATA command to host controller 660 * ata_sff_exec_command - issue ATA command to host controller
@@ -652,6 +674,7 @@ void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
652 iowrite8(tf->command, ap->ioaddr.command_addr); 674 iowrite8(tf->command, ap->ioaddr.command_addr);
653 ata_sff_pause(ap); 675 ata_sff_pause(ap);
654} 676}
677EXPORT_SYMBOL_GPL(ata_sff_exec_command);
655 678
656/** 679/**
657 * ata_tf_to_host - issue ATA taskfile to host controller 680 * ata_tf_to_host - issue ATA taskfile to host controller
@@ -717,6 +740,53 @@ unsigned int ata_sff_data_xfer(struct ata_device *dev, unsigned char *buf,
717 740
718 return words << 1; 741 return words << 1;
719} 742}
743EXPORT_SYMBOL_GPL(ata_sff_data_xfer);
744
745/**
746 * ata_sff_data_xfer32 - Transfer data by PIO
747 * @dev: device to target
748 * @buf: data buffer
749 * @buflen: buffer length
750 * @rw: read/write
751 *
752 * Transfer data from/to the device data register by PIO using 32bit
753 * I/O operations.
754 *
755 * LOCKING:
756 * Inherited from caller.
757 *
758 * RETURNS:
759 * Bytes consumed.
760 */
761
762unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
763 unsigned int buflen, int rw)
764{
765 struct ata_port *ap = dev->link->ap;
766 void __iomem *data_addr = ap->ioaddr.data_addr;
767 unsigned int words = buflen >> 2;
768 int slop = buflen & 3;
769
770 /* Transfer multiple of 4 bytes */
771 if (rw == READ)
772 ioread32_rep(data_addr, buf, words);
773 else
774 iowrite32_rep(data_addr, buf, words);
775
776 if (unlikely(slop)) {
777 __le32 pad;
778 if (rw == READ) {
779 pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
780 memcpy(buf + buflen - slop, &pad, slop);
781 } else {
782 memcpy(&pad, buf + buflen - slop, slop);
783 iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
784 }
785 words++;
786 }
787 return words << 2;
788}
789EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
720 790
721/** 791/**
722 * ata_sff_data_xfer_noirq - Transfer data by PIO 792 * ata_sff_data_xfer_noirq - Transfer data by PIO
@@ -746,6 +816,7 @@ unsigned int ata_sff_data_xfer_noirq(struct ata_device *dev, unsigned char *buf,
746 816
747 return consumed; 817 return consumed;
748} 818}
819EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq);
749 820
750/** 821/**
751 * ata_pio_sector - Transfer a sector of data. 822 * ata_pio_sector - Transfer a sector of data.
@@ -922,13 +993,15 @@ next_sg:
922 buf = kmap_atomic(page, KM_IRQ0); 993 buf = kmap_atomic(page, KM_IRQ0);
923 994
924 /* do the actual data transfer */ 995 /* do the actual data transfer */
925 consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw); 996 consumed = ap->ops->sff_data_xfer(dev, buf + offset,
997 count, rw);
926 998
927 kunmap_atomic(buf, KM_IRQ0); 999 kunmap_atomic(buf, KM_IRQ0);
928 local_irq_restore(flags); 1000 local_irq_restore(flags);
929 } else { 1001 } else {
930 buf = page_address(page); 1002 buf = page_address(page);
931 consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw); 1003 consumed = ap->ops->sff_data_xfer(dev, buf + offset,
1004 count, rw);
932 } 1005 }
933 1006
934 bytes -= min(bytes, consumed); 1007 bytes -= min(bytes, consumed);
@@ -1013,18 +1086,19 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
1013 * RETURNS: 1086 * RETURNS:
1014 * 1 if ok in workqueue, 0 otherwise. 1087 * 1 if ok in workqueue, 0 otherwise.
1015 */ 1088 */
1016static inline int ata_hsm_ok_in_wq(struct ata_port *ap, struct ata_queued_cmd *qc) 1089static inline int ata_hsm_ok_in_wq(struct ata_port *ap,
1090 struct ata_queued_cmd *qc)
1017{ 1091{
1018 if (qc->tf.flags & ATA_TFLAG_POLLING) 1092 if (qc->tf.flags & ATA_TFLAG_POLLING)
1019 return 1; 1093 return 1;
1020 1094
1021 if (ap->hsm_task_state == HSM_ST_FIRST) { 1095 if (ap->hsm_task_state == HSM_ST_FIRST) {
1022 if (qc->tf.protocol == ATA_PROT_PIO && 1096 if (qc->tf.protocol == ATA_PROT_PIO &&
1023 (qc->tf.flags & ATA_TFLAG_WRITE)) 1097 (qc->tf.flags & ATA_TFLAG_WRITE))
1024 return 1; 1098 return 1;
1025 1099
1026 if (ata_is_atapi(qc->tf.protocol) && 1100 if (ata_is_atapi(qc->tf.protocol) &&
1027 !(qc->dev->flags & ATA_DFLAG_CDB_INTR)) 1101 !(qc->dev->flags & ATA_DFLAG_CDB_INTR))
1028 return 1; 1102 return 1;
1029 } 1103 }
1030 1104
@@ -1338,6 +1412,7 @@ fsm_start:
1338 1412
1339 return poll_next; 1413 return poll_next;
1340} 1414}
1415EXPORT_SYMBOL_GPL(ata_sff_hsm_move);
1341 1416
1342void ata_pio_task(struct work_struct *work) 1417void ata_pio_task(struct work_struct *work)
1343{ 1418{
@@ -1507,6 +1582,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
1507 1582
1508 return 0; 1583 return 0;
1509} 1584}
1585EXPORT_SYMBOL_GPL(ata_sff_qc_issue);
1510 1586
1511/** 1587/**
1512 * ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read 1588 * ata_sff_qc_fill_rtf - fill result TF using ->sff_tf_read
@@ -1526,6 +1602,7 @@ bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc)
1526 qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf); 1602 qc->ap->ops->sff_tf_read(qc->ap, &qc->result_tf);
1527 return true; 1603 return true;
1528} 1604}
1605EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf);
1529 1606
1530/** 1607/**
1531 * ata_sff_host_intr - Handle host interrupt for given (port, task) 1608 * ata_sff_host_intr - Handle host interrupt for given (port, task)
@@ -1623,6 +1700,7 @@ idle_irq:
1623#endif 1700#endif
1624 return 0; /* irq not handled */ 1701 return 0; /* irq not handled */
1625} 1702}
1703EXPORT_SYMBOL_GPL(ata_sff_host_intr);
1626 1704
1627/** 1705/**
1628 * ata_sff_interrupt - Default ATA host interrupt handler 1706 * ata_sff_interrupt - Default ATA host interrupt handler
@@ -1667,6 +1745,7 @@ irqreturn_t ata_sff_interrupt(int irq, void *dev_instance)
1667 1745
1668 return IRQ_RETVAL(handled); 1746 return IRQ_RETVAL(handled);
1669} 1747}
1748EXPORT_SYMBOL_GPL(ata_sff_interrupt);
1670 1749
1671/** 1750/**
1672 * ata_sff_freeze - Freeze SFF controller port 1751 * ata_sff_freeze - Freeze SFF controller port
@@ -1695,6 +1774,7 @@ void ata_sff_freeze(struct ata_port *ap)
1695 1774
1696 ap->ops->sff_irq_clear(ap); 1775 ap->ops->sff_irq_clear(ap);
1697} 1776}
1777EXPORT_SYMBOL_GPL(ata_sff_freeze);
1698 1778
1699/** 1779/**
1700 * ata_sff_thaw - Thaw SFF controller port 1780 * ata_sff_thaw - Thaw SFF controller port
@@ -1712,6 +1792,7 @@ void ata_sff_thaw(struct ata_port *ap)
1712 ap->ops->sff_irq_clear(ap); 1792 ap->ops->sff_irq_clear(ap);
1713 ap->ops->sff_irq_on(ap); 1793 ap->ops->sff_irq_on(ap);
1714} 1794}
1795EXPORT_SYMBOL_GPL(ata_sff_thaw);
1715 1796
1716/** 1797/**
1717 * ata_sff_prereset - prepare SFF link for reset 1798 * ata_sff_prereset - prepare SFF link for reset
@@ -1753,6 +1834,7 @@ int ata_sff_prereset(struct ata_link *link, unsigned long deadline)
1753 1834
1754 return 0; 1835 return 0;
1755} 1836}
1837EXPORT_SYMBOL_GPL(ata_sff_prereset);
1756 1838
1757/** 1839/**
1758 * ata_devchk - PATA device presence detection 1840 * ata_devchk - PATA device presence detection
@@ -1865,6 +1947,7 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
1865 1947
1866 return class; 1948 return class;
1867} 1949}
1950EXPORT_SYMBOL_GPL(ata_sff_dev_classify);
1868 1951
1869/** 1952/**
1870 * ata_sff_wait_after_reset - wait for devices to become ready after reset 1953 * ata_sff_wait_after_reset - wait for devices to become ready after reset
@@ -1941,6 +2024,7 @@ int ata_sff_wait_after_reset(struct ata_link *link, unsigned int devmask,
1941 2024
1942 return ret; 2025 return ret;
1943} 2026}
2027EXPORT_SYMBOL_GPL(ata_sff_wait_after_reset);
1944 2028
1945static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask, 2029static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
1946 unsigned long deadline) 2030 unsigned long deadline)
@@ -2013,6 +2097,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
2013 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]); 2097 DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
2014 return 0; 2098 return 0;
2015} 2099}
2100EXPORT_SYMBOL_GPL(ata_sff_softreset);
2016 2101
2017/** 2102/**
2018 * sata_sff_hardreset - reset host port via SATA phy reset 2103 * sata_sff_hardreset - reset host port via SATA phy reset
@@ -2045,6 +2130,7 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
2045 DPRINTK("EXIT, class=%u\n", *class); 2130 DPRINTK("EXIT, class=%u\n", *class);
2046 return rc; 2131 return rc;
2047} 2132}
2133EXPORT_SYMBOL_GPL(sata_sff_hardreset);
2048 2134
2049/** 2135/**
2050 * ata_sff_postreset - SFF postreset callback 2136 * ata_sff_postreset - SFF postreset callback
@@ -2080,6 +2166,7 @@ void ata_sff_postreset(struct ata_link *link, unsigned int *classes)
2080 if (ap->ioaddr.ctl_addr) 2166 if (ap->ioaddr.ctl_addr)
2081 iowrite8(ap->ctl, ap->ioaddr.ctl_addr); 2167 iowrite8(ap->ctl, ap->ioaddr.ctl_addr);
2082} 2168}
2169EXPORT_SYMBOL_GPL(ata_sff_postreset);
2083 2170
2084/** 2171/**
2085 * ata_sff_error_handler - Stock error handler for BMDMA controller 2172 * ata_sff_error_handler - Stock error handler for BMDMA controller
@@ -2152,6 +2239,7 @@ void ata_sff_error_handler(struct ata_port *ap)
2152 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset, 2239 ata_do_eh(ap, ap->ops->prereset, softreset, hardreset,
2153 ap->ops->postreset); 2240 ap->ops->postreset);
2154} 2241}
2242EXPORT_SYMBOL_GPL(ata_sff_error_handler);
2155 2243
2156/** 2244/**
2157 * ata_sff_post_internal_cmd - Stock post_internal_cmd for SFF controller 2245 * ata_sff_post_internal_cmd - Stock post_internal_cmd for SFF controller
@@ -2174,6 +2262,7 @@ void ata_sff_post_internal_cmd(struct ata_queued_cmd *qc)
2174 2262
2175 spin_unlock_irqrestore(ap->lock, flags); 2263 spin_unlock_irqrestore(ap->lock, flags);
2176} 2264}
2265EXPORT_SYMBOL_GPL(ata_sff_post_internal_cmd);
2177 2266
2178/** 2267/**
2179 * ata_sff_port_start - Set port up for dma. 2268 * ata_sff_port_start - Set port up for dma.
@@ -2194,6 +2283,7 @@ int ata_sff_port_start(struct ata_port *ap)
2194 return ata_port_start(ap); 2283 return ata_port_start(ap);
2195 return 0; 2284 return 0;
2196} 2285}
2286EXPORT_SYMBOL_GPL(ata_sff_port_start);
2197 2287
2198/** 2288/**
2199 * ata_sff_std_ports - initialize ioaddr with standard port offsets. 2289 * ata_sff_std_ports - initialize ioaddr with standard port offsets.
@@ -2219,6 +2309,7 @@ void ata_sff_std_ports(struct ata_ioports *ioaddr)
2219 ioaddr->status_addr = ioaddr->cmd_addr + ATA_REG_STATUS; 2309 ioaddr->status_addr = ioaddr->cmd_addr + ATA_REG_STATUS;
2220 ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD; 2310 ioaddr->command_addr = ioaddr->cmd_addr + ATA_REG_CMD;
2221} 2311}
2312EXPORT_SYMBOL_GPL(ata_sff_std_ports);
2222 2313
2223unsigned long ata_bmdma_mode_filter(struct ata_device *adev, 2314unsigned long ata_bmdma_mode_filter(struct ata_device *adev,
2224 unsigned long xfer_mask) 2315 unsigned long xfer_mask)
@@ -2230,6 +2321,7 @@ unsigned long ata_bmdma_mode_filter(struct ata_device *adev,
2230 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 2321 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
2231 return xfer_mask; 2322 return xfer_mask;
2232} 2323}
2324EXPORT_SYMBOL_GPL(ata_bmdma_mode_filter);
2233 2325
2234/** 2326/**
2235 * ata_bmdma_setup - Set up PCI IDE BMDMA transaction 2327 * ata_bmdma_setup - Set up PCI IDE BMDMA transaction
@@ -2258,6 +2350,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
2258 /* issue r/w command */ 2350 /* issue r/w command */
2259 ap->ops->sff_exec_command(ap, &qc->tf); 2351 ap->ops->sff_exec_command(ap, &qc->tf);
2260} 2352}
2353EXPORT_SYMBOL_GPL(ata_bmdma_setup);
2261 2354
2262/** 2355/**
2263 * ata_bmdma_start - Start a PCI IDE BMDMA transaction 2356 * ata_bmdma_start - Start a PCI IDE BMDMA transaction
@@ -2290,6 +2383,7 @@ void ata_bmdma_start(struct ata_queued_cmd *qc)
2290 * unneccessarily delayed for MMIO 2383 * unneccessarily delayed for MMIO
2291 */ 2384 */
2292} 2385}
2386EXPORT_SYMBOL_GPL(ata_bmdma_start);
2293 2387
2294/** 2388/**
2295 * ata_bmdma_stop - Stop PCI IDE BMDMA transfer 2389 * ata_bmdma_stop - Stop PCI IDE BMDMA transfer
@@ -2314,6 +2408,7 @@ void ata_bmdma_stop(struct ata_queued_cmd *qc)
2314 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */ 2408 /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
2315 ata_sff_dma_pause(ap); 2409 ata_sff_dma_pause(ap);
2316} 2410}
2411EXPORT_SYMBOL_GPL(ata_bmdma_stop);
2317 2412
2318/** 2413/**
2319 * ata_bmdma_status - Read PCI IDE BMDMA status 2414 * ata_bmdma_status - Read PCI IDE BMDMA status
@@ -2330,6 +2425,7 @@ u8 ata_bmdma_status(struct ata_port *ap)
2330{ 2425{
2331 return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 2426 return ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
2332} 2427}
2428EXPORT_SYMBOL_GPL(ata_bmdma_status);
2333 2429
2334/** 2430/**
2335 * ata_bus_reset - reset host port and associated ATA channel 2431 * ata_bus_reset - reset host port and associated ATA channel
@@ -2422,6 +2518,7 @@ err_out:
2422 2518
2423 DPRINTK("EXIT\n"); 2519 DPRINTK("EXIT\n");
2424} 2520}
2521EXPORT_SYMBOL_GPL(ata_bus_reset);
2425 2522
2426#ifdef CONFIG_PCI 2523#ifdef CONFIG_PCI
2427 2524
@@ -2449,6 +2546,7 @@ int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
2449 return -EOPNOTSUPP; 2546 return -EOPNOTSUPP;
2450 return 0; 2547 return 0;
2451} 2548}
2549EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);
2452 2550
2453/** 2551/**
2454 * ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host 2552 * ata_pci_bmdma_init - acquire PCI BMDMA resources and init ATA host
@@ -2501,11 +2599,12 @@ int ata_pci_bmdma_init(struct ata_host *host)
2501 host->flags |= ATA_HOST_SIMPLEX; 2599 host->flags |= ATA_HOST_SIMPLEX;
2502 2600
2503 ata_port_desc(ap, "bmdma 0x%llx", 2601 ata_port_desc(ap, "bmdma 0x%llx",
2504 (unsigned long long)pci_resource_start(pdev, 4) + 8 * i); 2602 (unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
2505 } 2603 }
2506 2604
2507 return 0; 2605 return 0;
2508} 2606}
2607EXPORT_SYMBOL_GPL(ata_pci_bmdma_init);
2509 2608
2510static int ata_resources_present(struct pci_dev *pdev, int port) 2609static int ata_resources_present(struct pci_dev *pdev, int port)
2511{ 2610{
@@ -2513,7 +2612,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
2513 2612
2514 /* Check the PCI resources for this channel are enabled */ 2613 /* Check the PCI resources for this channel are enabled */
2515 port = port * 2; 2614 port = port * 2;
2516 for (i = 0; i < 2; i ++) { 2615 for (i = 0; i < 2; i++) {
2517 if (pci_resource_start(pdev, port + i) == 0 || 2616 if (pci_resource_start(pdev, port + i) == 0 ||
2518 pci_resource_len(pdev, port + i) == 0) 2617 pci_resource_len(pdev, port + i) == 0)
2519 return 0; 2618 return 0;
@@ -2598,6 +2697,7 @@ int ata_pci_sff_init_host(struct ata_host *host)
2598 2697
2599 return 0; 2698 return 0;
2600} 2699}
2700EXPORT_SYMBOL_GPL(ata_pci_sff_init_host);
2601 2701
2602/** 2702/**
2603 * ata_pci_sff_prepare_host - helper to prepare native PCI ATA host 2703 * ata_pci_sff_prepare_host - helper to prepare native PCI ATA host
@@ -2615,7 +2715,7 @@ int ata_pci_sff_init_host(struct ata_host *host)
2615 * 0 on success, -errno otherwise. 2715 * 0 on success, -errno otherwise.
2616 */ 2716 */
2617int ata_pci_sff_prepare_host(struct pci_dev *pdev, 2717int ata_pci_sff_prepare_host(struct pci_dev *pdev,
2618 const struct ata_port_info * const * ppi, 2718 const struct ata_port_info * const *ppi,
2619 struct ata_host **r_host) 2719 struct ata_host **r_host)
2620{ 2720{
2621 struct ata_host *host; 2721 struct ata_host *host;
@@ -2645,17 +2745,18 @@ int ata_pci_sff_prepare_host(struct pci_dev *pdev,
2645 *r_host = host; 2745 *r_host = host;
2646 return 0; 2746 return 0;
2647 2747
2648 err_bmdma: 2748err_bmdma:
2649 /* This is necessary because PCI and iomap resources are 2749 /* This is necessary because PCI and iomap resources are
2650 * merged and releasing the top group won't release the 2750 * merged and releasing the top group won't release the
2651 * acquired resources if some of those have been acquired 2751 * acquired resources if some of those have been acquired
2652 * before entering this function. 2752 * before entering this function.
2653 */ 2753 */
2654 pcim_iounmap_regions(pdev, 0xf); 2754 pcim_iounmap_regions(pdev, 0xf);
2655 err_out: 2755err_out:
2656 devres_release_group(&pdev->dev, NULL); 2756 devres_release_group(&pdev->dev, NULL);
2657 return rc; 2757 return rc;
2658} 2758}
2759EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host);
2659 2760
2660/** 2761/**
2661 * ata_pci_sff_activate_host - start SFF host, request IRQ and register it 2762 * ata_pci_sff_activate_host - start SFF host, request IRQ and register it
@@ -2741,7 +2842,7 @@ int ata_pci_sff_activate_host(struct ata_host *host,
2741 } 2842 }
2742 2843
2743 rc = ata_host_register(host, sht); 2844 rc = ata_host_register(host, sht);
2744 out: 2845out:
2745 if (rc == 0) 2846 if (rc == 0)
2746 devres_remove_group(dev, NULL); 2847 devres_remove_group(dev, NULL);
2747 else 2848 else
@@ -2749,6 +2850,7 @@ int ata_pci_sff_activate_host(struct ata_host *host,
2749 2850
2750 return rc; 2851 return rc;
2751} 2852}
2853EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host);
2752 2854
2753/** 2855/**
2754 * ata_pci_sff_init_one - Initialize/register PCI IDE host controller 2856 * ata_pci_sff_init_one - Initialize/register PCI IDE host controller
@@ -2776,7 +2878,7 @@ int ata_pci_sff_activate_host(struct ata_host *host,
2776 * Zero on success, negative on errno-based value on error. 2878 * Zero on success, negative on errno-based value on error.
2777 */ 2879 */
2778int ata_pci_sff_init_one(struct pci_dev *pdev, 2880int ata_pci_sff_init_one(struct pci_dev *pdev,
2779 const struct ata_port_info * const * ppi, 2881 const struct ata_port_info * const *ppi,
2780 struct scsi_host_template *sht, void *host_priv) 2882 struct scsi_host_template *sht, void *host_priv)
2781{ 2883{
2782 struct device *dev = &pdev->dev; 2884 struct device *dev = &pdev->dev;
@@ -2815,7 +2917,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev,
2815 2917
2816 pci_set_master(pdev); 2918 pci_set_master(pdev);
2817 rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); 2919 rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht);
2818 out: 2920out:
2819 if (rc == 0) 2921 if (rc == 0)
2820 devres_remove_group(&pdev->dev, NULL); 2922 devres_remove_group(&pdev->dev, NULL);
2821 else 2923 else
@@ -2823,54 +2925,7 @@ int ata_pci_sff_init_one(struct pci_dev *pdev,
2823 2925
2824 return rc; 2926 return rc;
2825} 2927}
2928EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);
2826 2929
2827#endif /* CONFIG_PCI */ 2930#endif /* CONFIG_PCI */
2828 2931
2829EXPORT_SYMBOL_GPL(ata_sff_port_ops);
2830EXPORT_SYMBOL_GPL(ata_bmdma_port_ops);
2831EXPORT_SYMBOL_GPL(ata_sff_qc_prep);
2832EXPORT_SYMBOL_GPL(ata_sff_dumb_qc_prep);
2833EXPORT_SYMBOL_GPL(ata_sff_dev_select);
2834EXPORT_SYMBOL_GPL(ata_sff_check_status);
2835EXPORT_SYMBOL_GPL(ata_sff_dma_pause);
2836EXPORT_SYMBOL_GPL(ata_sff_pause);
2837EXPORT_SYMBOL_GPL(ata_sff_busy_sleep);
2838EXPORT_SYMBOL_GPL(ata_sff_wait_ready);
2839EXPORT_SYMBOL_GPL(ata_sff_tf_load);
2840EXPORT_SYMBOL_GPL(ata_sff_tf_read);
2841EXPORT_SYMBOL_GPL(ata_sff_exec_command);
2842EXPORT_SYMBOL_GPL(ata_sff_data_xfer);
2843EXPORT_SYMBOL_GPL(ata_sff_data_xfer_noirq);
2844EXPORT_SYMBOL_GPL(ata_sff_irq_on);
2845EXPORT_SYMBOL_GPL(ata_sff_irq_clear);
2846EXPORT_SYMBOL_GPL(ata_sff_hsm_move);
2847EXPORT_SYMBOL_GPL(ata_sff_qc_issue);
2848EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf);
2849EXPORT_SYMBOL_GPL(ata_sff_host_intr);
2850EXPORT_SYMBOL_GPL(ata_sff_interrupt);
2851EXPORT_SYMBOL_GPL(ata_sff_freeze);
2852EXPORT_SYMBOL_GPL(ata_sff_thaw);
2853EXPORT_SYMBOL_GPL(ata_sff_prereset);
2854EXPORT_SYMBOL_GPL(ata_sff_dev_classify);
2855EXPORT_SYMBOL_GPL(ata_sff_wait_after_reset);
2856EXPORT_SYMBOL_GPL(ata_sff_softreset);
2857EXPORT_SYMBOL_GPL(sata_sff_hardreset);
2858EXPORT_SYMBOL_GPL(ata_sff_postreset);
2859EXPORT_SYMBOL_GPL(ata_sff_error_handler);
2860EXPORT_SYMBOL_GPL(ata_sff_post_internal_cmd);
2861EXPORT_SYMBOL_GPL(ata_sff_port_start);
2862EXPORT_SYMBOL_GPL(ata_sff_std_ports);
2863EXPORT_SYMBOL_GPL(ata_bmdma_mode_filter);
2864EXPORT_SYMBOL_GPL(ata_bmdma_setup);
2865EXPORT_SYMBOL_GPL(ata_bmdma_start);
2866EXPORT_SYMBOL_GPL(ata_bmdma_stop);
2867EXPORT_SYMBOL_GPL(ata_bmdma_status);
2868EXPORT_SYMBOL_GPL(ata_bus_reset);
2869#ifdef CONFIG_PCI
2870EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);
2871EXPORT_SYMBOL_GPL(ata_pci_bmdma_init);
2872EXPORT_SYMBOL_GPL(ata_pci_sff_init_host);
2873EXPORT_SYMBOL_GPL(ata_pci_sff_prepare_host);
2874EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host);
2875EXPORT_SYMBOL_GPL(ata_pci_sff_init_one);
2876#endif /* CONFIG_PCI */