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/pci/sgiioc4.c | |
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/pci/sgiioc4.c')
-rw-r--r-- | drivers/ide/pci/sgiioc4.c | 26 |
1 files changed, 13 insertions, 13 deletions
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 | ||
111 | static void | 111 | static void |
112 | sgiioc4_maskproc(ide_drive_t * drive, int mask) | 112 | sgiioc4_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 | ||
118 | static int | 118 | static int |
119 | sgiioc4_checkirq(ide_hwif_t * hwif) | 119 | sgiioc4_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 |