diff options
author | Akira Iguchi <akira2.iguchi@toshiba.co.jp> | 2007-01-26 02:27:32 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-02-09 17:39:38 -0500 |
commit | 836250069fc0eeebe8b6aed772281535cc6e34f9 (patch) | |
tree | 73c886ae7fd75dd2c9b5b17e11ea3b6b76b42fed /include | |
parent | 7f25377043925554cb9f3f9d8ada3390f71a5d10 (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 'include')
-rw-r--r-- | include/linux/libata.h | 42 |
1 files changed, 6 insertions, 36 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 308bb8cbe50f..bdfe6ea8edf7 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -632,6 +632,8 @@ struct ata_port_operations { | |||
632 | 632 | ||
633 | irq_handler_t irq_handler; | 633 | irq_handler_t irq_handler; |
634 | void (*irq_clear) (struct ata_port *); | 634 | void (*irq_clear) (struct ata_port *); |
635 | u8 (*irq_on) (struct ata_port *); | ||
636 | u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq); | ||
635 | 637 | ||
636 | u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); | 638 | u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg); |
637 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, | 639 | void (*scr_write) (struct ata_port *ap, unsigned int sc_reg, |
@@ -813,6 +815,10 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev); | |||
813 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, | 815 | extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, |
814 | int queue_depth); | 816 | int queue_depth); |
815 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); | 817 | extern struct ata_device *ata_dev_pair(struct ata_device *adev); |
818 | extern u8 ata_irq_on(struct ata_port *ap); | ||
819 | extern u8 ata_dummy_irq_on(struct ata_port *ap); | ||
820 | extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq); | ||
821 | extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq); | ||
816 | 822 | ||
817 | /* | 823 | /* |
818 | * Timing helpers | 824 | * Timing helpers |
@@ -1147,42 +1153,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc) | |||
1147 | qc->result_tf.feature = 0; | 1153 | qc->result_tf.feature = 0; |
1148 | } | 1154 | } |
1149 | 1155 | ||
1150 | /** | ||
1151 | * ata_irq_ack - Acknowledge a device interrupt. | ||
1152 | * @ap: Port on which interrupts are enabled. | ||
1153 | * | ||
1154 | * Wait up to 10 ms for legacy IDE device to become idle (BUSY | ||
1155 | * or BUSY+DRQ clear). Obtain dma status and port status from | ||
1156 | * device. Clear the interrupt. Return port status. | ||
1157 | * | ||
1158 | * LOCKING: | ||
1159 | */ | ||
1160 | |||
1161 | static inline u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) | ||
1162 | { | ||
1163 | unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; | ||
1164 | u8 host_stat, post_stat, status; | ||
1165 | |||
1166 | status = ata_busy_wait(ap, bits, 1000); | ||
1167 | if (status & bits) | ||
1168 | if (ata_msg_err(ap)) | ||
1169 | printk(KERN_ERR "abnormal status 0x%X\n", status); | ||
1170 | |||
1171 | /* get controller status; clear intr, err bits */ | ||
1172 | host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
1173 | iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, | ||
1174 | ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
1175 | |||
1176 | post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); | ||
1177 | |||
1178 | if (ata_msg_intr(ap)) | ||
1179 | printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", | ||
1180 | __FUNCTION__, | ||
1181 | host_stat, post_stat, status); | ||
1182 | |||
1183 | return status; | ||
1184 | } | ||
1185 | |||
1186 | static inline int ata_try_flush_cache(const struct ata_device *dev) | 1156 | static inline int ata_try_flush_cache(const struct ata_device *dev) |
1187 | { | 1157 | { |
1188 | return ata_id_wcache_enabled(dev->id) || | 1158 | return ata_id_wcache_enabled(dev->id) || |