Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126462
b: refs/heads/master
c: 0578963
h: refs/heads/master
v: v3
  • Loading branch information
Sergei Shtylyov authored and Bartlomiej Zolnierkiewicz committed Jan 6, 2009
1 parent 0f577c9 commit 6ffca88
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 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: 592b5315219881c6c0af4785f96456ad2043193a
refs/heads/master: 05789634ef84c78494c61124e69da49441735146
37 changes: 16 additions & 21 deletions trunk/drivers/ide/ide-dma-sff.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ u8 ide_dma_sff_read_status(ide_hwif_t *hwif)
}
EXPORT_SYMBOL_GPL(ide_dma_sff_read_status);

static void ide_dma_sff_write_status(ide_hwif_t *hwif, u8 val)
{
unsigned long addr = hwif->dma_base + ATA_DMA_STATUS;

if (hwif->host_flags & IDE_HFLAG_MMIO)
writeb(val, (void __iomem *)addr);
else
outb(val, addr);
}

/**
* ide_dma_host_set - Enable/disable DMA on a host
* @drive: drive to control
Expand All @@ -80,11 +90,7 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
else
dma_stat &= ~(1 << (5 + unit));

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

Expand Down Expand Up @@ -198,7 +204,7 @@ int ide_dma_setup(ide_drive_t *drive)
}

/* PRD table */
if (hwif->host_flags & IDE_HFLAG_MMIO)
if (mmio)
writel(hwif->dmatable_dma,
(void __iomem *)(hwif->dma_base + ATA_DMA_TABLE_OFS));
else
Expand All @@ -214,12 +220,7 @@ int ide_dma_setup(ide_drive_t *drive)
dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);

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

drive->waiting_for_dma = 1;
return 0;
Expand Down Expand Up @@ -300,13 +301,12 @@ EXPORT_SYMBOL_GPL(ide_dma_start);
int ide_dma_end(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
u8 dma_stat = 0, dma_cmd = 0, mask;

drive->waiting_for_dma = 0;

/* stop DMA */
if (mmio) {
if (hwif->host_flags & IDE_HFLAG_MMIO) {
dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
writeb(dma_cmd & ~ATA_DMA_START,
(void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
Expand All @@ -318,13 +318,8 @@ int ide_dma_end(ide_drive_t *drive)
/* get DMA status */
dma_stat = hwif->dma_ops->dma_sff_read_status(hwif);

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

/* purge DMA mappings */
ide_destroy_dmatable(drive);
Expand Down

0 comments on commit 6ffca88

Please sign in to comment.