aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:50 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:50 -0400
commitb2f951aabc9cc7d5fb987aeec9aef96ccce618a5 (patch)
treed388e9a44a153cee8395bd7ca9eff63492ff9cfd /drivers/ide/pci
parentc97c6aca75fd5f718056fde7cff798b8cbdb07c0 (diff)
ide: add ->read_sff_dma_status method
Add ->read_sff_dma_status method for reading DMA Status register and use it instead of ->INB. While at it: * Use inb() directly in ns87415.c::ns87415_dma_end(). There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/ns87415.c13
-rw-r--r--drivers/ide/pci/scc_pata.c7
2 files changed, 17 insertions, 3 deletions
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 45ba71a7182f..9ffdbb89df5c 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -63,6 +63,11 @@ static u8 superio_ide_inb (unsigned long port)
63 return inb(port); 63 return inb(port);
64} 64}
65 65
66static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
67{
68 return superio_ide_inb(hwif->dma_status);
69}
70
66static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) 71static void superio_tf_read(ide_drive_t *drive, ide_task_t *task)
67{ 72{
68 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 73 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
@@ -122,6 +127,8 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
122 tmp = superio_ide_inb(superio_ide_dma_status[port]); 127 tmp = superio_ide_inb(superio_ide_dma_status[port]);
123 outb(tmp | 0x66, superio_ide_dma_status[port]); 128 outb(tmp | 0x66, superio_ide_dma_status[port]);
124 129
130 hwif->read_sff_dma_status = superio_read_sff_dma_status;
131
125 hwif->tf_read = superio_tf_read; 132 hwif->tf_read = superio_tf_read;
126 133
127 /* We need to override inb to workaround a SuperIO errata */ 134 /* We need to override inb to workaround a SuperIO errata */
@@ -200,13 +207,13 @@ static int ns87415_dma_end(ide_drive_t *drive)
200 u8 dma_stat = 0, dma_cmd = 0; 207 u8 dma_stat = 0, dma_cmd = 0;
201 208
202 drive->waiting_for_dma = 0; 209 drive->waiting_for_dma = 0;
203 dma_stat = hwif->INB(hwif->dma_status); 210 dma_stat = hwif->read_sff_dma_status(hwif);
204 /* get dma command mode */ 211 /* get dma command mode */
205 dma_cmd = hwif->INB(hwif->dma_command); 212 dma_cmd = inb(hwif->dma_command);
206 /* stop DMA */ 213 /* stop DMA */
207 outb(dma_cmd & ~1, hwif->dma_command); 214 outb(dma_cmd & ~1, hwif->dma_command);
208 /* from ERRATA: clear the INTR & ERROR bits */ 215 /* from ERRATA: clear the INTR & ERROR bits */
209 dma_cmd = hwif->INB(hwif->dma_command); 216 dma_cmd = inb(hwif->dma_command);
210 outb(dma_cmd | 6, hwif->dma_command); 217 outb(dma_cmd | 6, hwif->dma_command);
211 /* and free any DMA resources */ 218 /* and free any DMA resources */
212 ide_destroy_dmatable(drive); 219 ide_destroy_dmatable(drive);
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 328e2df66550..7a2a7b2a319a 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -126,6 +126,11 @@ static u8 scc_ide_inb(unsigned long port)
126 return (u8)data; 126 return (u8)data;
127} 127}
128 128
129static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
130{
131 return (u8)in_be32((void *)hwif->dma_status);
132}
133
129static void scc_ide_insw(unsigned long port, void *addr, u32 count) 134static void scc_ide_insw(unsigned long port, void *addr, u32 count)
130{ 135{
131 u16 *ptr = (u16 *)addr; 136 u16 *ptr = (u16 *)addr;
@@ -773,6 +778,8 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
773 778
774 ide_set_hwifdata(hwif, ports); 779 ide_set_hwifdata(hwif, ports);
775 780
781 hwif->read_sff_dma_status = scc_read_sff_dma_status;
782
776 hwif->tf_load = scc_tf_load; 783 hwif->tf_load = scc_tf_load;
777 hwif->tf_read = scc_tf_read; 784 hwif->tf_read = scc_tf_read;
778 785