Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104994
b: refs/heads/master
c: cab7f8e
h: refs/heads/master
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Jul 23, 2008
1 parent 0398f43 commit 9c066a4
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 76 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab86f91e8739e0b1587a16e4792ab5e4bb11f1b5
refs/heads/master: cab7f8eda40d3e3e16b137c67cdddc2cf893c5d7
42 changes: 21 additions & 21 deletions trunk/drivers/ide/ide-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,10 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
dma_stat &= ~(1 << (5 + unit));

if (hwif->host_flags & IDE_HFLAG_MMIO)
writeb(dma_stat, (void __iomem *)hwif->dma_status);
writeb(dma_stat,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat, hwif->dma_status);
outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
}

EXPORT_SYMBOL_GPL(ide_dma_host_set);
Expand Down Expand Up @@ -475,18 +476,19 @@ int ide_dma_setup(ide_drive_t *drive)

/* specify r/w */
if (mmio)
writeb(reading, (void __iomem *)hwif->dma_command);
writeb(reading, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
else
outb(reading, hwif->dma_command);
outb(reading, hwif->dma_base + ATA_DMA_CMD);

/* read DMA status for INTR & ERROR flags */
dma_stat = hwif->read_sff_dma_status(hwif);

/* clear INTR & ERROR flags */
if (mmio)
writeb(dma_stat | 6, (void __iomem *)hwif->dma_status);
writeb(dma_stat | 6,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat | 6, hwif->dma_status);
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);

drive->waiting_for_dma = 1;
return 0;
Expand All @@ -512,12 +514,13 @@ void ide_dma_start(ide_drive_t *drive)
* we do this part before issuing the drive cmd.
*/
if (hwif->host_flags & IDE_HFLAG_MMIO) {
dma_cmd = readb((void __iomem *)hwif->dma_command);
dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
/* start DMA */
writeb(dma_cmd | 1, (void __iomem *)hwif->dma_command);
writeb(dma_cmd | 1,
(void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
} else {
dma_cmd = inb(hwif->dma_command);
outb(dma_cmd | 1, hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd | 1, hwif->dma_base + ATA_DMA_CMD);
}

hwif->dma = 1;
Expand All @@ -537,22 +540,24 @@ int __ide_dma_end (ide_drive_t *drive)

if (mmio) {
/* get DMA command mode */
dma_cmd = readb((void __iomem *)hwif->dma_command);
dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
/* stop DMA */
writeb(dma_cmd & ~1, (void __iomem *)hwif->dma_command);
writeb(dma_cmd & ~1,
(void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
} else {
dma_cmd = inb(hwif->dma_command);
outb(dma_cmd & ~1, hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
}

/* get DMA status */
dma_stat = hwif->read_sff_dma_status(hwif);

if (mmio)
/* clear the INTR & ERROR bits */
writeb(dma_stat | 6, (void __iomem *)hwif->dma_status);
writeb(dma_stat | 6,
(void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
outb(dma_stat | 6, hwif->dma_status);
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);

/* purge DMA mappings */
ide_destroy_dmatable(drive);
Expand Down Expand Up @@ -888,11 +893,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
{
hwif->dma_base = base;

if (!hwif->dma_command)
hwif->dma_command = hwif->dma_base + 0;
if (!hwif->dma_status)
hwif->dma_status = hwif->dma_base + 2;

hwif->dma_ops = &sff_dma_ops;
}

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ void SELECT_MASK(ide_drive_t *drive, int mask)
static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
{
if (hwif->host_flags & IDE_HFLAG_MMIO)
return readb((void __iomem *)hwif->dma_status);
return readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
else
return inb(hwif->dma_status);
return inb(hwif->dma_base + ATA_DMA_STATUS);
}

static void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
Expand Down
12 changes: 6 additions & 6 deletions trunk/drivers/ide/pci/cmd64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ static int cmd648_dma_test_irq(ide_drive_t *drive)
unsigned long base = hwif->dma_base - (hwif->channel * 8);
u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
MRDMODE_INTR_CH0;
u8 dma_stat = inb(hwif->dma_status);
u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 mrdmode = inb(base + 1);

#ifdef DEBUG
Expand All @@ -286,7 +286,7 @@ static int cmd64x_dma_test_irq(ide_drive_t *drive)
int irq_reg = hwif->channel ? ARTTIM23 : CFR;
u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
CFR_INTR_CH0;
u8 dma_stat = inb(hwif->dma_status);
u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 irq_stat = 0;

(void) pci_read_config_byte(dev, irq_reg, &irq_stat);
Expand Down Expand Up @@ -317,13 +317,13 @@ static int cmd646_1_dma_end(ide_drive_t *drive)

drive->waiting_for_dma = 0;
/* get DMA status */
dma_stat = inb(hwif->dma_status);
dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* read DMA command state */
dma_cmd = inb(hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */
outb(dma_cmd & ~1, hwif->dma_command);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
/* clear the INTR & ERROR bits */
outb(dma_stat | 6, hwif->dma_status);
outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
/* and free any DMA resources */
ide_destroy_dmatable(drive);
/* verify good DMA status */
Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/ide/pci/hpt366.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ static void hpt370_irq_timeout(ide_drive_t *drive)
printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff);

/* get DMA command mode */
dma_cmd = inb(hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */
outb(dma_cmd & ~0x1, hwif->dma_command);
outb(dma_cmd & ~0x1, hwif->dma_base + ATA_DMA_CMD);
hpt370_clear_engine(drive);
}

Expand All @@ -818,12 +818,12 @@ static void hpt370_dma_start(ide_drive_t *drive)
static int hpt370_dma_end(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
u8 dma_stat = inb(hwif->dma_status);
u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);

if (dma_stat & 0x01) {
/* wait a little */
udelay(20);
dma_stat = inb(hwif->dma_status);
dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
if (dma_stat & 0x01)
hpt370_irq_timeout(drive);
}
Expand All @@ -850,7 +850,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive)
return 0;
}

dma_stat = inb(hwif->dma_status);
dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* return 1 if INTR asserted */
if (dma_stat & 4)
return 1;
Expand Down
14 changes: 7 additions & 7 deletions trunk/drivers/ide/pci/ns87415.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static u8 superio_ide_inb (unsigned long port)

static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
{
return superio_ide_inb(hwif->dma_status);
return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
}

static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
Expand Down Expand Up @@ -208,13 +208,13 @@ static int ns87415_dma_end(ide_drive_t *drive)

drive->waiting_for_dma = 0;
dma_stat = hwif->read_sff_dma_status(hwif);
/* get dma command mode */
dma_cmd = inb(hwif->dma_command);
/* get DMA command mode */
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
/* stop DMA */
outb(dma_cmd & ~1, hwif->dma_command);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
/* from ERRATA: clear the INTR & ERROR bits */
dma_cmd = inb(hwif->dma_command);
outb(dma_cmd | 6, hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD);
/* and free any DMA resources */
ide_destroy_dmatable(drive);
/* verify good DMA status */
Expand Down Expand Up @@ -298,7 +298,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
if (!hwif->dma_base)
return;

outb(0x60, hwif->dma_status);
outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
}

static const struct ide_port_ops ns87415_port_ops = {
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/ide/pci/pdc202xx_old.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ static int pdc202xx_dma_test_irq(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
unsigned long high_16 = hwif->extra_base - 16;
u8 dma_stat = inb(hwif->dma_status);
u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
u8 sc1d = inb(high_16 + 0x001d);

if (hwif->channel) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/pci/piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
u8 dma_stat;

/* clear the INTR & ERROR bits */
dma_stat = inb(hwif->dma_status);
dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
/* Should we force the bit as well ? */
outb(dma_stat, hwif->dma_status);
outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
}

struct ich_laptop {
Expand Down
38 changes: 18 additions & 20 deletions trunk/drivers/ide/pci/scc_pata.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static u8 scc_ide_inb(unsigned long port)

static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
{
return (u8)in_be32((void *)hwif->dma_status);
return (u8)in_be32((void *)(hwif->dma_base + 4));
}

static void scc_ide_insw(unsigned long port, void *addr, u32 count)
Expand Down Expand Up @@ -266,14 +266,14 @@ static void scc_dma_host_set(ide_drive_t *drive, int on)
{
ide_hwif_t *hwif = drive->hwif;
u8 unit = (drive->select.b.unit & 0x01);
u8 dma_stat = scc_ide_inb(hwif->dma_status);
u8 dma_stat = scc_ide_inb(hwif->dma_base + 4);

if (on)
dma_stat |= (1 << (5 + unit));
else
dma_stat &= ~(1 << (5 + unit));

scc_ide_outb(dma_stat, hwif->dma_status);
scc_ide_outb(dma_stat, hwif->dma_base + 4);
}

/**
Expand Down Expand Up @@ -309,24 +309,24 @@ static int scc_dma_setup(ide_drive_t *drive)
out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);

/* specify r/w */
out_be32((void __iomem *)hwif->dma_command, reading);
out_be32((void __iomem *)hwif->dma_base, reading);

/* read dma_status for INTR & ERROR flags */
dma_stat = in_be32((void __iomem *)hwif->dma_status);
/* read DMA status for INTR & ERROR flags */
dma_stat = in_be32((void __iomem *)(hwif->dma_base + 4));

/* clear INTR & ERROR flags */
out_be32((void __iomem *)hwif->dma_status, dma_stat|6);
out_be32((void __iomem *)(hwif->dma_base + 4), dma_stat | 6);
drive->waiting_for_dma = 1;
return 0;
}

static void scc_dma_start(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 dma_cmd = scc_ide_inb(hwif->dma_command);
u8 dma_cmd = scc_ide_inb(hwif->dma_base);

/* start DMA */
scc_ide_outb(dma_cmd | 1, hwif->dma_command);
scc_ide_outb(dma_cmd | 1, hwif->dma_base);
hwif->dma = 1;
wmb();
}
Expand All @@ -338,13 +338,13 @@ static int __scc_dma_end(ide_drive_t *drive)

drive->waiting_for_dma = 0;
/* get DMA command mode */
dma_cmd = scc_ide_inb(hwif->dma_command);
dma_cmd = scc_ide_inb(hwif->dma_base);
/* stop DMA */
scc_ide_outb(dma_cmd & ~1, hwif->dma_command);
scc_ide_outb(dma_cmd & ~1, hwif->dma_base);
/* get DMA status */
dma_stat = scc_ide_inb(hwif->dma_status);
dma_stat = scc_ide_inb(hwif->dma_base + 4);
/* clear the INTR & ERROR bits */
scc_ide_outb(dma_stat | 6, hwif->dma_status);
scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
/* purge DMA mappings */
ide_destroy_dmatable(drive);
/* verify good DMA status */
Expand All @@ -364,6 +364,7 @@ static int __scc_dma_end(ide_drive_t *drive)
static int scc_dma_end(ide_drive_t *drive)
{
ide_hwif_t *hwif = HWIF(drive);
void __iomem *dma_base = (void __iomem *)hwif->dma_base;
unsigned long intsts_port = hwif->dma_base + 0x014;
u32 reg;
int dma_stat, data_loss = 0;
Expand Down Expand Up @@ -402,7 +403,7 @@ static int scc_dma_end(ide_drive_t *drive)
printk(KERN_WARNING "%s: SERROR\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_SERROR|INTSTS_BMSINT);

out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}

Expand All @@ -417,20 +418,20 @@ static int scc_dma_end(ide_drive_t *drive)

out_be32((void __iomem *)intsts_port, INTSTS_PRERR|INTSTS_BMSINT);

out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}

if (reg & INTSTS_RERR) {
printk(KERN_WARNING "%s: Response Error\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_RERR|INTSTS_BMSINT);

out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
continue;
}

if (reg & INTSTS_ICERR) {
out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS);
out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);

printk(KERN_WARNING "%s: Illegal Configuration\n", SCC_PATA_NAME);
out_be32((void __iomem *)intsts_port, INTSTS_ICERR|INTSTS_BMSINT);
Expand Down Expand Up @@ -832,9 +833,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)

ports->hwif = hwif;

hwif->dma_command = hwif->dma_base;
hwif->dma_status = hwif->dma_base + 0x04;

/* PTERADD */
out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma);

Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/pci/siimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static int siimage_io_dma_test_irq(ide_drive_t *drive)
unsigned long addr = siimage_selreg(hwif, 1);

/* return 1 if INTR asserted */
if (hwif->INB(hwif->dma_status) & 4)
if (inb(hwif->dma_base + ATA_DMA_STATUS) & 4)
return 1;

/* return 1 if Device INTR asserted */
Expand Down Expand Up @@ -382,7 +382,7 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive)
}

/* return 1 if INTR asserted */
if (readb((void __iomem *)hwif->dma_status) & 0x04)
if (readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)) & 4)
return 1;

/* return 1 if Device INTR asserted */
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/ide/pci/sl82c105.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive)
* Was DMA enabled? If so, disable it - we're resetting the
* host. The IDE layer will be handling the drive for us.
*/
dma_cmd = inb(hwif->dma_command);
dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
if (dma_cmd & 1) {
outb(dma_cmd & ~1, hwif->dma_command);
outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
printk("sl82c105: DMA was enabled\n");
}

Expand Down
Loading

0 comments on commit 9c066a4

Please sign in to comment.