From: Albert Lee <albertcc@tw.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Mark Lord <liml@rtr.ca>, Tejun Heo <htejun@gmail.com>,
linux-ide@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] libata: workaround DRQ=1 ERR=1 for ATAPI tape drives
Date: Tue, 13 Nov 2007 18:30:24 +0800 [thread overview]
Message-ID: <47397CC0.1070401@tw.ibm.com> (raw)
In-Reply-To: <47397784.9070205@tw.ibm.com>
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 <albertcc@tw.ibm.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Mark Lord <liml@rtr.ca>
---
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).
next prev parent reply other threads:[~2007-11-13 10:30 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 9:24 ATA tape drive STT3401A needs DRQ HSM workaround too Tejun Heo
2007-10-22 9:31 ` Alan Cox
2007-10-22 9:30 ` Tejun Heo
2007-10-22 14:18 ` Mark Lord
2007-10-22 18:37 ` Jeff Garzik
2007-10-22 22:36 ` Mark Lord
2007-11-13 10:08 ` Albert Lee
2007-11-13 10:30 ` Albert Lee [this message]
2007-11-13 10:35 ` [PATCH] libata: workaround DRQ=1 ERR=1 for ATAPI tape drives Tejun Heo
2007-11-13 13:49 ` Mark Lord
2007-11-13 14:16 ` Mark Lord
2007-11-13 15:14 ` Alan Cox
2007-11-13 17:24 ` Mark Lord
2007-11-13 18:12 ` Alan Cox
2007-11-13 18:22 ` Mark Lord
2007-11-14 2:00 ` Tejun Heo
2007-11-14 6:13 ` [PATCH 1/2] " Albert Lee
2007-11-14 12:19 ` Alan Cox
2007-11-15 0:32 ` Tejun Heo
2007-11-14 6:20 ` [PATCH 2/2] libata: use ATA_HORKAGE_STUCK_ERR " Albert Lee
2007-11-15 0:33 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47397CC0.1070401@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertl@mail.com \
--cc=htejun@gmail.com \
--cc=jeff@garzik.org \
--cc=liml@rtr.ca \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).