Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2d3b8eea7f2fbafd5d779cc92f7aedbd1ef575e9
Commit:     2d3b8eea7f2fbafd5d779cc92f7aedbd1ef575e9
Parent:     21bef6dd2b419f28c8096a8e30ad86dcbff44c02
Author:     Albert Lee <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 15 10:35:46 2007 +0900
Committer:  Tejun Heo <[EMAIL PROTECTED]>
CommitDate: Mon Nov 19 12:28:11 2007 +0900

    libata: workaround DRQ=1 ERR=1 for ATAPI tape drives
    
    After an error condition, some ATAPI tape drives set DRQ=1 together
    with ERR=1 when asking the host to transfer the CDB of the next packet
    command (i.e. request sense).  This patch, a revised version of
    Alan/Mark's previous patch, adds ATA_HORKAGE_STUCK_ERR to workaround
    the problem by ignoring the ERR bit and proceed sending the CDB.
    
    Signed-off-by: Albert Lee <[EMAIL PROTECTED]>
    Cc: Alan Cox <[EMAIL PROTECTED]>
    Cc: Mark Lord <[EMAIL PROTECTED]>
    Signed-off-by: Tejun Heo <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |   18 +++++++++++++-----
 include/linux/libata.h    |    1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 1584164..5478b4c 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5415,11 +5415,19 @@ fsm_start:
                 * let the EH abort the command or reset the device.
                 */
                if (unlikely(status & (ATA_ERR | ATA_DF))) {
-                       ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device "
-                                       "error, dev_stat 0x%X\n", status);
-                       qc->err_mask |= AC_ERR_HSM;
-                       ap->hsm_task_state = HSM_ST_ERR;
-                       goto fsm_start;
+                       /* Some ATAPI tape drives forget to clear the ERR bit
+                        * when doing the next command (mostly request sense).
+                        * We ignore ERR here to workaround and proceed sending
+                        * the CDB.
+                        */
+                       if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) {
+                               ata_port_printk(ap, KERN_WARNING,
+                                               "DRQ=1 with device error, "
+                                               "dev_stat 0x%X\n", status);
+                               qc->err_mask |= AC_ERR_HSM;
+                               ap->hsm_task_state = HSM_ST_ERR;
+                               goto fsm_start;
+                       }
                }
 
                /* Send the CDB (atapi) or the first data block (ata pio out).
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3f9a6a1..ef52a07 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -340,6 +340,7 @@ enum {
        ATA_HORKAGE_HPA_SIZE    = (1 << 6),     /* native size off by one */
        ATA_HORKAGE_IPM         = (1 << 7),     /* Link PM problems */
        ATA_HORKAGE_IVB         = (1 << 8),     /* cbl det validity bit bugs */
+       ATA_HORKAGE_STUCK_ERR   = (1 << 9),     /* stuck ERR on next PACKET */
 
         /* DMA mask for user DMA control: User visible values; DO NOT
            renumber */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to