aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/ide/ide-dma.c12
-rw-r--r--drivers/ide/ide-iops.c10
-rw-r--r--drivers/ide/pci/ns87415.c13
-rw-r--r--drivers/ide/pci/scc_pata.c7
4 files changed, 33 insertions, 9 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 7ee44f86bc54..ebddedde24af 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -334,7 +334,7 @@ static int config_drive_for_dma (ide_drive_t *drive)
334static int dma_timer_expiry (ide_drive_t *drive) 334static int dma_timer_expiry (ide_drive_t *drive)
335{ 335{
336 ide_hwif_t *hwif = HWIF(drive); 336 ide_hwif_t *hwif = HWIF(drive);
337 u8 dma_stat = hwif->INB(hwif->dma_status); 337 u8 dma_stat = hwif->read_sff_dma_status(hwif);
338 338
339 printk(KERN_WARNING "%s: dma_timer_expiry: dma status == 0x%02x\n", 339 printk(KERN_WARNING "%s: dma_timer_expiry: dma status == 0x%02x\n",
340 drive->name, dma_stat); 340 drive->name, dma_stat);
@@ -369,7 +369,7 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
369{ 369{
370 ide_hwif_t *hwif = HWIF(drive); 370 ide_hwif_t *hwif = HWIF(drive);
371 u8 unit = (drive->select.b.unit & 0x01); 371 u8 unit = (drive->select.b.unit & 0x01);
372 u8 dma_stat = hwif->INB(hwif->dma_status); 372 u8 dma_stat = hwif->read_sff_dma_status(hwif);
373 373
374 if (on) 374 if (on)
375 dma_stat |= (1 << (5 + unit)); 375 dma_stat |= (1 << (5 + unit));
@@ -472,8 +472,8 @@ int ide_dma_setup(ide_drive_t *drive)
472 /* specify r/w */ 472 /* specify r/w */
473 hwif->OUTB(reading, hwif->dma_command); 473 hwif->OUTB(reading, hwif->dma_command);
474 474
475 /* read dma_status for INTR & ERROR flags */ 475 /* read DMA status for INTR & ERROR flags */
476 dma_stat = hwif->INB(hwif->dma_status); 476 dma_stat = hwif->read_sff_dma_status(hwif);
477 477
478 /* clear INTR & ERROR flags */ 478 /* clear INTR & ERROR flags */
479 hwif->OUTB(dma_stat|6, hwif->dma_status); 479 hwif->OUTB(dma_stat|6, hwif->dma_status);
@@ -520,7 +520,7 @@ int __ide_dma_end (ide_drive_t *drive)
520 /* stop DMA */ 520 /* stop DMA */
521 hwif->OUTB(dma_cmd&~1, hwif->dma_command); 521 hwif->OUTB(dma_cmd&~1, hwif->dma_command);
522 /* get DMA status */ 522 /* get DMA status */
523 dma_stat = hwif->INB(hwif->dma_status); 523 dma_stat = hwif->read_sff_dma_status(hwif);
524 /* clear the INTR & ERROR bits */ 524 /* clear the INTR & ERROR bits */
525 hwif->OUTB(dma_stat|6, hwif->dma_status); 525 hwif->OUTB(dma_stat|6, hwif->dma_status);
526 /* purge DMA mappings */ 526 /* purge DMA mappings */
@@ -537,7 +537,7 @@ EXPORT_SYMBOL(__ide_dma_end);
537int ide_dma_test_irq(ide_drive_t *drive) 537int ide_dma_test_irq(ide_drive_t *drive)
538{ 538{
539 ide_hwif_t *hwif = HWIF(drive); 539 ide_hwif_t *hwif = HWIF(drive);
540 u8 dma_stat = hwif->INB(hwif->dma_status); 540 u8 dma_stat = hwif->read_sff_dma_status(hwif);
541 541
542 /* return 1 if INTR asserted */ 542 /* return 1 if INTR asserted */
543 if ((dma_stat & 4) == 4) 543 if ((dma_stat & 4) == 4)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 44aaec256a30..a09bf4369ed8 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -103,6 +103,14 @@ void SELECT_MASK(ide_drive_t *drive, int mask)
103 port_ops->maskproc(drive, mask); 103 port_ops->maskproc(drive, mask);
104} 104}
105 105
106static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
107{
108 if (hwif->host_flags & IDE_HFLAG_MMIO)
109 return readb((void __iomem *)hwif->dma_status);
110 else
111 return inb(hwif->dma_status);
112}
113
106static void ide_tf_load(ide_drive_t *drive, ide_task_t *task) 114static void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
107{ 115{
108 ide_hwif_t *hwif = drive->hwif; 116 ide_hwif_t *hwif = drive->hwif;
@@ -323,6 +331,8 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
323 331
324void default_hwif_transport(ide_hwif_t *hwif) 332void default_hwif_transport(ide_hwif_t *hwif)
325{ 333{
334 hwif->read_sff_dma_status = ide_read_sff_dma_status;
335
326 hwif->tf_load = ide_tf_load; 336 hwif->tf_load = ide_tf_load;
327 hwif->tf_read = ide_tf_read; 337 hwif->tf_read = ide_tf_read;
328 338
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