aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:52 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-07-23 13:55:52 -0400
commitb73c7ee25da6133f97f47ffd3557288417da7c76 (patch)
tree0d348c81294d246b8417aff6e24502c93b312505 /drivers/ide/pci
parentc6dfa867bb45f4bff2e48f3bc89ab1d6a7ab4c21 (diff)
ide: add ->read_status method
* Remove ide_read_status() inline helper. * Add ->read_status method for reading ATA Status register and use it instead of ->INB. While at it: * Don't use HWGROUP() macro. There should be no functional changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/ns87415.c8
-rw-r--r--drivers/ide/pci/scc_pata.c6
-rw-r--r--drivers/ide/pci/sgiioc4.c19
3 files changed, 23 insertions, 10 deletions
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c
index 76ce112fd857..b20e5f01ac89 100644
--- a/drivers/ide/pci/ns87415.c
+++ b/drivers/ide/pci/ns87415.c
@@ -63,6 +63,11 @@ static u8 superio_ide_inb (unsigned long port)
63 return inb(port); 63 return inb(port);
64} 64}
65 65
66static u8 superio_read_status(ide_hwif_t *hwif)
67{
68 return superio_ide_inb(hwif->io_ports.status_addr);
69}
70
66static u8 superio_read_sff_dma_status(ide_hwif_t *hwif) 71static u8 superio_read_sff_dma_status(ide_hwif_t *hwif)
67{ 72{
68 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); 73 return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS);
@@ -127,6 +132,7 @@ static void __devinit superio_ide_init_iops (struct hwif_s *hwif)
127 tmp = superio_ide_inb(superio_ide_dma_status[port]); 132 tmp = superio_ide_inb(superio_ide_dma_status[port]);
128 outb(tmp | 0x66, superio_ide_dma_status[port]); 133 outb(tmp | 0x66, superio_ide_dma_status[port]);
129 134
135 hwif->read_status = superio_read_status;
130 hwif->read_sff_dma_status = superio_read_sff_dma_status; 136 hwif->read_sff_dma_status = superio_read_sff_dma_status;
131 137
132 hwif->tf_read = superio_tf_read; 138 hwif->tf_read = superio_tf_read;
@@ -283,7 +289,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
283 outb(8, hwif->io_ports.ctl_addr); 289 outb(8, hwif->io_ports.ctl_addr);
284 do { 290 do {
285 udelay(50); 291 udelay(50);
286 stat = hwif->INB(hwif->io_ports.status_addr); 292 stat = hwif->read_status(hwif);
287 if (stat == 0xff) 293 if (stat == 0xff)
288 break; 294 break;
289 } while ((stat & BUSY_STAT) && --timeout); 295 } while ((stat & BUSY_STAT) && --timeout);
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index d140dfd565a4..3d72a5e03f3d 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -134,6 +134,11 @@ static void scc_exec_command(ide_hwif_t *hwif, u8 cmd)
134 eieio(); 134 eieio();
135} 135}
136 136
137static u8 scc_read_status(ide_hwif_t *hwif)
138{
139 return (u8)in_be32((void *)hwif->io_ports.status_addr);
140}
141
137static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) 142static u8 scc_read_sff_dma_status(ide_hwif_t *hwif)
138{ 143{
139 return (u8)in_be32((void *)(hwif->dma_base + 4)); 144 return (u8)in_be32((void *)(hwif->dma_base + 4));
@@ -788,6 +793,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
788 ide_set_hwifdata(hwif, ports); 793 ide_set_hwifdata(hwif, ports);
789 794
790 hwif->exec_command = scc_exec_command; 795 hwif->exec_command = scc_exec_command;
796 hwif->read_status = scc_read_status;
791 hwif->read_sff_dma_status = scc_read_sff_dma_status; 797 hwif->read_sff_dma_status = scc_read_sff_dma_status;
792 798
793 hwif->tf_load = scc_tf_load; 799 hwif->tf_load = scc_tf_load;
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
index 76afa1f9c599..3005a6334a58 100644
--- a/drivers/ide/pci/sgiioc4.c
+++ b/drivers/ide/pci/sgiioc4.c
@@ -127,7 +127,7 @@ sgiioc4_checkirq(ide_hwif_t * hwif)
127 return 0; 127 return 0;
128} 128}
129 129
130static u8 sgiioc4_INB(unsigned long); 130static u8 sgiioc4_read_status(ide_hwif_t *);
131 131
132static int 132static int
133sgiioc4_clearirq(ide_drive_t * drive) 133sgiioc4_clearirq(ide_drive_t * drive)
@@ -141,18 +141,19 @@ sgiioc4_clearirq(ide_drive_t * drive)
141 intr_reg = readl((void __iomem *)other_ir); 141 intr_reg = readl((void __iomem *)other_ir);
142 if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */ 142 if (intr_reg & 0x03) { /* Valid IOC4-IDE interrupt */
143 /* 143 /*
144 * Using sgiioc4_INB to read the Status register has a side 144 * Using sgiioc4_read_status to read the Status register has a
145 * effect of clearing the interrupt. The first read should 145 * side effect of clearing the interrupt. The first read should
146 * clear it if it is set. The second read should return 146 * clear it if it is set. The second read should return
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(io_ports->status_addr); 150 u8 stat = sgiioc4_read_status(hwif);
151 int count = 0; 151 int count = 0;
152 stat = sgiioc4_INB(io_ports->status_addr); 152
153 stat = sgiioc4_read_status(hwif);
153 while ((stat & 0x80) && (count++ < 100)) { 154 while ((stat & 0x80) && (count++ < 100)) {
154 udelay(1); 155 udelay(1);
155 stat = sgiioc4_INB(io_ports->status_addr); 156 stat = sgiioc4_read_status(hwif);
156 } 157 }
157 158
158 if (intr_reg & 0x02) { 159 if (intr_reg & 0x02) {
@@ -304,9 +305,9 @@ sgiioc4_dma_lost_irq(ide_drive_t * drive)
304 ide_dma_lost_irq(drive); 305 ide_dma_lost_irq(drive);
305} 306}
306 307
307static u8 308static u8 sgiioc4_read_status(ide_hwif_t *hwif)
308sgiioc4_INB(unsigned long port)
309{ 309{
310 unsigned long port = hwif->io_ports.status_addr;
310 u8 reg = (u8) readb((void __iomem *) port); 311 u8 reg = (u8) readb((void __iomem *) port);
311 312
312 if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */ 313 if ((port & 0xFFF) == 0x11C) { /* Status register of IOC4 */
@@ -628,7 +629,7 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
628 /* Initializing chipset IRQ Registers */ 629 /* Initializing chipset IRQ Registers */
629 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4)); 630 writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
630 631
631 hwif->INB = &sgiioc4_INB; 632 hwif->read_status = sgiioc4_read_status;
632 633
633 idx[0] = hwif->index; 634 idx[0] = hwif->index;
634 635