diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:32 -0400 |
commit | 4c3032d8a4d6c97bd6e02bcab524ef2428d89561 (patch) | |
tree | 4528851a9b04282f602cebb6b2ab4bc677b63259 /drivers/ide/legacy | |
parent | 387750c3bf49c22f6189436032145e2131985076 (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/legacy')
-rw-r--r-- | drivers/ide/legacy/buddha.c | 14 | ||||
-rw-r--r-- | drivers/ide/legacy/falconide.c | 6 | ||||
-rw-r--r-- | drivers/ide/legacy/gayle.c | 16 | ||||
-rw-r--r-- | drivers/ide/legacy/ht6560b.c | 4 | ||||
-rw-r--r-- | drivers/ide/legacy/ide-cs.c | 4 | ||||
-rw-r--r-- | drivers/ide/legacy/ide_platform.c | 8 | ||||
-rw-r--r-- | drivers/ide/legacy/macide.c | 4 | ||||
-rw-r--r-- | drivers/ide/legacy/q40ide.c | 6 |
8 files changed, 31 insertions, 31 deletions
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; |