aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
authorAkira Iguchi <akira2.iguchi@toshiba.co.jp>2007-01-26 02:27:32 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:38 -0500
commit836250069fc0eeebe8b6aed772281535cc6e34f9 (patch)
tree73c886ae7fd75dd2c9b5b17e11ea3b6b76b42fed /drivers/ata/libata-sff.c
parent7f25377043925554cb9f3f9d8ada3390f71a5d10 (diff)
libata: add another IRQ calls (core and headers)
This patch is against the libata core and headers. Two IRQ calls are added in ata_port_operations. - irq_on() is used to enable interrupts. - irq_ack() is used to acknowledge a device interrupt. In most drivers, ata_irq_on() and ata_irq_ack() are used for irq_on and irq_ack respectively. In some drivers (ex: ahci, sata_sil24) which cannot use them as is, ata_dummy_irq_on() and ata_dummy_irq_ack() are used. Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp> Signed-off-by: Akira Iguchi <akira2.iguchi@toshiba.co.jp> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c43
1 files changed, 41 insertions, 2 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index c561b3be4a97..16bc3e35bdd4 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -64,6 +64,46 @@ u8 ata_irq_on(struct ata_port *ap)
64 return tmp; 64 return tmp;
65} 65}
66 66
67u8 ata_dummy_irq_on (struct ata_port *ap) { return 0; }
68
69/**
70 * ata_irq_ack - Acknowledge a device interrupt.
71 * @ap: Port on which interrupts are enabled.
72 *
73 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
74 * or BUSY+DRQ clear). Obtain dma status and port status from
75 * device. Clear the interrupt. Return port status.
76 *
77 * LOCKING:
78 */
79
80u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
81{
82 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
83 u8 host_stat, post_stat, status;
84
85 status = ata_busy_wait(ap, bits, 1000);
86 if (status & bits)
87 if (ata_msg_err(ap))
88 printk(KERN_ERR "abnormal status 0x%X\n", status);
89
90 /* get controller status; clear intr, err bits */
91 host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
92 iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
93 ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
94
95 post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
96
97 if (ata_msg_intr(ap))
98 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
99 __FUNCTION__,
100 host_stat, post_stat, status);
101
102 return status;
103}
104
105u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq) { return 0; }
106
67/** 107/**
68 * ata_tf_load - send taskfile registers to host controller 108 * ata_tf_load - send taskfile registers to host controller
69 * @ap: Port to which output is sent 109 * @ap: Port to which output is sent
@@ -370,8 +410,7 @@ void ata_bmdma_thaw(struct ata_port *ap)
370 /* clear & re-enable interrupts */ 410 /* clear & re-enable interrupts */
371 ata_chk_status(ap); 411 ata_chk_status(ap);
372 ap->ops->irq_clear(ap); 412 ap->ops->irq_clear(ap);
373 if (ap->ioaddr.ctl_addr) /* FIXME: hack. create a hook instead */ 413 ap->ops->irq_on(ap);
374 ata_irq_on(ap);
375} 414}
376 415
377/** 416/**