From: Albert Lee <albertcc@tw.ibm.com>
To: Mark Lord <liml@rtr.ca>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
Chuck Ebbert <cebbert@redhat.com>,
IDE/ATA development list <linux-ide@vger.kernel.org>,
craig48@swbell.net, Jeff Garzik <jeff@garzik.org>
Subject: Re: ATAPI tape drives broken with libata
Date: Fri, 21 Sep 2007 11:07:19 +0800 [thread overview]
Message-ID: <46F33567.9090103@tw.ibm.com> (raw)
In-Reply-To: <46E9848E.2000704@rtr.ca>
Mark Lord wrote:
>
> I can read and write the tape successfully, and the written data matches
> what is later read back from it.
>
> Here's the hack I used. Not ready for mainline, but perhaps it will
> help Alan or whomever come up with something nice for Jeff.
>
> --- 2.6.23-rc6/drivers/ata/libata-core.c 2007-09-13 09:49:16.000000000
> -0400
> +++ linux/drivers/ata/libata-core.c 2007-09-13 14:15:57.000000000 -0400
> @@ -4932,9 +4932,9 @@
> 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;
> + //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).
>
It's strange that the device reports DRQ + ERR at this point since if
it knows something wrong, asking to transfer the CDB doesn't help...
Is the device configured to MWDMA? If yes, maybe it's ATAPI DMA of
the previous command makes the device state machine confused...
Could you please try if the attached debug patch helps? Thanks.
--
albert
diff -Nrup 00_libata-dev/drivers/ata/libata-core.c 01_atapi_dma/drivers/ata/libata-core.c
--- 00_libata-dev/drivers/ata/libata-core.c 2007-09-21 10:35:54.000000000 +0800
+++ 01_atapi_dma/drivers/ata/libata-core.c 2007-09-21 10:49:20.000000000 +0800
@@ -4193,6 +4193,8 @@ static void ata_fill_sg_dumb(struct ata_
int ata_check_atapi_dma(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
+ struct scsi_cmnd *cmd = qc->scsicmd;
+ u8 *scsicmd = cmd->cmnd;
/* Don't allow DMA if it isn't multiple of 16 bytes. Quite a
* few ATAPI devices choke on such DMA requests.
@@ -4200,6 +4202,21 @@ int ata_check_atapi_dma(struct ata_queue
if (unlikely(qc->nbytes & 15))
return 1;
+ switch (scsicmd[0]) {
+ case READ_10:
+ case WRITE_10:
+ case READ_12:
+ case WRITE_12:
+ case READ_6:
+ case WRITE_6:
+ case 0xad: /* READ_DVD_STRUCTURE */
+ case 0xbe: /* READ_CD */
+ /* ATAPI DMA maybe ok */
+ break;
+ default:
+ return 1;
+ }
+
if (ap->ops->check_atapi_dma)
return ap->ops->check_atapi_dma(qc);
next prev parent reply other threads:[~2007-09-21 3:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-29 22:55 ATAPI tape drives broken with libata Chuck Ebbert
2007-08-29 23:50 ` Alan Cox
2007-08-30 16:11 ` Chuck Ebbert
2007-08-31 14:19 ` Alan Cox
2007-09-13 16:35 ` Mark Lord
2007-09-13 18:22 ` Mark Lord
2007-09-13 18:42 ` Mark Lord
2007-09-13 19:07 ` Mark Lord
2007-09-13 19:09 ` Mark Lord
2007-09-19 20:50 ` Alan Cox
2007-09-22 0:28 ` Mark Lord
2007-09-21 3:07 ` Albert Lee [this message]
2007-08-30 4:00 ` Jeff Garzik
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=46F33567.9090103@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=albertl@mail.com \
--cc=cebbert@redhat.com \
--cc=craig48@swbell.net \
--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).