diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:53 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-23 13:55:53 -0400 |
commit | 92eb43800a3c1300bd5cb8a2a27e6f2a84f7042e (patch) | |
tree | 6c4b7253d2e799f260d7858b99addd0cdac978d2 | |
parent | 40f095f0138ea5b5971e5128b27e1bb907161149 (diff) |
ide: use ->tf_read in ide_read_error()
* Add IDE_TFLAG_IN_FEATURE taskfile flag for reading Feature
register and handle it in ->tf_read.
* Convert ide_read_error() to use ->tf_read instead of ->INB,
then uninline and export it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/h8300/ide-h8300.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 15 | ||||
-rw-r--r-- | drivers/ide/pci/ns87415.c | 2 | ||||
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 2 | ||||
-rw-r--r-- | include/linux/ide.h | 10 |
5 files changed, 24 insertions, 7 deletions
diff --git a/drivers/ide/h8300/ide-h8300.c b/drivers/ide/h8300/ide-h8300.c index a71433b3d0f3..548a2bf232c9 100644 --- a/drivers/ide/h8300/ide-h8300.c +++ b/drivers/ide/h8300/ide-h8300.c | |||
@@ -100,6 +100,8 @@ static void h8300_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
100 | /* be sure we're looking at the low order bits */ | 100 | /* be sure we're looking at the low order bits */ |
101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 101 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
102 | 102 | ||
103 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | ||
104 | tf->feature = inb(io_ports->feature_addr); | ||
103 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 105 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
104 | tf->nsect = inb(io_ports->nsect_addr); | 106 | tf->nsect = inb(io_ports->nsect_addr); |
105 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 107 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 1983b353eb16..113db8744736 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -241,6 +241,8 @@ static void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
241 | /* be sure we're looking at the low order bits */ | 241 | /* be sure we're looking at the low order bits */ |
242 | tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 242 | tf_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
243 | 243 | ||
244 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | ||
245 | tf->feature = tf_inb(io_ports->feature_addr); | ||
244 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 246 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
245 | tf->nsect = tf_inb(io_ports->nsect_addr); | 247 | tf->nsect = tf_inb(io_ports->nsect_addr); |
246 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 248 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
@@ -390,6 +392,19 @@ void default_hwif_transport(ide_hwif_t *hwif) | |||
390 | hwif->output_data = ata_output_data; | 392 | hwif->output_data = ata_output_data; |
391 | } | 393 | } |
392 | 394 | ||
395 | u8 ide_read_error(ide_drive_t *drive) | ||
396 | { | ||
397 | ide_task_t task; | ||
398 | |||
399 | memset(&task, 0, sizeof(task)); | ||
400 | task.tf_flags = IDE_TFLAG_IN_FEATURE; | ||
401 | |||
402 | drive->hwif->tf_read(drive, &task); | ||
403 | |||
404 | return task.tf.error; | ||
405 | } | ||
406 | EXPORT_SYMBOL_GPL(ide_read_error); | ||
407 | |||
393 | void ide_fix_driveid (struct hd_driveid *id) | 408 | void ide_fix_driveid (struct hd_driveid *id) |
394 | { | 409 | { |
395 | #ifndef __LITTLE_ENDIAN | 410 | #ifndef __LITTLE_ENDIAN |
diff --git a/drivers/ide/pci/ns87415.c b/drivers/ide/pci/ns87415.c index b20e5f01ac89..b9bb8428b35e 100644 --- a/drivers/ide/pci/ns87415.c +++ b/drivers/ide/pci/ns87415.c | |||
@@ -88,6 +88,8 @@ static void superio_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
88 | /* be sure we're looking at the low order bits */ | 88 | /* be sure we're looking at the low order bits */ |
89 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 89 | outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
90 | 90 | ||
91 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | ||
92 | tf->feature = inb(io_ports->feature_addr); | ||
91 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 93 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
92 | tf->nsect = inb(io_ports->nsect_addr); | 94 | tf->nsect = inb(io_ports->nsect_addr); |
93 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 95 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 727eda6db76c..c110f359b03e 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -741,6 +741,8 @@ static void scc_tf_read(ide_drive_t *drive, ide_task_t *task) | |||
741 | /* be sure we're looking at the low order bits */ | 741 | /* be sure we're looking at the low order bits */ |
742 | scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); | 742 | scc_ide_outb(ATA_DEVCTL_OBS & ~0x80, io_ports->ctl_addr); |
743 | 743 | ||
744 | if (task->tf_flags & IDE_TFLAG_IN_FEATURE) | ||
745 | tf->feature = scc_ide_inb(io_ports->feature_addr); | ||
744 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | 746 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) |
745 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); | 747 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); |
746 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | 748 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) |
diff --git a/include/linux/ide.h b/include/linux/ide.h index ae93f89e4448..7890768d03ed 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -889,6 +889,7 @@ enum { | |||
889 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | | 889 | IDE_TFLAG_IN_HOB = IDE_TFLAG_IN_HOB_FEATURE | |
890 | IDE_TFLAG_IN_HOB_NSECT | | 890 | IDE_TFLAG_IN_HOB_NSECT | |
891 | IDE_TFLAG_IN_HOB_LBA, | 891 | IDE_TFLAG_IN_HOB_LBA, |
892 | IDE_TFLAG_IN_FEATURE = (1 << 1), | ||
892 | IDE_TFLAG_IN_NSECT = (1 << 25), | 893 | IDE_TFLAG_IN_NSECT = (1 << 25), |
893 | IDE_TFLAG_IN_LBAL = (1 << 26), | 894 | IDE_TFLAG_IN_LBAL = (1 << 26), |
894 | IDE_TFLAG_IN_LBAM = (1 << 27), | 895 | IDE_TFLAG_IN_LBAM = (1 << 27), |
@@ -956,6 +957,8 @@ void ide_tf_dump(const char *, struct ide_taskfile *); | |||
956 | extern void SELECT_DRIVE(ide_drive_t *); | 957 | extern void SELECT_DRIVE(ide_drive_t *); |
957 | void SELECT_MASK(ide_drive_t *, int); | 958 | void SELECT_MASK(ide_drive_t *, int); |
958 | 959 | ||
960 | u8 ide_read_error(ide_drive_t *); | ||
961 | |||
959 | extern int drive_is_ready(ide_drive_t *); | 962 | extern int drive_is_ready(ide_drive_t *); |
960 | 963 | ||
961 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); | 964 | void ide_pktcmd_tf_load(ide_drive_t *, u32, u16, u8); |
@@ -1357,11 +1360,4 @@ static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive) | |||
1357 | 1360 | ||
1358 | return &hwif->drives[(drive->dn ^ 1) & 1]; | 1361 | return &hwif->drives[(drive->dn ^ 1) & 1]; |
1359 | } | 1362 | } |
1360 | |||
1361 | static inline u8 ide_read_error(ide_drive_t *drive) | ||
1362 | { | ||
1363 | ide_hwif_t *hwif = drive->hwif; | ||
1364 | |||
1365 | return hwif->INB(hwif->io_ports.error_addr); | ||
1366 | } | ||
1367 | #endif /* _IDE_H */ | 1363 | #endif /* _IDE_H */ |