Commit e62a34fb authored by Pat LaVarre's avatar Pat LaVarre Committed by Jeff Garzik

[PATCH] ata_check_bmdma

Move hand-coded BMDMA status check into separate function.
parent 7896c90e
...@@ -2145,6 +2145,22 @@ static void ata_pio_task(void *_data) ...@@ -2145,6 +2145,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 * ata_eng_timeout - Handle timeout of queued command
* @ap: Port on which timed-out command is active * @ap: Port on which timed-out command is active
...@@ -2188,11 +2204,7 @@ void ata_eng_timeout(struct ata_port *ap) ...@@ -2188,11 +2204,7 @@ void ata_eng_timeout(struct ata_port *ap)
switch (qc->tf.protocol) { switch (qc->tf.protocol) {
case ATA_PROT_DMA: case ATA_PROT_DMA:
if (ap->flags & ATA_FLAG_MMIO) { host_stat = ata_check_bmdma(ap);
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);
printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n", printk(KERN_ERR "ata%u: DMA timeout, stat 0x%x\n",
ap->id, host_stat); ap->id, host_stat);
...@@ -2622,11 +2634,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap, ...@@ -2622,11 +2634,7 @@ inline unsigned int ata_host_intr (struct ata_port *ap,
/* BMDMA completion */ /* BMDMA completion */
case ATA_PROT_DMA: case ATA_PROT_DMA:
case ATA_PROT_ATAPI_DMA: case ATA_PROT_ATAPI_DMA:
if (ap->flags & ATA_FLAG_MMIO) { host_stat = ata_check_bmdma(ap);
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);
VPRINTK("BUS_DMA (host_stat 0x%X)\n", host_stat); VPRINTK("BUS_DMA (host_stat 0x%X)\n", host_stat);
if (!(host_stat & ATA_DMA_INTR)) { if (!(host_stat & ATA_DMA_INTR)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment