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 a4cce9936a80..0ba3af7a1236 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -172,6 +172,13 @@ enum hsm_task_states {
172 HSM_ST_ERR, 172 HSM_ST_ERR,
173}; 173};
174 174
175enum ata_completion_errors {
176 AC_ERR_OTHER = (1 << 0),
177 AC_ERR_DEV = (1 << 1),
178 AC_ERR_ATA_BUS = (1 << 2),
179 AC_ERR_HOST_BUS = (1 << 3),
180};
181
175/* forward declarations */ 182/* forward declarations */
176struct scsi_device; 183struct scsi_device;
177struct ata_port_operations; 184struct ata_port_operations;
@@ -179,7 +186,7 @@ struct ata_port;
179struct ata_queued_cmd; 186struct ata_queued_cmd;
180 187
181/* typedefs */ 188/* typedefs */
182typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, u8 drv_stat); 189typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask);
183 190
184struct ata_ioports { 191struct ata_ioports {
185 unsigned long cmd_addr; 192 unsigned long cmd_addr;
@@ -453,7 +460,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
453extern void ata_bmdma_stop(struct ata_queued_cmd *qc); 460extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
454extern u8 ata_bmdma_status(struct ata_port *ap); 461extern u8 ata_bmdma_status(struct ata_port *ap);
455extern void ata_bmdma_irq_clear(struct ata_port *ap); 462extern void ata_bmdma_irq_clear(struct ata_port *ap);
456extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); 463extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask);
457extern void ata_eng_timeout(struct ata_port *ap); 464extern void ata_eng_timeout(struct ata_port *ap);
458extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, 465extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd,
459 void (*done)(struct scsi_cmnd *)); 466 void (*done)(struct scsi_cmnd *));
@@ -716,4 +723,21 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
716 ata_id_has_flush_ext(dev->id); 723 ata_id_has_flush_ext(dev->id);
717} 724}
718 725
726static inline unsigned int ac_err_mask(u8 status)
727{
728 if (status & ATA_BUSY)
729 return AC_ERR_ATA_BUS;
730 if (status & (ATA_ERR | ATA_DF))
731 return AC_ERR_DEV;
732 return 0;
733}
734
735static inline unsigned int __ac_err_mask(u8 status)
736{
737 unsigned int mask = ac_err_mask(status);
738 if (mask == 0)
739 return AC_ERR_OTHER;
740 return mask;
741}
742
719#endif /* __LINUX_LIBATA_H__ */ 743#endif /* __LINUX_LIBATA_H__ */