aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:51 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:51 -0400
commitcab7f8eda40d3e3e16b137c67cdddc2cf893c5d7 (patch)
tree369335f0bc359357653fb2271c67940840eedced /drivers
parentab86f91e8739e0b1587a16e4792ab5e4bb11f1b5 (diff)
ide: remove ->dma_{status,command} fields from ide_hwif_t
* Use ->dma_base + offset instead of ->dma_{status,command} and remove no longer needed ->dma_{status,command}. While at it: * Use ATA_DMA_* defines. 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.c42
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/pci/cmd64x.c12
-rw-r--r--drivers/ide/pci/hpt366.c10
-rw-r--r--drivers/ide/pci/ns87415.c14
-rw-r--r--drivers/ide/pci/pdc202xx_old.c2
-rw-r--r--drivers/ide/pci/piix.c4
-rw-r--r--drivers/ide/pci/scc_pata.c38
-rw-r--r--drivers/ide/pci/siimage.c4
-rw-r--r--drivers/ide/pci/sl82c105.c4
-rw-r--r--drivers/ide/pci/tc86c001.c13
11 files changed, 74 insertions, 73 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index f3229642c052..d98a9da2699c 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -377,9 +377,10 @@ void ide_dma_host_set(ide_drive_t *drive, int on)
377 dma_stat &= ~(1 << (5 + unit)); 377 dma_stat &= ~(1 << (5 + unit));
378 378
379 if (hwif->host_flags & IDE_HFLAG_MMIO) 379 if (hwif->host_flags & IDE_HFLAG_MMIO)
380 writeb(dma_stat, (void __iomem *)hwif->dma_status); 380 writeb(dma_stat,
381 (void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
381 else 382 else
382 outb(dma_stat, hwif->dma_status); 383 outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
383} 384}
384 385
385EXPORT_SYMBOL_GPL(ide_dma_host_set); 386EXPORT_SYMBOL_GPL(ide_dma_host_set);
@@ -475,18 +476,19 @@ int ide_dma_setup(ide_drive_t *drive)
475 476
476 /* specify r/w */ 477 /* specify r/w */
477 if (mmio) 478 if (mmio)
478 writeb(reading, (void __iomem *)hwif->dma_command); 479 writeb(reading, (void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
479 else 480 else
480 outb(reading, hwif->dma_command); 481 outb(reading, hwif->dma_base + ATA_DMA_CMD);
481 482
482 /* read DMA status for INTR & ERROR flags */ 483 /* read DMA status for INTR & ERROR flags */
483 dma_stat = hwif->read_sff_dma_status(hwif); 484 dma_stat = hwif->read_sff_dma_status(hwif);
484 485
485 /* clear INTR & ERROR flags */ 486 /* clear INTR & ERROR flags */
486 if (mmio) 487 if (mmio)
487 writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); 488 writeb(dma_stat | 6,
489 (void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
488 else 490 else
489 outb(dma_stat | 6, hwif->dma_status); 491 outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
490 492
491 drive->waiting_for_dma = 1; 493 drive->waiting_for_dma = 1;
492 return 0; 494 return 0;
@@ -512,12 +514,13 @@ void ide_dma_start(ide_drive_t *drive)
512 * we do this part before issuing the drive cmd. 514 * we do this part before issuing the drive cmd.
513 */ 515 */
514 if (hwif->host_flags & IDE_HFLAG_MMIO) { 516 if (hwif->host_flags & IDE_HFLAG_MMIO) {
515 dma_cmd = readb((void __iomem *)hwif->dma_command); 517 dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
516 /* start DMA */ 518 /* start DMA */
517 writeb(dma_cmd | 1, (void __iomem *)hwif->dma_command); 519 writeb(dma_cmd | 1,
520 (void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
518 } else { 521 } else {
519 dma_cmd = inb(hwif->dma_command); 522 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
520 outb(dma_cmd | 1, hwif->dma_command); 523 outb(dma_cmd | 1, hwif->dma_base + ATA_DMA_CMD);
521 } 524 }
522 525
523 hwif->dma = 1; 526 hwif->dma = 1;
@@ -537,12 +540,13 @@ int __ide_dma_end (ide_drive_t *drive)
537 540
538 if (mmio) { 541 if (mmio) {
539 /* get DMA command mode */ 542 /* get DMA command mode */
540 dma_cmd = readb((void __iomem *)hwif->dma_command); 543 dma_cmd = readb((void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
541 /* stop DMA */ 544 /* stop DMA */
542 writeb(dma_cmd & ~1, (void __iomem *)hwif->dma_command); 545 writeb(dma_cmd & ~1,
546 (void __iomem *)(hwif->dma_base + ATA_DMA_CMD));
543 } else { 547 } else {
544 dma_cmd = inb(hwif->dma_command); 548 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
545 outb(dma_cmd & ~1, hwif->dma_command); 549 outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
546 } 550 }
547 551
548 /* get DMA status */ 552 /* get DMA status */
@@ -550,9 +554,10 @@ int __ide_dma_end (ide_drive_t *drive)
550 554
551 if (mmio) 555 if (mmio)
552 /* clear the INTR & ERROR bits */ 556 /* clear the INTR & ERROR bits */
553 writeb(dma_stat | 6, (void __iomem *)hwif->dma_status); 557 writeb(dma_stat | 6,
558 (void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
554 else 559 else
555 outb(dma_stat | 6, hwif->dma_status); 560 outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
556 561
557 /* purge DMA mappings */ 562 /* purge DMA mappings */
558 ide_destroy_dmatable(drive); 563 ide_destroy_dmatable(drive);
@@ -888,11 +893,6 @@ void ide_setup_dma(ide_hwif_t *hwif, unsigned long base)
888{ 893{
889 hwif->dma_base = base; 894 hwif->dma_base = base;
890 895
891 if (!hwif->dma_command)
892 hwif->dma_command = hwif->dma_base + 0;
893 if (!hwif->dma_status)
894 hwif->dma_status = hwif->dma_base + 2;
895
896 hwif->dma_ops = &sff_dma_ops; 896 hwif->dma_ops = &sff_dma_ops;
897} 897}
898 898
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index a09bf4369ed8..17cad6c39ee3 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -106,9 +106,9 @@ void SELECT_MASK(ide_drive_t *drive, int mask)
106static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) 106static u8 ide_read_sff_dma_status(ide_hwif_t *hwif)
107{ 107{
108 if (hwif->host_flags & IDE_HFLAG_MMIO) 108 if (hwif->host_flags & IDE_HFLAG_MMIO)
109 return readb((void __iomem *)hwif->dma_status); 109 return readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS));
110 else 110 else
111 return inb(hwif->dma_status); 111 return inb(hwif->dma_base + ATA_DMA_STATUS);
112} 112}
113 113
114static 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)
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index cfa784bacf48..ce58bfcdb3c6 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -262,7 +262,7 @@ static int cmd648_dma_test_irq(ide_drive_t *drive)
262 unsigned long base = hwif->dma_base - (hwif->channel * 8); 262 unsigned long base = hwif->dma_base - (hwif->channel * 8);
263 u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 : 263 u8 irq_mask = hwif->channel ? MRDMODE_INTR_CH1 :
264 MRDMODE_INTR_CH0; 264 MRDMODE_INTR_CH0;
265 u8 dma_stat = inb(hwif->dma_status); 265 u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
266 u8 mrdmode = inb(base + 1); 266 u8 mrdmode = inb(base + 1);
267 267
268#ifdef DEBUG 268#ifdef DEBUG
@@ -286,7 +286,7 @@ static int cmd64x_dma_test_irq(ide_drive_t *drive)
286 int irq_reg = hwif->channel ? ARTTIM23 : CFR; 286 int irq_reg = hwif->channel ? ARTTIM23 : CFR;
287 u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 : 287 u8 irq_mask = hwif->channel ? ARTTIM23_INTR_CH1 :
288 CFR_INTR_CH0; 288 CFR_INTR_CH0;
289 u8 dma_stat = inb(hwif->dma_status); 289 u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
290 u8 irq_stat = 0; 290 u8 irq_stat = 0;
291 291
292 (void) pci_read_config_byte(dev, irq_reg, &irq_stat); 292 (void) pci_read_config_byte(dev, irq_reg, &irq_stat);
@@ -317,13 +317,13 @@ static int cmd646_1_dma_end(ide_drive_t *drive)
317 317
318 drive->waiting_for_dma = 0; 318 drive->waiting_for_dma = 0;
319 /* get DMA status */ 319 /* get DMA status */
320 dma_stat = inb(hwif->dma_status); 320 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
321 /* read DMA command state */ 321 /* read DMA command state */
322 dma_cmd = inb(hwif->dma_command); 322 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
323 /* stop DMA */ 323 /* stop DMA */
324 outb(dma_cmd & ~1, hwif->dma_command); 324 outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
325 /* clear the INTR & ERROR bits */ 325 /* clear the INTR & ERROR bits */
326 outb(dma_stat | 6, hwif->dma_status); 326 outb(dma_stat | 6, hwif->dma_base + ATA_DMA_STATUS);
327 /* and free any DMA resources */ 327 /* and free any DMA resources */
328 ide_destroy_dmatable(drive); 328 ide_destroy_dmatable(drive);
329 /* verify good DMA status */ 329 /* verify good DMA status */
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 397c6cbe953c..d2f470ec8055 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -801,9 +801,9 @@ static void hpt370_irq_timeout(ide_drive_t *drive)
801 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff); 801 printk(KERN_DEBUG "%s: %d bytes in FIFO\n", drive->name, bfifo & 0x1ff);
802 802
803 /* get DMA command mode */ 803 /* get DMA command mode */
804 dma_cmd = inb(hwif->dma_command); 804 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
805 /* stop DMA */ 805 /* stop DMA */
806 outb(dma_cmd & ~0x1, hwif->dma_command); 806 outb(dma_cmd & ~0x1, hwif->dma_base + ATA_DMA_CMD);
807 hpt370_clear_engine(drive); 807 hpt370_clear_engine(drive);
808} 808}
809 809
@@ -818,12 +818,12 @@ static void hpt370_dma_start(ide_drive_t *drive)
818static int hpt370_dma_end(ide_drive_t *drive) 818static int hpt370_dma_end(ide_drive_t *drive)
819{ 819{
820 ide_hwif_t *hwif = HWIF(drive); 820 ide_hwif_t *hwif = HWIF(drive);
821 u8 dma_stat = inb(hwif->dma_status); 821 u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
822 822
823 if (dma_stat & 0x01) { 823 if (dma_stat & 0x01) {
824 /* wait a little */ 824 /* wait a little */
825 udelay(20); 825 udelay(20);
826 dma_stat = inb(hwif->dma_status); 826 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
827 if (dma_stat & 0x01) 827 if (dma_stat & 0x01)
828 hpt370_irq_timeout(drive); 828 hpt370_irq_timeout(drive);
829 } 829 }
@@ -850,7 +850,7 @@ static int hpt374_dma_test_irq(ide_drive_t *drive)
850 return 0; 850 return 0;
851 } 851 }
852 852
853 dma_stat = inb(hwif->dma_status); 853 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
854 /* return 1 if INTR asserted */ 854 /* return 1 if INTR asserted */
855 if (dma_stat & 4) 855 if (dma_stat & 4)
856 return 1; 856 return 1;
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 9ffdbb89df5c..76ce112fd857 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -65,7 +65,7 @@ static u8 superio_ide_inb (unsigned long port)
65 65
66static u8 superio_read_sff_dma_status(ide_hwif_t *hwif) 66static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
67{ 67{
68 return superio_ide_inb(hwif->dma_status); 68 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
69} 69}
70 70
71static 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)
@@ -208,13 +208,13 @@ static int ns87415_dma_end(ide_drive_t *drive)
208 208
209 drive->waiting_for_dma = 0; 209 drive->waiting_for_dma = 0;
210 dma_stat = hwif->read_sff_dma_status(hwif); 210 dma_stat = hwif->read_sff_dma_status(hwif);
211 /* get dma command mode */ 211 /* get DMA command mode */
212 dma_cmd = inb(hwif->dma_command); 212 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
213 /* stop DMA */ 213 /* stop DMA */
214 outb(dma_cmd & ~1, hwif->dma_command); 214 outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
215 /* from ERRATA: clear the INTR & ERROR bits */ 215 /* from ERRATA: clear the INTR & ERROR bits */
216 dma_cmd = inb(hwif->dma_command); 216 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
217 outb(dma_cmd | 6, hwif->dma_command); 217 outb(dma_cmd | 6, hwif->dma_base + ATA_DMA_CMD);
218 /* and free any DMA resources */ 218 /* and free any DMA resources */
219 ide_destroy_dmatable(drive); 219 ide_destroy_dmatable(drive);
220 /* verify good DMA status */ 220 /* verify good DMA status */
@@ -298,7 +298,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
298 if (!hwif->dma_base) 298 if (!hwif->dma_base)
299 return; 299 return;
300 300
301 outb(0x60, hwif->dma_status); 301 outb(0x60, hwif->dma_base + ATA_DMA_STATUS);
302} 302}
303 303
304static const struct ide_port_ops ns87415_port_ops = { 304static const struct ide_port_ops ns87415_port_ops = {
diff --git a/drivers/ide/pci/pdc202xx_old.c b/drivers/ide/pci/pdc202xx_old.c
index fca89eda5c02..1c2f9df31129 100644
--- a/drivers/ide/pci/pdc202xx_old.c
+++ b/drivers/ide/pci/pdc202xx_old.c
@@ -206,7 +206,7 @@ static int pdc202xx_dma_test_irq(ide_drive_t *drive)
206{ 206{
207 ide_hwif_t *hwif = HWIF(drive); 207 ide_hwif_t *hwif = HWIF(drive);
208 unsigned long high_16 = hwif->extra_base - 16; 208 unsigned long high_16 = hwif->extra_base - 16;
209 u8 dma_stat = inb(hwif->dma_status); 209 u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
210 u8 sc1d = inb(high_16 + 0x001d); 210 u8 sc1d = inb(high_16 + 0x001d);
211 211
212 if (hwif->channel) { 212 if (hwif->channel) {
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index f04738d14a6f..0ce41b4dddaf 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -227,9 +227,9 @@ static void piix_dma_clear_irq(ide_drive_t *drive)
227 u8 dma_stat; 227 u8 dma_stat;
228 228
229 /* clear the INTR & ERROR bits */ 229 /* clear the INTR & ERROR bits */
230 dma_stat = inb(hwif->dma_status); 230 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
231 /* Should we force the bit as well ? */ 231 /* Should we force the bit as well ? */
232 outb(dma_stat, hwif->dma_status); 232 outb(dma_stat, hwif->dma_base + ATA_DMA_STATUS);
233} 233}
234 234
235struct ich_laptop { 235struct ich_laptop {
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 7a2a7b2a319a..fc163a7772a7 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -128,7 +128,7 @@ static u8 scc_ide_inb(unsigned long port)
128 128
129static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) 129static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
130{ 130{
131 return (u8)in_be32((void *)hwif->dma_status); 131 return (u8)in_be32((void *)(hwif->dma_base + 4));
132} 132}
133 133
134static void scc_ide_insw(unsigned long port, void *addr, u32 count) 134static void scc_ide_insw(unsigned long port, void *addr, u32 count)
@@ -266,14 +266,14 @@ static void scc_dma_host_set(ide_drive_t *drive, int on)
266{ 266{
267 ide_hwif_t *hwif = drive->hwif; 267 ide_hwif_t *hwif = drive->hwif;
268 u8 unit = (drive->select.b.unit & 0x01); 268 u8 unit = (drive->select.b.unit & 0x01);
269 u8 dma_stat = scc_ide_inb(hwif->dma_status); 269 u8 dma_stat = scc_ide_inb(hwif->dma_base + 4);
270 270
271 if (on) 271 if (on)
272 dma_stat |= (1 << (5 + unit)); 272 dma_stat |= (1 << (5 + unit));
273 else 273 else
274 dma_stat &= ~(1 << (5 + unit)); 274 dma_stat &= ~(1 << (5 + unit));
275 275
276 scc_ide_outb(dma_stat, hwif->dma_status); 276 scc_ide_outb(dma_stat, hwif->dma_base + 4);
277} 277}
278 278
279/** 279/**
@@ -309,13 +309,13 @@ static int scc_dma_setup(ide_drive_t *drive)
309 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma); 309 out_be32((void __iomem *)(hwif->dma_base + 8), hwif->dmatable_dma);
310 310
311 /* specify r/w */ 311 /* specify r/w */
312 out_be32((void __iomem *)hwif->dma_command, reading); 312 out_be32((void __iomem *)hwif->dma_base, reading);
313 313
314 /* read dma_status for INTR & ERROR flags */ 314 /* read DMA status for INTR & ERROR flags */
315 dma_stat = in_be32((void __iomem *)hwif->dma_status); 315 dma_stat = in_be32((void __iomem *)(hwif->dma_base + 4));
316 316
317 /* clear INTR & ERROR flags */ 317 /* clear INTR & ERROR flags */
318 out_be32((void __iomem *)hwif->dma_status, dma_stat|6); 318 out_be32((void __iomem *)(hwif->dma_base + 4), dma_stat | 6);
319 drive->waiting_for_dma = 1; 319 drive->waiting_for_dma = 1;
320 return 0; 320 return 0;
321} 321}
@@ -323,10 +323,10 @@ static int scc_dma_setup(ide_drive_t *drive)
323static void scc_dma_start(ide_drive_t *drive) 323static void scc_dma_start(ide_drive_t *drive)
324{ 324{
325 ide_hwif_t *hwif = drive->hwif; 325 ide_hwif_t *hwif = drive->hwif;
326 u8 dma_cmd = scc_ide_inb(hwif->dma_command); 326 u8 dma_cmd = scc_ide_inb(hwif->dma_base);
327 327
328 /* start DMA */ 328 /* start DMA */
329 scc_ide_outb(dma_cmd | 1, hwif->dma_command); 329 scc_ide_outb(dma_cmd | 1, hwif->dma_base);
330 hwif->dma = 1; 330 hwif->dma = 1;
331 wmb(); 331 wmb();
332} 332}
@@ -338,13 +338,13 @@ static int __scc_dma_end(ide_drive_t *drive)
338 338
339 drive->waiting_for_dma = 0; 339 drive->waiting_for_dma = 0;
340 /* get DMA command mode */ 340 /* get DMA command mode */
341 dma_cmd = scc_ide_inb(hwif->dma_command); 341 dma_cmd = scc_ide_inb(hwif->dma_base);
342 /* stop DMA */ 342 /* stop DMA */
343 scc_ide_outb(dma_cmd & ~1, hwif->dma_command); 343 scc_ide_outb(dma_cmd & ~1, hwif->dma_base);
344 /* get DMA status */ 344 /* get DMA status */
345 dma_stat = scc_ide_inb(hwif->dma_status); 345 dma_stat = scc_ide_inb(hwif->dma_base + 4);
346 /* clear the INTR & ERROR bits */ 346 /* clear the INTR & ERROR bits */
347 scc_ide_outb(dma_stat | 6, hwif->dma_status); 347 scc_ide_outb(dma_stat | 6, hwif->dma_base + 4);
348 /* purge DMA mappings */ 348 /* purge DMA mappings */
349 ide_destroy_dmatable(drive); 349 ide_destroy_dmatable(drive);
350 /* verify good DMA status */ 350 /* verify good DMA status */
@@ -364,6 +364,7 @@ static int __scc_dma_end(ide_drive_t *drive)
364static int scc_dma_end(ide_drive_t *drive) 364static int scc_dma_end(ide_drive_t *drive)
365{ 365{
366 ide_hwif_t *hwif = HWIF(drive); 366 ide_hwif_t *hwif = HWIF(drive);
367 void __iomem *dma_base = (void __iomem *)hwif->dma_base;
367 unsigned long intsts_port = hwif->dma_base + 0x014; 368 unsigned long intsts_port = hwif->dma_base + 0x014;
368 u32 reg; 369 u32 reg;
369 int dma_stat, data_loss = 0; 370 int dma_stat, data_loss = 0;
@@ -402,7 +403,7 @@ static int scc_dma_end(ide_drive_t *drive)
402 printk(KERN_WARNING "%s: SERROR\n", SCC_PATA_NAME); 403 printk(KERN_WARNING "%s: SERROR\n", SCC_PATA_NAME);
403 out_be32((void __iomem *)intsts_port, INTSTS_SERROR|INTSTS_BMSINT); 404 out_be32((void __iomem *)intsts_port, INTSTS_SERROR|INTSTS_BMSINT);
404 405
405 out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS); 406 out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
406 continue; 407 continue;
407 } 408 }
408 409
@@ -417,7 +418,7 @@ static int scc_dma_end(ide_drive_t *drive)
417 418
418 out_be32((void __iomem *)intsts_port, INTSTS_PRERR|INTSTS_BMSINT); 419 out_be32((void __iomem *)intsts_port, INTSTS_PRERR|INTSTS_BMSINT);
419 420
420 out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS); 421 out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
421 continue; 422 continue;
422 } 423 }
423 424
@@ -425,12 +426,12 @@ static int scc_dma_end(ide_drive_t *drive)
425 printk(KERN_WARNING "%s: Response Error\n", SCC_PATA_NAME); 426 printk(KERN_WARNING "%s: Response Error\n", SCC_PATA_NAME);
426 out_be32((void __iomem *)intsts_port, INTSTS_RERR|INTSTS_BMSINT); 427 out_be32((void __iomem *)intsts_port, INTSTS_RERR|INTSTS_BMSINT);
427 428
428 out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS); 429 out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
429 continue; 430 continue;
430 } 431 }
431 432
432 if (reg & INTSTS_ICERR) { 433 if (reg & INTSTS_ICERR) {
433 out_be32((void __iomem *)hwif->dma_command, in_be32((void __iomem *)hwif->dma_command) & ~QCHCD_IOS_SS); 434 out_be32(dma_base, in_be32(dma_base) & ~QCHCD_IOS_SS);
434 435
435 printk(KERN_WARNING "%s: Illegal Configuration\n", SCC_PATA_NAME); 436 printk(KERN_WARNING "%s: Illegal Configuration\n", SCC_PATA_NAME);
436 out_be32((void __iomem *)intsts_port, INTSTS_ICERR|INTSTS_BMSINT); 437 out_be32((void __iomem *)intsts_port, INTSTS_ICERR|INTSTS_BMSINT);
@@ -832,9 +833,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
832 833
833 ports->hwif = hwif; 834 ports->hwif = hwif;
834 835
835 hwif->dma_command = hwif->dma_base;
836 hwif->dma_status = hwif->dma_base + 0x04;
837
838 /* PTERADD */ 836 /* PTERADD */
839 out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); 837 out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma);
840 838
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 6e9d7655d89c..21d7137f7d6c 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -334,7 +334,7 @@ static int siimage_io_dma_test_irq(ide_drive_t *drive)
334 unsigned long addr = siimage_selreg(hwif, 1); 334 unsigned long addr = siimage_selreg(hwif, 1);
335 335
336 /* return 1 if INTR asserted */ 336 /* return 1 if INTR asserted */
337 if (hwif->INB(hwif->dma_status) & 4) 337 if (inb(hwif->dma_base + ATA_DMA_STATUS) & 4)
338 return 1; 338 return 1;
339 339
340 /* return 1 if Device INTR asserted */ 340 /* return 1 if Device INTR asserted */
@@ -382,7 +382,7 @@ static int siimage_mmio_dma_test_irq(ide_drive_t *drive)
382 } 382 }
383 383
384 /* return 1 if INTR asserted */ 384 /* return 1 if INTR asserted */
385 if (readb((void __iomem *)hwif->dma_status) & 0x04) 385 if (readb((void __iomem *)(hwif->dma_base + ATA_DMA_STATUS)) & 4)
386 return 1; 386 return 1;
387 387
388 /* return 1 if Device INTR asserted */ 388 /* return 1 if Device INTR asserted */
diff --git a/drivers/ide/pci/sl82c105.c b/drivers/ide/pci/sl82c105.c
index 6efbde297174..f82a6502c1b7 100644
--- a/drivers/ide/pci/sl82c105.c
+++ b/drivers/ide/pci/sl82c105.c
@@ -157,9 +157,9 @@ static void sl82c105_dma_lost_irq(ide_drive_t *drive)
157 * Was DMA enabled? If so, disable it - we're resetting the 157 * Was DMA enabled? If so, disable it - we're resetting the
158 * host. The IDE layer will be handling the drive for us. 158 * host. The IDE layer will be handling the drive for us.
159 */ 159 */
160 dma_cmd = inb(hwif->dma_command); 160 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
161 if (dma_cmd & 1) { 161 if (dma_cmd & 1) {
162 outb(dma_cmd & ~1, hwif->dma_command); 162 outb(dma_cmd & ~1, hwif->dma_base + ATA_DMA_CMD);
163 printk("sl82c105: DMA was enabled\n"); 163 printk("sl82c105: DMA was enabled\n");
164 } 164 }
165 165
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 9b4b27a4c711..a81d47c55ce1 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -63,7 +63,7 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
63 ide_hwif_t *hwif = HWIF(drive); 63 ide_hwif_t *hwif = HWIF(drive);
64 ide_expiry_t *expiry = ide_get_hwifdata(hwif); 64 ide_expiry_t *expiry = ide_get_hwifdata(hwif);
65 ide_hwgroup_t *hwgroup = HWGROUP(drive); 65 ide_hwgroup_t *hwgroup = HWGROUP(drive);
66 u8 dma_stat = inb(hwif->dma_status); 66 u8 dma_stat = inb(hwif->dma_base + ATA_DMA_STATUS);
67 67
68 /* Restore a higher level driver's expiry handler first. */ 68 /* Restore a higher level driver's expiry handler first. */
69 hwgroup->expiry = expiry; 69 hwgroup->expiry = expiry;
@@ -71,21 +71,24 @@ static int tc86c001_timer_expiry(ide_drive_t *drive)
71 if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */ 71 if ((dma_stat & 5) == 1) { /* DMA active and no interrupt */
72 unsigned long sc_base = hwif->config_data; 72 unsigned long sc_base = hwif->config_data;
73 unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04); 73 unsigned long twcr_port = sc_base + (drive->dn ? 0x06 : 0x04);
74 u8 dma_cmd = inb(hwif->dma_command); 74 u8 dma_cmd = inb(hwif->dma_base + ATA_DMA_CMD);
75 75
76 printk(KERN_WARNING "%s: DMA interrupt possibly stuck, " 76 printk(KERN_WARNING "%s: DMA interrupt possibly stuck, "
77 "attempting recovery...\n", drive->name); 77 "attempting recovery...\n", drive->name);
78 78
79 /* Stop DMA */ 79 /* Stop DMA */
80 outb(dma_cmd & ~0x01, hwif->dma_command); 80 outb(dma_cmd & ~0x01, hwif->dma_base + ATA_DMA_CMD);
81 81
82 /* Setup the dummy DMA transfer */ 82 /* Setup the dummy DMA transfer */
83 outw(0, sc_base + 0x0a); /* Sector Count */ 83 outw(0, sc_base + 0x0a); /* Sector Count */
84 outw(0, twcr_port); /* Transfer Word Count 1 or 2 */ 84 outw(0, twcr_port); /* Transfer Word Count 1 or 2 */
85 85
86 /* Start the dummy DMA transfer */ 86 /* Start the dummy DMA transfer */
87 outb(0x00, hwif->dma_command); /* clear R_OR_WCTR for write */ 87
88 outb(0x01, hwif->dma_command); /* set START_STOPBM */ 88 /* clear R_OR_WCTR for write */
89 outb(0x00, hwif->dma_base + ATA_DMA_CMD);
90 /* set START_STOPBM */
91 outb(0x01, hwif->dma_base + ATA_DMA_CMD);
89 92
90 /* 93 /*
91 * If an interrupt was pending, it should come thru shortly. 94 * If an interrupt was pending, it should come thru shortly.