aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-01-27 02:36:14 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-27 02:36:14 -0500
commit7dfb869c8e45e5863534f38fdac990829b22964a (patch)
treef36bbdba46b022356d05ac26d5073e395d2f8abd
parent628e386e27674906326455f01d87878a5f0cbce7 (diff)
parent11a56d2439259892319df81cf1582687d7e7fde5 (diff)
Merge branch 'tmp'
-rw-r--r--drivers/scsi/ahci.c4
-rw-r--r--drivers/scsi/libata-core.c26
-rw-r--r--drivers/scsi/libata-scsi.c6
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--include/linux/libata.h15
6 files changed, 30 insertions, 25 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 30676b0eb366..bb3686ae1885 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -680,7 +680,7 @@ static void ahci_eng_timeout(struct ata_port *ap)
680 * not being called from the SCSI EH. 680 * not being called from the SCSI EH.
681 */ 681 */
682 qc->scsidone = scsi_finish_command; 682 qc->scsidone = scsi_finish_command;
683 qc->err_mask |= AC_ERR_OTHER; 683 qc->err_mask |= AC_ERR_TIMEOUT;
684 ata_qc_complete(qc); 684 ata_qc_complete(qc);
685 } 685 }
686 686
@@ -721,7 +721,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
721 ahci_restart_port(ap, status); 721 ahci_restart_port(ap, status);
722 722
723 if (qc) { 723 if (qc) {
724 qc->err_mask |= AC_ERR_OTHER; 724 qc->err_mask |= err_mask;
725 ata_qc_complete(qc); 725 ata_qc_complete(qc);
726 } 726 }
727 } 727 }
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 20bccabb54fc..5b6bc3655068 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1126,8 +1126,10 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev,
1126 qc->private_data = &wait; 1126 qc->private_data = &wait;
1127 qc->complete_fn = ata_qc_complete_internal; 1127 qc->complete_fn = ata_qc_complete_internal;
1128 1128
1129 if (ata_qc_issue(qc)) 1129 if (ata_qc_issue(qc)) {
1130 goto issue_fail; 1130 qc->err_mask = AC_ERR_OTHER;
1131 ata_qc_complete(qc);
1132 }
1131 1133
1132 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1134 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1133 1135
@@ -1141,7 +1143,7 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev,
1141 * spurious interrupt. We can live with that. 1143 * spurious interrupt. We can live with that.
1142 */ 1144 */
1143 if (qc->flags & ATA_QCFLAG_ACTIVE) { 1145 if (qc->flags & ATA_QCFLAG_ACTIVE) {
1144 qc->err_mask = AC_ERR_OTHER; 1146 qc->err_mask = AC_ERR_TIMEOUT;
1145 ata_qc_complete(qc); 1147 ata_qc_complete(qc);
1146 printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n", 1148 printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n",
1147 ap->id, command); 1149 ap->id, command);
@@ -1156,11 +1158,6 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev,
1156 ata_qc_free(qc); 1158 ata_qc_free(qc);
1157 1159
1158 return err_mask; 1160 return err_mask;
1159
1160 issue_fail:
1161 ata_qc_free(qc);
1162 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1163 return AC_ERR_OTHER;
1164} 1161}
1165 1162
1166/** 1163/**
@@ -2929,7 +2926,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2929 status = ata_chk_status(ap); 2926 status = ata_chk_status(ap);
2930 if (status & ATA_BUSY) { 2927 if (status & ATA_BUSY) {
2931 if (time_after(jiffies, ap->pio_task_timeout)) { 2928 if (time_after(jiffies, ap->pio_task_timeout)) {
2932 qc->err_mask |= AC_ERR_ATA_BUS; 2929 qc->err_mask |= AC_ERR_TIMEOUT;
2933 ap->hsm_task_state = HSM_ST_TMOUT; 2930 ap->hsm_task_state = HSM_ST_TMOUT;
2934 return 0; 2931 return 0;
2935 } 2932 }
@@ -3474,7 +3471,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
3474err_out: 3471err_out:
3475 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", 3472 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n",
3476 ap->id, dev->devno); 3473 ap->id, dev->devno);
3477 qc->err_mask |= AC_ERR_ATA_BUS; 3474 qc->err_mask |= AC_ERR_HSM;
3478 ap->hsm_task_state = HSM_ST_ERR; 3475 ap->hsm_task_state = HSM_ST_ERR;
3479} 3476}
3480 3477
@@ -3532,7 +3529,7 @@ static void ata_pio_block(struct ata_port *ap)
3532 } else { 3529 } else {
3533 /* handle BSY=0, DRQ=0 as error */ 3530 /* handle BSY=0, DRQ=0 as error */
3534 if ((status & ATA_DRQ) == 0) { 3531 if ((status & ATA_DRQ) == 0) {
3535 qc->err_mask |= AC_ERR_ATA_BUS; 3532 qc->err_mask |= AC_ERR_HSM;
3536 ap->hsm_task_state = HSM_ST_ERR; 3533 ap->hsm_task_state = HSM_ST_ERR;
3537 return; 3534 return;
3538 } 3535 }
@@ -3873,10 +3870,10 @@ int ata_qc_issue(struct ata_queued_cmd *qc)
3873 if (ata_should_dma_map(qc)) { 3870 if (ata_should_dma_map(qc)) {
3874 if (qc->flags & ATA_QCFLAG_SG) { 3871 if (qc->flags & ATA_QCFLAG_SG) {
3875 if (ata_sg_setup(qc)) 3872 if (ata_sg_setup(qc))
3876 goto err_out; 3873 goto sg_err;
3877 } else if (qc->flags & ATA_QCFLAG_SINGLE) { 3874 } else if (qc->flags & ATA_QCFLAG_SINGLE) {
3878 if (ata_sg_setup_one(qc)) 3875 if (ata_sg_setup_one(qc))
3879 goto err_out; 3876 goto sg_err;
3880 } 3877 }
3881 } else { 3878 } else {
3882 qc->flags &= ~ATA_QCFLAG_DMAMAP; 3879 qc->flags &= ~ATA_QCFLAG_DMAMAP;
@@ -3889,7 +3886,8 @@ int ata_qc_issue(struct ata_queued_cmd *qc)
3889 3886
3890 return ap->ops->qc_issue(qc); 3887 return ap->ops->qc_issue(qc);
3891 3888
3892err_out: 3889sg_err:
3890 qc->flags &= ~ATA_QCFLAG_DMAMAP;
3893 return -1; 3891 return -1;
3894} 3892}
3895 3893
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index ce3fe928a386..c496309f691a 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1322,8 +1322,10 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
1322 goto early_finish; 1322 goto early_finish;
1323 1323
1324 /* select device, send command to hardware */ 1324 /* select device, send command to hardware */
1325 if (ata_qc_issue(qc)) 1325 if (ata_qc_issue(qc)) {
1326 goto err_did; 1326 qc->err_mask |= AC_ERR_OTHER;
1327 ata_qc_complete(qc);
1328 }
1327 1329
1328 VPRINTK("EXIT\n"); 1330 VPRINTK("EXIT\n");
1329 return; 1331 return;
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index e9bee1210c23..68d17791896f 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1865,7 +1865,7 @@ static void mv_eng_timeout(struct ata_port *ap)
1865 */ 1865 */
1866 spin_lock_irqsave(&ap->host_set->lock, flags); 1866 spin_lock_irqsave(&ap->host_set->lock, flags);
1867 qc->scsidone = scsi_finish_command; 1867 qc->scsidone = scsi_finish_command;
1868 qc->err_mask |= AC_ERR_OTHER; 1868 qc->err_mask |= AC_ERR_TIMEOUT;
1869 ata_qc_complete(qc); 1869 ata_qc_complete(qc);
1870 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1870 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1871 } 1871 }
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 923130185a9e..fb59012b9fbe 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -653,7 +653,7 @@ static void sil24_eng_timeout(struct ata_port *ap)
653 */ 653 */
654 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 654 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
655 qc->scsidone = scsi_finish_command; 655 qc->scsidone = scsi_finish_command;
656 qc->err_mask |= AC_ERR_OTHER; 656 qc->err_mask |= AC_ERR_TIMEOUT;
657 ata_qc_complete(qc); 657 ata_qc_complete(qc);
658 658
659 sil24_reset_controller(ap); 659 sil24_reset_controller(ap);
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d34963c18656..510aee82113a 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -227,10 +227,15 @@ enum hsm_task_states {
227}; 227};
228 228
229enum ata_completion_errors { 229enum ata_completion_errors {
230 AC_ERR_OTHER = (1 << 0), 230 AC_ERR_DEV = (1 << 0), /* device reported error */
231 AC_ERR_DEV = (1 << 1), 231 AC_ERR_HSM = (1 << 1), /* host state machine violation */
232 AC_ERR_ATA_BUS = (1 << 2), 232 AC_ERR_TIMEOUT = (1 << 2), /* timeout */
233 AC_ERR_HOST_BUS = (1 << 3), 233 AC_ERR_MEDIA = (1 << 3), /* media error */
234 AC_ERR_ATA_BUS = (1 << 4), /* ATA bus error */
235 AC_ERR_HOST_BUS = (1 << 5), /* host bus error */
236 AC_ERR_SYSTEM = (1 << 6), /* system error */
237 AC_ERR_INVALID = (1 << 7), /* invalid argument */
238 AC_ERR_OTHER = (1 << 8), /* unknown */
234}; 239};
235 240
236/* forward declarations */ 241/* forward declarations */
@@ -836,7 +841,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
836static inline unsigned int ac_err_mask(u8 status) 841static inline unsigned int ac_err_mask(u8 status)
837{ 842{
838 if (status & ATA_BUSY) 843 if (status & ATA_BUSY)
839 return AC_ERR_ATA_BUS; 844 return AC_ERR_HSM;
840 if (status & (ATA_ERR | ATA_DF)) 845 if (status & (ATA_ERR | ATA_DF))
841 return AC_ERR_DEV; 846 return AC_ERR_DEV;
842 return 0; 847 return 0;