diff options
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/ahci.c | 14 | ||||
-rw-r--r-- | drivers/scsi/ata_piix.c | 83 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 103 | ||||
-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 | 11 | ||||
-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 |
12 files changed, 194 insertions, 117 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/ata_piix.c b/drivers/scsi/ata_piix.c index 333d69dd84ef..908ff1f9671a 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -37,6 +37,49 @@ | |||
37 | * | 37 | * |
38 | * Hardware documentation available at http://developer.intel.com/ | 38 | * Hardware documentation available at http://developer.intel.com/ |
39 | * | 39 | * |
40 | * Documentation | ||
41 | * Publically available from Intel web site. Errata documentation | ||
42 | * is also publically available. As an aide to anyone hacking on this | ||
43 | * driver the list of errata that are relevant is below.going back to | ||
44 | * PIIX4. Older device documentation is now a bit tricky to find. | ||
45 | * | ||
46 | * The chipsets all follow very much the same design. The orginal Triton | ||
47 | * series chipsets do _not_ support independant device timings, but this | ||
48 | * is fixed in Triton II. With the odd mobile exception the chips then | ||
49 | * change little except in gaining more modes until SATA arrives. This | ||
50 | * driver supports only the chips with independant timing (that is those | ||
51 | * with SITRE and the 0x44 timing register). See pata_oldpiix and pata_mpiix | ||
52 | * for the early chip drivers. | ||
53 | * | ||
54 | * Errata of note: | ||
55 | * | ||
56 | * Unfixable | ||
57 | * PIIX4 errata #9 - Only on ultra obscure hw | ||
58 | * ICH3 errata #13 - Not observed to affect real hw | ||
59 | * by Intel | ||
60 | * | ||
61 | * Things we must deal with | ||
62 | * PIIX4 errata #10 - BM IDE hang with non UDMA | ||
63 | * (must stop/start dma to recover) | ||
64 | * 440MX errata #15 - As PIIX4 errata #10 | ||
65 | * PIIX4 errata #15 - Must not read control registers | ||
66 | * during a PIO transfer | ||
67 | * 440MX errata #13 - As PIIX4 errata #15 | ||
68 | * ICH2 errata #21 - DMA mode 0 doesn't work right | ||
69 | * ICH0/1 errata #55 - As ICH2 errata #21 | ||
70 | * ICH2 spec c #9 - Extra operations needed to handle | ||
71 | * drive hotswap [NOT YET SUPPORTED] | ||
72 | * ICH2 spec c #20 - IDE PRD must not cross a 64K boundary | ||
73 | * and must be dword aligned | ||
74 | * ICH2 spec c #24 - UDMA mode 4,5 t85/86 should be 6ns not 3.3 | ||
75 | * | ||
76 | * Should have been BIOS fixed: | ||
77 | * 450NX: errata #19 - DMA hangs on old 450NX | ||
78 | * 450NX: errata #20 - DMA hangs on old 450NX | ||
79 | * 450NX: errata #25 - Corruption with DMA on old 450NX | ||
80 | * ICH3 errata #15 - IDE deadlock under high load | ||
81 | * (BIOS must set dev 31 fn 0 bit 23) | ||
82 | * ICH3 errata #18 - Don't use native mode | ||
40 | */ | 83 | */ |
41 | 84 | ||
42 | #include <linux/kernel.h> | 85 | #include <linux/kernel.h> |
@@ -78,9 +121,7 @@ enum { | |||
78 | ich5_sata = 1, | 121 | ich5_sata = 1, |
79 | piix4_pata = 2, | 122 | piix4_pata = 2, |
80 | ich6_sata = 3, | 123 | ich6_sata = 3, |
81 | ich6_sata_rm = 4, | 124 | ich6_sata_ahci = 4, |
82 | ich7_sata = 5, | ||
83 | esb2_sata = 6, | ||
84 | 125 | ||
85 | PIIX_AHCI_DEVICE = 6, | 126 | PIIX_AHCI_DEVICE = 6, |
86 | }; | 127 | }; |
@@ -111,11 +152,11 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
111 | { 0x8086, 0x25a3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, | 152 | { 0x8086, 0x25a3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, |
112 | { 0x8086, 0x25b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, | 153 | { 0x8086, 0x25b0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich5_sata }, |
113 | { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, | 154 | { 0x8086, 0x2651, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata }, |
114 | { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm }, | 155 | { 0x8086, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
115 | { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_rm }, | 156 | { 0x8086, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
116 | { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7_sata }, | 157 | { 0x8086, 0x27c0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
117 | { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich7_sata }, | 158 | { 0x8086, 0x27c4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
118 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, esb2_sata }, | 159 | { 0x8086, 0x2680, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich6_sata_ahci }, |
119 | 160 | ||
120 | { } /* terminate list */ | 161 | { } /* terminate list */ |
121 | }; | 162 | }; |
@@ -258,31 +299,7 @@ static struct ata_port_info piix_port_info[] = { | |||
258 | .port_ops = &piix_sata_ops, | 299 | .port_ops = &piix_sata_ops, |
259 | }, | 300 | }, |
260 | 301 | ||
261 | /* ich6_sata_rm */ | 302 | /* ich6_sata_ahci */ |
262 | { | ||
263 | .sht = &piix_sht, | ||
264 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | | ||
265 | PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR | | ||
266 | ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI, | ||
267 | .pio_mask = 0x1f, /* pio0-4 */ | ||
268 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
269 | .udma_mask = 0x7f, /* udma0-6 */ | ||
270 | .port_ops = &piix_sata_ops, | ||
271 | }, | ||
272 | |||
273 | /* ich7_sata */ | ||
274 | { | ||
275 | .sht = &piix_sht, | ||
276 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | | ||
277 | PIIX_FLAG_COMBINED | PIIX_FLAG_CHECKINTR | | ||
278 | ATA_FLAG_SLAVE_POSS | PIIX_FLAG_AHCI, | ||
279 | .pio_mask = 0x1f, /* pio0-4 */ | ||
280 | .mwdma_mask = 0x07, /* mwdma0-2 */ | ||
281 | .udma_mask = 0x7f, /* udma0-6 */ | ||
282 | .port_ops = &piix_sata_ops, | ||
283 | }, | ||
284 | |||
285 | /* esb2_sata */ | ||
286 | { | 303 | { |
287 | .sht = &piix_sht, | 304 | .sht = &piix_sht, |
288 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | | 305 | .host_flags = ATA_FLAG_SATA | ATA_FLAG_SRST | |
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 665ae79e1fd6..e4c400756b23 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -605,7 +605,7 @@ void ata_rwcmd_protocol(struct ata_queued_cmd *qc) | |||
605 | tf->command = ata_rw_cmds[index + lba48 + write]; | 605 | tf->command = ata_rw_cmds[index + lba48 + write]; |
606 | } | 606 | } |
607 | 607 | ||
608 | static const char * xfer_mode_str[] = { | 608 | static const char * const xfer_mode_str[] = { |
609 | "UDMA/16", | 609 | "UDMA/16", |
610 | "UDMA/25", | 610 | "UDMA/25", |
611 | "UDMA/33", | 611 | "UDMA/33", |
@@ -1053,9 +1053,9 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1053 | 1053 | ||
1054 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { | 1054 | if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { |
1055 | /* timeout handling */ | 1055 | /* timeout handling */ |
1056 | unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); | 1056 | qc->err_mask |= ac_err_mask(ata_chk_status(qc->ap)); |
1057 | 1057 | ||
1058 | if (!err_mask) { | 1058 | if (!qc->err_mask) { |
1059 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", | 1059 | printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", |
1060 | qc->ap->id, qc->tf.command); | 1060 | qc->ap->id, qc->tf.command); |
1061 | } else { | 1061 | } else { |
@@ -1064,7 +1064,7 @@ static int ata_qc_wait_err(struct ata_queued_cmd *qc, | |||
1064 | rc = -EIO; | 1064 | rc = -EIO; |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | ata_qc_complete(qc, err_mask); | 1067 | ata_qc_complete(qc); |
1068 | } | 1068 | } |
1069 | 1069 | ||
1070 | return rc; | 1070 | return rc; |
@@ -1175,6 +1175,7 @@ retry: | |||
1175 | qc->cursg_ofs = 0; | 1175 | qc->cursg_ofs = 0; |
1176 | qc->cursect = 0; | 1176 | qc->cursect = 0; |
1177 | qc->nsect = 1; | 1177 | qc->nsect = 1; |
1178 | qc->err_mask = 0; | ||
1178 | goto retry; | 1179 | goto retry; |
1179 | } | 1180 | } |
1180 | } | 1181 | } |
@@ -1444,11 +1445,23 @@ void __sata_phy_reset(struct ata_port *ap) | |||
1444 | } while (time_before(jiffies, timeout)); | 1445 | } while (time_before(jiffies, timeout)); |
1445 | 1446 | ||
1446 | /* TODO: phy layer with polling, timeouts, etc. */ | 1447 | /* TODO: phy layer with polling, timeouts, etc. */ |
1447 | if (sata_dev_present(ap)) | 1448 | sstatus = scr_read(ap, SCR_STATUS); |
1449 | if (sata_dev_present(ap)) { | ||
1450 | const char *speed; | ||
1451 | u32 tmp; | ||
1452 | |||
1453 | tmp = (sstatus >> 4) & 0xf; | ||
1454 | if (tmp & (1 << 0)) | ||
1455 | speed = "1.5"; | ||
1456 | else if (tmp & (1 << 1)) | ||
1457 | speed = "3.0"; | ||
1458 | else | ||
1459 | speed = "<unknown>"; | ||
1460 | printk(KERN_INFO "ata%u: SATA link up %s Gbps (SStatus %X)\n", | ||
1461 | ap->id, speed, sstatus); | ||
1448 | ata_port_probe(ap); | 1462 | ata_port_probe(ap); |
1449 | else { | 1463 | } else { |
1450 | sstatus = scr_read(ap, SCR_STATUS); | 1464 | printk(KERN_INFO "ata%u: SATA link down (SStatus %X)\n", |
1451 | printk(KERN_INFO "ata%u: no device found (phy stat %08x)\n", | ||
1452 | ap->id, sstatus); | 1465 | ap->id, sstatus); |
1453 | ata_port_disable(ap); | 1466 | ata_port_disable(ap); |
1454 | } | 1467 | } |
@@ -2071,7 +2084,7 @@ static void ata_pr_blacklisted(const struct ata_port *ap, | |||
2071 | ap->id, dev->devno); | 2084 | ap->id, dev->devno); |
2072 | } | 2085 | } |
2073 | 2086 | ||
2074 | static const char * ata_dma_blacklist [] = { | 2087 | static const char * const ata_dma_blacklist [] = { |
2075 | "WDC AC11000H", | 2088 | "WDC AC11000H", |
2076 | "WDC AC22100H", | 2089 | "WDC AC22100H", |
2077 | "WDC AC32500H", | 2090 | "WDC AC32500H", |
@@ -2765,7 +2778,7 @@ skip_map: | |||
2765 | * None. (grabs host lock) | 2778 | * None. (grabs host lock) |
2766 | */ | 2779 | */ |
2767 | 2780 | ||
2768 | void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 2781 | void ata_poll_qc_complete(struct ata_queued_cmd *qc) |
2769 | { | 2782 | { |
2770 | struct ata_port *ap = qc->ap; | 2783 | struct ata_port *ap = qc->ap; |
2771 | unsigned long flags; | 2784 | unsigned long flags; |
@@ -2773,7 +2786,7 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
2773 | spin_lock_irqsave(&ap->host_set->lock, flags); | 2786 | spin_lock_irqsave(&ap->host_set->lock, flags); |
2774 | ap->flags &= ~ATA_FLAG_NOINTR; | 2787 | ap->flags &= ~ATA_FLAG_NOINTR; |
2775 | ata_irq_on(ap); | 2788 | ata_irq_on(ap); |
2776 | ata_qc_complete(qc, err_mask); | 2789 | ata_qc_complete(qc); |
2777 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 2790 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
2778 | } | 2791 | } |
2779 | 2792 | ||
@@ -2790,10 +2803,14 @@ void ata_poll_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
2790 | 2803 | ||
2791 | static unsigned long ata_pio_poll(struct ata_port *ap) | 2804 | static unsigned long ata_pio_poll(struct ata_port *ap) |
2792 | { | 2805 | { |
2806 | struct ata_queued_cmd *qc; | ||
2793 | u8 status; | 2807 | u8 status; |
2794 | unsigned int poll_state = HSM_ST_UNKNOWN; | 2808 | unsigned int poll_state = HSM_ST_UNKNOWN; |
2795 | unsigned int reg_state = HSM_ST_UNKNOWN; | 2809 | unsigned int reg_state = HSM_ST_UNKNOWN; |
2796 | 2810 | ||
2811 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2812 | assert(qc != NULL); | ||
2813 | |||
2797 | switch (ap->hsm_task_state) { | 2814 | switch (ap->hsm_task_state) { |
2798 | case HSM_ST: | 2815 | case HSM_ST: |
2799 | case HSM_ST_POLL: | 2816 | case HSM_ST_POLL: |
@@ -2813,6 +2830,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap) | |||
2813 | status = ata_chk_status(ap); | 2830 | status = ata_chk_status(ap); |
2814 | if (status & ATA_BUSY) { | 2831 | if (status & ATA_BUSY) { |
2815 | if (time_after(jiffies, ap->pio_task_timeout)) { | 2832 | if (time_after(jiffies, ap->pio_task_timeout)) { |
2833 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
2816 | ap->hsm_task_state = HSM_ST_TMOUT; | 2834 | ap->hsm_task_state = HSM_ST_TMOUT; |
2817 | return 0; | 2835 | return 0; |
2818 | } | 2836 | } |
@@ -2847,29 +2865,31 @@ static int ata_pio_complete (struct ata_port *ap) | |||
2847 | * msecs, then chk-status again. If still busy, fall back to | 2865 | * msecs, then chk-status again. If still busy, fall back to |
2848 | * HSM_ST_POLL state. | 2866 | * HSM_ST_POLL state. |
2849 | */ | 2867 | */ |
2850 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); | 2868 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); |
2851 | if (drv_stat & (ATA_BUSY | ATA_DRQ)) { | 2869 | if (drv_stat & ATA_BUSY) { |
2852 | msleep(2); | 2870 | msleep(2); |
2853 | drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 10); | 2871 | drv_stat = ata_busy_wait(ap, ATA_BUSY, 10); |
2854 | if (drv_stat & (ATA_BUSY | ATA_DRQ)) { | 2872 | if (drv_stat & ATA_BUSY) { |
2855 | ap->hsm_task_state = HSM_ST_LAST_POLL; | 2873 | ap->hsm_task_state = HSM_ST_LAST_POLL; |
2856 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; | 2874 | ap->pio_task_timeout = jiffies + ATA_TMOUT_PIO; |
2857 | return 0; | 2875 | return 0; |
2858 | } | 2876 | } |
2859 | } | 2877 | } |
2860 | 2878 | ||
2879 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2880 | assert(qc != NULL); | ||
2881 | |||
2861 | drv_stat = ata_wait_idle(ap); | 2882 | drv_stat = ata_wait_idle(ap); |
2862 | if (!ata_ok(drv_stat)) { | 2883 | if (!ata_ok(drv_stat)) { |
2884 | qc->err_mask |= __ac_err_mask(drv_stat); | ||
2863 | ap->hsm_task_state = HSM_ST_ERR; | 2885 | ap->hsm_task_state = HSM_ST_ERR; |
2864 | return 0; | 2886 | return 0; |
2865 | } | 2887 | } |
2866 | 2888 | ||
2867 | qc = ata_qc_from_tag(ap, ap->active_tag); | ||
2868 | assert(qc != NULL); | ||
2869 | |||
2870 | ap->hsm_task_state = HSM_ST_IDLE; | 2889 | ap->hsm_task_state = HSM_ST_IDLE; |
2871 | 2890 | ||
2872 | ata_poll_qc_complete(qc, 0); | 2891 | assert(qc->err_mask == 0); |
2892 | ata_poll_qc_complete(qc); | ||
2873 | 2893 | ||
2874 | /* another command may start at this point */ | 2894 | /* another command may start at this point */ |
2875 | 2895 | ||
@@ -3177,6 +3197,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc) | |||
3177 | err_out: | 3197 | err_out: |
3178 | printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", | 3198 | printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", |
3179 | ap->id, dev->devno); | 3199 | ap->id, dev->devno); |
3200 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
3180 | ap->hsm_task_state = HSM_ST_ERR; | 3201 | ap->hsm_task_state = HSM_ST_ERR; |
3181 | } | 3202 | } |
3182 | 3203 | ||
@@ -3215,8 +3236,16 @@ static void ata_pio_block(struct ata_port *ap) | |||
3215 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3236 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3216 | assert(qc != NULL); | 3237 | assert(qc != NULL); |
3217 | 3238 | ||
3239 | /* check error */ | ||
3240 | if (status & (ATA_ERR | ATA_DF)) { | ||
3241 | qc->err_mask |= AC_ERR_DEV; | ||
3242 | ap->hsm_task_state = HSM_ST_ERR; | ||
3243 | return; | ||
3244 | } | ||
3245 | |||
3246 | /* transfer data if any */ | ||
3218 | if (is_atapi_taskfile(&qc->tf)) { | 3247 | if (is_atapi_taskfile(&qc->tf)) { |
3219 | /* no more data to transfer or unsupported ATAPI command */ | 3248 | /* DRQ=0 means no more data to transfer */ |
3220 | if ((status & ATA_DRQ) == 0) { | 3249 | if ((status & ATA_DRQ) == 0) { |
3221 | ap->hsm_task_state = HSM_ST_LAST; | 3250 | ap->hsm_task_state = HSM_ST_LAST; |
3222 | return; | 3251 | return; |
@@ -3226,6 +3255,7 @@ static void ata_pio_block(struct ata_port *ap) | |||
3226 | } else { | 3255 | } else { |
3227 | /* handle BSY=0, DRQ=0 as error */ | 3256 | /* handle BSY=0, DRQ=0 as error */ |
3228 | if ((status & ATA_DRQ) == 0) { | 3257 | if ((status & ATA_DRQ) == 0) { |
3258 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
3229 | ap->hsm_task_state = HSM_ST_ERR; | 3259 | ap->hsm_task_state = HSM_ST_ERR; |
3230 | return; | 3260 | return; |
3231 | } | 3261 | } |
@@ -3243,9 +3273,14 @@ static void ata_pio_error(struct ata_port *ap) | |||
3243 | qc = ata_qc_from_tag(ap, ap->active_tag); | 3273 | qc = ata_qc_from_tag(ap, ap->active_tag); |
3244 | assert(qc != NULL); | 3274 | assert(qc != NULL); |
3245 | 3275 | ||
3276 | /* make sure qc->err_mask is available to | ||
3277 | * know what's wrong and recover | ||
3278 | */ | ||
3279 | assert(qc->err_mask); | ||
3280 | |||
3246 | ap->hsm_task_state = HSM_ST_IDLE; | 3281 | ap->hsm_task_state = HSM_ST_IDLE; |
3247 | 3282 | ||
3248 | ata_poll_qc_complete(qc, AC_ERR_ATA_BUS); | 3283 | ata_poll_qc_complete(qc); |
3249 | } | 3284 | } |
3250 | 3285 | ||
3251 | static void ata_pio_task(void *_data) | 3286 | static void ata_pio_task(void *_data) |
@@ -3347,7 +3382,8 @@ static void ata_qc_timeout(struct ata_queued_cmd *qc) | |||
3347 | ap->id, qc->tf.command, drv_stat, host_stat); | 3382 | ap->id, qc->tf.command, drv_stat, host_stat); |
3348 | 3383 | ||
3349 | /* complete taskfile transaction */ | 3384 | /* complete taskfile transaction */ |
3350 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 3385 | qc->err_mask |= ac_err_mask(drv_stat); |
3386 | ata_qc_complete(qc); | ||
3351 | break; | 3387 | break; |
3352 | } | 3388 | } |
3353 | 3389 | ||
@@ -3446,7 +3482,7 @@ struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap, | |||
3446 | return qc; | 3482 | return qc; |
3447 | } | 3483 | } |
3448 | 3484 | ||
3449 | int ata_qc_complete_noop(struct ata_queued_cmd *qc, unsigned int err_mask) | 3485 | int ata_qc_complete_noop(struct ata_queued_cmd *qc) |
3450 | { | 3486 | { |
3451 | return 0; | 3487 | return 0; |
3452 | } | 3488 | } |
@@ -3505,7 +3541,7 @@ void ata_qc_free(struct ata_queued_cmd *qc) | |||
3505 | * spin_lock_irqsave(host_set lock) | 3541 | * spin_lock_irqsave(host_set lock) |
3506 | */ | 3542 | */ |
3507 | 3543 | ||
3508 | void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | 3544 | void ata_qc_complete(struct ata_queued_cmd *qc) |
3509 | { | 3545 | { |
3510 | int rc; | 3546 | int rc; |
3511 | 3547 | ||
@@ -3522,7 +3558,7 @@ void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask) | |||
3522 | qc->flags &= ~ATA_QCFLAG_ACTIVE; | 3558 | qc->flags &= ~ATA_QCFLAG_ACTIVE; |
3523 | 3559 | ||
3524 | /* call completion callback */ | 3560 | /* call completion callback */ |
3525 | rc = qc->complete_fn(qc, err_mask); | 3561 | rc = qc->complete_fn(qc); |
3526 | 3562 | ||
3527 | /* if callback indicates not to complete command (non-zero), | 3563 | /* if callback indicates not to complete command (non-zero), |
3528 | * return immediately | 3564 | * return immediately |
@@ -3960,7 +3996,8 @@ inline unsigned int ata_host_intr (struct ata_port *ap, | |||
3960 | ap->ops->irq_clear(ap); | 3996 | ap->ops->irq_clear(ap); |
3961 | 3997 | ||
3962 | /* complete taskfile transaction */ | 3998 | /* complete taskfile transaction */ |
3963 | ata_qc_complete(qc, ac_err_mask(status)); | 3999 | qc->err_mask |= ac_err_mask(status); |
4000 | ata_qc_complete(qc); | ||
3964 | break; | 4001 | break; |
3965 | 4002 | ||
3966 | default: | 4003 | default: |
@@ -4054,13 +4091,17 @@ static void atapi_packet_task(void *_data) | |||
4054 | 4091 | ||
4055 | /* sleep-wait for BSY to clear */ | 4092 | /* sleep-wait for BSY to clear */ |
4056 | DPRINTK("busy wait\n"); | 4093 | DPRINTK("busy wait\n"); |
4057 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) | 4094 | if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) { |
4058 | goto err_out_status; | 4095 | qc->err_mask |= AC_ERR_ATA_BUS; |
4096 | goto err_out; | ||
4097 | } | ||
4059 | 4098 | ||
4060 | /* make sure DRQ is set */ | 4099 | /* make sure DRQ is set */ |
4061 | status = ata_chk_status(ap); | 4100 | status = ata_chk_status(ap); |
4062 | if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) | 4101 | if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) { |
4102 | qc->err_mask |= AC_ERR_ATA_BUS; | ||
4063 | goto err_out; | 4103 | goto err_out; |
4104 | } | ||
4064 | 4105 | ||
4065 | /* send SCSI cdb */ | 4106 | /* send SCSI cdb */ |
4066 | DPRINTK("send cdb\n"); | 4107 | DPRINTK("send cdb\n"); |
@@ -4092,10 +4133,8 @@ static void atapi_packet_task(void *_data) | |||
4092 | 4133 | ||
4093 | return; | 4134 | return; |
4094 | 4135 | ||
4095 | err_out_status: | ||
4096 | status = ata_chk_status(ap); | ||
4097 | err_out: | 4136 | err_out: |
4098 | ata_poll_qc_complete(qc, __ac_err_mask(status)); | 4137 | ata_poll_qc_complete(qc); |
4099 | } | 4138 | } |
4100 | 4139 | ||
4101 | 4140 | ||
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 f557f17ca00c..e8df0c9ec1e6 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.ctl & ATA_NIEN))) { | 466 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
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 ab7432a5778e..3e7866b51ac6 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -430,7 +430,7 @@ static const struct ata_port_operations mv6_ops = { | |||
430 | .host_stop = mv_host_stop, | 430 | .host_stop = mv_host_stop, |
431 | }; | 431 | }; |
432 | 432 | ||
433 | static struct ata_port_info mv_port_info[] = { | 433 | static const struct ata_port_info mv_port_info[] = { |
434 | { /* chip_504x */ | 434 | { /* chip_504x */ |
435 | .sht = &mv_sht, | 435 | .sht = &mv_sht, |
436 | .host_flags = MV_COMMON_FLAGS, | 436 | .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.ctl & ATA_NIEN)) | 1245 | if (!(qc->tf.ctl & ATA_NIEN)) { |
1246 | ata_qc_complete(qc, err_mask); | 1246 | qc->err_mask |= err_mask; |
1247 | ata_qc_complete(qc); | ||
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 8a8e3e3ef0ed..e2e146a14f97 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, |
@@ -401,7 +401,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
401 | case ATA_PROT_NODATA: | 401 | case ATA_PROT_NODATA: |
402 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 402 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
403 | drv_stat = ata_wait_idle(ap); | 403 | drv_stat = ata_wait_idle(ap); |
404 | ata_qc_complete(qc, __ac_err_mask(drv_stat)); | 404 | qc->err_mask |= __ac_err_mask(drv_stat); |
405 | ata_qc_complete(qc); | ||
405 | break; | 406 | break; |
406 | 407 | ||
407 | default: | 408 | default: |
@@ -410,7 +411,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
410 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 411 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
411 | ap->id, qc->tf.command, drv_stat); | 412 | ap->id, qc->tf.command, drv_stat); |
412 | 413 | ||
413 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 414 | qc->err_mask |= ac_err_mask(drv_stat); |
415 | ata_qc_complete(qc); | ||
414 | break; | 416 | break; |
415 | } | 417 | } |
416 | 418 | ||
@@ -422,21 +424,21 @@ out: | |||
422 | static inline unsigned int pdc_host_intr( struct ata_port *ap, | 424 | static inline unsigned int pdc_host_intr( struct ata_port *ap, |
423 | struct ata_queued_cmd *qc) | 425 | struct ata_queued_cmd *qc) |
424 | { | 426 | { |
425 | unsigned int handled = 0, err_mask = 0; | 427 | unsigned int handled = 0; |
426 | u32 tmp; | 428 | u32 tmp; |
427 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; | 429 | void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; |
428 | 430 | ||
429 | tmp = readl(mmio); | 431 | tmp = readl(mmio); |
430 | if (tmp & PDC_ERR_MASK) { | 432 | if (tmp & PDC_ERR_MASK) { |
431 | err_mask = AC_ERR_DEV; | 433 | qc->err_mask |= AC_ERR_DEV; |
432 | pdc_reset_port(ap); | 434 | pdc_reset_port(ap); |
433 | } | 435 | } |
434 | 436 | ||
435 | switch (qc->tf.protocol) { | 437 | switch (qc->tf.protocol) { |
436 | case ATA_PROT_DMA: | 438 | case ATA_PROT_DMA: |
437 | case ATA_PROT_NODATA: | 439 | case ATA_PROT_NODATA: |
438 | err_mask |= ac_err_mask(ata_wait_idle(ap)); | 440 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
439 | ata_qc_complete(qc, err_mask); | 441 | ata_qc_complete(qc); |
440 | handled = 1; | 442 | handled = 1; |
441 | break; | 443 | break; |
442 | 444 | ||
@@ -703,7 +705,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
703 | probe_ent->port[3].scr_addr = base + 0x700; | 705 | probe_ent->port[3].scr_addr = base + 0x700; |
704 | break; | 706 | break; |
705 | case board_2037x: | 707 | case board_2037x: |
706 | probe_ent->n_ports = 2; | 708 | probe_ent->n_ports = 2; |
707 | break; | 709 | break; |
708 | case board_20619: | 710 | case board_20619: |
709 | probe_ent->n_ports = 4; | 711 | probe_ent->n_ports = 4; |
@@ -713,7 +715,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
713 | 715 | ||
714 | probe_ent->port[2].scr_addr = base + 0x600; | 716 | probe_ent->port[2].scr_addr = base + 0x600; |
715 | probe_ent->port[3].scr_addr = base + 0x700; | 717 | probe_ent->port[3].scr_addr = base + 0x700; |
716 | break; | 718 | break; |
717 | default: | 719 | default: |
718 | BUG(); | 720 | BUG(); |
719 | break; | 721 | break; |
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index a8987f5ff5cc..de05e2883f9c 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, |
@@ -409,8 +409,8 @@ static inline unsigned int qs_intr_pkt(struct ata_host_set *host_set) | |||
409 | case 3: /* device error */ | 409 | case 3: /* device error */ |
410 | pp->state = qs_state_idle; | 410 | pp->state = qs_state_idle; |
411 | qs_enter_reg_mode(qc->ap); | 411 | qs_enter_reg_mode(qc->ap); |
412 | ata_qc_complete(qc, | 412 | qc->err_mask |= ac_err_mask(sDST); |
413 | ac_err_mask(sDST)); | 413 | ata_qc_complete(qc); |
414 | break; | 414 | break; |
415 | default: | 415 | default: |
416 | break; | 416 | break; |
@@ -447,7 +447,8 @@ static inline unsigned int qs_intr_mmio(struct ata_host_set *host_set) | |||
447 | 447 | ||
448 | /* complete taskfile transaction */ | 448 | /* complete taskfile transaction */ |
449 | pp->state = qs_state_idle; | 449 | pp->state = qs_state_idle; |
450 | ata_qc_complete(qc, ac_err_mask(status)); | 450 | qc->err_mask |= ac_err_mask(status); |
451 | ata_qc_complete(qc); | ||
451 | handled = 1; | 452 | handled = 1; |
452 | } | 453 | } |
453 | } | 454 | } |
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 dcc3ad9a9d6e..58da854a7c68 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, |
@@ -718,7 +718,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
718 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, | 718 | VPRINTK("ata%u: read hdma, 0x%x 0x%x\n", ap->id, |
719 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 719 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
720 | /* get drive status; clear intr; complete txn */ | 720 | /* get drive status; clear intr; complete txn */ |
721 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); | 721 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
722 | ata_qc_complete(qc); | ||
722 | pdc20621_pop_hdma(qc); | 723 | pdc20621_pop_hdma(qc); |
723 | } | 724 | } |
724 | 725 | ||
@@ -756,7 +757,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
756 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, | 757 | VPRINTK("ata%u: write ata, 0x%x 0x%x\n", ap->id, |
757 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); | 758 | readl(mmio + 0x104), readl(mmio + PDC_HDMA_CTLSTAT)); |
758 | /* get drive status; clear intr; complete txn */ | 759 | /* get drive status; clear intr; complete txn */ |
759 | ata_qc_complete(qc, ac_err_mask(ata_wait_idle(ap))); | 760 | qc->err_mask |= ac_err_mask(ata_wait_idle(ap)); |
761 | ata_qc_complete(qc); | ||
760 | pdc20621_pop_hdma(qc); | 762 | pdc20621_pop_hdma(qc); |
761 | } | 763 | } |
762 | handled = 1; | 764 | handled = 1; |
@@ -766,7 +768,8 @@ static inline unsigned int pdc20621_host_intr( struct ata_port *ap, | |||
766 | 768 | ||
767 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); | 769 | status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000); |
768 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); | 770 | DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status); |
769 | ata_qc_complete(qc, ac_err_mask(status)); | 771 | qc->err_mask |= ac_err_mask(status); |
772 | ata_qc_complete(qc); | ||
770 | handled = 1; | 773 | handled = 1; |
771 | 774 | ||
772 | } else { | 775 | } else { |
@@ -881,7 +884,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
881 | case ATA_PROT_DMA: | 884 | case ATA_PROT_DMA: |
882 | case ATA_PROT_NODATA: | 885 | case ATA_PROT_NODATA: |
883 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); | 886 | printk(KERN_ERR "ata%u: command timeout\n", ap->id); |
884 | ata_qc_complete(qc, __ac_err_mask(ata_wait_idle(ap))); | 887 | qc->err_mask |= __ac_err_mask(ata_wait_idle(ap)); |
888 | ata_qc_complete(qc); | ||
885 | break; | 889 | break; |
886 | 890 | ||
887 | default: | 891 | default: |
@@ -890,7 +894,8 @@ static void pdc_eng_timeout(struct ata_port *ap) | |||
890 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", | 894 | printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", |
891 | ap->id, qc->tf.command, drv_stat); | 895 | ap->id, qc->tf.command, drv_stat); |
892 | 896 | ||
893 | ata_qc_complete(qc, ac_err_mask(drv_stat)); | 897 | qc->err_mask |= ac_err_mask(drv_stat); |
898 | ata_qc_complete(qc); | ||
894 | break; | 899 | break; |
895 | } | 900 | } |
896 | 901 | ||