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 workarounds the problem by ignoring the ERR bit and proceed REQUEST
SENSE.
Signed-off-by: Albert Lee <[EMAIL PROTECTED]>
Cc: Alan Cox <[EMAIL PROTECTED]>
Cc: Mark Lord <[EMAIL PROTECTED]>
---
Tested ok with the Seagate STT8000A tape drive. A similar workaround is seen in
ide-tape.c:
if (status.b.check && pc->c[0] == IDETAPE_REQUEST_SENSE_CMD)
status.b.check = 0;
Although ide-tape only does it when DRQ=0...
--- linux-2.6.23.1/drivers/ata/libata-core.c.orig 2007-10-13
00:43:44.000000000 +0800
+++ linux-2.6.23.1/drivers/ata/libata-core.c 2007-11-13 17:11:03.000000000
+0800
@@ -4930,11 +4930,18 @@ 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 (i.e. request sense). We
+ * ignore ERR here to workaround and proceed
REQUEST_SENSE.
+ */
+ if (qc->tf.protocol == ATA_PROT_PIO ||
+ qc->cdb[0] != REQUEST_SENSE) {
+ 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).
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html