aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h42
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);
813extern int ata_scsi_change_queue_depth(struct scsi_device *sdev, 815extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
814 int queue_depth); 816 int queue_depth);
815extern struct ata_device *ata_dev_pair(struct ata_device *adev); 817extern struct ata_device *ata_dev_pair(struct ata_device *adev);
818extern u8 ata_irq_on(struct ata_port *ap);
819extern u8 ata_dummy_irq_on(struct ata_port *ap);
820extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
821extern 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
1161static 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
1186static inline int ata_try_flush_cache(const struct ata_device *dev) 1156static 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) ||