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 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 | ||
175 | enum 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 */ |
176 | struct scsi_device; | 183 | struct scsi_device; |
177 | struct ata_port_operations; | 184 | struct ata_port_operations; |
@@ -179,7 +186,7 @@ struct ata_port; | |||
179 | struct ata_queued_cmd; | 186 | struct ata_queued_cmd; |
180 | 187 | ||
181 | /* typedefs */ | 188 | /* typedefs */ |
182 | typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, u8 drv_stat); | 189 | typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask); |
183 | 190 | ||
184 | struct ata_ioports { | 191 | struct 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); | |||
453 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 460 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
454 | extern u8 ata_bmdma_status(struct ata_port *ap); | 461 | extern u8 ata_bmdma_status(struct ata_port *ap); |
455 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 462 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
456 | extern void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat); | 463 | extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask); |
457 | extern void ata_eng_timeout(struct ata_port *ap); | 464 | extern void ata_eng_timeout(struct ata_port *ap); |
458 | extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, | 465 | extern 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 | ||
726 | static 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 | |||
735 | static 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__ */ |