aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-04-07 09:47:16 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-17 15:44:22 -0400
commit5682ed33aae05d10a25c95633ef9d9c062825888 (patch)
tree1632d4d70f4fd2dc25596a5cde1183f70f162ac3 /drivers/ata/libata-sff.c
parent9363c3825ea9ad76561eb48a395349dd29211ed6 (diff)
libata: rename SFF port ops
Add sff_ prefix to SFF specific port ops. This rename is in preparation of separating SFF support out of libata core layer. This patch strictly renames ops and doesn't introduce any behavior difference. Signed-off-by: Tejun Heo <htejun@gmail.com>
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c109
1 files changed, 56 insertions, 53 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 8544321293d4..04024a556660 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -51,13 +51,13 @@ const struct ata_port_operations ata_sff_port_ops = {
51 .error_handler = ata_sff_error_handler, 51 .error_handler = ata_sff_error_handler,
52 .post_internal_cmd = ata_sff_post_internal_cmd, 52 .post_internal_cmd = ata_sff_post_internal_cmd,
53 53
54 .dev_select = ata_sff_dev_select, 54 .sff_dev_select = ata_sff_dev_select,
55 .check_status = ata_sff_check_status, 55 .sff_check_status = ata_sff_check_status,
56 .tf_load = ata_sff_tf_load, 56 .sff_tf_load = ata_sff_tf_load,
57 .tf_read = ata_sff_tf_read, 57 .sff_tf_read = ata_sff_tf_read,
58 .exec_command = ata_sff_exec_command, 58 .sff_exec_command = ata_sff_exec_command,
59 .data_xfer = ata_sff_data_xfer, 59 .sff_data_xfer = ata_sff_data_xfer,
60 .irq_on = ata_sff_irq_on, 60 .sff_irq_on = ata_sff_irq_on,
61 61
62 .port_start = ata_sff_port_start, 62 .port_start = ata_sff_port_start,
63}; 63};
@@ -71,7 +71,7 @@ const struct ata_port_operations ata_bmdma_port_ops = {
71 .bmdma_start = ata_bmdma_start, 71 .bmdma_start = ata_bmdma_start,
72 .bmdma_stop = ata_bmdma_stop, 72 .bmdma_stop = ata_bmdma_stop,
73 .bmdma_status = ata_bmdma_status, 73 .bmdma_status = ata_bmdma_status,
74 .irq_clear = ata_sff_irq_clear, 74 .sff_irq_clear = ata_sff_irq_clear,
75}; 75};
76 76
77/** 77/**
@@ -245,8 +245,8 @@ u8 ata_sff_check_status(struct ata_port *ap)
245 */ 245 */
246u8 ata_sff_altstatus(struct ata_port *ap) 246u8 ata_sff_altstatus(struct ata_port *ap)
247{ 247{
248 if (ap->ops->check_altstatus) 248 if (ap->ops->sff_check_altstatus)
249 return ap->ops->check_altstatus(ap); 249 return ap->ops->sff_check_altstatus(ap);
250 250
251 return ioread8(ap->ioaddr.altstatus_addr); 251 return ioread8(ap->ioaddr.altstatus_addr);
252} 252}
@@ -290,7 +290,7 @@ int ata_sff_busy_sleep(struct ata_port *ap,
290 while (status != 0xff && (status & ATA_BUSY) && 290 while (status != 0xff && (status & ATA_BUSY) &&
291 time_before(jiffies, timeout)) { 291 time_before(jiffies, timeout)) {
292 msleep(50); 292 msleep(50);
293 status = ap->ops->check_status(ap); 293 status = ap->ops->sff_check_status(ap);
294 } 294 }
295 295
296 if (status == 0xff) 296 if (status == 0xff)
@@ -326,7 +326,7 @@ int ata_sff_wait_ready(struct ata_port *ap, unsigned long deadline)
326 int warned = 0; 326 int warned = 0;
327 327
328 while (1) { 328 while (1) {
329 u8 status = ap->ops->check_status(ap); 329 u8 status = ap->ops->sff_check_status(ap);
330 unsigned long now = jiffies; 330 unsigned long now = jiffies;
331 331
332 if (!(status & ATA_BUSY)) 332 if (!(status & ATA_BUSY))
@@ -403,7 +403,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
403 if (wait) 403 if (wait)
404 ata_wait_idle(ap); 404 ata_wait_idle(ap);
405 405
406 ap->ops->dev_select(ap, device); 406 ap->ops->sff_dev_select(ap, device);
407 407
408 if (wait) { 408 if (wait) {
409 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI) 409 if (can_sleep && ap->link.device[device].class == ATA_DEV_ATAPI)
@@ -434,7 +434,7 @@ u8 ata_sff_irq_on(struct ata_port *ap)
434 iowrite8(ap->ctl, ioaddr->ctl_addr); 434 iowrite8(ap->ctl, ioaddr->ctl_addr);
435 tmp = ata_wait_idle(ap); 435 tmp = ata_wait_idle(ap);
436 436
437 ap->ops->irq_clear(ap); 437 ap->ops->sff_irq_clear(ap);
438 438
439 return tmp; 439 return tmp;
440} 440}
@@ -593,8 +593,8 @@ void ata_sff_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
593static inline void ata_tf_to_host(struct ata_port *ap, 593static inline void ata_tf_to_host(struct ata_port *ap,
594 const struct ata_taskfile *tf) 594 const struct ata_taskfile *tf)
595{ 595{
596 ap->ops->tf_load(ap, tf); 596 ap->ops->sff_tf_load(ap, tf);
597 ap->ops->exec_command(ap, tf); 597 ap->ops->sff_exec_command(ap, tf);
598} 598}
599 599
600/** 600/**
@@ -709,13 +709,15 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
709 buf = kmap_atomic(page, KM_IRQ0); 709 buf = kmap_atomic(page, KM_IRQ0);
710 710
711 /* do the actual data transfer */ 711 /* do the actual data transfer */
712 ap->ops->data_xfer(qc->dev, buf + offset, qc->sect_size, do_write); 712 ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size,
713 do_write);
713 714
714 kunmap_atomic(buf, KM_IRQ0); 715 kunmap_atomic(buf, KM_IRQ0);
715 local_irq_restore(flags); 716 local_irq_restore(flags);
716 } else { 717 } else {
717 buf = page_address(page); 718 buf = page_address(page);
718 ap->ops->data_xfer(qc->dev, buf + offset, qc->sect_size, do_write); 719 ap->ops->sff_data_xfer(qc->dev, buf + offset, qc->sect_size,
720 do_write);
719 } 721 }
720 722
721 qc->curbytes += qc->sect_size; 723 qc->curbytes += qc->sect_size;
@@ -772,7 +774,7 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc)
772 DPRINTK("send cdb\n"); 774 DPRINTK("send cdb\n");
773 WARN_ON(qc->dev->cdb_len < 12); 775 WARN_ON(qc->dev->cdb_len < 12);
774 776
775 ap->ops->data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1); 777 ap->ops->sff_data_xfer(qc->dev, qc->cdb, qc->dev->cdb_len, 1);
776 ata_sff_altstatus(ap); /* flush */ 778 ata_sff_altstatus(ap); /* flush */
777 779
778 switch (qc->tf.protocol) { 780 switch (qc->tf.protocol) {
@@ -844,13 +846,13 @@ next_sg:
844 buf = kmap_atomic(page, KM_IRQ0); 846 buf = kmap_atomic(page, KM_IRQ0);
845 847
846 /* do the actual data transfer */ 848 /* do the actual data transfer */
847 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw); 849 consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw);
848 850
849 kunmap_atomic(buf, KM_IRQ0); 851 kunmap_atomic(buf, KM_IRQ0);
850 local_irq_restore(flags); 852 local_irq_restore(flags);
851 } else { 853 } else {
852 buf = page_address(page); 854 buf = page_address(page);
853 consumed = ap->ops->data_xfer(dev, buf + offset, count, rw); 855 consumed = ap->ops->sff_data_xfer(dev, buf + offset, count, rw);
854 } 856 }
855 857
856 bytes -= min(bytes, consumed); 858 bytes -= min(bytes, consumed);
@@ -893,7 +895,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
893 * error, qc->result_tf is later overwritten by ata_qc_complete(). 895 * error, qc->result_tf is later overwritten by ata_qc_complete().
894 * So, the correctness of qc->result_tf is not affected. 896 * So, the correctness of qc->result_tf is not affected.
895 */ 897 */
896 ap->ops->tf_read(ap, &qc->result_tf); 898 ap->ops->sff_tf_read(ap, &qc->result_tf);
897 ireason = qc->result_tf.nsect; 899 ireason = qc->result_tf.nsect;
898 bc_lo = qc->result_tf.lbam; 900 bc_lo = qc->result_tf.lbam;
899 bc_hi = qc->result_tf.lbah; 901 bc_hi = qc->result_tf.lbah;
@@ -979,7 +981,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
979 qc = ata_qc_from_tag(ap, qc->tag); 981 qc = ata_qc_from_tag(ap, qc->tag);
980 if (qc) { 982 if (qc) {
981 if (likely(!(qc->err_mask & AC_ERR_HSM))) { 983 if (likely(!(qc->err_mask & AC_ERR_HSM))) {
982 ap->ops->irq_on(ap); 984 ap->ops->sff_irq_on(ap);
983 ata_qc_complete(qc); 985 ata_qc_complete(qc);
984 } else 986 } else
985 ata_port_freeze(ap); 987 ata_port_freeze(ap);
@@ -995,7 +997,7 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq)
995 } else { 997 } else {
996 if (in_wq) { 998 if (in_wq) {
997 spin_lock_irqsave(ap->lock, flags); 999 spin_lock_irqsave(ap->lock, flags);
998 ap->ops->irq_on(ap); 1000 ap->ops->sff_irq_on(ap);
999 ata_qc_complete(qc); 1001 ata_qc_complete(qc);
1000 spin_unlock_irqrestore(ap->lock, flags); 1002 spin_unlock_irqrestore(ap->lock, flags);
1001 } else 1003 } else
@@ -1345,7 +1347,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
1345 case ATA_PROT_DMA: 1347 case ATA_PROT_DMA:
1346 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING); 1348 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
1347 1349
1348 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ 1350 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
1349 ap->ops->bmdma_setup(qc); /* set up bmdma */ 1351 ap->ops->bmdma_setup(qc); /* set up bmdma */
1350 ap->ops->bmdma_start(qc); /* initiate bmdma */ 1352 ap->ops->bmdma_start(qc); /* initiate bmdma */
1351 ap->hsm_task_state = HSM_ST_LAST; 1353 ap->hsm_task_state = HSM_ST_LAST;
@@ -1397,7 +1399,7 @@ unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc)
1397 case ATAPI_PROT_DMA: 1399 case ATAPI_PROT_DMA:
1398 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING); 1400 WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
1399 1401
1400 ap->ops->tf_load(ap, &qc->tf); /* load tf registers */ 1402 ap->ops->sff_tf_load(ap, &qc->tf); /* load tf registers */
1401 ap->ops->bmdma_setup(qc); /* set up bmdma */ 1403 ap->ops->bmdma_setup(qc); /* set up bmdma */
1402 ap->hsm_task_state = HSM_ST_FIRST; 1404 ap->hsm_task_state = HSM_ST_FIRST;
1403 1405
@@ -1486,12 +1488,12 @@ inline unsigned int ata_sff_host_intr(struct ata_port *ap,
1486 goto idle_irq; 1488 goto idle_irq;
1487 1489
1488 /* check main status, clearing INTRQ */ 1490 /* check main status, clearing INTRQ */
1489 status = ap->ops->check_status(ap); 1491 status = ap->ops->sff_check_status(ap);
1490 if (unlikely(status & ATA_BUSY)) 1492 if (unlikely(status & ATA_BUSY))
1491 goto idle_irq; 1493 goto idle_irq;
1492 1494
1493 /* ack bmdma irq events */ 1495 /* ack bmdma irq events */
1494 ap->ops->irq_clear(ap); 1496 ap->ops->sff_irq_clear(ap);
1495 1497
1496 ata_sff_hsm_move(ap, qc, status, 0); 1498 ata_sff_hsm_move(ap, qc, status, 0);
1497 1499
@@ -1506,8 +1508,8 @@ idle_irq:
1506 1508
1507#ifdef ATA_IRQ_TRAP 1509#ifdef ATA_IRQ_TRAP
1508 if ((ap->stats.idle_irq % 1000) == 0) { 1510 if ((ap->stats.idle_irq % 1000) == 0) {
1509 ap->ops->check_status(ap); 1511 ap->ops->sff_check_status(ap);
1510 ap->ops->irq_clear(ap); 1512 ap->ops->sff_irq_clear(ap);
1511 ata_port_printk(ap, KERN_WARNING, "irq trap\n"); 1513 ata_port_printk(ap, KERN_WARNING, "irq trap\n");
1512 return 1; 1514 return 1;
1513 } 1515 }
@@ -1582,9 +1584,9 @@ void ata_sff_freeze(struct ata_port *ap)
1582 * ATA_NIEN manipulation. Also, many controllers fail to mask 1584 * ATA_NIEN manipulation. Also, many controllers fail to mask
1583 * previously pending IRQ on ATA_NIEN assertion. Clear it. 1585 * previously pending IRQ on ATA_NIEN assertion. Clear it.
1584 */ 1586 */
1585 ap->ops->check_status(ap); 1587 ap->ops->sff_check_status(ap);
1586 1588
1587 ap->ops->irq_clear(ap); 1589 ap->ops->sff_irq_clear(ap);
1588} 1590}
1589 1591
1590/** 1592/**
@@ -1599,9 +1601,9 @@ void ata_sff_freeze(struct ata_port *ap)
1599void ata_sff_thaw(struct ata_port *ap) 1601void ata_sff_thaw(struct ata_port *ap)
1600{ 1602{
1601 /* clear & re-enable interrupts */ 1603 /* clear & re-enable interrupts */
1602 ap->ops->check_status(ap); 1604 ap->ops->sff_check_status(ap);
1603 ap->ops->irq_clear(ap); 1605 ap->ops->sff_irq_clear(ap);
1604 ap->ops->irq_on(ap); 1606 ap->ops->sff_irq_on(ap);
1605} 1607}
1606 1608
1607/** 1609/**
@@ -1626,7 +1628,7 @@ static unsigned int ata_devchk(struct ata_port *ap, unsigned int device)
1626 struct ata_ioports *ioaddr = &ap->ioaddr; 1628 struct ata_ioports *ioaddr = &ap->ioaddr;
1627 u8 nsect, lbal; 1629 u8 nsect, lbal;
1628 1630
1629 ap->ops->dev_select(ap, device); 1631 ap->ops->sff_dev_select(ap, device);
1630 1632
1631 iowrite8(0x55, ioaddr->nsect_addr); 1633 iowrite8(0x55, ioaddr->nsect_addr);
1632 iowrite8(0xaa, ioaddr->lbal_addr); 1634 iowrite8(0xaa, ioaddr->lbal_addr);
@@ -1675,11 +1677,11 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
1675 unsigned int class; 1677 unsigned int class;
1676 u8 err; 1678 u8 err;
1677 1679
1678 ap->ops->dev_select(ap, dev->devno); 1680 ap->ops->sff_dev_select(ap, dev->devno);
1679 1681
1680 memset(&tf, 0, sizeof(tf)); 1682 memset(&tf, 0, sizeof(tf));
1681 1683
1682 ap->ops->tf_read(ap, &tf); 1684 ap->ops->sff_tf_read(ap, &tf);
1683 err = tf.feature; 1685 err = tf.feature;
1684 if (r_err) 1686 if (r_err)
1685 *r_err = err; 1687 *r_err = err;
@@ -1709,7 +1711,8 @@ unsigned int ata_sff_dev_classify(struct ata_device *dev, int present,
1709 class = ATA_DEV_ATA; 1711 class = ATA_DEV_ATA;
1710 else 1712 else
1711 class = ATA_DEV_NONE; 1713 class = ATA_DEV_NONE;
1712 } else if ((class == ATA_DEV_ATA) && (ap->ops->check_status(ap) == 0)) 1714 } else if ((class == ATA_DEV_ATA) &&
1715 (ap->ops->sff_check_status(ap) == 0))
1713 class = ATA_DEV_NONE; 1716 class = ATA_DEV_NONE;
1714 1717
1715 return class; 1718 return class;
@@ -1741,7 +1744,7 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
1741 if (dev1) { 1744 if (dev1) {
1742 int i; 1745 int i;
1743 1746
1744 ap->ops->dev_select(ap, 1); 1747 ap->ops->sff_dev_select(ap, 1);
1745 1748
1746 /* Wait for register access. Some ATAPI devices fail 1749 /* Wait for register access. Some ATAPI devices fail
1747 * to set nsect/lbal after reset, so don't waste too 1750 * to set nsect/lbal after reset, so don't waste too
@@ -1766,11 +1769,11 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
1766 } 1769 }
1767 1770
1768 /* is all this really necessary? */ 1771 /* is all this really necessary? */
1769 ap->ops->dev_select(ap, 0); 1772 ap->ops->sff_dev_select(ap, 0);
1770 if (dev1) 1773 if (dev1)
1771 ap->ops->dev_select(ap, 1); 1774 ap->ops->sff_dev_select(ap, 1);
1772 if (dev0) 1775 if (dev0)
1773 ap->ops->dev_select(ap, 0); 1776 ap->ops->sff_dev_select(ap, 0);
1774 1777
1775 return ret; 1778 return ret;
1776} 1779}
@@ -1820,7 +1823,7 @@ void ata_sff_wait_after_reset(struct ata_port *ap, unsigned long deadline)
1820 */ 1823 */
1821 if (ap->flags & ATA_FLAG_SATA) { 1824 if (ap->flags & ATA_FLAG_SATA) {
1822 while (1) { 1825 while (1) {
1823 u8 status = ap->ops->check_status(ap); 1826 u8 status = ap->ops->sff_check_status(ap);
1824 1827
1825 if (status != 0xff || time_after(jiffies, deadline)) 1828 if (status != 0xff || time_after(jiffies, deadline))
1826 return; 1829 return;
@@ -1851,7 +1854,7 @@ static int ata_bus_softreset(struct ata_port *ap, unsigned int devmask,
1851 * the bus shows 0xFF because the odd clown forgets the D7 1854 * the bus shows 0xFF because the odd clown forgets the D7
1852 * pulldown resistor. 1855 * pulldown resistor.
1853 */ 1856 */
1854 if (ap->ops->check_status(ap) == 0xFF) 1857 if (ap->ops->sff_check_status(ap) == 0xFF)
1855 return -ENODEV; 1858 return -ENODEV;
1856 1859
1857 return ata_bus_post_reset(ap, devmask, deadline); 1860 return ata_bus_post_reset(ap, devmask, deadline);
@@ -1894,7 +1897,7 @@ int ata_sff_softreset(struct ata_link *link, unsigned int *classes,
1894 devmask |= (1 << 1); 1897 devmask |= (1 << 1);
1895 1898
1896 /* select device 0 again */ 1899 /* select device 0 again */
1897 ap->ops->dev_select(ap, 0); 1900 ap->ops->sff_dev_select(ap, 0);
1898 1901
1899 /* issue bus reset */ 1902 /* issue bus reset */
1900 DPRINTK("about to softreset, devmask=%x\n", devmask); 1903 DPRINTK("about to softreset, devmask=%x\n", devmask);
@@ -1977,7 +1980,7 @@ int sata_sff_hardreset(struct ata_link *link, unsigned int *class,
1977 return rc; 1980 return rc;
1978 } 1981 }
1979 1982
1980 ap->ops->dev_select(ap, 0); /* probably unnecessary */ 1983 ap->ops->sff_dev_select(ap, 0); /* probably unnecessary */
1981 1984
1982 *class = ata_sff_dev_classify(link->device, 1, NULL); 1985 *class = ata_sff_dev_classify(link->device, 1, NULL);
1983 1986
@@ -2035,8 +2038,8 @@ void ata_sff_error_handler(struct ata_port *ap)
2035 } 2038 }
2036 2039
2037 ata_sff_altstatus(ap); 2040 ata_sff_altstatus(ap);
2038 ap->ops->check_status(ap); 2041 ap->ops->sff_check_status(ap);
2039 ap->ops->irq_clear(ap); 2042 ap->ops->sff_irq_clear(ap);
2040 2043
2041 spin_unlock_irqrestore(ap->lock, flags); 2044 spin_unlock_irqrestore(ap->lock, flags);
2042 2045
@@ -2153,7 +2156,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
2153 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 2156 iowrite8(dmactl, ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
2154 2157
2155 /* issue r/w command */ 2158 /* issue r/w command */
2156 ap->ops->exec_command(ap, &qc->tf); 2159 ap->ops->sff_exec_command(ap, &qc->tf);
2157} 2160}
2158 2161
2159/** 2162/**
@@ -2277,7 +2280,7 @@ void ata_bus_reset(struct ata_port *ap)
2277 devmask |= (1 << 1); 2280 devmask |= (1 << 1);
2278 2281
2279 /* select device 0 again */ 2282 /* select device 0 again */
2280 ap->ops->dev_select(ap, 0); 2283 ap->ops->sff_dev_select(ap, 0);
2281 2284
2282 /* issue bus reset */ 2285 /* issue bus reset */
2283 if (ap->flags & ATA_FLAG_SRST) { 2286 if (ap->flags & ATA_FLAG_SRST) {
@@ -2295,9 +2298,9 @@ void ata_bus_reset(struct ata_port *ap)
2295 2298
2296 /* is double-select really necessary? */ 2299 /* is double-select really necessary? */
2297 if (device[1].class != ATA_DEV_NONE) 2300 if (device[1].class != ATA_DEV_NONE)
2298 ap->ops->dev_select(ap, 1); 2301 ap->ops->sff_dev_select(ap, 1);
2299 if (device[0].class != ATA_DEV_NONE) 2302 if (device[0].class != ATA_DEV_NONE)
2300 ap->ops->dev_select(ap, 0); 2303 ap->ops->sff_dev_select(ap, 0);
2301 2304
2302 /* if no devices were detected, disable this port */ 2305 /* if no devices were detected, disable this port */
2303 if ((device[0].class == ATA_DEV_NONE) && 2306 if ((device[0].class == ATA_DEV_NONE) &&