* [PATCH] ata_check_bmdma
@ 2004-06-03 1:06 Pat LaVarre
2004-06-03 1:09 ` Jeff Garzik
0 siblings, 1 reply; 3+ messages in thread
From: Pat LaVarre @ 2004-06-03 1:06 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide
Forwarded per your request. Patch inline only, not also attached.
-----Forwarded Message-----
From: Pat LaVarre <p.lavarre@ieee.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH] atapi request sense work
Date: 27 May 2004 18:13:25 -0600
Jeff G:
> As a first step, ...
> create a patch versus mainline, that does
> nothing but add this function (and uses it)?
Here you go.
"Here I chose { inline } over { static inline } because lately I saw you
counting libata.ko bytes."
"Here I chose u8 over int because lxr.linux.no/source/ suggests Linux
readb and inb return u8."
This patch names the repeated five lines without changing where they are
called. I have included it inline but not also attached. I confirmed
the lines repeat via diff -b. I compiled, linked, cleared unit
attentions by unsolicited sense, read, and wrote.
...
Pat LaVarre
diff -Nurp linux-2.6.7-rc1-bk4/include/linux/ata.h linux-2.6.7-rc1-bk4-pel/include/linux/ata.h
diff -Nurp linux-2.6.7-rc1-bk4/include/linux/libata.h linux-2.6.7-rc1-bk4-pel/include/linux/libata.h
diff -Nurp linux-2.6.7-rc1-bk4/drivers/scsi/libata-core.c linux-2.6.7-rc1-bk4-pel/drivers/scsi/libata-core.c
--- linux-2.6.7-rc1-bk4/drivers/scsi/libata-core.c 2004-05-27 16:40:42.000000000 -0600
+++ linux-2.6.7-rc1-bk4-pel/drivers/scsi/libata-core.c 2004-05-27 17:56:57.192826736 -0600
@@ -2146,6 +2146,22 @@ static void ata_pio_task(void *_data)
}
/**
+ * ata_check_bmdma - read PCI IDE BMDMA status
+ * @ap: struct ata_port
+ */
+
+static u8 ata_check_bmdma(struct ata_port *ap)
+{
+ u8 host_stat;
+ if (ap->flags & ATA_FLAG_MMIO) {
+ void *mmio = (void *) ap->ioaddr.bmdma_addr;
+ host_stat = readb(mmio + ATA_DMA_STATUS);
+ } else
+ host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+ return host_stat;
+}
+
+/**
* ata_eng_timeout - Handle timeout of queued command
* @ap: Port on which timed-out command is active
*
@@ -2188,11 +2204,7 @@ void ata_eng_timeout(struct ata_port *ap
switch (qc->tf.protocol) {
case ATA_PROT_DMA:
- if (ap->flags & ATA_FLAG_MMIO) {
- void *mmio = (void *) ap->ioaddr.bmdma_addr;
- host_stat = readb(mmio + ATA_DMA_STATUS);
- } else
- host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+ host_stat = ata_check_bmdma(ap);
printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n",
ap->id, host_stat);
@@ -2622,11 +2634,7 @@ inline unsigned int ata_host_intr (struc
/* BMDMA completion */
case ATA_PROT_DMA:
case ATA_PROT_ATAPI_DMA:
- if (ap->flags & ATA_FLAG_MMIO) {
- void *mmio = (void *) ap->ioaddr.bmdma_addr;
- host_stat = readb(mmio + ATA_DMA_STATUS);
- } else
- host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+ host_stat = ata_check_bmdma(ap);
VPRINTK("BUS_DMA (host_stat 0x%X)\n", host_stat);
if (!(host_stat & ATA_DMA_INTR)) {
diff -Nurp linux-2.6.7-rc1-bk4/drivers/scsi/libata-scsi.c linux-2.6.7-rc1-bk4-pel/drivers/scsi/libata-scsi.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ata_check_bmdma
2004-06-03 1:06 [PATCH] ata_check_bmdma Pat LaVarre
@ 2004-06-03 1:09 ` Jeff Garzik
2004-06-03 13:41 ` Pat LaVarre
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Garzik @ 2004-06-03 1:09 UTC (permalink / raw)
To: Pat LaVarre; +Cc: linux-ide
thanks, applied to 2.4 and 2.6
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ata_check_bmdma
2004-06-03 1:09 ` Jeff Garzik
@ 2004-06-03 13:41 ` Pat LaVarre
0 siblings, 0 replies; 3+ messages in thread
From: Pat LaVarre @ 2004-06-03 13:41 UTC (permalink / raw)
To: Jeff Garzik; +Cc: linux-ide
Jeff G:
> applied to 2.4 and 2.6
Thank you.
> ...
What comes next?
Shall we add support for SATAPI Data Not, for example op x00 "TEST UNIT
READY", to the support we have already for SATAPI Data In and SATAPI
Data Out?
As you may recall, when I try Data Not here, I get "kernel: Disabling
IRQ" with the source as is. After applying the ata_check_bmdma patch,
then a patch like the following three lines seem to help. Without
understanding, I think I'm seeing:
1) We have to ack an ATA_DMA_INTR even when we have copied no data.
2) We VPRINTK the host_stat although we DPRINTK the drv_stat.
Pat LaVarre
P.S. Would you prefer a patch that acked ATA_DMA_INTR without clearing
ATA_DMA_ERR and ATA_DMA_START?
diff -urp o/include/linux/ata.h linux-2.6.7-rc2-pel/include/linux/ata.h
diff -urp o/include/linux/libata.h linux-2.6.7-rc2-pel/include/linux/libata.h
diff -urp o/drivers/scsi/libata-core.c linux-2.6.7-rc2-pel/drivers/scsi/libata-core.c
--- o/drivers/scsi/libata-core.c 2004-06-03 07:18:39.000000000 -0600
+++ linux-2.6.7-rc2-pel/drivers/scsi/libata-core.c 2004-06-03 07:20:22.694466800 -0600
@@ -2656,9 +2656,11 @@ inline unsigned int ata_host_intr (struc
*/
case ATA_PROT_ATAPI:
case ATA_PROT_NODATA:
+ host_stat = ata_check_bmdma(ap);
+ VPRINTK("BUS_NODATA (host_stat 0x%X)\n", host_stat);
status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
- ata_qc_complete(qc, status);
+ ata_dma_complete(qc, host_stat);
handled = 1;
break;
diff -urp o/drivers/scsi/libata-scsi.c linux-2.6.7-rc2-pel/drivers/scsi/libata-scsi.c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-06-03 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-03 1:06 [PATCH] ata_check_bmdma Pat LaVarre
2004-06-03 1:09 ` Jeff Garzik
2004-06-03 13:41 ` Pat LaVarre
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.