aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-01-22 23:09:36 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-01-26 22:36:27 -0500
commit11a56d2439259892319df81cf1582687d7e7fde5 (patch)
tree976f5ecb7ff61c19620ca482c0550b0b009bfa6a
parent284b6481cc7112ca6a9e60b7a9b650fba3bf0492 (diff)
[PATCH] libata: add detailed AC_ERR_* flags
Add detailed AC_ERR_* flags and use them. Long-term goal is to describe all errors with err_mask and tf combination (tf for failed sector information, etc...). After proper error diagnosis is implemented, sense data should also be generated from err_mask instead of directly from hardware tf registers as it is currently. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r--drivers/scsi/ahci.c2
-rw-r--r--drivers/scsi/libata-core.c12
-rw-r--r--drivers/scsi/sata_mv.c2
-rw-r--r--drivers/scsi/sata_sil24.c2
-rw-r--r--include/linux/libata.h15
5 files changed, 19 insertions, 14 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index a168b525d079..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
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 43a23286d6fe..f5519f01491c 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1142,7 +1142,7 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev,
1142 * spurious interrupt. We can live with that. 1142 * spurious interrupt. We can live with that.
1143 */ 1143 */
1144 if (qc->flags & ATA_QCFLAG_ACTIVE) { 1144 if (qc->flags & ATA_QCFLAG_ACTIVE) {
1145 qc->err_mask = AC_ERR_OTHER; 1145 qc->err_mask = AC_ERR_TIMEOUT;
1146 ata_qc_complete(qc); 1146 ata_qc_complete(qc);
1147 printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n", 1147 printk(KERN_WARNING "ata%u: qc timeout (cmd 0x%x)\n",
1148 ap->id, command); 1148 ap->id, command);
@@ -2917,7 +2917,7 @@ static unsigned long ata_pio_poll(struct ata_port *ap)
2917 status = ata_chk_status(ap); 2917 status = ata_chk_status(ap);
2918 if (status & ATA_BUSY) { 2918 if (status & ATA_BUSY) {
2919 if (time_after(jiffies, ap->pio_task_timeout)) { 2919 if (time_after(jiffies, ap->pio_task_timeout)) {
2920 qc->err_mask |= AC_ERR_ATA_BUS; 2920 qc->err_mask |= AC_ERR_TIMEOUT;
2921 ap->hsm_task_state = HSM_ST_TMOUT; 2921 ap->hsm_task_state = HSM_ST_TMOUT;
2922 return 0; 2922 return 0;
2923 } 2923 }
@@ -3295,7 +3295,7 @@ static void atapi_pio_bytes(struct ata_queued_cmd *qc)
3295err_out: 3295err_out:
3296 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n", 3296 printk(KERN_INFO "ata%u: dev %u: ATAPI check failed\n",
3297 ap->id, dev->devno); 3297 ap->id, dev->devno);
3298 qc->err_mask |= AC_ERR_ATA_BUS; 3298 qc->err_mask |= AC_ERR_HSM;
3299 ap->hsm_task_state = HSM_ST_ERR; 3299 ap->hsm_task_state = HSM_ST_ERR;
3300} 3300}
3301 3301
@@ -3353,7 +3353,7 @@ static void ata_pio_block(struct ata_port *ap)
3353 } else { 3353 } else {
3354 /* handle BSY=0, DRQ=0 as error */ 3354 /* handle BSY=0, DRQ=0 as error */
3355 if ((status & ATA_DRQ) == 0) { 3355 if ((status & ATA_DRQ) == 0) {
3356 qc->err_mask |= AC_ERR_ATA_BUS; 3356 qc->err_mask |= AC_ERR_HSM;
3357 ap->hsm_task_state = HSM_ST_ERR; 3357 ap->hsm_task_state = HSM_ST_ERR;
3358 return; 3358 return;
3359 } 3359 }
@@ -4159,14 +4159,14 @@ static void atapi_packet_task(void *_data)
4159 /* sleep-wait for BSY to clear */ 4159 /* sleep-wait for BSY to clear */
4160 DPRINTK("busy wait\n"); 4160 DPRINTK("busy wait\n");
4161 if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) { 4161 if (ata_busy_sleep(ap, ATA_TMOUT_CDB_QUICK, ATA_TMOUT_CDB)) {
4162 qc->err_mask |= AC_ERR_ATA_BUS; 4162 qc->err_mask |= AC_ERR_TIMEOUT;
4163 goto err_out; 4163 goto err_out;
4164 } 4164 }
4165 4165
4166 /* make sure DRQ is set */ 4166 /* make sure DRQ is set */
4167 status = ata_chk_status(ap); 4167 status = ata_chk_status(ap);
4168 if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) { 4168 if ((status & (ATA_BUSY | ATA_DRQ)) != ATA_DRQ) {
4169 qc->err_mask |= AC_ERR_ATA_BUS; 4169 qc->err_mask |= AC_ERR_HSM;
4170 goto err_out; 4170 goto err_out;
4171 } 4171 }
4172 4172
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index cd54244058b5..89bcd85fa58c 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -1866,7 +1866,7 @@ static void mv_eng_timeout(struct ata_port *ap)
1866 */ 1866 */
1867 spin_lock_irqsave(&ap->host_set->lock, flags); 1867 spin_lock_irqsave(&ap->host_set->lock, flags);
1868 qc->scsidone = scsi_finish_command; 1868 qc->scsidone = scsi_finish_command;
1869 qc->err_mask |= AC_ERR_OTHER; 1869 qc->err_mask |= AC_ERR_TIMEOUT;
1870 ata_qc_complete(qc); 1870 ata_qc_complete(qc);
1871 spin_unlock_irqrestore(&ap->host_set->lock, flags); 1871 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1872 } 1872 }
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 d58b659cf3f5..8ff3a7f6f63c 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -222,10 +222,15 @@ enum hsm_task_states {
222}; 222};
223 223
224enum ata_completion_errors { 224enum ata_completion_errors {
225 AC_ERR_OTHER = (1 << 0), 225 AC_ERR_DEV = (1 << 0), /* device reported error */
226 AC_ERR_DEV = (1 << 1), 226 AC_ERR_HSM = (1 << 1), /* host state machine violation */
227 AC_ERR_ATA_BUS = (1 << 2), 227 AC_ERR_TIMEOUT = (1 << 2), /* timeout */
228 AC_ERR_HOST_BUS = (1 << 3), 228 AC_ERR_MEDIA = (1 << 3), /* media error */
229 AC_ERR_ATA_BUS = (1 << 4), /* ATA bus error */
230 AC_ERR_HOST_BUS = (1 << 5), /* host bus error */
231 AC_ERR_SYSTEM = (1 << 6), /* system error */
232 AC_ERR_INVALID = (1 << 7), /* invalid argument */
233 AC_ERR_OTHER = (1 << 8), /* unknown */
229}; 234};
230 235
231/* forward declarations */ 236/* forward declarations */
@@ -833,7 +838,7 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
833static inline unsigned int ac_err_mask(u8 status) 838static inline unsigned int ac_err_mask(u8 status)
834{ 839{
835 if (status & ATA_BUSY) 840 if (status & ATA_BUSY)
836 return AC_ERR_ATA_BUS; 841 return AC_ERR_HSM;
837 if (status & (ATA_ERR | ATA_DF)) 842 if (status & (ATA_ERR | ATA_DF))
838 return AC_ERR_DEV; 843 return AC_ERR_DEV;
839 return 0; 844 return 0;