aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:32 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-27 09:38:32 -0400
commit4c3032d8a4d6c97bd6e02bcab524ef2428d89561 (patch)
tree4528851a9b04282f602cebb6b2ab4bc677b63259 /drivers/ide
parent387750c3bf49c22f6189436032145e2131985076 (diff)
ide: add struct ide_io_ports (take 3)
* Add struct ide_io_ports and use it instead of `unsigned long io_ports[]` in ide_hwif_t. * Rename io_ports[] in hw_regs_t to io_ports_array[]. * Use un-named union for 'unsigned long io_ports_array[]' and 'struct ide_io_ports io_ports' in hw_regs_t. * Remove IDE_*_OFFSET defines. v2: * scc_pata.c build fix from Stephen Rothwell. v3: * Fix ctl_adrr typo in Sparc-specific part of ns87415.c. (Noticed by Andrew Morton) Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/arm/bast-ide.c6
-rw-r--r--drivers/ide/arm/icside.c7
-rw-r--r--drivers/ide/arm/palm_bk3710.c6
-rw-r--r--drivers/ide/arm/rapide.c6
-rw-r--r--drivers/ide/cris/ide-cris.c18
-rw-r--r--drivers/ide/h8300/ide-h8300.c6
-rw-r--r--drivers/ide/ide-cd.c8
-rw-r--r--drivers/ide/ide-floppy.c12
-rw-r--r--drivers/ide/ide-io.c42
-rw-r--r--drivers/ide/ide-iops.c72
-rw-r--r--drivers/ide/ide-probe.c41
-rw-r--r--drivers/ide/ide-tape.c12
-rw-r--r--drivers/ide/ide-taskfile.c29
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/ide/legacy/buddha.c14
-rw-r--r--drivers/ide/legacy/falconide.c6
-rw-r--r--drivers/ide/legacy/gayle.c16
-rw-r--r--drivers/ide/legacy/ht6560b.c4
-rw-r--r--drivers/ide/legacy/ide-cs.c4
-rw-r--r--drivers/ide/legacy/ide_platform.c8
-rw-r--r--drivers/ide/legacy/macide.c4
-rw-r--r--drivers/ide/legacy/q40ide.c6
-rw-r--r--drivers/ide/mips/au1xxx-ide.c5
-rw-r--r--drivers/ide/mips/swarm.c6
-rw-r--r--drivers/ide/pci/cmd640.c8
-rw-r--r--drivers/ide/pci/hpt366.c2
-rw-r--r--drivers/ide/pci/ns87415.c12
-rw-r--r--drivers/ide/pci/opti621.c2
-rw-r--r--drivers/ide/pci/scc_pata.c8
-rw-r--r--drivers/ide/pci/sgiioc4.c26
-rw-r--r--drivers/ide/pci/siimage.c27
-rw-r--r--drivers/ide/pci/trm290.c2
-rw-r--r--drivers/ide/ppc/mpc8xx.c4
-rw-r--r--drivers/ide/ppc/pmac.c7
34 files changed, 213 insertions, 225 deletions
diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c
index df09f0372605..713cef20622e 100644
--- a/drivers/ide/arm/bast-ide.c
+++ b/drivers/ide/arm/bast-ide.c
@@ -35,12 +35,12 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq)
35 base += BAST_IDE_CS; 35 base += BAST_IDE_CS;
36 aux += BAST_IDE_CS; 36 aux += BAST_IDE_CS;
37 37
38 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 38 for (i = 0; i <= 7; i++) {
39 hw.io_ports[i] = (unsigned long)base; 39 hw.io_ports_array[i] = (unsigned long)base;
40 base += 0x20; 40 base += 0x20;
41 } 41 }
42 42
43 hw.io_ports[IDE_CONTROL_OFFSET] = aux + (6 * 0x20); 43 hw.io_ports.ctl_addr = aux + (6 * 0x20);
44 hw.irq = irq; 44 hw.irq = irq;
45 45
46 hwif = ide_find_port(); 46 hwif = ide_find_port();
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index 4211bfbd1582..124445c20921 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -426,11 +426,12 @@ icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *e
426 */ 426 */
427 default_hwif_mmiops(hwif); 427 default_hwif_mmiops(hwif);
428 428
429 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 429 for (i = 0; i <= 7; i++) {
430 hwif->io_ports[i] = port; 430 hwif->io_ports_array[i] = port;
431 port += 1 << info->stepping; 431 port += 1 << info->stepping;
432 } 432 }
433 hwif->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)base + info->ctrloffset; 433 hwif->io_ports.ctl_addr =
434 (unsigned long)base + info->ctrloffset;
434 hwif->irq = ec->irq; 435 hwif->irq = ec->irq;
435 hwif->chipset = ide_acorn; 436 hwif->chipset = ide_acorn;
436 hwif->gendev.parent = &ec->dev; 437 hwif->gendev.parent = &ec->dev;
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index 208d7f2d6d10..aaf32541622d 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -321,7 +321,7 @@ static int __devinit palm_bk3710_init_dma(ide_hwif_t *hwif,
321 const struct ide_port_info *d) 321 const struct ide_port_info *d)
322{ 322{
323 unsigned long base = 323 unsigned long base =
324 hwif->io_ports[IDE_DATA_OFFSET] - IDE_PALM_ATA_PRI_REG_OFFSET; 324 hwif->io_ports.data_addr - IDE_PALM_ATA_PRI_REG_OFFSET;
325 325
326 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name); 326 printk(KERN_INFO " %s: MMIO-DMA\n", hwif->name);
327 327
@@ -386,8 +386,8 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
386 386
387 pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; 387 pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
388 for (i = 0; i < IDE_NR_PORTS - 2; i++) 388 for (i = 0; i < IDE_NR_PORTS - 2; i++)
389 hw.io_ports[i] = pribase + i; 389 hw.io_ports_array[i] = pribase + i;
390 hw.io_ports[IDE_CONTROL_OFFSET] = mem->start + 390 hw.io_ports.ctl_addr = mem->start +
391 IDE_PALM_ATA_PRI_CTL_OFFSET; 391 IDE_PALM_ATA_PRI_CTL_OFFSET;
392 hw.irq = irq->start; 392 hw.irq = irq->start;
393 hw.chipset = ide_palm3710; 393 hw.chipset = ide_palm3710;
diff --git a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
index 3d30d4b5f9e3..babc1a5e128d 100644
--- a/drivers/ide/arm/rapide.c
+++ b/drivers/ide/arm/rapide.c
@@ -17,11 +17,11 @@ static void rapide_setup_ports(hw_regs_t *hw, void __iomem *base,
17 unsigned long port = (unsigned long)base; 17 unsigned long port = (unsigned long)base;
18 int i; 18 int i;
19 19
20 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) { 20 for (i = 0; i <= 7; i++) {
21 hw->io_ports[i] = port; 21 hw->io_ports_array[i] = port;
22 port += sz; 22 port += sz;
23 } 23 }
24 hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 24 hw->io_ports.ctl_addr = (unsigned long)ctrl;
25 hw->irq = irq; 25 hw->irq = irq;
26} 26}
27 27
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c
index a62ca75c7e28..9df26855bc05 100644
--- a/drivers/ide/cris/ide-cris.c
+++ b/drivers/ide/cris/ide-cris.c
@@ -88,8 +88,8 @@ enum /* Transfer types */
88int 88int
89cris_ide_ack_intr(ide_hwif_t* hwif) 89cris_ide_ack_intr(ide_hwif_t* hwif)
90{ 90{
91 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, 91 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int,
92 int, hwif->io_ports[0]); 92 hwif->io_ports.data_addr);
93 REG_WR_INT(ata, regi_ata, rw_ack_intr, 1 << ctrl2.sel); 93 REG_WR_INT(ata, regi_ata, rw_ack_intr, 1 << ctrl2.sel);
94 return 1; 94 return 1;
95} 95}
@@ -231,7 +231,7 @@ cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int dir,int type,
231 ide_hwif_t *hwif = drive->hwif; 231 ide_hwif_t *hwif = drive->hwif;
232 232
233 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, 233 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int,
234 hwif->io_ports[IDE_DATA_OFFSET]); 234 hwif->io_ports.data_addr);
235 reg_ata_rw_trf_cnt trf_cnt = {0}; 235 reg_ata_rw_trf_cnt trf_cnt = {0};
236 236
237 mycontext.saved_data = (dma_descr_data*)virt_to_phys(d); 237 mycontext.saved_data = (dma_descr_data*)virt_to_phys(d);
@@ -271,7 +271,7 @@ static int cris_dma_test_irq(ide_drive_t *drive)
271 int intr = REG_RD_INT(ata, regi_ata, r_intr); 271 int intr = REG_RD_INT(ata, regi_ata, r_intr);
272 272
273 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int, 273 reg_ata_rw_ctrl2 ctrl2 = REG_TYPE_CONV(reg_ata_rw_ctrl2, int,
274 hwif->io_ports[IDE_DATA_OFFSET]); 274 hwif->io_ports.data_addr);
275 275
276 return intr & (1 << ctrl2.sel) ? 1 : 0; 276 return intr & (1 << ctrl2.sel) ? 1 : 0;
277} 277}
@@ -531,7 +531,7 @@ static void cris_ide_start_dma(ide_drive_t *drive, cris_dma_descr_type *d, int d
531 *R_ATA_CTRL_DATA = 531 *R_ATA_CTRL_DATA =
532 cmd | 532 cmd |
533 IO_FIELD(R_ATA_CTRL_DATA, data, 533 IO_FIELD(R_ATA_CTRL_DATA, data,
534 drive->hwif->io_ports[IDE_DATA_OFFSET]) | 534 drive->hwif->io_ports.data_addr) |
535 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) | 535 IO_STATE(R_ATA_CTRL_DATA, src_dst, dma) |
536 IO_STATE(R_ATA_CTRL_DATA, multi, on) | 536 IO_STATE(R_ATA_CTRL_DATA, multi, on) |
537 IO_STATE(R_ATA_CTRL_DATA, dma_size, word); 537 IO_STATE(R_ATA_CTRL_DATA, dma_size, word);
@@ -550,7 +550,7 @@ static int cris_dma_test_irq(ide_drive_t *drive)
550{ 550{
551 int intr = *R_IRQ_MASK0_RD; 551 int intr = *R_IRQ_MASK0_RD;
552 int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel, 552 int bus = IO_EXTRACT(R_ATA_CTRL_DATA, sel,
553 drive->hwif->io_ports[IDE_DATA_OFFSET]); 553 drive->hwif->io_ports.data_addr);
554 554
555 return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0; 555 return intr & (1 << (bus + IO_BITNR(R_IRQ_MASK0_RD, ata_irq0))) ? 1 : 0;
556} 556}
@@ -644,7 +644,7 @@ cris_ide_inw(unsigned long reg) {
644 * call will also timeout on busy, but as long as the 644 * call will also timeout on busy, but as long as the
645 * write is still performed, everything will be fine. 645 * write is still performed, everything will be fine.
646 */ 646 */
647 if (cris_ide_get_reg(reg) == IDE_STATUS_OFFSET) 647 if (cris_ide_get_reg(reg) == 7)
648 return BUSY_STAT; 648 return BUSY_STAT;
649 else 649 else
650 /* For other rare cases we assume 0 is good enough. */ 650 /* For other rare cases we assume 0 is good enough. */
@@ -765,13 +765,13 @@ static void __init cris_setup_ports(hw_regs_t *hw, unsigned long base)
765 memset(hw, 0, sizeof(*hw)); 765 memset(hw, 0, sizeof(*hw));
766 766
767 for (i = 0; i <= 7; i++) 767 for (i = 0; i <= 7; i++)
768 hw->io_ports[i] = base + cris_ide_reg_addr(i, 0, 1); 768 hw->io_ports_array[i] = base + cris_ide_reg_addr(i, 0, 1);
769 769
770 /* 770 /*
771 * the IDE control register is at ATA address 6, 771 * the IDE control register is at ATA address 6,
772 * with CS1 active instead of CS0 772 * with CS1 active instead of CS0
773 */ 773 */
774 hw->io_ports[IDE_CONTROL_OFFSET] = base + cris_ide_reg_addr(6, 1, 0); 774 hw->io_ports.ctl_addr = base + cris_ide_reg_addr(6, 1, 0);
775 775
776 hw->irq = ide_default_irq(0); 776 hw->irq = ide_default_irq(0);
777 hw->ack_intr = cris_ide_ack_intr; 777 hw->ack_intr = cris_ide_ack_intr;
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c
index 0708b29cdb17..fd23f12e17aa 100644
--- a/drivers/ide/h8300/ide-h8300.c
+++ b/drivers/ide/h8300/ide-h8300.c
@@ -63,9 +63,9 @@ static inline void hw_setup(hw_regs_t *hw)
63 int i; 63 int i;
64 64
65 memset(hw, 0, sizeof(hw_regs_t)); 65 memset(hw, 0, sizeof(hw_regs_t));
66 for (i = 0; i <= IDE_STATUS_OFFSET; i++) 66 for (i = 0; i <= 7; i++)
67 hw->io_ports[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i; 67 hw->io_ports_array[i] = CONFIG_H8300_IDE_BASE + H8300_IDE_GAP*i;
68 hw->io_ports[IDE_CONTROL_OFFSET] = CONFIG_H8300_IDE_ALT; 68 hw->io_ports.ctl_addr = CONFIG_H8300_IDE_ALT;
69 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ; 69 hw->irq = EXT_IRQ0 + CONFIG_H8300_IDE_IRQ;
70 hw->chipset = ide_generic; 70 hw->chipset = ide_generic;
71} 71}
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 164adc3a48a2..b34fd2bde96f 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -560,7 +560,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
560 /* packet command */ 560 /* packet command */
561 spin_lock_irqsave(&ide_lock, flags); 561 spin_lock_irqsave(&ide_lock, flags);
562 hwif->OUTBSYNC(drive, WIN_PACKETCMD, 562 hwif->OUTBSYNC(drive, WIN_PACKETCMD,
563 hwif->io_ports[IDE_COMMAND_OFFSET]); 563 hwif->io_ports.command_addr);
564 ndelay(400); 564 ndelay(400);
565 spin_unlock_irqrestore(&ide_lock, flags); 565 spin_unlock_irqrestore(&ide_lock, flags);
566 566
@@ -952,9 +952,9 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
952 } 952 }
953 953
954 /* ok we fall to pio :/ */ 954 /* ok we fall to pio :/ */
955 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]) & 0x3; 955 ireason = hwif->INB(hwif->io_ports.nsect_addr) & 0x3;
956 lowcyl = hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); 956 lowcyl = hwif->INB(hwif->io_ports.lbam_addr);
957 highcyl = hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]); 957 highcyl = hwif->INB(hwif->io_ports.lbah_addr);
958 958
959 len = lowcyl + (256 * highcyl); 959 len = lowcyl + (256 * highcyl);
960 960
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 6e891bccd052..489079b8ed03 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -465,10 +465,10 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
465 } 465 }
466 466
467 /* Get the number of bytes to transfer */ 467 /* Get the number of bytes to transfer */
468 bcount = (hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]) << 8) | 468 bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
469 hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); 469 hwif->INB(hwif->io_ports.lbam_addr);
470 /* on this interrupt */ 470 /* on this interrupt */
471 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 471 ireason = hwif->INB(hwif->io_ports.nsect_addr);
472 472
473 if (ireason & CD) { 473 if (ireason & CD) {
474 printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__); 474 printk(KERN_ERR "ide-floppy: CoD != 0 in %s\n", __func__);
@@ -539,7 +539,7 @@ static ide_startstop_t idefloppy_transfer_pc(ide_drive_t *drive)
539 "initiated yet DRQ isn't asserted\n"); 539 "initiated yet DRQ isn't asserted\n");
540 return startstop; 540 return startstop;
541 } 541 }
542 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 542 ireason = hwif->INB(hwif->io_ports.nsect_addr);
543 if ((ireason & CD) == 0 || (ireason & IO)) { 543 if ((ireason & CD) == 0 || (ireason & IO)) {
544 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while " 544 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) while "
545 "issuing a packet command\n"); 545 "issuing a packet command\n");
@@ -586,7 +586,7 @@ static ide_startstop_t idefloppy_transfer_pc1(ide_drive_t *drive)
586 "initiated yet DRQ isn't asserted\n"); 586 "initiated yet DRQ isn't asserted\n");
587 return startstop; 587 return startstop;
588 } 588 }
589 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 589 ireason = hwif->INB(hwif->io_ports.nsect_addr);
590 if ((ireason & CD) == 0 || (ireason & IO)) { 590 if ((ireason & CD) == 0 || (ireason & IO)) {
591 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) " 591 printk(KERN_ERR "ide-floppy: (IO,CoD) != (0,1) "
592 "while issuing a packet command\n"); 592 "while issuing a packet command\n");
@@ -692,7 +692,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
692 return ide_started; 692 return ide_started;
693 } else { 693 } else {
694 /* Issue the packet command */ 694 /* Issue the packet command */
695 hwif->OUTB(WIN_PACKETCMD, hwif->io_ports[IDE_COMMAND_OFFSET]); 695 hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr);
696 return (*pkt_xfer_routine) (drive); 696 return (*pkt_xfer_routine) (drive);
697 } 697 }
698} 698}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 0fe89a599275..3a2d8930d17f 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -298,48 +298,43 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq)
298void ide_tf_read(ide_drive_t *drive, ide_task_t *task) 298void ide_tf_read(ide_drive_t *drive, ide_task_t *task)
299{ 299{
300 ide_hwif_t *hwif = drive->hwif; 300 ide_hwif_t *hwif = drive->hwif;
301 struct ide_io_ports *io_ports = &hwif->io_ports;
301 struct ide_taskfile *tf = &task->tf; 302 struct ide_taskfile *tf = &task->tf;
302 303
303 if (task->tf_flags & IDE_TFLAG_IN_DATA) { 304 if (task->tf_flags & IDE_TFLAG_IN_DATA) {
304 u16 data = hwif->INW(hwif->io_ports[IDE_DATA_OFFSET]); 305 u16 data = hwif->INW(io_ports->data_addr);
305 306
306 tf->data = data & 0xff; 307 tf->data = data & 0xff;
307 tf->hob_data = (data >> 8) & 0xff; 308 tf->hob_data = (data >> 8) & 0xff;
308 } 309 }
309 310
310 /* be sure we're looking at the low order bits */ 311 /* be sure we're looking at the low order bits */
311 hwif->OUTB(drive->ctl & ~0x80, hwif->io_ports[IDE_CONTROL_OFFSET]); 312 hwif->OUTB(drive->ctl & ~0x80, io_ports->ctl_addr);
312 313
313 if (task->tf_flags & IDE_TFLAG_IN_NSECT) 314 if (task->tf_flags & IDE_TFLAG_IN_NSECT)
314 tf->nsect = hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]); 315 tf->nsect = hwif->INB(io_ports->nsect_addr);
315 if (task->tf_flags & IDE_TFLAG_IN_LBAL) 316 if (task->tf_flags & IDE_TFLAG_IN_LBAL)
316 tf->lbal = hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]); 317 tf->lbal = hwif->INB(io_ports->lbal_addr);
317 if (task->tf_flags & IDE_TFLAG_IN_LBAM) 318 if (task->tf_flags & IDE_TFLAG_IN_LBAM)
318 tf->lbam = hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]); 319 tf->lbam = hwif->INB(io_ports->lbam_addr);
319 if (task->tf_flags & IDE_TFLAG_IN_LBAH) 320 if (task->tf_flags & IDE_TFLAG_IN_LBAH)
320 tf->lbah = hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]); 321 tf->lbah = hwif->INB(io_ports->lbah_addr);
321 if (task->tf_flags & IDE_TFLAG_IN_DEVICE) 322 if (task->tf_flags & IDE_TFLAG_IN_DEVICE)
322 tf->device = hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]); 323 tf->device = hwif->INB(io_ports->device_addr);
323 324
324 if (task->tf_flags & IDE_TFLAG_LBA48) { 325 if (task->tf_flags & IDE_TFLAG_LBA48) {
325 hwif->OUTB(drive->ctl | 0x80, 326 hwif->OUTB(drive->ctl | 0x80, io_ports->ctl_addr);
326 hwif->io_ports[IDE_CONTROL_OFFSET]);
327 327
328 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) 328 if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE)
329 tf->hob_feature = 329 tf->hob_feature = hwif->INB(io_ports->feature_addr);
330 hwif->INB(hwif->io_ports[IDE_FEATURE_OFFSET]);
331 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 330 if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT)
332 tf->hob_nsect = 331 tf->hob_nsect = hwif->INB(io_ports->nsect_addr);
333 hwif->INB(hwif->io_ports[IDE_NSECTOR_OFFSET]);
334 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 332 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL)
335 tf->hob_lbal = 333 tf->hob_lbal = hwif->INB(io_ports->lbal_addr);
336 hwif->INB(hwif->io_ports[IDE_SECTOR_OFFSET]);
337 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 334 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM)
338 tf->hob_lbam = 335 tf->hob_lbam = hwif->INB(io_ports->lbam_addr);
339 hwif->INB(hwif->io_ports[IDE_LCYL_OFFSET]);
340 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 336 if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH)
341 tf->hob_lbah = 337 tf->hob_lbah = hwif->INB(io_ports->lbah_addr);
342 hwif->INB(hwif->io_ports[IDE_HCYL_OFFSET]);
343 } 338 }
344} 339}
345 340
@@ -454,7 +449,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
454 if (err == ABRT_ERR) { 449 if (err == ABRT_ERR) {
455 if (drive->select.b.lba && 450 if (drive->select.b.lba &&
456 /* some newer drives don't support WIN_SPECIFY */ 451 /* some newer drives don't support WIN_SPECIFY */
457 hwif->INB(hwif->io_ports[IDE_COMMAND_OFFSET]) == 452 hwif->INB(hwif->io_ports.command_addr) ==
458 WIN_SPECIFY) 453 WIN_SPECIFY)
459 return ide_stopped; 454 return ide_stopped;
460 } else if ((err & BAD_CRC) == BAD_CRC) { 455 } else if ((err & BAD_CRC) == BAD_CRC) {
@@ -507,8 +502,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
507 502
508 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) 503 if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT))
509 /* force an abort */ 504 /* force an abort */
510 hwif->OUTB(WIN_IDLEIMMEDIATE, 505 hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr);
511 hwif->io_ports[IDE_COMMAND_OFFSET]);
512 506
513 if (rq->errors >= ERROR_MAX) { 507 if (rq->errors >= ERROR_MAX) {
514 ide_kill_rq(drive, rq); 508 ide_kill_rq(drive, rq);
@@ -1421,7 +1415,7 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
1421 */ 1415 */
1422 do { 1416 do {
1423 if (hwif->irq == irq) { 1417 if (hwif->irq == irq) {
1424 stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 1418 stat = hwif->INB(hwif->io_ports.status_addr);
1425 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { 1419 if (!OK_STAT(stat, READY_STAT, BAD_STAT)) {
1426 /* Try to not flood the console with msgs */ 1420 /* Try to not flood the console with msgs */
1427 static unsigned long last_msgtime, count; 1421 static unsigned long last_msgtime, count;
@@ -1511,7 +1505,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
1511 * Whack the status register, just in case 1505 * Whack the status register, just in case
1512 * we have a leftover pending IRQ. 1506 * we have a leftover pending IRQ.
1513 */ 1507 */
1514 (void) hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 1508 (void) hwif->INB(hwif->io_ports.status_addr);
1515#endif /* CONFIG_BLK_DEV_IDEPCI */ 1509#endif /* CONFIG_BLK_DEV_IDEPCI */
1516 } 1510 }
1517 spin_unlock_irqrestore(&ide_lock, flags); 1511 spin_unlock_irqrestore(&ide_lock, flags);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 9c646bd63549..5425d3038ec2 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -164,7 +164,7 @@ void SELECT_DRIVE (ide_drive_t *drive)
164 if (port_ops && port_ops->selectproc) 164 if (port_ops && port_ops->selectproc)
165 port_ops->selectproc(drive); 165 port_ops->selectproc(drive);
166 166
167 hwif->OUTB(drive->select.all, hwif->io_ports[IDE_SELECT_OFFSET]); 167 hwif->OUTB(drive->select.all, hwif->io_ports.device_addr);
168} 168}
169 169
170void SELECT_MASK (ide_drive_t *drive, int mask) 170void SELECT_MASK (ide_drive_t *drive, int mask)
@@ -194,24 +194,22 @@ static void ata_vlb_sync(ide_drive_t *drive, unsigned long port)
194 */ 194 */
195static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount) 195static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount)
196{ 196{
197 ide_hwif_t *hwif = HWIF(drive); 197 ide_hwif_t *hwif = drive->hwif;
198 u8 io_32bit = drive->io_32bit; 198 struct ide_io_ports *io_ports = &hwif->io_ports;
199 u8 io_32bit = drive->io_32bit;
199 200
200 if (io_32bit) { 201 if (io_32bit) {
201 if (io_32bit & 2) { 202 if (io_32bit & 2) {
202 unsigned long flags; 203 unsigned long flags;
203 204
204 local_irq_save(flags); 205 local_irq_save(flags);
205 ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); 206 ata_vlb_sync(drive, io_ports->nsect_addr);
206 hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, 207 hwif->INSL(io_ports->data_addr, buffer, wcount);
207 wcount);
208 local_irq_restore(flags); 208 local_irq_restore(flags);
209 } else 209 } else
210 hwif->INSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, 210 hwif->INSL(io_ports->data_addr, buffer, wcount);
211 wcount);
212 } else 211 } else
213 hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, 212 hwif->INSW(io_ports->data_addr, buffer, wcount << 1);
214 wcount << 1);
215} 213}
216 214
217/* 215/*
@@ -219,24 +217,22 @@ static void ata_input_data(ide_drive_t *drive, void *buffer, u32 wcount)
219 */ 217 */
220static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount) 218static void ata_output_data(ide_drive_t *drive, void *buffer, u32 wcount)
221{ 219{
222 ide_hwif_t *hwif = HWIF(drive); 220 ide_hwif_t *hwif = drive->hwif;
223 u8 io_32bit = drive->io_32bit; 221 struct ide_io_ports *io_ports = &hwif->io_ports;
222 u8 io_32bit = drive->io_32bit;
224 223
225 if (io_32bit) { 224 if (io_32bit) {
226 if (io_32bit & 2) { 225 if (io_32bit & 2) {
227 unsigned long flags; 226 unsigned long flags;
228 227
229 local_irq_save(flags); 228 local_irq_save(flags);
230 ata_vlb_sync(drive, hwif->io_ports[IDE_NSECTOR_OFFSET]); 229 ata_vlb_sync(drive, io_ports->nsect_addr);
231 hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, 230 hwif->OUTSL(io_ports->data_addr, buffer, wcount);
232 wcount);
233 local_irq_restore(flags); 231 local_irq_restore(flags);
234 } else 232 } else
235 hwif->OUTSL(hwif->io_ports[IDE_DATA_OFFSET], buffer, 233 hwif->OUTSL(io_ports->data_addr, buffer, wcount);
236 wcount);
237 } else 234 } else
238 hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], buffer, 235 hwif->OUTSW(io_ports->data_addr, buffer, wcount << 1);
239 wcount << 1);
240} 236}
241 237
242/* 238/*
@@ -255,14 +251,13 @@ static void atapi_input_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
255#if defined(CONFIG_ATARI) || defined(CONFIG_Q40) 251#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
256 if (MACH_IS_ATARI || MACH_IS_Q40) { 252 if (MACH_IS_ATARI || MACH_IS_Q40) {
257 /* Atari has a byte-swapped IDE interface */ 253 /* Atari has a byte-swapped IDE interface */
258 insw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, 254 insw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2);
259 bytecount / 2);
260 return; 255 return;
261 } 256 }
262#endif /* CONFIG_ATARI || CONFIG_Q40 */ 257#endif /* CONFIG_ATARI || CONFIG_Q40 */
263 hwif->ata_input_data(drive, buffer, bytecount / 4); 258 hwif->ata_input_data(drive, buffer, bytecount / 4);
264 if ((bytecount & 0x03) >= 2) 259 if ((bytecount & 0x03) >= 2)
265 hwif->INSW(hwif->io_ports[IDE_DATA_OFFSET], 260 hwif->INSW(hwif->io_ports.data_addr,
266 (u8 *)buffer + (bytecount & ~0x03), 1); 261 (u8 *)buffer + (bytecount & ~0x03), 1);
267} 262}
268 263
@@ -274,14 +269,13 @@ static void atapi_output_bytes(ide_drive_t *drive, void *buffer, u32 bytecount)
274#if defined(CONFIG_ATARI) || defined(CONFIG_Q40) 269#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
275 if (MACH_IS_ATARI || MACH_IS_Q40) { 270 if (MACH_IS_ATARI || MACH_IS_Q40) {
276 /* Atari has a byte-swapped IDE interface */ 271 /* Atari has a byte-swapped IDE interface */
277 outsw_swapw(hwif->io_ports[IDE_DATA_OFFSET], buffer, 272 outsw_swapw(hwif->io_ports.data_addr, buffer, bytecount / 2);
278 bytecount / 2);
279 return; 273 return;
280 } 274 }
281#endif /* CONFIG_ATARI || CONFIG_Q40 */ 275#endif /* CONFIG_ATARI || CONFIG_Q40 */
282 hwif->ata_output_data(drive, buffer, bytecount / 4); 276 hwif->ata_output_data(drive, buffer, bytecount / 4);
283 if ((bytecount & 0x03) >= 2) 277 if ((bytecount & 0x03) >= 2)
284 hwif->OUTSW(hwif->io_ports[IDE_DATA_OFFSET], 278 hwif->OUTSW(hwif->io_ports.data_addr,
285 (u8 *)buffer + (bytecount & ~0x03), 1); 279 (u8 *)buffer + (bytecount & ~0x03), 1);
286} 280}
287 281
@@ -445,7 +439,7 @@ int drive_is_ready (ide_drive_t *drive)
445 * an interrupt with another pci card/device. We make no assumptions 439 * an interrupt with another pci card/device. We make no assumptions
446 * about possible isa-pnp and pci-pnp issues yet. 440 * about possible isa-pnp and pci-pnp issues yet.
447 */ 441 */
448 if (hwif->io_ports[IDE_CONTROL_OFFSET]) 442 if (hwif->io_ports.ctl_addr)
449 stat = ide_read_altstatus(drive); 443 stat = ide_read_altstatus(drive);
450 else 444 else
451 /* Note: this may clear a pending IRQ!! */ 445 /* Note: this may clear a pending IRQ!! */
@@ -647,7 +641,7 @@ int ide_driveid_update(ide_drive_t *drive)
647 SELECT_MASK(drive, 1); 641 SELECT_MASK(drive, 1);
648 ide_set_irq(drive, 1); 642 ide_set_irq(drive, 1);
649 msleep(50); 643 msleep(50);
650 hwif->OUTB(WIN_IDENTIFY, hwif->io_ports[IDE_COMMAND_OFFSET]); 644 hwif->OUTB(WIN_IDENTIFY, hwif->io_ports.command_addr);
651 timeout = jiffies + WAIT_WORSTCASE; 645 timeout = jiffies + WAIT_WORSTCASE;
652 do { 646 do {
653 if (time_after(jiffies, timeout)) { 647 if (time_after(jiffies, timeout)) {
@@ -696,6 +690,7 @@ int ide_driveid_update(ide_drive_t *drive)
696int ide_config_drive_speed(ide_drive_t *drive, u8 speed) 690int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
697{ 691{
698 ide_hwif_t *hwif = drive->hwif; 692 ide_hwif_t *hwif = drive->hwif;
693 struct ide_io_ports *io_ports = &hwif->io_ports;
699 int error = 0; 694 int error = 0;
700 u8 stat; 695 u8 stat;
701 696
@@ -734,10 +729,9 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
734 SELECT_MASK(drive, 0); 729 SELECT_MASK(drive, 0);
735 udelay(1); 730 udelay(1);
736 ide_set_irq(drive, 0); 731 ide_set_irq(drive, 0);
737 hwif->OUTB(speed, hwif->io_ports[IDE_NSECTOR_OFFSET]); 732 hwif->OUTB(speed, io_ports->nsect_addr);
738 hwif->OUTB(SETFEATURES_XFER, hwif->io_ports[IDE_FEATURE_OFFSET]); 733 hwif->OUTB(SETFEATURES_XFER, io_ports->feature_addr);
739 hwif->OUTBSYNC(drive, WIN_SETFEATURES, 734 hwif->OUTBSYNC(drive, WIN_SETFEATURES, io_ports->command_addr);
740 hwif->io_ports[IDE_COMMAND_OFFSET]);
741 if (drive->quirk_list == 2) 735 if (drive->quirk_list == 2)
742 ide_set_irq(drive, 1); 736 ide_set_irq(drive, 1);
743 737
@@ -845,7 +839,7 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
845 839
846 spin_lock_irqsave(&ide_lock, flags); 840 spin_lock_irqsave(&ide_lock, flags);
847 __ide_set_handler(drive, handler, timeout, expiry); 841 __ide_set_handler(drive, handler, timeout, expiry);
848 hwif->OUTBSYNC(drive, cmd, hwif->io_ports[IDE_COMMAND_OFFSET]); 842 hwif->OUTBSYNC(drive, cmd, hwif->io_ports.command_addr);
849 /* 843 /*
850 * Drive takes 400nS to respond, we must avoid the IRQ being 844 * Drive takes 400nS to respond, we must avoid the IRQ being
851 * serviced before that. 845 * serviced before that.
@@ -1029,6 +1023,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1029 unsigned long flags; 1023 unsigned long flags;
1030 ide_hwif_t *hwif; 1024 ide_hwif_t *hwif;
1031 ide_hwgroup_t *hwgroup; 1025 ide_hwgroup_t *hwgroup;
1026 struct ide_io_ports *io_ports;
1032 const struct ide_port_ops *port_ops; 1027 const struct ide_port_ops *port_ops;
1033 u8 ctl; 1028 u8 ctl;
1034 1029
@@ -1036,6 +1031,8 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1036 hwif = HWIF(drive); 1031 hwif = HWIF(drive);
1037 hwgroup = HWGROUP(drive); 1032 hwgroup = HWGROUP(drive);
1038 1033
1034 io_ports = &hwif->io_ports;
1035
1039 /* We must not reset with running handlers */ 1036 /* We must not reset with running handlers */
1040 BUG_ON(hwgroup->handler != NULL); 1037 BUG_ON(hwgroup->handler != NULL);
1041 1038
@@ -1045,8 +1042,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1045 pre_reset(drive); 1042 pre_reset(drive);
1046 SELECT_DRIVE(drive); 1043 SELECT_DRIVE(drive);
1047 udelay (20); 1044 udelay (20);
1048 hwif->OUTBSYNC(drive, WIN_SRST, 1045 hwif->OUTBSYNC(drive, WIN_SRST, io_ports->command_addr);
1049 hwif->io_ports[IDE_COMMAND_OFFSET]);
1050 ndelay(400); 1046 ndelay(400);
1051 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1047 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
1052 hwgroup->polling = 1; 1048 hwgroup->polling = 1;
@@ -1062,7 +1058,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1062 for (unit = 0; unit < MAX_DRIVES; ++unit) 1058 for (unit = 0; unit < MAX_DRIVES; ++unit)
1063 pre_reset(&hwif->drives[unit]); 1059 pre_reset(&hwif->drives[unit]);
1064 1060
1065 if (hwif->io_ports[IDE_CONTROL_OFFSET] == 0) { 1061 if (io_ports->ctl_addr == 0) {
1066 spin_unlock_irqrestore(&ide_lock, flags); 1062 spin_unlock_irqrestore(&ide_lock, flags);
1067 return ide_stopped; 1063 return ide_stopped;
1068 } 1064 }
@@ -1077,14 +1073,14 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1077 * recover from reset very quickly, saving us the first 50ms wait time. 1073 * recover from reset very quickly, saving us the first 50ms wait time.
1078 */ 1074 */
1079 /* set SRST and nIEN */ 1075 /* set SRST and nIEN */
1080 hwif->OUTBSYNC(drive, drive->ctl|6, hwif->io_ports[IDE_CONTROL_OFFSET]); 1076 hwif->OUTBSYNC(drive, drive->ctl|6, io_ports->ctl_addr);
1081 /* more than enough time */ 1077 /* more than enough time */
1082 udelay(10); 1078 udelay(10);
1083 if (drive->quirk_list == 2) 1079 if (drive->quirk_list == 2)
1084 ctl = drive->ctl; /* clear SRST and nIEN */ 1080 ctl = drive->ctl; /* clear SRST and nIEN */
1085 else 1081 else
1086 ctl = drive->ctl | 2; /* clear SRST, leave nIEN */ 1082 ctl = drive->ctl | 2; /* clear SRST, leave nIEN */
1087 hwif->OUTBSYNC(drive, ctl, hwif->io_ports[IDE_CONTROL_OFFSET]); 1083 hwif->OUTBSYNC(drive, ctl, io_ports->ctl_addr);
1088 /* more than enough time */ 1084 /* more than enough time */
1089 udelay(10); 1085 udelay(10);
1090 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1086 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
@@ -1129,7 +1125,7 @@ int ide_wait_not_busy(ide_hwif_t *hwif, unsigned long timeout)
1129 * about locking issues (2.5 work ?). 1125 * about locking issues (2.5 work ?).
1130 */ 1126 */
1131 mdelay(1); 1127 mdelay(1);
1132 stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 1128 stat = hwif->INB(hwif->io_ports.status_addr);
1133 if ((stat & BUSY_STAT) == 0) 1129 if ((stat & BUSY_STAT) == 0)
1134 return 0; 1130 return 0;
1135 /* 1131 /*
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index ace826f52811..862f02603f9b 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -264,6 +264,7 @@ err_misc:
264static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) 264static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
265{ 265{
266 ide_hwif_t *hwif = HWIF(drive); 266 ide_hwif_t *hwif = HWIF(drive);
267 struct ide_io_ports *io_ports = &hwif->io_ports;
267 int use_altstatus = 0, rc; 268 int use_altstatus = 0, rc;
268 unsigned long timeout; 269 unsigned long timeout;
269 u8 s = 0, a = 0; 270 u8 s = 0, a = 0;
@@ -271,7 +272,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
271 /* take a deep breath */ 272 /* take a deep breath */
272 msleep(50); 273 msleep(50);
273 274
274 if (hwif->io_ports[IDE_CONTROL_OFFSET]) { 275 if (io_ports->ctl_addr) {
275 a = ide_read_altstatus(drive); 276 a = ide_read_altstatus(drive);
276 s = ide_read_status(drive); 277 s = ide_read_status(drive);
277 if ((a ^ s) & ~INDEX_STAT) 278 if ((a ^ s) & ~INDEX_STAT)
@@ -289,10 +290,10 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
289 */ 290 */
290 if ((cmd == WIN_PIDENTIFY)) 291 if ((cmd == WIN_PIDENTIFY))
291 /* disable dma & overlap */ 292 /* disable dma & overlap */
292 hwif->OUTB(0, hwif->io_ports[IDE_FEATURE_OFFSET]); 293 hwif->OUTB(0, io_ports->feature_addr);
293 294
294 /* ask drive for ID */ 295 /* ask drive for ID */
295 hwif->OUTB(cmd, hwif->io_ports[IDE_COMMAND_OFFSET]); 296 hwif->OUTB(cmd, io_ports->command_addr);
296 297
297 timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; 298 timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
298 timeout += jiffies; 299 timeout += jiffies;
@@ -353,7 +354,7 @@ static int try_to_identify (ide_drive_t *drive, u8 cmd)
353 * interrupts during the identify-phase that 354 * interrupts during the identify-phase that
354 * the irq handler isn't expecting. 355 * the irq handler isn't expecting.
355 */ 356 */
356 if (hwif->io_ports[IDE_CONTROL_OFFSET]) { 357 if (hwif->io_ports.ctl_addr) {
357 if (!hwif->irq) { 358 if (!hwif->irq) {
358 autoprobe = 1; 359 autoprobe = 1;
359 cookie = probe_irq_on(); 360 cookie = probe_irq_on();
@@ -393,7 +394,7 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
393 394
394 do { 395 do {
395 msleep(50); 396 msleep(50);
396 stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 397 stat = hwif->INB(hwif->io_ports.status_addr);
397 if ((stat & BUSY_STAT) == 0) 398 if ((stat & BUSY_STAT) == 0)
398 return 0; 399 return 0;
399 } while (time_before(jiffies, timeout)); 400 } while (time_before(jiffies, timeout));
@@ -425,6 +426,7 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
425static int do_probe (ide_drive_t *drive, u8 cmd) 426static int do_probe (ide_drive_t *drive, u8 cmd)
426{ 427{
427 ide_hwif_t *hwif = HWIF(drive); 428 ide_hwif_t *hwif = HWIF(drive);
429 struct ide_io_ports *io_ports = &hwif->io_ports;
428 int rc; 430 int rc;
429 u8 stat; 431 u8 stat;
430 432
@@ -445,7 +447,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
445 msleep(50); 447 msleep(50);
446 SELECT_DRIVE(drive); 448 SELECT_DRIVE(drive);
447 msleep(50); 449 msleep(50);
448 if (hwif->INB(hwif->io_ports[IDE_SELECT_OFFSET]) != drive->select.all && 450 if (hwif->INB(io_ports->device_addr) != drive->select.all &&
449 !drive->present) { 451 !drive->present) {
450 if (drive->select.b.unit != 0) { 452 if (drive->select.b.unit != 0) {
451 /* exit with drive0 selected */ 453 /* exit with drive0 selected */
@@ -476,11 +478,9 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
476 printk(KERN_ERR "%s: no response (status = 0x%02x), " 478 printk(KERN_ERR "%s: no response (status = 0x%02x), "
477 "resetting drive\n", drive->name, stat); 479 "resetting drive\n", drive->name, stat);
478 msleep(50); 480 msleep(50);
479 hwif->OUTB(drive->select.all, 481 hwif->OUTB(drive->select.all, io_ports->device_addr);
480 hwif->io_ports[IDE_SELECT_OFFSET]);
481 msleep(50); 482 msleep(50);
482 hwif->OUTB(WIN_SRST, 483 hwif->OUTB(WIN_SRST, io_ports->command_addr);
483 hwif->io_ports[IDE_COMMAND_OFFSET]);
484 (void)ide_busy_sleep(hwif); 484 (void)ide_busy_sleep(hwif);
485 rc = try_to_identify(drive, cmd); 485 rc = try_to_identify(drive, cmd);
486 } 486 }
@@ -516,7 +516,7 @@ static void enable_nest (ide_drive_t *drive)
516 printk("%s: enabling %s -- ", hwif->name, drive->id->model); 516 printk("%s: enabling %s -- ", hwif->name, drive->id->model);
517 SELECT_DRIVE(drive); 517 SELECT_DRIVE(drive);
518 msleep(50); 518 msleep(50);
519 hwif->OUTB(EXABYTE_ENABLE_NEST, hwif->io_ports[IDE_COMMAND_OFFSET]); 519 hwif->OUTB(EXABYTE_ENABLE_NEST, hwif->io_ports.command_addr);
520 520
521 if (ide_busy_sleep(hwif)) { 521 if (ide_busy_sleep(hwif)) {
522 printk(KERN_CONT "failed (timeout)\n"); 522 printk(KERN_CONT "failed (timeout)\n");
@@ -982,6 +982,7 @@ static void ide_port_setup_devices(ide_hwif_t *hwif)
982 */ 982 */
983static int init_irq (ide_hwif_t *hwif) 983static int init_irq (ide_hwif_t *hwif)
984{ 984{
985 struct ide_io_ports *io_ports = &hwif->io_ports;
985 unsigned int index; 986 unsigned int index;
986 ide_hwgroup_t *hwgroup; 987 ide_hwgroup_t *hwgroup;
987 ide_hwif_t *match = NULL; 988 ide_hwif_t *match = NULL;
@@ -1065,9 +1066,9 @@ static int init_irq (ide_hwif_t *hwif)
1065 if (IDE_CHIPSET_IS_PCI(hwif->chipset)) 1066 if (IDE_CHIPSET_IS_PCI(hwif->chipset))
1066 sa = IRQF_SHARED; 1067 sa = IRQF_SHARED;
1067 1068
1068 if (hwif->io_ports[IDE_CONTROL_OFFSET]) 1069 if (io_ports->ctl_addr)
1069 /* clear nIEN */ 1070 /* clear nIEN */
1070 hwif->OUTB(0x08, hwif->io_ports[IDE_CONTROL_OFFSET]); 1071 hwif->OUTB(0x08, io_ports->ctl_addr);
1071 1072
1072 if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup)) 1073 if (request_irq(hwif->irq,&ide_intr,sa,hwif->name,hwgroup))
1073 goto out_unlink; 1074 goto out_unlink;
@@ -1083,12 +1084,11 @@ static int init_irq (ide_hwif_t *hwif)
1083 1084
1084#if !defined(__mc68000__) 1085#if !defined(__mc68000__)
1085 printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name, 1086 printk("%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
1086 hwif->io_ports[IDE_DATA_OFFSET], 1087 io_ports->data_addr, io_ports->status_addr,
1087 hwif->io_ports[IDE_DATA_OFFSET]+7, 1088 io_ports->ctl_addr, hwif->irq);
1088 hwif->io_ports[IDE_CONTROL_OFFSET], hwif->irq);
1089#else 1089#else
1090 printk("%s at 0x%08lx on irq %d", hwif->name, 1090 printk("%s at 0x%08lx on irq %d", hwif->name,
1091 hwif->io_ports[IDE_DATA_OFFSET], hwif->irq); 1091 io_ports->data_addr, hwif->irq);
1092#endif /* __mc68000__ */ 1092#endif /* __mc68000__ */
1093 if (match) 1093 if (match)
1094 printk(" (%sed with %s)", 1094 printk(" (%sed with %s)",
@@ -1230,8 +1230,8 @@ static int hwif_init(ide_hwif_t *hwif)
1230 int old_irq; 1230 int old_irq;
1231 1231
1232 if (!hwif->irq) { 1232 if (!hwif->irq) {
1233 if (!(hwif->irq = ide_default_irq(hwif->io_ports[IDE_DATA_OFFSET]))) 1233 hwif->irq = ide_default_irq(hwif->io_ports.data_addr);
1234 { 1234 if (!hwif->irq) {
1235 printk("%s: DISABLED, NO IRQ\n", hwif->name); 1235 printk("%s: DISABLED, NO IRQ\n", hwif->name);
1236 return 0; 1236 return 0;
1237 } 1237 }
@@ -1260,7 +1260,8 @@ static int hwif_init(ide_hwif_t *hwif)
1260 * It failed to initialise. Find the default IRQ for 1260 * It failed to initialise. Find the default IRQ for
1261 * this port and try that. 1261 * this port and try that.
1262 */ 1262 */
1263 if (!(hwif->irq = ide_default_irq(hwif->io_ports[IDE_DATA_OFFSET]))) { 1263 hwif->irq = ide_default_irq(hwif->io_ports.data_addr);
1264 if (!hwif->irq) {
1264 printk("%s: Disabled unable to get IRQ %d.\n", 1265 printk("%s: Disabled unable to get IRQ %d.\n",
1265 hwif->name, old_irq); 1266 hwif->name, old_irq);
1266 goto out; 1267 goto out;
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 6752d47db2f8..2275cd22902c 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -849,10 +849,10 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
849 return ide_do_reset(drive); 849 return ide_do_reset(drive);
850 } 850 }
851 /* Get the number of bytes to transfer on this interrupt. */ 851 /* Get the number of bytes to transfer on this interrupt. */
852 bcount = (hwif->INB(hwif->io_ports[IDE_BCOUNTH_OFFSET]) << 8) | 852 bcount = (hwif->INB(hwif->io_ports.lbah_addr) << 8) |
853 hwif->INB(hwif->io_ports[IDE_BCOUNTL_OFFSET]); 853 hwif->INB(hwif->io_ports.lbam_addr);
854 854
855 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 855 ireason = hwif->INB(hwif->io_ports.nsect_addr);
856 856
857 if (ireason & CD) { 857 if (ireason & CD) {
858 printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__); 858 printk(KERN_ERR "ide-tape: CoD != 0 in %s\n", __func__);
@@ -956,12 +956,12 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
956 "yet DRQ isn't asserted\n"); 956 "yet DRQ isn't asserted\n");
957 return startstop; 957 return startstop;
958 } 958 }
959 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 959 ireason = hwif->INB(hwif->io_ports.nsect_addr);
960 while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) { 960 while (retries-- && ((ireason & CD) == 0 || (ireason & IO))) {
961 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing " 961 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while issuing "
962 "a packet command, retrying\n"); 962 "a packet command, retrying\n");
963 udelay(100); 963 udelay(100);
964 ireason = hwif->INB(hwif->io_ports[IDE_IREASON_OFFSET]); 964 ireason = hwif->INB(hwif->io_ports.nsect_addr);
965 if (retries == 0) { 965 if (retries == 0) {
966 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while " 966 printk(KERN_ERR "ide-tape: (IO,CoD != (0,1) while "
967 "issuing a packet command, ignoring\n"); 967 "issuing a packet command, ignoring\n");
@@ -1058,7 +1058,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
1058 IDETAPE_WAIT_CMD, NULL); 1058 IDETAPE_WAIT_CMD, NULL);
1059 return ide_started; 1059 return ide_started;
1060 } else { 1060 } else {
1061 hwif->OUTB(WIN_PACKETCMD, hwif->io_ports[IDE_COMMAND_OFFSET]); 1061 hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr);
1062 return idetape_transfer_pc(drive); 1062 return idetape_transfer_pc(drive);
1063 } 1063 }
1064} 1064}
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index a317ca9c46e5..9f9ad9fb6b89 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -36,6 +36,7 @@
36void ide_tf_load(ide_drive_t *drive, ide_task_t *task) 36void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
37{ 37{
38 ide_hwif_t *hwif = drive->hwif; 38 ide_hwif_t *hwif = drive->hwif;
39 struct ide_io_ports *io_ports = &hwif->io_ports;
39 struct ide_taskfile *tf = &task->tf; 40 struct ide_taskfile *tf = &task->tf;
40 u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 41 u8 HIHI = (task->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
41 42
@@ -59,34 +60,33 @@ void ide_tf_load(ide_drive_t *drive, ide_task_t *task)
59 SELECT_MASK(drive, 0); 60 SELECT_MASK(drive, 0);
60 61
61 if (task->tf_flags & IDE_TFLAG_OUT_DATA) 62 if (task->tf_flags & IDE_TFLAG_OUT_DATA)
62 hwif->OUTW((tf->hob_data << 8) | tf->data, 63 hwif->OUTW((tf->hob_data << 8) | tf->data, io_ports->data_addr);
63 hwif->io_ports[IDE_DATA_OFFSET]);
64 64
65 if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 65 if (task->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
66 hwif->OUTB(tf->hob_feature, hwif->io_ports[IDE_FEATURE_OFFSET]); 66 hwif->OUTB(tf->hob_feature, io_ports->feature_addr);
67 if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 67 if (task->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
68 hwif->OUTB(tf->hob_nsect, hwif->io_ports[IDE_NSECTOR_OFFSET]); 68 hwif->OUTB(tf->hob_nsect, io_ports->nsect_addr);
69 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 69 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAL)
70 hwif->OUTB(tf->hob_lbal, hwif->io_ports[IDE_SECTOR_OFFSET]); 70 hwif->OUTB(tf->hob_lbal, io_ports->lbal_addr);
71 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 71 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAM)
72 hwif->OUTB(tf->hob_lbam, hwif->io_ports[IDE_LCYL_OFFSET]); 72 hwif->OUTB(tf->hob_lbam, io_ports->lbam_addr);
73 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 73 if (task->tf_flags & IDE_TFLAG_OUT_HOB_LBAH)
74 hwif->OUTB(tf->hob_lbah, hwif->io_ports[IDE_HCYL_OFFSET]); 74 hwif->OUTB(tf->hob_lbah, io_ports->lbah_addr);
75 75
76 if (task->tf_flags & IDE_TFLAG_OUT_FEATURE) 76 if (task->tf_flags & IDE_TFLAG_OUT_FEATURE)
77 hwif->OUTB(tf->feature, hwif->io_ports[IDE_FEATURE_OFFSET]); 77 hwif->OUTB(tf->feature, io_ports->feature_addr);
78 if (task->tf_flags & IDE_TFLAG_OUT_NSECT) 78 if (task->tf_flags & IDE_TFLAG_OUT_NSECT)
79 hwif->OUTB(tf->nsect, hwif->io_ports[IDE_NSECTOR_OFFSET]); 79 hwif->OUTB(tf->nsect, io_ports->nsect_addr);
80 if (task->tf_flags & IDE_TFLAG_OUT_LBAL) 80 if (task->tf_flags & IDE_TFLAG_OUT_LBAL)
81 hwif->OUTB(tf->lbal, hwif->io_ports[IDE_SECTOR_OFFSET]); 81 hwif->OUTB(tf->lbal, io_ports->lbal_addr);
82 if (task->tf_flags & IDE_TFLAG_OUT_LBAM) 82 if (task->tf_flags & IDE_TFLAG_OUT_LBAM)
83 hwif->OUTB(tf->lbam, hwif->io_ports[IDE_LCYL_OFFSET]); 83 hwif->OUTB(tf->lbam, io_ports->lbam_addr);
84 if (task->tf_flags & IDE_TFLAG_OUT_LBAH) 84 if (task->tf_flags & IDE_TFLAG_OUT_LBAH)
85 hwif->OUTB(tf->lbah, hwif->io_ports[IDE_HCYL_OFFSET]); 85 hwif->OUTB(tf->lbah, io_ports->lbah_addr);
86 86
87 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE) 87 if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
88 hwif->OUTB((tf->device & HIHI) | drive->select.all, 88 hwif->OUTB((tf->device & HIHI) | drive->select.all,
89 hwif->io_ports[IDE_SELECT_OFFSET]); 89 io_ports->device_addr);
90} 90}
91 91
92int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) 92int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
@@ -155,8 +155,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
155 switch (task->data_phase) { 155 switch (task->data_phase) {
156 case TASKFILE_MULTI_OUT: 156 case TASKFILE_MULTI_OUT:
157 case TASKFILE_OUT: 157 case TASKFILE_OUT:
158 hwif->OUTBSYNC(drive, tf->command, 158 hwif->OUTBSYNC(drive, tf->command, hwif->io_ports.command_addr);
159 hwif->io_ports[IDE_COMMAND_OFFSET]);
160 ndelay(400); /* FIXME */ 159 ndelay(400); /* FIXME */
161 return pre_task_out_intr(drive, task->rq); 160 return pre_task_out_intr(drive, task->rq);
162 case TASKFILE_MULTI_IN: 161 case TASKFILE_MULTI_IN:
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 7bcc4c452255..999584c03d97 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -368,7 +368,7 @@ EXPORT_SYMBOL(ide_unregister);
368 368
369void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw) 369void ide_init_port_hw(ide_hwif_t *hwif, hw_regs_t *hw)
370{ 370{
371 memcpy(hwif->io_ports, hw->io_ports, sizeof(hwif->io_ports)); 371 memcpy(&hwif->io_ports, &hw->io_ports, sizeof(hwif->io_ports));
372 hwif->irq = hw->irq; 372 hwif->irq = hw->irq;
373 hwif->chipset = hw->chipset; 373 hwif->chipset = hw->chipset;
374 hwif->gendev.parent = hw->dev; 374 hwif->gendev.parent = hw->dev;
diff --git a/drivers/ide/legacy/buddha.c b/drivers/ide/legacy/buddha.c
index f51433bce8e4..5c730e4dd735 100644
--- a/drivers/ide/legacy/buddha.c
+++ b/drivers/ide/legacy/buddha.c
@@ -102,7 +102,7 @@ static int buddha_ack_intr(ide_hwif_t *hwif)
102{ 102{
103 unsigned char ch; 103 unsigned char ch;
104 104
105 ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]); 105 ch = z_readb(hwif->io_ports.irq_addr);
106 if (!(ch & 0x80)) 106 if (!(ch & 0x80))
107 return 0; 107 return 0;
108 return 1; 108 return 1;
@@ -112,9 +112,9 @@ static int xsurf_ack_intr(ide_hwif_t *hwif)
112{ 112{
113 unsigned char ch; 113 unsigned char ch;
114 114
115 ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]); 115 ch = z_readb(hwif->io_ports.irq_addr);
116 /* X-Surf needs a 0 written to IRQ register to ensure ISA bit A11 stays at 0 */ 116 /* X-Surf needs a 0 written to IRQ register to ensure ISA bit A11 stays at 0 */
117 z_writeb(0, hwif->io_ports[IDE_IRQ_OFFSET]); 117 z_writeb(0, hwif->io_ports.irq_addr);
118 if (!(ch & 0x80)) 118 if (!(ch & 0x80))
119 return 0; 119 return 0;
120 return 1; 120 return 1;
@@ -128,13 +128,13 @@ static void __init buddha_setup_ports(hw_regs_t *hw, unsigned long base,
128 128
129 memset(hw, 0, sizeof(*hw)); 129 memset(hw, 0, sizeof(*hw));
130 130
131 hw->io_ports[IDE_DATA_OFFSET] = base; 131 hw->io_ports.data_addr = base;
132 132
133 for (i = 1; i < 8; i++) 133 for (i = 1; i < 8; i++)
134 hw->io_ports[i] = base + 2 + i * 4; 134 hw->io_ports_array[i] = base + 2 + i * 4;
135 135
136 hw->io_ports[IDE_CONTROL_OFFSET] = ctl; 136 hw->io_ports.ctl_addr = ctl;
137 hw->io_ports[IDE_IRQ_OFFSET] = irq_port; 137 hw->io_ports.irq_addr = irq_port;
138 138
139 hw->irq = IRQ_AMIGA_PORTS; 139 hw->irq = IRQ_AMIGA_PORTS;
140 hw->ack_intr = ack_intr; 140 hw->ack_intr = ack_intr;
diff --git a/drivers/ide/legacy/falconide.c b/drivers/ide/legacy/falconide.c
index 5c19c422c5cc..56cdaa0eeea5 100644
--- a/drivers/ide/legacy/falconide.c
+++ b/drivers/ide/legacy/falconide.c
@@ -50,12 +50,12 @@ static void __init falconide_setup_ports(hw_regs_t *hw)
50 50
51 memset(hw, 0, sizeof(*hw)); 51 memset(hw, 0, sizeof(*hw));
52 52
53 hw->io_ports[IDE_DATA_OFFSET] = ATA_HD_BASE; 53 hw->io_ports.data_addr = ATA_HD_BASE;
54 54
55 for (i = 1; i < 8; i++) 55 for (i = 1; i < 8; i++)
56 hw->io_ports[i] = ATA_HD_BASE + 1 + i * 4; 56 hw->io_ports_array[i] = ATA_HD_BASE + 1 + i * 4;
57 57
58 hw->io_ports[IDE_CONTROL_OFFSET] = ATA_HD_BASE + ATA_HD_CONTROL; 58 hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL;
59 59
60 hw->irq = IRQ_MFP_IDE; 60 hw->irq = IRQ_MFP_IDE;
61 hw->ack_intr = NULL; 61 hw->ack_intr = NULL;
diff --git a/drivers/ide/legacy/gayle.c b/drivers/ide/legacy/gayle.c
index 61a713bf24b5..a9c2593a898c 100644
--- a/drivers/ide/legacy/gayle.c
+++ b/drivers/ide/legacy/gayle.c
@@ -76,7 +76,7 @@ static int gayle_ack_intr_a4000(ide_hwif_t *hwif)
76{ 76{
77 unsigned char ch; 77 unsigned char ch;
78 78
79 ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]); 79 ch = z_readb(hwif->io_ports.irq_addr);
80 if (!(ch & GAYLE_IRQ_IDE)) 80 if (!(ch & GAYLE_IRQ_IDE))
81 return 0; 81 return 0;
82 return 1; 82 return 1;
@@ -86,11 +86,11 @@ static int gayle_ack_intr_a1200(ide_hwif_t *hwif)
86{ 86{
87 unsigned char ch; 87 unsigned char ch;
88 88
89 ch = z_readb(hwif->io_ports[IDE_IRQ_OFFSET]); 89 ch = z_readb(hwif->io_ports.irq_addr);
90 if (!(ch & GAYLE_IRQ_IDE)) 90 if (!(ch & GAYLE_IRQ_IDE))
91 return 0; 91 return 0;
92 (void)z_readb(hwif->io_ports[IDE_STATUS_OFFSET]); 92 (void)z_readb(hwif->io_ports.status_addr);
93 z_writeb(0x7c, hwif->io_ports[IDE_IRQ_OFFSET]); 93 z_writeb(0x7c, hwif->io_ports.irq_addr);
94 return 1; 94 return 1;
95} 95}
96 96
@@ -102,13 +102,13 @@ static void __init gayle_setup_ports(hw_regs_t *hw, unsigned long base,
102 102
103 memset(hw, 0, sizeof(*hw)); 103 memset(hw, 0, sizeof(*hw));
104 104
105 hw->io_ports[IDE_DATA_OFFSET] = base; 105 hw->io_ports.data_addr = base;
106 106
107 for (i = 1; i < 8; i++) 107 for (i = 1; i < 8; i++)
108 hw->io_ports[i] = base + 2 + i * 4; 108 hw->io_ports_array[i] = base + 2 + i * 4;
109 109
110 hw->io_ports[IDE_CONTROL_OFFSET] = ctl; 110 hw->io_ports.ctl_addr = ctl;
111 hw->io_ports[IDE_IRQ_OFFSET] = irq_port; 111 hw->io_ports.irq_addr = irq_port;
112 112
113 hw->irq = IRQ_AMIGA_PORTS; 113 hw->irq = IRQ_AMIGA_PORTS;
114 hw->ack_intr = ack_intr; 114 hw->ack_intr = ack_intr;
diff --git a/drivers/ide/legacy/ht6560b.c b/drivers/ide/legacy/ht6560b.c
index 9c667a1cf972..4fe516df9f74 100644
--- a/drivers/ide/legacy/ht6560b.c
+++ b/drivers/ide/legacy/ht6560b.c
@@ -157,8 +157,8 @@ static void ht6560b_selectproc (ide_drive_t *drive)
157 /* 157 /*
158 * Set timing for this drive: 158 * Set timing for this drive:
159 */ 159 */
160 outb(timing, hwif->io_ports[IDE_SELECT_OFFSET]); 160 outb(timing, hwif->io_ports.device_addr);
161 (void)inb(hwif->io_ports[IDE_STATUS_OFFSET]); 161 (void)inb(hwif->io_ports.status_addr);
162#ifdef DEBUG 162#ifdef DEBUG
163 printk("ht6560b: %s: select=%#x timing=%#x\n", 163 printk("ht6560b: %s: select=%#x timing=%#x\n",
164 drive->name, select, timing); 164 drive->name, select, timing);
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 8753e2d7e34e..aa2ea3deac85 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -140,8 +140,8 @@ static void ide_detach(struct pcmcia_device *link)
140 140
141 ide_release(link); 141 ide_release(link);
142 142
143 release_region(hwif->io_ports[IDE_CONTROL_OFFSET], 1); 143 release_region(hwif->io_ports.ctl_addr, 1);
144 release_region(hwif->io_ports[IDE_DATA_OFFSET], 8); 144 release_region(hwif->io_ports.data_addr, 8);
145 145
146 kfree(info); 146 kfree(info);
147} /* ide_detach */ 147} /* ide_detach */
diff --git a/drivers/ide/legacy/ide_platform.c b/drivers/ide/legacy/ide_platform.c
index ff5a1c03c92c..8279dc7ca4c0 100644
--- a/drivers/ide/legacy/ide_platform.c
+++ b/drivers/ide/legacy/ide_platform.c
@@ -30,14 +30,14 @@ static void __devinit plat_ide_setup_ports(hw_regs_t *hw,
30 unsigned long port = (unsigned long)base; 30 unsigned long port = (unsigned long)base;
31 int i; 31 int i;
32 32
33 hw->io_ports[IDE_DATA_OFFSET] = port; 33 hw->io_ports.data_addr = port;
34 34
35 port += (1 << pdata->ioport_shift); 35 port += (1 << pdata->ioport_shift);
36 for (i = IDE_ERROR_OFFSET; i <= IDE_STATUS_OFFSET; 36 for (i = 1; i <= 7;
37 i++, port += (1 << pdata->ioport_shift)) 37 i++, port += (1 << pdata->ioport_shift))
38 hw->io_ports[i] = port; 38 hw->io_ports_array[i] = port;
39 39
40 hw->io_ports[IDE_CONTROL_OFFSET] = (unsigned long)ctrl; 40 hw->io_ports.ctl_addr = (unsigned long)ctrl;
41 41
42 hw->irq = irq; 42 hw->irq = irq;
43 43
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c
index 26546d0afc7f..1f527bbf8d96 100644
--- a/drivers/ide/legacy/macide.c
+++ b/drivers/ide/legacy/macide.c
@@ -72,9 +72,9 @@ static void __init macide_setup_ports(hw_regs_t *hw, unsigned long base,
72 memset(hw, 0, sizeof(*hw)); 72 memset(hw, 0, sizeof(*hw));
73 73
74 for (i = 0; i < 8; i++) 74 for (i = 0; i < 8; i++)
75 hw->io_ports[i] = base + i * 4; 75 hw->io_ports_array[i] = base + i * 4;
76 76
77 hw->io_ports[IDE_CONTROL_OFFSET] = base + IDE_CONTROL; 77 hw->io_ports.ctl_addr = base + IDE_CONTROL;
78 78
79 hw->irq = irq; 79 hw->irq = irq;
80 hw->ack_intr = ack_intr; 80 hw->ack_intr = ack_intr;
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c
index f23999dd3d46..a3573d40b4b7 100644
--- a/drivers/ide/legacy/q40ide.c
+++ b/drivers/ide/legacy/q40ide.c
@@ -80,10 +80,10 @@ void q40_ide_setup_ports ( hw_regs_t *hw,
80 for (i = 0; i < IDE_NR_PORTS; i++) { 80 for (i = 0; i < IDE_NR_PORTS; i++) {
81 /* BIG FAT WARNING: 81 /* BIG FAT WARNING:
82 assumption: only DATA port is ever used in 16 bit mode */ 82 assumption: only DATA port is ever used in 16 bit mode */
83 if ( i==0 ) 83 if (i == 0)
84 hw->io_ports[i] = Q40_ISA_IO_W(base + offsets[i]); 84 hw->io_ports_array[i] = Q40_ISA_IO_W(base + offsets[i]);
85 else 85 else
86 hw->io_ports[i] = Q40_ISA_IO_B(base + offsets[i]); 86 hw->io_ports_array[i] = Q40_ISA_IO_B(base + offsets[i]);
87 } 87 }
88 88
89 hw->irq = irq; 89 hw->irq = irq;
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 0f6399408c76..296b9c674bae 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -502,12 +502,11 @@ static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
502static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif) 502static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
503{ 503{
504 int i; 504 int i;
505 unsigned long *ata_regs = hw->io_ports; 505 unsigned long *ata_regs = hw->io_ports_array;
506 506
507 /* FIXME? */ 507 /* FIXME? */
508 for (i = 0; i < IDE_CONTROL_OFFSET; i++) { 508 for (i = 0; i < 8; i++)
509 *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET); 509 *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET);
510 }
511 510
512 /* set the Alternative Status register */ 511 /* set the Alternative Status register */
513 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); 512 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
index 112fe566bb93..68947626e4aa 100644
--- a/drivers/ide/mips/swarm.c
+++ b/drivers/ide/mips/swarm.c
@@ -113,10 +113,10 @@ static int __devinit swarm_ide_probe(struct device *dev)
113 113
114 hwif->chipset = ide_generic; 114 hwif->chipset = ide_generic;
115 115
116 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 116 for (i = 0; i <= 7; i++)
117 hwif->io_ports[i] = 117 hwif->io_ports_array[i] =
118 (unsigned long)(base + ((0x1f0 + i) << 5)); 118 (unsigned long)(base + ((0x1f0 + i) << 5));
119 hwif->io_ports[IDE_CONTROL_OFFSET] = 119 hwif->io_ports.ctl_addr =
120 (unsigned long)(base + (0x3f6 << 5)); 120 (unsigned long)(base + (0x3f6 << 5));
121 hwif->irq = K_INT_GB_IDE; 121 hwif->irq = K_INT_GB_IDE;
122 122
diff --git a/drivers/ide/pci/cmd640.c b/drivers/ide/pci/cmd640.c
index 812027ddaafa..aaf38109eaec 100644
--- a/drivers/ide/pci/cmd640.c
+++ b/drivers/ide/pci/cmd640.c
@@ -347,12 +347,12 @@ static int __init secondary_port_responding(void)
347 347
348 spin_lock_irqsave(&cmd640_lock, flags); 348 spin_lock_irqsave(&cmd640_lock, flags);
349 349
350 outb_p(0x0a, 0x170 + IDE_SELECT_OFFSET); /* select drive0 */ 350 outb_p(0x0a, 0x176); /* select drive0 */
351 udelay(100); 351 udelay(100);
352 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x0a) { 352 if ((inb_p(0x176) & 0x1f) != 0x0a) {
353 outb_p(0x1a, 0x170 + IDE_SELECT_OFFSET); /* select drive1 */ 353 outb_p(0x1a, 0x176); /* select drive1 */
354 udelay(100); 354 udelay(100);
355 if ((inb_p(0x170 + IDE_SELECT_OFFSET) & 0x1f) != 0x1a) { 355 if ((inb_p(0x176) & 0x1f) != 0x1a) {
356 spin_unlock_irqrestore(&cmd640_lock, flags); 356 spin_unlock_irqrestore(&cmd640_lock, flags);
357 return 0; /* nothing responded */ 357 return 0; /* nothing responded */
358 } 358 }
diff --git a/drivers/ide/pci/hpt366.c b/drivers/ide/pci/hpt366.c
index 8c02961d0188..c929dadaaaff 100644
--- a/drivers/ide/pci/hpt366.c
+++ b/drivers/ide/pci/hpt366.c
@@ -760,7 +760,7 @@ static void hpt3xx_maskproc(ide_drive_t *drive, int mask)
760 } 760 }
761 } else 761 } else
762 outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), 762 outb(mask ? (drive->ctl | 2) : (drive->ctl & ~2),
763 hwif->io_ports[IDE_CONTROL_OFFSET]); 763 hwif->io_ports.ctl_addr);
764} 764}
765 765
766/* 766/*
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index e1b0c9a9ab9c..c13e299077ec 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -72,8 +72,8 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
72 base = pci_resource_start(pdev, port * 2) & ~3; 72 base = pci_resource_start(pdev, port * 2) & ~3;
73 dmabase = pci_resource_start(pdev, 4) & ~3; 73 dmabase = pci_resource_start(pdev, 4) & ~3;
74 74
75 superio_ide_status[port] = base + IDE_STATUS_OFFSET; 75 superio_ide_status[port] = base + 7;
76 superio_ide_select[port] = base + IDE_SELECT_OFFSET; 76 superio_ide_select[port] = base + 6;
77 superio_ide_dma_status[port] = dmabase + (!port ? 2 : 0xa); 77 superio_ide_dma_status[port] = dmabase + (!port ? 2 : 0xa);
78 78
79 /* Clear error/interrupt, enable dma */ 79 /* Clear error/interrupt, enable dma */
@@ -231,12 +231,12 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
231 * SELECT_DRIVE() properly during first ide_probe_port(). 231 * SELECT_DRIVE() properly during first ide_probe_port().
232 */ 232 */
233 timeout = 10000; 233 timeout = 10000;
234 outb(12, hwif->io_ports[IDE_CONTROL_OFFSET]); 234 outb(12, hwif->io_ports.ctl_addr);
235 udelay(10); 235 udelay(10);
236 outb(8, hwif->io_ports[IDE_CONTROL_OFFSET]); 236 outb(8, hwif->io_ports.ctl_addr);
237 do { 237 do {
238 udelay(50); 238 udelay(50);
239 stat = hwif->INB(hwif->io_ports[IDE_STATUS_OFFSET]); 239 stat = hwif->INB(hwif->io_ports.status_addr);
240 if (stat == 0xff) 240 if (stat == 0xff)
241 break; 241 break;
242 } while ((stat & BUSY_STAT) && --timeout); 242 } while ((stat & BUSY_STAT) && --timeout);
@@ -244,7 +244,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
244 } 244 }
245 245
246 if (!using_inta) 246 if (!using_inta)
247 hwif->irq = ide_default_irq(hwif->io_ports[IDE_DATA_OFFSET]); 247 hwif->irq = ide_default_irq(hwif->io_ports.data_addr);
248 else if (!hwif->irq && hwif->mate && hwif->mate->irq) 248 else if (!hwif->irq && hwif->mate && hwif->mate->irq)
249 hwif->irq = hwif->mate->irq; /* share IRQ with mate */ 249 hwif->irq = hwif->mate->irq; /* share IRQ with mate */
250 250
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c
index 684160d3cc0e..6e99080497bf 100644
--- a/drivers/ide/pci/opti621.c
+++ b/drivers/ide/pci/opti621.c
@@ -279,7 +279,7 @@ static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio)
279 279
280 spin_lock_irqsave(&opti621_lock, flags); 280 spin_lock_irqsave(&opti621_lock, flags);
281 281
282 reg_base = hwif->io_ports[IDE_DATA_OFFSET]; 282 reg_base = hwif->io_ports.data_addr;
283 283
284 /* allow Register-B */ 284 /* allow Register-B */
285 outb(0xc0, reg_base + CNTRL_REG); 285 outb(0xc0, reg_base + CNTRL_REG);
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index f80306b39299..ad7cdf9060ca 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -334,7 +334,7 @@ static int scc_dma_end(ide_drive_t *drive)
334 334
335 /* errata A308 workaround: Step5 (check data loss) */ 335 /* errata A308 workaround: Step5 (check data loss) */
336 /* We don't check non ide_disk because it is limited to UDMA4 */ 336 /* We don't check non ide_disk because it is limited to UDMA4 */
337 if (!(in_be32((void __iomem *)hwif->io_ports[IDE_ALTSTATUS_OFFSET]) 337 if (!(in_be32((void __iomem *)hwif->io_ports.ctl_addr)
338 & ERR_STAT) && 338 & ERR_STAT) &&
339 drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { 339 drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) {
340 reg = in_be32((void __iomem *)intsts_port); 340 reg = in_be32((void __iomem *)intsts_port);
@@ -438,7 +438,7 @@ static int scc_dma_test_irq(ide_drive_t *drive)
438 u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); 438 u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014);
439 439
440 /* SCC errata A252,A308 workaround: Step4 */ 440 /* SCC errata A252,A308 workaround: Step4 */
441 if ((in_be32((void __iomem *)hwif->io_ports[IDE_ALTSTATUS_OFFSET]) 441 if ((in_be32((void __iomem *)hwif->io_ports.ctl_addr)
442 & ERR_STAT) && 442 & ERR_STAT) &&
443 (int_stat & INTSTS_INTRQ)) 443 (int_stat & INTSTS_INTRQ))
444 return 1; 444 return 1;
@@ -534,8 +534,8 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev,
534 } 534 }
535 535
536 memset(&hw, 0, sizeof(hw)); 536 memset(&hw, 0, sizeof(hw));
537 for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; i++) 537 for (i = 0; i <= 8; i++)
538 hw.io_ports[i] = ports->dma + 0x20 + i * 4; 538 hw.io_ports_array[i] = ports->dma + 0x20 + i * 4;
539 hw.irq = dev->irq; 539 hw.irq = dev->irq;
540 hw.dev = &dev->dev; 540 hw.dev = &dev->dev;
541 hw.chipset = ide_pci; 541 hw.chipset = ide_pci;
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index bfcd2acfede0..63e28f4e6d3b 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -98,28 +98,28 @@ sgiioc4_init_hwif_ports(hw_regs_t * hw, unsigned long data_port,
98 int i; 98 int i;
99 99
100 /* Registers are word (32 bit) aligned */ 100 /* Registers are word (32 bit) aligned */
101 for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) 101 for (i = 0; i <= 7; i++)
102 hw->io_ports[i] = reg + i * 4; 102 hw->io_ports_array[i] = reg + i * 4;
103 103
104 if (ctrl_port) 104 if (ctrl_port)
105 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port; 105 hw->io_ports.ctl_addr = ctrl_port;
106 106
107 if (irq_port) 107 if (irq_port)
108 hw->io_ports[IDE_IRQ_OFFSET] = irq_port; 108 hw->io_ports.irq_addr = irq_port;
109} 109}
110 110
111static void 111static void
112sgiioc4_maskproc(ide_drive_t * drive, int mask) 112sgiioc4_maskproc(ide_drive_t * drive, int mask)
113{ 113{
114 writeb(mask ? (drive->ctl | 2) : (drive->ctl & ~2), 114 writeb(mask ? (drive->ctl | 2) : (drive->ctl & ~2),
115 (void __iomem *)drive->hwif->io_ports[IDE_CONTROL_OFFSET]); 115 (void __iomem *)drive->hwif->io_ports.ctl_addr);
116} 116}
117 117
118static int 118static int
119sgiioc4_checkirq(ide_hwif_t * hwif) 119sgiioc4_checkirq(ide_hwif_t * hwif)
120{ 120{
121 unsigned long intr_addr = 121 unsigned long intr_addr =
122 hwif->io_ports[IDE_IRQ_OFFSET] + IOC4_INTR_REG * 4; 122 hwif->io_ports.irq_addr + IOC4_INTR_REG * 4;
123 123
124 if ((u8)readl((void __iomem *)intr_addr) & 0x03) 124 if ((u8)readl((void __iomem *)intr_addr) & 0x03)
125 return 1; 125 return 1;
@@ -134,8 +134,8 @@ sgiioc4_clearirq(ide_drive_t * drive)
134{ 134{
135 u32 intr_reg; 135 u32 intr_reg;
136 ide_hwif_t *hwif = HWIF(drive); 136 ide_hwif_t *hwif = HWIF(drive);
137 unsigned long other_ir = 137 struct ide_io_ports *io_ports = &hwif->io_ports;
138 hwif->io_ports[IDE_IRQ_OFFSET] + (IOC4_INTR_REG << 2); 138 unsigned long other_ir = io_ports->irq_addr + (IOC4_INTR_REG << 2);
139 139
140 /* Code to check for PCI error conditions */ 140 /* Code to check for PCI error conditions */
141 intr_reg = readl((void __iomem *)other_ir); 141 intr_reg = readl((void __iomem *)other_ir);
@@ -147,12 +147,12 @@ sgiioc4_clearirq(ide_drive_t * drive)
147 * a "clear" status if it got cleared. If not, then spin 147 * a "clear" status if it got cleared. If not, then spin
148 * for a bit trying to clear it. 148 * for a bit trying to clear it.
149 */ 149 */
150 u8 stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); 150 u8 stat = sgiioc4_INB(io_ports->status_addr);
151 int count = 0; 151 int count = 0;
152 stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); 152 stat = sgiioc4_INB(io_ports->status_addr);
153 while ((stat & 0x80) && (count++ < 100)) { 153 while ((stat & 0x80) && (count++ < 100)) {
154 udelay(1); 154 udelay(1);
155 stat = sgiioc4_INB(hwif->io_ports[IDE_STATUS_OFFSET]); 155 stat = sgiioc4_INB(io_ports->status_addr);
156 } 156 }
157 157
158 if (intr_reg & 0x02) { 158 if (intr_reg & 0x02) {
@@ -162,9 +162,9 @@ sgiioc4_clearirq(ide_drive_t * drive)
162 pci_stat_cmd_reg; 162 pci_stat_cmd_reg;
163 163
164 pci_err_addr_low = 164 pci_err_addr_low =
165 readl((void __iomem *)hwif->io_ports[IDE_IRQ_OFFSET]); 165 readl((void __iomem *)io_ports->irq_addr);
166 pci_err_addr_high = 166 pci_err_addr_high =
167 readl((void __iomem *)(hwif->io_ports[IDE_IRQ_OFFSET] + 4)); 167 readl((void __iomem *)(io_ports->irq_addr + 4));
168 pci_read_config_dword(dev, PCI_COMMAND, 168 pci_read_config_dword(dev, PCI_COMMAND,
169 &pci_stat_cmd_reg); 169 &pci_stat_cmd_reg);
170 printk(KERN_ERR 170 printk(KERN_ERR
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c
index 1fffea3211bd..c2040a017f47 100644
--- a/drivers/ide/pci/siimage.c
+++ b/drivers/ide/pci/siimage.c
@@ -622,9 +622,10 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
622 struct pci_dev *dev = to_pci_dev(hwif->dev); 622 struct pci_dev *dev = to_pci_dev(hwif->dev);
623 void *addr = pci_get_drvdata(dev); 623 void *addr = pci_get_drvdata(dev);
624 u8 ch = hwif->channel; 624 u8 ch = hwif->channel;
625 hw_regs_t hw;
626 unsigned long base; 625 unsigned long base;
627 626
627 struct ide_io_ports *io_ports = &hwif->io_ports;
628
628 /* 629 /*
629 * Fill in the basic HWIF bits 630 * Fill in the basic HWIF bits
630 */ 631 */
@@ -638,7 +639,7 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
638 * based I/O 639 * based I/O
639 */ 640 */
640 641
641 memset(&hw, 0, sizeof(hw_regs_t)); 642 memset(io_ports, 0, sizeof(*io_ports));
642 643
643 base = (unsigned long)addr; 644 base = (unsigned long)addr;
644 if (ch) 645 if (ch)
@@ -651,17 +652,15 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
651 * so we can't currently use it sanely since we want to 652 * so we can't currently use it sanely since we want to
652 * use LBA48 mode. 653 * use LBA48 mode.
653 */ 654 */
654 hw.io_ports[IDE_DATA_OFFSET] = base; 655 io_ports->data_addr = base;
655 hw.io_ports[IDE_ERROR_OFFSET] = base + 1; 656 io_ports->error_addr = base + 1;
656 hw.io_ports[IDE_NSECTOR_OFFSET] = base + 2; 657 io_ports->nsect_addr = base + 2;
657 hw.io_ports[IDE_SECTOR_OFFSET] = base + 3; 658 io_ports->lbal_addr = base + 3;
658 hw.io_ports[IDE_LCYL_OFFSET] = base + 4; 659 io_ports->lbam_addr = base + 4;
659 hw.io_ports[IDE_HCYL_OFFSET] = base + 5; 660 io_ports->lbah_addr = base + 5;
660 hw.io_ports[IDE_SELECT_OFFSET] = base + 6; 661 io_ports->device_addr = base + 6;
661 hw.io_ports[IDE_STATUS_OFFSET] = base + 7; 662 io_ports->status_addr = base + 7;
662 hw.io_ports[IDE_CONTROL_OFFSET] = base + 10; 663 io_ports->ctl_addr = base + 10;
663
664 hw.io_ports[IDE_IRQ_OFFSET] = 0;
665 664
666 if (pdev_is_sata(dev)) { 665 if (pdev_is_sata(dev)) {
667 base = (unsigned long)addr; 666 base = (unsigned long)addr;
@@ -672,8 +671,6 @@ static void __devinit init_mmio_iops_siimage(ide_hwif_t *hwif)
672 hwif->sata_scr[SATA_CONTROL_OFFSET] = base + 0x100; 671 hwif->sata_scr[SATA_CONTROL_OFFSET] = base + 0x100;
673 } 672 }
674 673
675 memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports));
676
677 hwif->irq = dev->irq; 674 hwif->irq = dev->irq;
678 675
679 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00); 676 hwif->dma_base = (unsigned long)addr + (ch ? 0x08 : 0x00);
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c
index 15ee38f7ad3f..a8a3138682ef 100644
--- a/drivers/ide/pci/trm290.c
+++ b/drivers/ide/pci/trm290.c
@@ -298,7 +298,7 @@ static void __devinit init_hwif_trm290(ide_hwif_t *hwif)
298 if (old != compat && old_mask == 0xff) { 298 if (old != compat && old_mask == 0xff) {
299 /* leave lower 10 bits untouched */ 299 /* leave lower 10 bits untouched */
300 compat += (next_offset += 0x400); 300 compat += (next_offset += 0x400);
301 hwif->io_ports[IDE_CONTROL_OFFSET] = compat + 2; 301 hwif->io_ports.ctl_addr = compat + 2;
302 outw(compat | 1, hwif->config_data); 302 outw(compat | 1, hwif->config_data);
303 new = inw(hwif->config_data); 303 new = inw(hwif->config_data);
304 printk(KERN_INFO "%s: control basereg workaround: " 304 printk(KERN_INFO "%s: control basereg workaround: "
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c
index 828896f927cc..f0e638dcc3ab 100644
--- a/drivers/ide/ppc/mpc8xx.c
+++ b/drivers/ide/ppc/mpc8xx.c
@@ -131,7 +131,7 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL;
131#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 131#if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
132static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) 132static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
133{ 133{
134 unsigned long *p = hw->io_ports; 134 unsigned long *p = hw->io_ports_array;
135 int i; 135 int i;
136 136
137 typedef struct { 137 typedef struct {
@@ -314,7 +314,7 @@ static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
314#if defined(CONFIG_IDE_EXT_DIRECT) 314#if defined(CONFIG_IDE_EXT_DIRECT)
315static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) 315static int __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
316{ 316{
317 unsigned long *p = hw->io_ports; 317 unsigned long *p = hw->io_ports_array;
318 int i; 318 int i;
319 319
320 u32 ide_phy_base; 320 u32 ide_phy_base;
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c
index 185faa0dce94..3cac6b2790dd 100644
--- a/drivers/ide/ppc/pmac.c
+++ b/drivers/ide/ppc/pmac.c
@@ -417,7 +417,7 @@ static void pmac_ide_kauai_selectproc(ide_drive_t *drive);
417#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */ 417#endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
418 418
419#define PMAC_IDE_REG(x) \ 419#define PMAC_IDE_REG(x) \
420 ((void __iomem *)((drive)->hwif->io_ports[IDE_DATA_OFFSET] + (x))) 420 ((void __iomem *)((drive)->hwif->io_ports.data_addr + (x)))
421 421
422/* 422/*
423 * Apply the timings of the proper unit (master/slave) to the shared 423 * Apply the timings of the proper unit (master/slave) to the shared
@@ -1086,8 +1086,9 @@ static void __devinit pmac_ide_init_ports(hw_regs_t *hw, unsigned long base)
1086 int i; 1086 int i;
1087 1087
1088 for (i = 0; i < 8; ++i) 1088 for (i = 0; i < 8; ++i)
1089 hw->io_ports[i] = base + i * 0x10; 1089 hw->io_ports_array[i] = base + i * 0x10;
1090 hw->io_ports[8] = base + 0x160; 1090
1091 hw->io_ports.ctl_addr = base + 0x160;
1091} 1092}
1092 1093
1093/* 1094/*