diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:52 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:52 -0400 |
commit | 1f6d8a0fd8f6cc5ee2219a8cf9b2da16dfd67397 (patch) | |
tree | 4a858f4525ea67cd325ec370f4823adc1f7c0450 | |
parent | b73c7ee25da6133f97f47ffd3557288417da7c76 (diff) |
ide: add ->read_altstatus method
* Remove ide_read_altstatus() inline helper.
* Add ->read_altstatus method for reading ATA Alternate Status
register and use it instead of ->INB.
There should be no functional changes caused by this patch.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/ide-iops.c | 13 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 4 | ||||
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 6 | ||||
-rw-r--r-- | include/linux/ide.h | 8 |
4 files changed, 20 insertions, 11 deletions
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 086eceaeeaf..e106954e13f 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -119,6 +119,14 @@ static u8 ide_read_status(ide_hwif_t *hwif) | |||
119 | return inb(hwif->io_ports.status_addr); | 119 | return inb(hwif->io_ports.status_addr); |
120 | } | 120 | } |
121 | 121 | ||
122 | static u8 ide_read_altstatus(ide_hwif_t *hwif) | ||
123 | { | ||
124 | if (hwif->host_flags & IDE_HFLAG_MMIO) | ||
125 | return readb((void __iomem *)hwif->io_ports.ctl_addr); | ||
126 | else | ||
127 | return inb(hwif->io_ports.ctl_addr); | ||
128 | } | ||
129 | |||
122 | static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) | 130 | static u8 ide_read_sff_dma_status(ide_hwif_t *hwif) |
123 | { | 131 | { |
124 | if (hwif->host_flags & IDE_HFLAG_MMIO) | 132 | if (hwif->host_flags & IDE_HFLAG_MMIO) |
@@ -349,6 +357,7 @@ void default_hwif_transport(ide_hwif_t *hwif) | |||
349 | { | 357 | { |
350 | hwif->exec_command = ide_exec_command; | 358 | hwif->exec_command = ide_exec_command; |
351 | hwif->read_status = ide_read_status; | 359 | hwif->read_status = ide_read_status; |
360 | hwif->read_altstatus = ide_read_altstatus; | ||
352 | hwif->read_sff_dma_status = ide_read_sff_dma_status; | 361 | hwif->read_sff_dma_status = ide_read_sff_dma_status; |
353 | 362 | ||
354 | hwif->tf_load = ide_tf_load; | 363 | hwif->tf_load = ide_tf_load; |
@@ -511,7 +520,7 @@ int drive_is_ready (ide_drive_t *drive) | |||
511 | * about possible isa-pnp and pci-pnp issues yet. | 520 | * about possible isa-pnp and pci-pnp issues yet. |
512 | */ | 521 | */ |
513 | if (hwif->io_ports.ctl_addr) | 522 | if (hwif->io_ports.ctl_addr) |
514 | stat = ide_read_altstatus(drive); | 523 | stat = hwif->read_altstatus(hwif); |
515 | else | 524 | else |
516 | /* Note: this may clear a pending IRQ!! */ | 525 | /* Note: this may clear a pending IRQ!! */ |
517 | stat = hwif->read_status(hwif); | 526 | stat = hwif->read_status(hwif); |
@@ -724,7 +733,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
724 | } | 733 | } |
725 | 734 | ||
726 | msleep(50); /* give drive a breather */ | 735 | msleep(50); /* give drive a breather */ |
727 | stat = ide_read_altstatus(drive); | 736 | stat = hwif->read_altstatus(hwif); |
728 | } while (stat & BUSY_STAT); | 737 | } while (stat & BUSY_STAT); |
729 | 738 | ||
730 | msleep(50); /* wait for IRQ and DRQ_STAT */ | 739 | msleep(50); /* wait for IRQ and DRQ_STAT */ |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index c42fcfedcbf..fe14d576ef0 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -275,7 +275,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
275 | msleep(50); | 275 | msleep(50); |
276 | 276 | ||
277 | if (io_ports->ctl_addr) { | 277 | if (io_ports->ctl_addr) { |
278 | a = ide_read_altstatus(drive); | 278 | a = hwif->read_altstatus(hwif); |
279 | s = hwif->read_status(hwif); | 279 | s = hwif->read_status(hwif); |
280 | if ((a ^ s) & ~INDEX_STAT) | 280 | if ((a ^ s) & ~INDEX_STAT) |
281 | /* ancient Seagate drives, broken interfaces */ | 281 | /* ancient Seagate drives, broken interfaces */ |
@@ -306,7 +306,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd) | |||
306 | } | 306 | } |
307 | /* give drive a breather */ | 307 | /* give drive a breather */ |
308 | msleep(50); | 308 | msleep(50); |
309 | s = use_altstatus ? ide_read_altstatus(drive) | 309 | s = use_altstatus ? hwif->read_altstatus(hwif) |
310 | : hwif->read_status(hwif); | 310 | : hwif->read_status(hwif); |
311 | } while (s & BUSY_STAT); | 311 | } while (s & BUSY_STAT); |
312 | 312 | ||
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 3d72a5e03f3..a89dc478078 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -139,6 +139,11 @@ static u8 scc_read_status(ide_hwif_t *hwif) | |||
139 | return (u8)in_be32((void *)hwif->io_ports.status_addr); | 139 | return (u8)in_be32((void *)hwif->io_ports.status_addr); |
140 | } | 140 | } |
141 | 141 | ||
142 | static u8 scc_read_altstatus(ide_hwif_t *hwif) | ||
143 | { | ||
144 | return (u8)in_be32((void *)hwif->io_ports.ctl_addr); | ||
145 | } | ||
146 | |||
142 | static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) | 147 | static u8 scc_read_sff_dma_status(ide_hwif_t *hwif) |
143 | { | 148 | { |
144 | return (u8)in_be32((void *)(hwif->dma_base + 4)); | 149 | return (u8)in_be32((void *)(hwif->dma_base + 4)); |
@@ -794,6 +799,7 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif) | |||
794 | 799 | ||
795 | hwif->exec_command = scc_exec_command; | 800 | hwif->exec_command = scc_exec_command; |
796 | hwif->read_status = scc_read_status; | 801 | hwif->read_status = scc_read_status; |
802 | hwif->read_altstatus = scc_read_altstatus; | ||
797 | hwif->read_sff_dma_status = scc_read_sff_dma_status; | 803 | hwif->read_sff_dma_status = scc_read_sff_dma_status; |
798 | 804 | ||
799 | hwif->tf_load = scc_tf_load; | 805 | hwif->tf_load = scc_tf_load; |
diff --git a/include/linux/ide.h b/include/linux/ide.h index a23ae25d7da..e5fa5e868d6 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -491,6 +491,7 @@ typedef struct hwif_s { | |||
491 | 491 | ||
492 | void (*exec_command)(struct hwif_s *, u8); | 492 | void (*exec_command)(struct hwif_s *, u8); |
493 | u8 (*read_status)(struct hwif_s *); | 493 | u8 (*read_status)(struct hwif_s *); |
494 | u8 (*read_altstatus)(struct hwif_s *); | ||
494 | u8 (*read_sff_dma_status)(struct hwif_s *); | 495 | u8 (*read_sff_dma_status)(struct hwif_s *); |
495 | 496 | ||
496 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); | 497 | void (*tf_load)(ide_drive_t *, struct ide_task_s *); |
@@ -1363,13 +1364,6 @@ static inline void ide_set_irq(ide_drive_t *drive, int on) | |||
1363 | hwif->io_ports.ctl_addr); | 1364 | hwif->io_ports.ctl_addr); |
1364 | } | 1365 | } |
1365 | 1366 | ||
1366 | static inline u8 ide_read_altstatus(ide_drive_t *drive) | ||
1367 | { | ||
1368 | ide_hwif_t *hwif = drive->hwif; | ||
1369 | |||
1370 | return hwif->INB(hwif->io_ports.ctl_addr); | ||
1371 | } | ||
1372 | |||
1373 | static inline u8 ide_read_error(ide_drive_t *drive) | 1367 | static inline u8 ide_read_error(ide_drive_t *drive) |
1374 | { | 1368 | { |
1375 | ide_hwif_t *hwif = drive->hwif; | 1369 | ide_hwif_t *hwif = drive->hwif; |