From: Albert Lee <albertcc@tw.ibm.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Jeff Garzik <jgarzik@pobox.com>, Doug Maxey <dwm@maxeymade.com>,
Linux IDE <linux-ide@vger.kernel.org>
Subject: Re: [PATCH 1/1] libata: Handle ATAPI interrupt before CDB is sent
Date: Wed, 08 Jun 2005 20:17:37 +0800 [thread overview]
Message-ID: <42A6E1E1.4090202@tw.ibm.com> (raw)
In-Reply-To: <58cb370e05060803014046ef0b@mail.gmail.com>
Hi Bart:
>
>
>>@@ -3457,6 +3461,32 @@
>> {
>> u8 status, host_stat;
>>
>>+ /* ATAPI: Handle the interrupt before CDB is sent */
>>+ if (is_atapi_taskfile(&qc->tf) &&
>>+ ap->pio_task_state != PIO_ST_CDB_SENT) {
>>+ /* check whether it's our irq */
>>+ host_stat = ap->ops->bmdma_status(ap);
>>+
>>+ if (host_stat & ATA_DMA_INTR) {
>>+ /* Some pre-ATAPI-4 devices assert INTRQ here
>>+ * if nIEN is zero. qc->dev->id[0] bits 5-6 can
>>+ * be used to identify such devices.
>>+ */
>>+ DPRINTK("ata%u: atapi interrupt handled\n", ap->id);
>
>
> This looks wrong for ATA_PROT_ATAPI_[NODATA],
> we can't expect host to support DMA.
>
>
Yes, it looks strange.
If the IRQ is shared, the interrupt bit in the BM-DMA status register
seems to be our only hope to distinguish our interrupt from others.
Is there any other better method to make sure it is our interrupt?
Or, maybe no need to make sure it is our interrupt?
We can just assume it is our interrupt and read status register
to clear INTRQ (if asserted) blindly here. It should not hurt anyway.
>
>
> case ATA_PROT_DMA:
> case ATA_PROT_ATAPI_DMA:
> case ATA_PROT_ATAPI:
> /* check status of DMA engine */
> host_stat = ap->ops->bmdma_status(ap);
> VPRINTK("ata%u: host_stat 0x%X\n", ap->id, host_stat);
>
> /* if it's not our irq... */
> if (!(host_stat & ATA_DMA_INTR))
> goto idle_irq;
>
> /* before we do anything else, clear DMA-Start bit */
> ap->ops->bmdma_stop(ap);
>
> /* fall through */
>
> ditto (vanilla libata-core.c)
ATA_PROT_ATAPI is done via PIO polling. So, maybe we can safely change the
'case ATA_PROT_ATAPI' here to return error?
BTW, I'm not sure whether the interrupt bit in the BM-DMA status register
is correct if BM-DMA is not started, so I added a debug patch and
did experiment on my pdc2027x adapter.
It seems the interrupt bit of BM-DMA status register is correct
even the BM-DMA is not started on the pdc2027x. Please see the attached log.
(I am not sure whether other adapters have the same behavior.)
Just for your reference.
Albert
======================
Jun 8 14:14:14 p4ht-s kernel: NODATA: ata2: host_stat 0x4
Jun 8 14:14:14 p4ht-s kernel: NODATA: alt status 0x50
Jun 8 14:14:15 p4ht-s kernel: NODATA: ata2: host_stat 0x4
Jun 8 14:14:15 p4ht-s kernel: NODATA: alt status 0x50
Jun 8 14:14:15 p4ht-s kernel: NODATA: ata2: host_stat 0x0
Jun 8 14:14:15 p4ht-s kernel: NODATA: alt status 0xD0 (device busy)
Jun 8 14:14:15 p4ht-s kernel: NODATA: ata2: host_stat 0x0
Jun 8 14:14:15 p4ht-s kernel: NODATA: alt status 0xD0 (device busy)
Jun 8 14:14:15 p4ht-s kernel: NODATA: ata2: host_stat 0x0
Jun 8 14:14:15 p4ht-s kernel: NODATA: alt status 0xD0 (device busy)
Jun 8 14:14:15 p4ht-s kernel: NODATA: ata2: host_stat 0x4
Jun 8 14:14:15 p4ht-s kernel: NODATA: alt status 0x50
Jun 8 14:14:16 p4ht-s kernel: NODATA: ata2: host_stat 0x4
Jun 8 14:14:16 p4ht-s kernel: NODATA: alt status 0x50
next prev parent reply other threads:[~2005-06-08 12:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-29 9:27 [PATCH 0/2] libata-2.6: Fix races caused by the interrupt handler Albert Lee
2005-04-29 9:34 ` [PATCH 1/2] libata-2.6: Prevent the interrupt handler from completing a command twice Albert Lee
2005-05-15 22:47 ` Jeff Garzik
2005-04-29 9:39 ` [PATCH 2/2] libata-2.6: Ignore interrupt before the ATAPI CDB is sent to the device Albert Lee
2005-05-15 22:49 ` Jeff Garzik
2005-05-16 10:37 ` Albert Lee
2005-06-08 8:02 ` [PATCH 1/1] libata: Handle ATAPI interrupt before CDB is sent Albert Lee
2005-06-08 10:01 ` Bartlomiej Zolnierkiewicz
2005-06-08 12:17 ` Albert Lee [this message]
2005-06-09 7:13 ` Albert Lee
2005-06-28 3:06 ` [PATCH 2/2] libata-2.6: Ignore interrupt before the ATAPI CDB is sent to the device Jeff Garzik
2005-06-28 10:05 ` Albert Lee
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=42A6E1E1.4090202@tw.ibm.com \
--to=albertcc@tw.ibm.com \
--cc=bzolnier@gmail.com \
--cc=dwm@maxeymade.com \
--cc=jgarzik@pobox.com \
--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).