diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 28 |
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 | ||
178 | enum 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 */ |
179 | struct scsi_device; | 186 | struct scsi_device; |
180 | struct ata_port_operations; | 187 | struct ata_port_operations; |
@@ -182,7 +189,7 @@ struct ata_port; | |||
182 | struct ata_queued_cmd; | 189 | struct ata_queued_cmd; |
183 | 190 | ||
184 | /* typedefs */ | 191 | /* typedefs */ |
185 | typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, u8 drv_stat); | 192 | typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); |
186 | 193 | ||
187 | struct ata_ioports { | 194 | struct 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); | |||
456 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 463 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
457 | extern u8 ata_bmdma_status(struct ata_port *ap); | 464 | extern u8 ata_bmdma_status(struct ata_port *ap); |
458 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 465 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
459 | extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); | 466 | extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); |
460 | extern void ata_eng_timeout(struct ata_port *ap); | 467 | extern void ata_eng_timeout(struct ata_port *ap); |
461 | extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, | 468 | extern 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 | ||
729 | static 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 | |||
738 | static 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__ */ |