From e198076542a22ce7773184e3618440b29bf64d83 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Sat, 25 Mar 2006 18:11:12 +0800 Subject: [PATCH] --- yaml --- r: 29407 b: refs/heads/master c: 71601958f73b952281f2b02e16d1f11c99ee0a8b h: refs/heads/master i: 29405: c7f30fd7b6267b1d8def8a6cb491775a29d5c5a0 29403: 629503b02037ef3edc4ba92963c2817d951d91ef 29399: 764b7fb09b5ec7ef5cd9e4a0e3bf120074b95577 29391: 7499ce4dde889ee0fbc619d0673deab29e1ce6ba 29375: 53a0d5885d46fde7511d5319eff94cc62cd633a7 v: v3 --- [refs] | 2 +- trunk/drivers/scsi/libata-core.c | 44 +++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index bf9cb1d4d81f..d245216394f4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 999bb6f4260f9499fdeab3f8fdcd8b9013eca39e +refs/heads/master: 71601958f73b952281f2b02e16d1f11c99ee0a8b diff --git a/trunk/drivers/scsi/libata-core.c b/trunk/drivers/scsi/libata-core.c index d68f5d5b423a..59cb12993f95 100644 --- a/trunk/drivers/scsi/libata-core.c +++ b/trunk/drivers/scsi/libata-core.c @@ -3587,12 +3587,6 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, */ WARN_ON(in_wq != ata_hsm_ok_in_wq(ap, qc)); - /* check error */ - if (unlikely(status & (ATA_ERR | ATA_DF))) { - qc->err_mask |= AC_ERR_DEV; - ap->hsm_task_state = HSM_ST_ERR; - } - fsm_start: DPRINTK("ata%u: protocol %d task_state %d (dev_stat 0x%X)\n", ap->id, qc->tf.protocol, ap->hsm_task_state, status); @@ -3615,6 +3609,17 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, goto fsm_start; } + /* Device should not ask for data transfer (DRQ=1) + * when it finds something wrong. + * Anyway, we respect DRQ here and let HSM go on + * without changing hsm_task_state to HSM_ST_ERR. + */ + if (unlikely(status & (ATA_ERR | ATA_DF))) { + printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n", + ap->id, status); + qc->err_mask |= AC_ERR_DEV; + } + /* Send the CDB (atapi) or the first data block (ata pio out). * During the state transition, interrupt handler shouldn't * be invoked before the data transfer is complete and @@ -3657,6 +3662,17 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, goto fsm_start; } + /* Device should not ask for data transfer (DRQ=1) + * when it finds something wrong. + * Anyway, we respect DRQ here and let HSM go on + * without changing hsm_task_state to HSM_ST_ERR. + */ + if (unlikely(status & (ATA_ERR | ATA_DF))) { + printk(KERN_WARNING "ata%d: DRQ=1 with device error, dev_stat 0x%X\n", + ap->id, status); + qc->err_mask |= AC_ERR_DEV; + } + atapi_pio_bytes(qc); if (unlikely(ap->hsm_task_state == HSM_ST_ERR)) @@ -3672,6 +3688,22 @@ static int ata_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, goto fsm_start; } + /* Some devices may ask for data transfer (DRQ=1) + * alone with ERR=1 for PIO reads. + * We respect DRQ here and let HSM go on without + * changing hsm_task_state to HSM_ST_ERR. + */ + if (unlikely(status & (ATA_ERR | ATA_DF))) { + /* For writes, ERR=1 DRQ=1 doesn't make + * sense since the data block has been + * transferred to the device. + */ + WARN_ON(qc->tf.flags & ATA_TFLAG_WRITE); + + /* data might be corrputed */ + qc->err_mask |= AC_ERR_DEV; + } + ata_pio_sectors(qc); if (ap->hsm_task_state == HSM_ST_LAST &&