ata_check_bmdma
PATCH 1/1 ata_check_bmdma
Forwarded per your request. Patch inline only, not also attached.
-----Forwarded Message-----
From: Pat LaVarre <[email protected]>
To: Jeff Garzik <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] atapi request sense work
Date: 27 May 2004 18:13:25 -0600
Jeff G:
Quoted 3 lines
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
drivers/scsi/libata-core.c +18 -10
@@ -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 *apswitch (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
Jeff Garzik
Appliedthanks, applied to 2.4 and 2.6
Jeff G:
Quoted 1 line
applied to 2.4 and 2.6
Thank you.
Quoted 1 line
...
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
drivers/scsi/libata-core.c +3 -1
@@ -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