diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-12-06 04:52:48 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-06 04:52:48 -0500 |
commit | 701db69d6647f61e4660c9102d7f2fd5dffc203d (patch) | |
tree | e3ebe94f72b4bbdfad608d77d7b11719022b8c9b /drivers/scsi | |
parent | 6cf5bcaaf9a92225017f7a3f1a630f6b5147ad4a (diff) | |
parent | fe79e683ccdb29c13b3e0d18507474b4e2d9aab6 (diff) |
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ahci.c | 14 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 69 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 24 | ||||
-rw-r--r-- | drivers/scsi/libata.h | 2 | ||||
-rw-r--r-- | drivers/scsi/pdc_adma.c | 11 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 9 | ||||
-rw-r--r-- | drivers/scsi/sata_promise.c | 20 | ||||
-rw-r--r-- | drivers/scsi/sata_qstor.c | 9 | ||||
-rw-r--r-- | drivers/scsi/sata_sil.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_sil24.c | 15 | ||||
-rw-r--r-- | drivers/scsi/sata_sx4.c | 17 |
11 files changed, 119 insertions, 73 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 83467a05dc8e..887eaa2a3ebf 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c | |||
@@ -243,7 +243,7 @@ static const struct ata_port_operations ahci_ops = { | |||
243 | .port_stop = ahci_port_stop, | 243 | .port_stop = ahci_port_stop, |
244 | }; | 244 | }; |
245 | 245 | ||
246 | static struct ata_port_info ahci_port_info[] = { | 246 | static const struct ata_port_info ahci_port_info[] = { |
247 | /* board_ahci */ | 247 | /* board_ahci */ |
248 | { | 248 | { |
249 | .sht = &ahci_sht, | 249 | .sht = &ahci_sht, |
@@ -643,7 +643,8 @@ static void ahci_eng_timeout(struct ata_port *ap) | |||
643 | * not being called from the SCSI EH. | 643 | * not being called from the SCSI EH. |
644 | */ | 644 | */ |
645 | qc->scsidone = scsi_finish_command; | 645 | qc->scsidone = scsi_finish_command; |
646 | ata_qc_complete(qc, AC_ERR_OTHER); | 646 | qc->err_mask |= AC_ERR_OTHER; |
647 | ata_qc_complete(qc); | ||
647 | } | 648 | } |
648 | 649 | ||
649 | spin_unlock_irqrestore(&host_set->lock, flags); | 650 | spin_unlock_irqrestore(&host_set->lock, flags); |
@@ -664,7 +665,8 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
664 | ci = readl(port_mmio + PORT_CMD_ISSUE); | 665 | ci = readl(port_mmio + PORT_CMD_ISSUE); |
665 | if (likely((ci & 0x1) == 0)) { | 666 | if (likely((ci & 0x1) == 0)) { |
666 | if (qc) { | 667 | if (qc) { |
667 | ata_qc_complete(qc, 0); | 668 | assert(qc->err_mask == 0); |
669 | ata_qc_complete(qc); | ||
668 | qc = NULL; | 670 | qc = NULL; |
669 | } | 671 | } |
670 | } | 672 | } |
@@ -681,8 +683,10 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
681 | /* command processing has stopped due to error; restart */ | 683 | /* command processing has stopped due to error; restart */ |
682 | ahci_restart_port(ap, status); | 684 | ahci_restart_port(ap, status); |
683 | 685 | ||
684 | if (qc) | 686 | if (qc) { |
685 | ata_qc_complete(qc, err_mask); | 687 | qc->err_mask |= AC_ERR_OTHER; |
688 | ata_qc_complete(qc); | ||
689 | } | ||
686 | } | 690 | } |
687 | 691 | ||
688 | return 1; | 692 | return 1; |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index f37cc01e8dbd..82f566cf75c6 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -606,7 +606,7 @@ void ata_rwcmd_protocol(struct ata_queued_cmd *qc) | |||
606 | tf->command = ata_rw_cmds[index + lba48 + write]; | 606 | tf->command = ata_rw_cmds[index + lba48 + write]; |
607 | } | 607 | } |
608 | 608 | ||
609 | static const char * xfer_mode_str[] = { | 609 | static const char * const xfer_mode_str[] = { |
610 | "UDMA/16", | 610 | "UDMA/16", |
611 | "UDMA/25", | 611 | "UDMA/25", |
612 | "UDMA/33", | 612 | "UDMA/33", |
@@ -1054,9 +1054,9 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1054 | 1054 | ||
1055 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { | 1055 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { |
1056 | /* timeout handling */ | 1056 | /* timeout handling */ |
1057 | unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); | 1057 | qc->err_mask |= ac_err_mask(ata_chk_status(qc->ap)); |
1058 | 1058 | ||
1059 | if (!err_mask) { | 1059 | if (!qc->err_mask) { |
1060 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", | 1060 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", |
1061 | qc->ap->id, qc->tf.command); | 1061 | qc->ap->id, qc->tf.command); |
1062 | } else { | 1062 | } else { |
@@ -1065,7 +1065,7 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1065 | rc = -EIO; | 1065 | rc = -EIO; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | ata_qc_complete(qc, err_mask); | 1068 | ata_qc_complete(qc); |
1069 | } | 1069 | } |
1070 | 1070 | ||
1071 | return rc; | 1071 | return rc; |
@@ -1176,6 +1176,7 @@ retry: | |||
1176 | qc->cursg_ofs = 0; | 1176 | qc->cursg_ofs = 0; |
1177 | qc->cursect = 0; | 1177 | qc->cursect = 0; |
1178 | qc->nsect = 1; | 1178 | qc->nsect = 1; |
1179 | qc->err_mask = 0; | ||
1179 | goto retry; | 1180 | goto retry; |
1180 | } | 1181 | } |
1181 | } | 1182 | } |
@@ -2093,7 +2094,7 @@ static void ata_pr_blacklisted(const struct ata_port *ap, | |||
2093 | ap->id, dev->devno); | 2094 | ap->id, dev->devno); |
2094 | } | 2095 | } |
2095 | 2096 | ||
2096 | static const char * ata_dma_blacklist [] = { | 2097 | static const char * const ata_dma_blacklist [] = { |
2097 | "WDC AC11000H", | 2098 | "WDC AC11000H", |
2098 | "WDC AC22100H", | 2099 | "WDC AC22100H", |
2099 | "WDC AC32500H", | 2100 | "WDC AC32500H", |
@@ -2787,14 +2788,14 @@ skip_map: | |||
2787 | * None. (grabs host lock) | 2788 | * None. (grabs host lock) |
2788 | */ | 2789 | */ |
2789 | 2790 | ||
2790 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 2791 | void ata_poll_qc_complete(struct ata_queued_cmd *qc) |
2791 | { | 2792 | { |
2792 | struct ata_port *ap = qc->ap; | 2793 | struct ata_port *ap = qc->ap; |
2793 | unsigned long flags; | 2794 | unsigned long flags; |
2794 | 2795 | ||
2795 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2796 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2796 | ata_irq_on(ap); | 2797 | ata_irq_on(ap); |
2797 | ata_qc_complete(qc, err_mask); | 2798 | ata_qc_complete(qc); |
2798 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 2799 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
2799 | } | 2800 | } |
2800 | 2801 | ||
@@ -2811,10 +2812,14 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
2811 | 2812 | ||
2812 | static unsigned long ata_pio_poll(struct ata_port *ap) | 2813 | static unsigned long ata_pio_poll(struct ata_port *ap) |
2813 | { | 2814 | { |
2815 | struct ata_queued_cmd *qc; | ||
2814 | u8 status; | 2816 | u8 status; |
2815 | unsigned int poll_state = HSM_ST_UNKNOWN; | 2817 | unsigned int poll_state = HSM_ST_UNKNOWN; |
2816 | unsigned int reg_state = HSM_ST_UNKNOWN; | 2818 | unsigned int reg_state = HSM_ST_UNKNOWN; |
2817 | 2819 | ||
2820 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2821 | assert(qc != NULL); | ||
2822 | |||
2818 | switch (ap->hsm_task_state) { | 2823 | switch (ap->hsm_task_state) { |
2819 | case HSM_ST: | 2824 | case HSM_ST: |
2820 | case HSM_ST_POLL: | 2825 | case HSM_ST_POLL: |
@@ -2834,6 +2839,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap) | |||
2834 | status = ata_chk_status(ap); | 2839 | status = ata_chk_status(ap); |
2835 | if (status & ATA_BUSY) { | 2840 | if (status & ATA_BUSY) { |
2836 | if (time_after(jiffies, ap->pio_task_timeout)) { | 2841 | if (time_after(jiffies, ap->pio_task_timeout)) { |
2842 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
2837 | ap->hsm_task_state = HSM_ST_TMOUT; | 2843 | ap->hsm_task_state = HSM_ST_TMOUT; |
2838 | return 0; | 2844 | return 0; |
2839 | } | 2845 | } |
@@ -2869,29 +2875,31 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2869 | * msecs, then chk-status again. If still busy, fall back to | 2875 | * msecs, then chk-status again. If still busy, fall back to |
2870 | * HSM_ST_LAST_POLL state. | 2876 | * HSM_ST_LAST_POLL state. |
2871 | */ | 2877 | */ |
2872 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); | 2878 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); |
2873 | if (drv_stat & (ATA_BUSY | ATA_DRQ)) { | 2879 | if (drv_stat & ATA_BUSY) { |
2874 | msleep(2); | 2880 | msleep(2); |
2875 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); | 2881 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); |
2876 | if (drv_stat & (ATA_BUSY | ATA_DRQ)) { | 2882 | if (drv_stat & ATA_BUSY) { |
2877 | ap->hsm_task_state = HSM_ST_LAST_POLL; | 2883 | ap->hsm_task_state = HSM_ST_LAST_POLL; |
2878 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; | 2884 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; |
2879 | return 1; | 2885 | return 1; |
2880 | } | 2886 | } |
2881 | } | 2887 | } |
2882 | 2888 | ||
2889 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2890 | assert(qc != NULL); | ||
2891 | |||
2883 | drv_stat = ata_wait_idle(ap); | 2892 | drv_stat = ata_wait_idle(ap); |
2884 | if (!ata_ok(drv_stat)) { | 2893 | if (!ata_ok(drv_stat)) { |
2894 | qc->err_mask |= __ac_err_mask(drv_stat); | ||
2885 | ap->hsm_task_state = HSM_ST_ERR; | 2895 | ap->hsm_task_state = HSM_ST_ERR; |
2886 | return 1; | 2896 | return 1; |
2887 | } | 2897 | } |
2888 | 2898 | ||
2889 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2890 | assert(qc != NULL); | ||
2891 | |||
2892 | ap->hsm_task_state = HSM_ST_IDLE; | 2899 | ap->hsm_task_state = HSM_ST_IDLE; |
2893 | 2900 | ||
2894 | ata_poll_qc_complete(qc, 0); | 2901 | assert(qc->err_mask == 0); |
2902 | ata_poll_qc_complete(qc); | ||
2895 | 2903 | ||
2896 | /* another command may start at this point */ | 2904 | /* another command may start at this point */ |
2897 | 2905 | ||
@@ -3363,6 +3371,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) | |||
3363 | err_out: | 3371 | err_out: |
3364 | printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", | 3372 | printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", |
3365 | ap->id, dev->devno); | 3373 | ap->id, dev->devno); |
3374 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
3366 | ap->hsm_task_state = HSM_ST_ERR; | 3375 | ap->hsm_task_state = HSM_ST_ERR; |
3367 | } | 3376 | } |
3368 | 3377 | ||
@@ -3401,8 +3410,16 @@ static void ata_pio_block(struct ata_port *ap) | |||
3401 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3410 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3402 | assert(qc != NULL); | 3411 | assert(qc != NULL); |
3403 | 3412 | ||
3413 | /* check error */ | ||
3414 | if (status & (ATA_ERR | ATA_DF)) { | ||
3415 | qc->err_mask |= AC_ERR_DEV; | ||
3416 | ap->hsm_task_state = HSM_ST_ERR; | ||
3417 | return; | ||
3418 | } | ||
3419 | |||
3420 | /* transfer data if any */ | ||
3404 | if (is_atapi_taskfile(&qc->tf)) { | 3421 | if (is_atapi_taskfile(&qc->tf)) { |
3405 | /* no more data to transfer or unsupported ATAPI command */ | 3422 | /* DRQ=0 means no more data to transfer */ |
3406 | if ((status & ATA_DRQ) == 0) { | 3423 | if ((status & ATA_DRQ) == 0) { |
3407 | ap->hsm_task_state = HSM_ST_LAST; | 3424 | ap->hsm_task_state = HSM_ST_LAST; |
3408 | return; | 3425 | return; |
@@ -3412,6 +3429,7 @@ static void ata_pio_block(struct ata_port *ap) | |||
3412 | } else { | 3429 | } else { |
3413 | /* handle BSY=0, DRQ=0 as error */ | 3430 | /* handle BSY=0, DRQ=0 as error */ |
3414 | if ((status & ATA_DRQ) == 0) { | 3431 | if ((status & ATA_DRQ) == 0) { |
3432 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
3415 | ap->hsm_task_state = HSM_ST_ERR; | 3433 | ap->hsm_task_state = HSM_ST_ERR; |
3416 | return; | 3434 | return; |
3417 | } | 3435 | } |
@@ -3431,9 +3449,14 @@ static void ata_pio_error(struct ata_port *ap) | |||
3431 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3449 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3432 | assert(qc != NULL); | 3450 | assert(qc != NULL); |
3433 | 3451 | ||
3452 | /* make sure qc->err_mask is available to | ||
3453 | * know what's wrong and recover | ||
3454 | */ | ||
3455 | assert(qc->err_mask); | ||
3456 | |||
3434 | ap->hsm_task_state = HSM_ST_IDLE; | 3457 | ap->hsm_task_state = HSM_ST_IDLE; |
3435 | 3458 | ||
3436 | ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); | 3459 | ata_poll_qc_complete(qc); |
3437 | } | 3460 | } |
3438 | 3461 | ||
3439 | static void ata_pio_task(void *_data) | 3462 | static void ata_pio_task(void *_data) |
@@ -3542,7 +3565,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3542 | ap->hsm_task_state = HSM_ST_IDLE; | 3565 | ap->hsm_task_state = HSM_ST_IDLE; |
3543 | 3566 | ||
3544 | /* complete taskfile transaction */ | 3567 | /* complete taskfile transaction */ |
3545 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 3568 | qc->err_mask |= ac_err_mask(drv_stat); |
3569 | ata_qc_complete(qc); | ||
3546 | break; | 3570 | break; |
3547 | } | 3571 | } |
3548 | 3572 | ||
@@ -3641,7 +3665,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3641 | return qc; | 3665 | return qc; |
3642 | } | 3666 | } |
3643 | 3667 | ||
3644 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) | 3668 | int ata_qc_complete_noop(struct ata_queued_cmd *qc) |
3645 | { | 3669 | { |
3646 | return 0; | 3670 | return 0; |
3647 | } | 3671 | } |
@@ -3700,7 +3724,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3700 | * spin_lock_irqsave(host_set lock) | 3724 | * spin_lock_irqsave(host_set lock) |
3701 | */ | 3725 | */ |
3702 | 3726 | ||
3703 | void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 3727 | void ata_qc_complete(struct ata_queued_cmd *qc) |
3704 | { | 3728 | { |
3705 | int rc; | 3729 | int rc; |
3706 | 3730 | ||
@@ -3717,7 +3741,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
3717 | qc->flags &= ~ATA_QCFLAG_ACTIVE; | 3741 | qc->flags &= ~ATA_QCFLAG_ACTIVE; |
3718 | 3742 | ||
3719 | /* call completion callback */ | 3743 | /* call completion callback */ |
3720 | rc = qc->complete_fn(qc, err_mask); | 3744 | rc = qc->complete_fn(qc); |
3721 | 3745 | ||
3722 | /* if callback indicates not to complete command (non-zero), | 3746 | /* if callback indicates not to complete command (non-zero), |
3723 | * return immediately | 3747 | * return immediately |
@@ -4303,7 +4327,8 @@ fsm_start: | |||
4303 | ap->hsm_task_state = HSM_ST_IDLE; | 4327 | ap->hsm_task_state = HSM_ST_IDLE; |
4304 | 4328 | ||
4305 | /* complete taskfile transaction */ | 4329 | /* complete taskfile transaction */ |
4306 | ata_qc_complete(qc, ac_err_mask(status)); | 4330 | qc->err_mask |= ac_err_mask(status); |
4331 | ata_qc_complete(qc); | ||
4307 | break; | 4332 | break; |
4308 | 4333 | ||
4309 | case HSM_ST_ERR: | 4334 | case HSM_ST_ERR: |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 379e87089764..2aef41112c43 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -418,7 +418,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, | |||
418 | int i; | 418 | int i; |
419 | 419 | ||
420 | /* Based on the 3ware driver translation table */ | 420 | /* Based on the 3ware driver translation table */ |
421 | static unsigned char sense_table[][4] = { | 421 | static const unsigned char sense_table[][4] = { |
422 | /* BBD|ECC|ID|MAR */ | 422 | /* BBD|ECC|ID|MAR */ |
423 | {0xd1, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command | 423 | {0xd1, ABORTED_COMMAND, 0x00, 0x00}, // Device busy Aborted command |
424 | /* BBD|ECC|ID */ | 424 | /* BBD|ECC|ID */ |
@@ -449,7 +449,7 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, | |||
449 | {0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error | 449 | {0x80, MEDIUM_ERROR, 0x11, 0x04}, // Block marked bad Medium error, unrecovered read error |
450 | {0xFF, 0xFF, 0xFF, 0xFF}, // END mark | 450 | {0xFF, 0xFF, 0xFF, 0xFF}, // END mark |
451 | }; | 451 | }; |
452 | static unsigned char stat_table[][4] = { | 452 | static const unsigned char stat_table[][4] = { |
453 | /* Must be first because BUSY means no other bits valid */ | 453 | /* Must be first because BUSY means no other bits valid */ |
454 | {0x80, ABORTED_COMMAND, 0x47, 0x00}, // Busy, fake parity for now | 454 | {0x80, ABORTED_COMMAND, 0x47, 0x00}, // Busy, fake parity for now |
455 | {0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault | 455 | {0x20, HARDWARE_ERROR, 0x00, 0x00}, // Device fault |
@@ -1203,12 +1203,11 @@ nothing_to_do: | |||
1203 | return 1; | 1203 | return 1; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, | 1206 | static int ata_scsi_qc_complete(struct ata_queued_cmd *qc) |
1207 | unsigned int err_mask) | ||
1208 | { | 1207 | { |
1209 | struct scsi_cmnd *cmd = qc->scsicmd; | 1208 | struct scsi_cmnd *cmd = qc->scsicmd; |
1210 | u8 *cdb = cmd->cmnd; | 1209 | u8 *cdb = cmd->cmnd; |
1211 | int need_sense = (err_mask != 0); | 1210 | int need_sense = (qc->err_mask != 0); |
1212 | 1211 | ||
1213 | /* For ATA pass thru (SAT) commands, generate a sense block if | 1212 | /* For ATA pass thru (SAT) commands, generate a sense block if |
1214 | * user mandated it or if there's an error. Note that if we | 1213 | * user mandated it or if there's an error. Note that if we |
@@ -1532,7 +1531,7 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |||
1532 | return 0; | 1531 | return 0; |
1533 | } | 1532 | } |
1534 | 1533 | ||
1535 | static const char *inq_83_str = "Linux ATA-SCSI simulator"; | 1534 | static const char * const inq_83_str = "Linux ATA-SCSI simulator"; |
1536 | 1535 | ||
1537 | /** | 1536 | /** |
1538 | * ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity | 1537 | * ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity |
@@ -1955,9 +1954,9 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 | |||
1955 | done(cmd); | 1954 | done(cmd); |
1956 | } | 1955 | } |
1957 | 1956 | ||
1958 | static int atapi_sense_complete(struct ata_queued_cmd *qc,unsigned int err_mask) | 1957 | static int atapi_sense_complete(struct ata_queued_cmd *qc) |
1959 | { | 1958 | { |
1960 | if (err_mask && ((err_mask & AC_ERR_DEV) == 0)) | 1959 | if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) |
1961 | /* FIXME: not quite right; we don't want the | 1960 | /* FIXME: not quite right; we don't want the |
1962 | * translation of taskfile registers into | 1961 | * translation of taskfile registers into |
1963 | * a sense descriptors, since that's only | 1962 | * a sense descriptors, since that's only |
@@ -2015,15 +2014,18 @@ static void atapi_request_sense(struct ata_queued_cmd *qc) | |||
2015 | 2014 | ||
2016 | qc->complete_fn = atapi_sense_complete; | 2015 | qc->complete_fn = atapi_sense_complete; |
2017 | 2016 | ||
2018 | if (ata_qc_issue(qc)) | 2017 | if (ata_qc_issue(qc)) { |
2019 | ata_qc_complete(qc, AC_ERR_OTHER); | 2018 | qc->err_mask |= AC_ERR_OTHER; |
2019 | ata_qc_complete(qc); | ||
2020 | } | ||
2020 | 2021 | ||
2021 | DPRINTK("EXIT\n"); | 2022 | DPRINTK("EXIT\n"); |
2022 | } | 2023 | } |
2023 | 2024 | ||
2024 | static int atapi_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 2025 | static int atapi_qc_complete(struct ata_queued_cmd *qc) |
2025 | { | 2026 | { |
2026 | struct scsi_cmnd *cmd = qc->scsicmd; | 2027 | struct scsi_cmnd *cmd = qc->scsicmd; |
2028 | unsigned int err_mask = qc->err_mask; | ||
2027 | 2029 | ||
2028 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); | 2030 | VPRINTK("ENTER, err_mask 0x%X\n", err_mask); |
2029 | 2031 | ||
diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 8ebaa694d18e..686255df76b8 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h | |||
@@ -39,7 +39,7 @@ struct ata_scsi_args { | |||
39 | 39 | ||
40 | /* libata-core.c */ | 40 | /* libata-core.c */ |
41 | extern int atapi_enabled; | 41 | extern int atapi_enabled; |
42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask); | 42 | extern int ata_qc_complete_noop(struct ata_queued_cmd *qc); |
43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | 43 | extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, |
44 | struct ata_device *dev); | 44 | struct ata_device *dev); |
45 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); | 45 | extern void ata_rwcmd_protocol(struct ata_queued_cmd *qc); |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index e254f1e1bb1c..4daede86f00a 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -464,14 +464,12 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set) | |||
464 | continue; | 464 | continue; |
465 | qc = ata_qc_from_tag(ap, ap->active_tag); | 465 | qc = ata_qc_from_tag(ap, ap->active_tag); |
466 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 466 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
467 | unsigned int err_mask = 0; | ||
468 | |||
469 | if ((status & (aPERR | aPSD | aUIRQ))) | 467 | if ((status & (aPERR | aPSD | aUIRQ))) |
470 | err_mask = AC_ERR_OTHER; | 468 | qc->err_mask |= AC_ERR_OTHER; |
471 | else if (pp->pkt[0] != cDONE) | 469 | else if (pp->pkt[0] != cDONE) |
472 | err_mask = AC_ERR_OTHER; | 470 | qc->err_mask |= AC_ERR_OTHER; |
473 | 471 | ||
474 | ata_qc_complete(qc, err_mask); | 472 | ata_qc_complete(qc); |
475 | } | 473 | } |
476 | } | 474 | } |
477 | return handled; | 475 | return handled; |
@@ -501,7 +499,8 @@ static inline unsigned int adma_intr_mmio(struct ata_host_set *host_set) | |||
501 | 499 | ||
502 | /* complete taskfile transaction */ | 500 | /* complete taskfile transaction */ |
503 | pp->state = adma_state_idle; | 501 | pp->state = adma_state_idle; |
504 | ata_qc_complete(qc, ac_err_mask(status)); | 502 | qc->err_mask |= ac_err_mask(status); |
503 | ata_qc_complete(qc); | ||
505 | handled = 1; | 504 | handled = 1; |
506 | } | 505 | } |
507 | } | 506 | } |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index edd0afa852eb..ef148acb5eeb 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -431,7 +431,7 @@ static const struct ata_port_operations mv6_ops = { | |||
431 | .host_stop = mv_host_stop, | 431 | .host_stop = mv_host_stop, |
432 | }; | 432 | }; |
433 | 433 | ||
434 | static struct ata_port_info mv_port_info[] = { | 434 | static const struct ata_port_info mv_port_info[] = { |
435 | { /* chip_504x */ | 435 | { /* chip_504x */ |
436 | .sht = &mv_sht, | 436 | .sht = &mv_sht, |
437 | .host_flags = MV_COMMON_FLAGS, | 437 | .host_flags = MV_COMMON_FLAGS, |
@@ -1242,8 +1242,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, | |||
1242 | VPRINTK("port %u IRQ found for qc, " | 1242 | VPRINTK("port %u IRQ found for qc, " |
1243 | "ata_status 0x%x\n", port,ata_status); | 1243 | "ata_status 0x%x\n", port,ata_status); |
1244 | /* mark qc status appropriately */ | 1244 | /* mark qc status appropriately */ |
1245 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) | 1245 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) { |
1246 | qc->err_mask |= err_mask; | ||
1246 | ata_qc_complete(qc, err_mask); | 1247 | ata_qc_complete(qc, err_mask); |
1248 | } | ||
1247 | } | 1249 | } |
1248 | } | 1250 | } |
1249 | } | 1251 | } |
@@ -1864,7 +1866,8 @@ static void mv_eng_timeout(struct ata_port *ap) | |||
1864 | */ | 1866 | */ |
1865 | spin_lock_irqsave(&ap->host_set->lock, flags); | 1867 | spin_lock_irqsave(&ap->host_set->lock, flags); |
1866 | qc->scsidone = scsi_finish_command; | 1868 | qc->scsidone = scsi_finish_command; |
1867 | ata_qc_complete(qc, AC_ERR_OTHER); | 1869 | qc->err_mask |= AC_ERR_OTHER; |
1870 | ata_qc_complete(qc); | ||
1868 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 1871 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
1869 | } | 1872 | } |
1870 | } | 1873 | } |
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index e9ffc27a0493..b4cbc9d6be1b 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c | |||
@@ -158,7 +158,7 @@ static const struct ata_port_operations pdc_pata_ops = { | |||
158 | .host_stop = ata_pci_host_stop, | 158 | .host_stop = ata_pci_host_stop, |
159 | }; | 159 | }; |
160 | 160 | ||
161 | static struct ata_port_info pdc_port_info[] = { | 161 | static const struct ata_port_info pdc_port_info[] = { |
162 | /* board_2037x */ | 162 | /* board_2037x */ |
163 | { | 163 | { |
164 | .sht = &pdc_ata_sht, | 164 | .sht = &pdc_ata_sht, |
@@ -404,7 +404,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
404 | case ATA_PROT_NODATA: | 404 | case ATA_PROT_NODATA: |
405 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 405 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
406 | drv_stat = ata_wait_idle(ap); | 406 | drv_stat = ata_wait_idle(ap); |
407 | ata_qc_complete(qc, __ac_err_mask(drv_stat)); | 407 | qc->err_mask |= __ac_err_mask(drv_stat); |
408 | ata_qc_complete(qc); | ||
408 | break; | 409 | break; |
409 | 410 | ||
410 | default: | 411 | default: |
@@ -413,7 +414,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
413 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 414 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
414 | ap->id, qc->tf.command, drv_stat); | 415 | ap->id, qc->tf.command, drv_stat); |
415 | 416 | ||
416 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 417 | qc->err_mask |= ac_err_mask(drv_stat); |
418 | ata_qc_complete(qc); | ||
417 | break; | 419 | break; |
418 | } | 420 | } |
419 | 421 | ||
@@ -425,21 +427,21 @@ out: | |||
425 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 427 | static inline unsigned int pdc_host_intr( struct ata_port *ap, |
426 | struct ata_queued_cmd *qc) | 428 | struct ata_queued_cmd *qc) |
427 | { | 429 | { |
428 | unsigned int handled = 0, err_mask = 0; | 430 | unsigned int handled = 0; |
429 | u32 tmp; | 431 | u32 tmp; |
430 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; | 432 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; |
431 | 433 | ||
432 | tmp = readl(mmio); | 434 | tmp = readl(mmio); |
433 | if (tmp & PDC_ERR_MASK) { | 435 | if (tmp & PDC_ERR_MASK) { |
434 | err_mask = AC_ERR_DEV; | 436 | qc->err_mask |= AC_ERR_DEV; |
435 | pdc_reset_port(ap); | 437 | pdc_reset_port(ap); |
436 | } | 438 | } |
437 | 439 | ||
438 | switch (qc->tf.protocol) { | 440 | switch (qc->tf.protocol) { |
439 | case ATA_PROT_DMA: | 441 | case ATA_PROT_DMA: |
440 | case ATA_PROT_NODATA: | 442 | case ATA_PROT_NODATA: |
441 | err_mask |= ac_err_mask(ata_wait_idle(ap)); | 443 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
442 | ata_qc_complete(qc, err_mask); | 444 | ata_qc_complete(qc); |
443 | handled = 1; | 445 | handled = 1; |
444 | break; | 446 | break; |
445 | 447 | ||
@@ -706,7 +708,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
706 | probe_ent->port[3].scr_addr = base + 0x700; | 708 | probe_ent->port[3].scr_addr = base + 0x700; |
707 | break; | 709 | break; |
708 | case board_2037x: | 710 | case board_2037x: |
709 | probe_ent->n_ports = 2; | 711 | probe_ent->n_ports = 2; |
710 | break; | 712 | break; |
711 | case board_20619: | 713 | case board_20619: |
712 | probe_ent->n_ports = 4; | 714 | probe_ent->n_ports = 4; |
@@ -716,7 +718,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
716 | 718 | ||
717 | probe_ent->port[2].scr_addr = base + 0x600; | 719 | probe_ent->port[2].scr_addr = base + 0x600; |
718 | probe_ent->port[3].scr_addr = base + 0x700; | 720 | probe_ent->port[3].scr_addr = base + 0x700; |
719 | break; | 721 | break; |
720 | default: | 722 | default: |
721 | BUG(); | 723 | BUG(); |
722 | break; | 724 | break; |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 17a39ed62306..6367966941d6 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c | |||
@@ -170,7 +170,7 @@ static const struct ata_port_operations qs_ata_ops = { | |||
170 | .bmdma_status = qs_bmdma_status, | 170 | .bmdma_status = qs_bmdma_status, |
171 | }; | 171 | }; |
172 | 172 | ||
173 | static struct ata_port_info qs_port_info[] = { | 173 | static const struct ata_port_info qs_port_info[] = { |
174 | /* board_2068_idx */ | 174 | /* board_2068_idx */ |
175 | { | 175 | { |
176 | .sht = &qs_ata_sht, | 176 | .sht = &qs_ata_sht, |
@@ -408,8 +408,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set) | |||
408 | case 3: /* device error */ | 408 | case 3: /* device error */ |
409 | pp->state = qs_state_idle; | 409 | pp->state = qs_state_idle; |
410 | qs_enter_reg_mode(qc->ap); | 410 | qs_enter_reg_mode(qc->ap); |
411 | ata_qc_complete(qc, | 411 | qc->err_mask |= ac_err_mask(sDST); |
412 | ac_err_mask(sDST)); | 412 | ata_qc_complete(qc); |
413 | break; | 413 | break; |
414 | default: | 414 | default: |
415 | break; | 415 | break; |
@@ -446,7 +446,8 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) | |||
446 | 446 | ||
447 | /* complete taskfile transaction */ | 447 | /* complete taskfile transaction */ |
448 | pp->state = qs_state_idle; | 448 | pp->state = qs_state_idle; |
449 | ata_qc_complete(qc, ac_err_mask(status)); | 449 | qc->err_mask |= ac_err_mask(status); |
450 | ata_qc_complete(qc); | ||
450 | handled = 1; | 451 | handled = 1; |
451 | } | 452 | } |
452 | } | 453 | } |
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c index 36091868560d..d2053487c73b 100644 --- a/drivers/scsi/sata_sil.c +++ b/drivers/scsi/sata_sil.c | |||
@@ -176,7 +176,7 @@ static const struct ata_port_operations sil_ops = { | |||
176 | .host_stop = ata_pci_host_stop, | 176 | .host_stop = ata_pci_host_stop, |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static struct ata_port_info sil_port_info[] = { | 179 | static const struct ata_port_info sil_port_info[] = { |
180 | /* sil_3112 */ | 180 | /* sil_3112 */ |
181 | { | 181 | { |
182 | .sht = &sil_sht, | 182 | .sht = &sil_sht, |
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index e0d6f194f54f..a0ad3ed2200a 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c | |||
@@ -654,7 +654,8 @@ static void sil24_eng_timeout(struct ata_port *ap) | |||
654 | */ | 654 | */ |
655 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 655 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
656 | qc->scsidone = scsi_finish_command; | 656 | qc->scsidone = scsi_finish_command; |
657 | ata_qc_complete(qc, AC_ERR_OTHER); | 657 | qc->err_mask |= AC_ERR_OTHER; |
658 | ata_qc_complete(qc); | ||
658 | 659 | ||
659 | sil24_reset_controller(ap); | 660 | sil24_reset_controller(ap); |
660 | } | 661 | } |
@@ -711,8 +712,10 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) | |||
711 | sil24_reset_controller(ap); | 712 | sil24_reset_controller(ap); |
712 | } | 713 | } |
713 | 714 | ||
714 | if (qc) | 715 | if (qc) { |
715 | ata_qc_complete(qc, err_mask); | 716 | qc->err_mask |= err_mask; |
717 | ata_qc_complete(qc); | ||
718 | } | ||
716 | } | 719 | } |
717 | 720 | ||
718 | static inline void sil24_host_intr(struct ata_port *ap) | 721 | static inline void sil24_host_intr(struct ata_port *ap) |
@@ -734,8 +737,10 @@ static inline void sil24_host_intr(struct ata_port *ap) | |||
734 | */ | 737 | */ |
735 | sil24_update_tf(ap); | 738 | sil24_update_tf(ap); |
736 | 739 | ||
737 | if (qc) | 740 | if (qc) { |
738 | ata_qc_complete(qc, ac_err_mask(pp->tf.command)); | 741 | qc->err_mask |= ac_err_mask(pp->tf.command); |
742 | ata_qc_complete(qc); | ||
743 | } | ||
739 | } else | 744 | } else |
740 | sil24_error_intr(ap, slot_stat); | 745 | sil24_error_intr(ap, slot_stat); |
741 | } | 746 | } |
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index 2eea6de12d70..a33862d2b630 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c | |||
@@ -215,7 +215,7 @@ static const struct ata_port_operations pdc_20621_ops = { | |||
215 | .host_stop = pdc20621_host_stop, | 215 | .host_stop = pdc20621_host_stop, |
216 | }; | 216 | }; |
217 | 217 | ||
218 | static struct ata_port_info pdc_port_info[] = { | 218 | static const struct ata_port_info pdc_port_info[] = { |
219 | /* board_20621 */ | 219 | /* board_20621 */ |
220 | { | 220 | { |
221 | .sht = &pdc_sata_sht, | 221 | .sht = &pdc_sata_sht, |
@@ -719,7 +719,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
719 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, | 719 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, |
720 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 720 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
721 | /* get drive status; clear intr; complete txn */ | 721 | /* get drive status; clear intr; complete txn */ |
722 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); | 722 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
723 | ata_qc_complete(qc); | ||
723 | pdc20621_pop_hdma(qc); | 724 | pdc20621_pop_hdma(qc); |
724 | } | 725 | } |
725 | 726 | ||
@@ -757,7 +758,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
757 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, | 758 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, |
758 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 759 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
759 | /* get drive status; clear intr; complete txn */ | 760 | /* get drive status; clear intr; complete txn */ |
760 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); | 761 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
762 | ata_qc_complete(qc); | ||
761 | pdc20621_pop_hdma(qc); | 763 | pdc20621_pop_hdma(qc); |
762 | } | 764 | } |
763 | handled = 1; | 765 | handled = 1; |
@@ -767,7 +769,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
767 | 769 | ||
768 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 770 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
769 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); | 771 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); |
770 | ata_qc_complete(qc, ac_err_mask(status)); | 772 | qc->err_mask |= ac_err_mask(status); |
773 | ata_qc_complete(qc); | ||
771 | handled = 1; | 774 | handled = 1; |
772 | 775 | ||
773 | } else { | 776 | } else { |
@@ -882,7 +885,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
882 | case ATA_PROT_DMA: | 885 | case ATA_PROT_DMA: |
883 | case ATA_PROT_NODATA: | 886 | case ATA_PROT_NODATA: |
884 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 887 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
885 | ata_qc_complete(qc, __ac_err_mask(ata_wait_idle(ap))); | 888 | qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); |
889 | ata_qc_complete(qc); | ||
886 | break; | 890 | break; |
887 | 891 | ||
888 | default: | 892 | default: |
@@ -891,7 +895,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
891 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 895 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
892 | ap->id, qc->tf.command, drv_stat); | 896 | ap->id, qc->tf.command, drv_stat); |
893 | 897 | ||
894 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 898 | qc->err_mask |= ac_err_mask(drv_stat); |
899 | ata_qc_complete(qc); | ||
895 | break; | 900 | break; |
896 | } | 901 | } |
897 | 902 | ||