diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index 00a8a5738858..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; |
@@ -347,7 +354,6 @@ struct ata_port_operations { | |||
347 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); | 354 | void (*exec_command)(struct ata_port *ap, const struct ata_taskfile *tf); |
348 | u8 (*check_status)(struct ata_port *ap); | 355 | u8 (*check_status)(struct ata_port *ap); |
349 | u8 (*check_altstatus)(struct ata_port *ap); | 356 | u8 (*check_altstatus)(struct ata_port *ap); |
350 | u8 (*check_err)(struct ata_port *ap); | ||
351 | void (*dev_select)(struct ata_port *ap, unsigned int device); | 357 | void (*dev_select)(struct ata_port *ap, unsigned int device); |
352 | 358 | ||
353 | void (*phy_reset) (struct ata_port *ap); | 359 | void (*phy_reset) (struct ata_port *ap); |
@@ -434,7 +440,6 @@ extern void ata_noop_dev_select (struct ata_port *ap, unsigned int device); | |||
434 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); | 440 | extern void ata_std_dev_select (struct ata_port *ap, unsigned int device); |
435 | extern u8 ata_check_status(struct ata_port *ap); | 441 | extern u8 ata_check_status(struct ata_port *ap); |
436 | extern u8 ata_altstatus(struct ata_port *ap); | 442 | extern u8 ata_altstatus(struct ata_port *ap); |
437 | extern u8 ata_chk_err(struct ata_port *ap); | ||
438 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); | 443 | extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); |
439 | extern int ata_port_start (struct ata_port *ap); | 444 | extern int ata_port_start (struct ata_port *ap); |
440 | extern void ata_port_stop (struct ata_port *ap); | 445 | extern void ata_port_stop (struct ata_port *ap); |
@@ -455,7 +460,7 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc); | |||
455 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 460 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
456 | extern u8 ata_bmdma_status(struct ata_port *ap); | 461 | extern u8 ata_bmdma_status(struct ata_port *ap); |
457 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | 462 | extern void ata_bmdma_irq_clear(struct ata_port *ap); |
458 | 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); |
459 | extern void ata_eng_timeout(struct ata_port *ap); | 464 | extern void ata_eng_timeout(struct ata_port *ap); |
460 | extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, | 465 | extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd, |
461 | void (*done)(struct scsi_cmnd *)); | 466 | void (*done)(struct scsi_cmnd *)); |
@@ -718,4 +723,21 @@ static inline int ata_try_flush_cache(const struct ata_device *dev) | |||
718 | ata_id_has_flush_ext(dev->id); | 723 | ata_id_has_flush_ext(dev->id); |
719 | } | 724 | } |
720 | 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 | |||
721 | #endif /* __LINUX_LIBATA_H__ */ | 743 | #endif /* __LINUX_LIBATA_H__ */ |