diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 04:44:42 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-30 04:44:42 -0500 |
commit | a7dac447bb9cef27d4d29cdf63e2d7809c50b1f4 (patch) | |
tree | a8935490cdd374aba3a804ba9f79d1aed67db36d /drivers/scsi/libata-core.c | |
parent | 81cfb8864c73230eb1c37753aba517db15cf4d8f (diff) |
[libata] change ata_qc_complete() to take error mask as second arg
The second argument to ata_qc_complete() was being used for two
purposes: communicate the ATA Status register to the completion
function, and indicate an error. On legacy PCI IDE hardware, the latter
is often implicit in the former. On more modern hardware, the driver
often completely emulated a Status register value, passing ATA_ERR as an
indication that something went wrong.
Now that previous code changes have eliminated the need to use drv_stat
arg to communicate the ATA Status register value, we can convert it to a
mask of possible error classes.
This will lead to more flexible error handling in the future.
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r-- | drivers/scsi/libata-core.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 771bc7d376bc..cc089f1fb114 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -2663,7 +2663,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc) | |||
2663 | * None. (grabs host lock) | 2663 | * None. (grabs host lock) |
2664 | */ | 2664 | */ |
2665 | 2665 | ||
2666 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 2666 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
2667 | { | 2667 | { |
2668 | struct ata_port *ap = qc->ap; | 2668 | struct ata_port *ap = qc->ap; |
2669 | unsigned long flags; | 2669 | unsigned long flags; |
@@ -2671,7 +2671,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
2671 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2671 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2672 | ap->flags &= ~ATA_FLAG_NOINTR; | 2672 | ap->flags &= ~ATA_FLAG_NOINTR; |
2673 | ata_irq_on(ap); | 2673 | ata_irq_on(ap); |
2674 | ata_qc_complete(qc, drv_stat); | 2674 | ata_qc_complete(qc, err_mask); |
2675 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 2675 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
2676 | } | 2676 | } |
2677 | 2677 | ||
@@ -2768,7 +2768,7 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2768 | 2768 | ||
2769 | ap->hsm_task_state = HSM_ST_IDLE; | 2769 | ap->hsm_task_state = HSM_ST_IDLE; |
2770 | 2770 | ||
2771 | ata_poll_qc_complete(qc, drv_stat); | 2771 | ata_poll_qc_complete(qc, 0); |
2772 | 2772 | ||
2773 | /* another command may start at this point */ | 2773 | /* another command may start at this point */ |
2774 | 2774 | ||
@@ -3136,18 +3136,15 @@ static void ata_pio_block(struct ata_port *ap) | |||
3136 | static void ata_pio_error(struct ata_port *ap) | 3136 | static void ata_pio_error(struct ata_port *ap) |
3137 | { | 3137 | { |
3138 | struct ata_queued_cmd *qc; | 3138 | struct ata_queued_cmd *qc; |
3139 | u8 drv_stat; | 3139 | |
3140 | printk(KERN_WARNING "ata%u: PIO error\n", ap->id); | ||
3140 | 3141 | ||
3141 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3142 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3142 | assert(qc != NULL); | 3143 | assert(qc != NULL); |
3143 | 3144 | ||
3144 | drv_stat = ata_chk_status(ap); | ||
3145 | printk(KERN_WARNING "ata%u: PIO error, drv_stat 0x%x\n", | ||
3146 | ap->id, drv_stat); | ||
3147 | |||
3148 | ap->hsm_task_state = HSM_ST_IDLE; | 3145 | ap->hsm_task_state = HSM_ST_IDLE; |
3149 | 3146 | ||
3150 | ata_poll_qc_complete(qc, drv_stat | ATA_ERR); | 3147 | ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); |
3151 | } | 3148 | } |
3152 | 3149 | ||
3153 | static void ata_pio_task(void *_data) | 3150 | static void ata_pio_task(void *_data) |
@@ -3270,7 +3267,7 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3270 | ap->id, qc->tf.command, drv_stat, host_stat); | 3267 | ap->id, qc->tf.command, drv_stat, host_stat); |
3271 | 3268 | ||
3272 | /* complete taskfile transaction */ | 3269 | /* complete taskfile transaction */ |
3273 | ata_qc_complete(qc, drv_stat); | 3270 | ata_qc_complete(qc, ac_err_mask(drv_stat)); |
3274 | break; | 3271 | break; |
3275 | } | 3272 | } |
3276 | 3273 | ||
@@ -3375,7 +3372,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3375 | return qc; | 3372 | return qc; |
3376 | } | 3373 | } |
3377 | 3374 | ||
3378 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, u8 drv_stat) | 3375 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) |
3379 | { | 3376 | { |
3380 | return 0; | 3377 | return 0; |
3381 | } | 3378 | } |
@@ -3434,7 +3431,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3434 | * spin_lock_irqsave(host_set lock) | 3431 | * spin_lock_irqsave(host_set lock) |
3435 | */ | 3432 | */ |
3436 | 3433 | ||
3437 | void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | 3434 | void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) |
3438 | { | 3435 | { |
3439 | int rc; | 3436 | int rc; |
3440 | 3437 | ||
@@ -3451,7 +3448,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat) | |||
3451 | qc->flags &= ~ATA_QCFLAG_ACTIVE; | 3448 | qc->flags &= ~ATA_QCFLAG_ACTIVE; |
3452 | 3449 | ||
3453 | /* call completion callback */ | 3450 | /* call completion callback */ |
3454 | rc = qc->complete_fn(qc, drv_stat); | 3451 | rc = qc->complete_fn(qc, err_mask); |
3455 | 3452 | ||
3456 | /* if callback indicates not to complete command (non-zero), | 3453 | /* if callback indicates not to complete command (non-zero), |
3457 | * return immediately | 3454 | * return immediately |
@@ -3889,7 +3886,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap, | |||
3889 | ap->ops->irq_clear(ap); | 3886 | ap->ops->irq_clear(ap); |
3890 | 3887 | ||
3891 | /* complete taskfile transaction */ | 3888 | /* complete taskfile transaction */ |
3892 | ata_qc_complete(qc, status); | 3889 | ata_qc_complete(qc, ac_err_mask(status)); |
3893 | break; | 3890 | break; |
3894 | 3891 | ||
3895 | default: | 3892 | default: |
@@ -3984,7 +3981,7 @@ static void atapi_packet_task(void *_data) | |||
3984 | /* sleep-wait for BSY to clear */ | 3981 | /* sleep-wait for BSY to clear */ |
3985 | DPRINTK("busy wait\n"); | 3982 | DPRINTK("busy wait\n"); |
3986 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) | 3983 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) |
3987 | goto err_out; | 3984 | goto err_out_status; |
3988 | 3985 | ||
3989 | /* make sure DRQ is set */ | 3986 | /* make sure DRQ is set */ |
3990 | status = ata_chk_status(ap); | 3987 | status = ata_chk_status(ap); |
@@ -4021,8 +4018,10 @@ static void atapi_packet_task(void *_data) | |||
4021 | 4018 | ||
4022 | return; | 4019 | return; |
4023 | 4020 | ||
4021 | err_out_status: | ||
4022 | status = ata_chk_status(ap); | ||
4024 | err_out: | 4023 | err_out: |
4025 | ata_poll_qc_complete(qc, ATA_ERR); | 4024 | ata_poll_qc_complete(qc, __ac_err_mask(status)); |
4026 | } | 4025 | } |
4027 | 4026 | ||
4028 | 4027 | ||