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.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed6aacc236dd..457bdc44e4b1 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -175,6 +175,13 @@ enum hsm_task_states {
175 write CDB or first data block */ 175 write CDB or first data block */
176}; 176};
177 177
178enum ata_completion_errors {
179 AC_ERR_OTHER = (1 << 0),
180 AC_ERR_DEV = (1 << 1),
181 AC_ERR_ATA_BUS = (1 << 2),
182 AC_ERR_HOST_BUS = (1 << 3),
183};
184
178/* forward declarations */ 185/* forward declarations */
179struct scsi_device; 186struct scsi_device;
180struct ata_port_operations; 187struct ata_port_operations;
@@ -182,7 +189,7 @@ struct ata_port;
182struct ata_queued_cmd; 189struct ata_queued_cmd;
183 190
184/* typedefs */ 191/* typedefs */
185typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, u8 drv_stat); 192typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask);
186 193
187struct ata_ioports { 194struct ata_ioports {
188 unsigned long cmd_addr; 195 unsigned long cmd_addr;
@@ -456,7 +463,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
456extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 463extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
457extern u8 ata_bmdma_status(struct ata_port *ap); 464extern u8 ata_bmdma_status(struct ata_port *ap);
458extern void ata_bmdma_irq_clear(struct ata_port *ap); 465extern void ata_bmdma_irq_clear(struct ata_port *ap);
459extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); 466extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask);
460extern void ata_eng_timeout(struct ata_port *ap); 467extern void ata_eng_timeout(struct ata_port *ap);
461extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 468extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd,
462 void (*done)(struct scsi_cmnd *)); 469 void (*done)(struct scsi_cmnd *));
@@ -719,4 +726,21 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
719 ata_id_has_flush_ext(dev->id); 726 ata_id_has_flush_ext(dev->id);
720} 727}
721 728
729static inline unsigned int ac_err_mask(u8 status)
730{
731 if (status & ATA_BUSY)
732 return AC_ERR_ATA_BUS;
733 if (status & (ATA_ERR | ATA_DF))
734 return AC_ERR_DEV;
735 return 0;
736}
737
738static inline unsigned int __ac_err_mask(u8 status)
739{
740 unsigned int mask = ac_err_mask(status);
741 if (mask == 0)
742 return AC_ERR_OTHER;
743 return mask;
744}
745
722#endif /* __LINUX_LIBATA_H__ */ 746#endif /* __LINUX_LIBATA_H__ */