diff options
-rw-r--r-- | drivers/ide/ide-atapi.c | 21 | ||||
-rw-r--r-- | drivers/ide/ide-io-std.c | 25 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-iops.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-lib.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-probe.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 17 | ||||
-rw-r--r-- | drivers/ide/ns87415.c | 26 | ||||
-rw-r--r-- | drivers/ide/scc_pata.c | 25 | ||||
-rw-r--r-- | include/linux/ide.h | 5 |
10 files changed, 40 insertions, 101 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index a359323d8ffe..7201b176d75b 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -254,15 +254,13 @@ EXPORT_SYMBOL_GPL(ide_cd_get_xferlen); | |||
254 | 254 | ||
255 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) | 255 | void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason) |
256 | { | 256 | { |
257 | struct ide_cmd cmd; | 257 | struct ide_taskfile tf; |
258 | 258 | ||
259 | memset(&cmd, 0, sizeof(cmd)); | 259 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT | |
260 | cmd.valid.in.tf = IDE_VALID_LBAH | IDE_VALID_LBAM | IDE_VALID_NSECT; | 260 | IDE_VALID_LBAM | IDE_VALID_LBAH); |
261 | 261 | ||
262 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 262 | *bcount = (tf.lbah << 8) | tf.lbam; |
263 | 263 | *ireason = tf.nsect & 3; | |
264 | *bcount = (cmd.tf.lbah << 8) | cmd.tf.lbam; | ||
265 | *ireason = cmd.tf.nsect & 3; | ||
266 | } | 264 | } |
267 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); | 265 | EXPORT_SYMBOL_GPL(ide_read_bcount_and_ireason); |
268 | 266 | ||
@@ -452,14 +450,11 @@ static void ide_init_packet_cmd(struct ide_cmd *cmd, u8 valid_tf, | |||
452 | 450 | ||
453 | static u8 ide_read_ireason(ide_drive_t *drive) | 451 | static u8 ide_read_ireason(ide_drive_t *drive) |
454 | { | 452 | { |
455 | struct ide_cmd cmd; | 453 | struct ide_taskfile tf; |
456 | |||
457 | memset(&cmd, 0, sizeof(cmd)); | ||
458 | cmd.valid.in.tf = IDE_VALID_NSECT; | ||
459 | 454 | ||
460 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 455 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_NSECT); |
461 | 456 | ||
462 | return cmd.tf.nsect & 3; | 457 | return tf.nsect & 3; |
463 | } | 458 | } |
464 | 459 | ||
465 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) | 460 | static u8 ide_wait_ireason(ide_drive_t *drive, u8 ireason) |
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c index 481e221b233d..46721c454518 100644 --- a/drivers/ide/ide-io-std.c +++ b/drivers/ide/ide-io-std.c | |||
@@ -112,13 +112,11 @@ void ide_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) | |||
112 | } | 112 | } |
113 | EXPORT_SYMBOL_GPL(ide_tf_load); | 113 | EXPORT_SYMBOL_GPL(ide_tf_load); |
114 | 114 | ||
115 | void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 115 | void ide_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
116 | { | 116 | { |
117 | ide_hwif_t *hwif = drive->hwif; | 117 | ide_hwif_t *hwif = drive->hwif; |
118 | struct ide_io_ports *io_ports = &hwif->io_ports; | 118 | struct ide_io_ports *io_ports = &hwif->io_ports; |
119 | struct ide_taskfile *tf = &cmd->tf; | ||
120 | u8 (*tf_inb)(unsigned long port); | 119 | u8 (*tf_inb)(unsigned long port); |
121 | u8 valid = cmd->valid.in.tf; | ||
122 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; | 120 | u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; |
123 | 121 | ||
124 | if (mmio) | 122 | if (mmio) |
@@ -126,9 +124,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
126 | else | 124 | else |
127 | tf_inb = ide_inb; | 125 | tf_inb = ide_inb; |
128 | 126 | ||
129 | /* be sure we're looking at the low order bits */ | ||
130 | hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); | ||
131 | |||
132 | if (valid & IDE_VALID_ERROR) | 127 | if (valid & IDE_VALID_ERROR) |
133 | tf->error = tf_inb(io_ports->feature_addr); | 128 | tf->error = tf_inb(io_ports->feature_addr); |
134 | if (valid & IDE_VALID_NSECT) | 129 | if (valid & IDE_VALID_NSECT) |
@@ -141,24 +136,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
141 | tf->lbah = tf_inb(io_ports->lbah_addr); | 136 | tf->lbah = tf_inb(io_ports->lbah_addr); |
142 | if (valid & IDE_VALID_DEVICE) | 137 | if (valid & IDE_VALID_DEVICE) |
143 | tf->device = tf_inb(io_ports->device_addr); | 138 | tf->device = tf_inb(io_ports->device_addr); |
144 | |||
145 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
146 | hwif->tp_ops->write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
147 | |||
148 | tf = &cmd->hob; | ||
149 | valid = cmd->valid.in.hob; | ||
150 | |||
151 | if (valid & IDE_VALID_ERROR) | ||
152 | tf->error = tf_inb(io_ports->feature_addr); | ||
153 | if (valid & IDE_VALID_NSECT) | ||
154 | tf->nsect = tf_inb(io_ports->nsect_addr); | ||
155 | if (valid & IDE_VALID_LBAL) | ||
156 | tf->lbal = tf_inb(io_ports->lbal_addr); | ||
157 | if (valid & IDE_VALID_LBAM) | ||
158 | tf->lbam = tf_inb(io_ports->lbam_addr); | ||
159 | if (valid & IDE_VALID_LBAH) | ||
160 | tf->lbah = tf_inb(io_ports->lbah_addr); | ||
161 | } | ||
162 | } | 139 | } |
163 | EXPORT_SYMBOL_GPL(ide_tf_read); | 140 | EXPORT_SYMBOL_GPL(ide_tf_read); |
164 | 141 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index e71c72be7622..2ae02b8d7f8e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -90,7 +90,7 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
90 | cmd->hob.data = data[1]; | 90 | cmd->hob.data = data[1]; |
91 | } | 91 | } |
92 | 92 | ||
93 | tp_ops->tf_read(drive, cmd); | 93 | ide_tf_readback(drive, cmd); |
94 | 94 | ||
95 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && | 95 | if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && |
96 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { | 96 | tf_cmd == ATA_CMD_IDLEIMMEDIATE) { |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index 6f1ed427a484..c19a221b1e18 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -37,14 +37,11 @@ void SELECT_MASK(ide_drive_t *drive, int mask) | |||
37 | 37 | ||
38 | u8 ide_read_error(ide_drive_t *drive) | 38 | u8 ide_read_error(ide_drive_t *drive) |
39 | { | 39 | { |
40 | struct ide_cmd cmd; | 40 | struct ide_taskfile tf; |
41 | |||
42 | memset(&cmd, 0, sizeof(cmd)); | ||
43 | cmd.valid.in.tf = IDE_VALID_ERROR; | ||
44 | 41 | ||
45 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 42 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_ERROR); |
46 | 43 | ||
47 | return cmd.tf.error; | 44 | return tf.error; |
48 | } | 45 | } |
49 | EXPORT_SYMBOL_GPL(ide_read_error); | 46 | EXPORT_SYMBOL_GPL(ide_read_error); |
50 | 47 | ||
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index 6857e6aaf20d..56ff8c46c7d1 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c | |||
@@ -79,7 +79,7 @@ static void ide_dump_sector(ide_drive_t *drive) | |||
79 | } else | 79 | } else |
80 | cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE; | 80 | cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE; |
81 | 81 | ||
82 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 82 | ide_tf_readback(drive, &cmd); |
83 | 83 | ||
84 | if (lba48 || (tf->device & ATA_LBA)) | 84 | if (lba48 || (tf->device & ATA_LBA)) |
85 | printk(KERN_CONT ", LBAsect=%llu", | 85 | printk(KERN_CONT ", LBAsect=%llu", |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 44d7816c1fe9..7f264ed1141b 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -335,14 +335,11 @@ int ide_busy_sleep(ide_hwif_t *hwif, unsigned long timeout, int altstatus) | |||
335 | 335 | ||
336 | static u8 ide_read_device(ide_drive_t *drive) | 336 | static u8 ide_read_device(ide_drive_t *drive) |
337 | { | 337 | { |
338 | struct ide_cmd cmd; | 338 | struct ide_taskfile tf; |
339 | 339 | ||
340 | memset(&cmd, 0, sizeof(cmd)); | 340 | drive->hwif->tp_ops->tf_read(drive, &tf, IDE_VALID_DEVICE); |
341 | cmd.valid.in.tf = IDE_VALID_DEVICE; | ||
342 | 341 | ||
343 | drive->hwif->tp_ops->tf_read(drive, &cmd); | 342 | return tf.device; |
344 | |||
345 | return cmd.tf.device; | ||
346 | } | 343 | } |
347 | 344 | ||
348 | /** | 345 | /** |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index b1806ed46175..4aa6223c11be 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -23,6 +23,23 @@ | |||
23 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | 25 | ||
26 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd) | ||
27 | { | ||
28 | ide_hwif_t *hwif = drive->hwif; | ||
29 | const struct ide_tp_ops *tp_ops = hwif->tp_ops; | ||
30 | |||
31 | /* Be sure we're looking at the low order bytes */ | ||
32 | tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); | ||
33 | |||
34 | tp_ops->tf_read(drive, &cmd->tf, cmd->valid.in.tf); | ||
35 | |||
36 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
37 | tp_ops->write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
38 | |||
39 | tp_ops->tf_read(drive, &cmd->hob, cmd->valid.in.hob); | ||
40 | } | ||
41 | } | ||
42 | |||
26 | void ide_tf_dump(const char *s, struct ide_cmd *cmd) | 43 | void ide_tf_dump(const char *s, struct ide_cmd *cmd) |
27 | { | 44 | { |
28 | #ifdef DEBUG | 45 | #ifdef DEBUG |
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c index f1305f4d2be7..95327a2c2422 100644 --- a/drivers/ide/ns87415.c +++ b/drivers/ide/ns87415.c | |||
@@ -61,14 +61,10 @@ static u8 superio_dma_sff_read_status(ide_hwif_t *hwif) | |||
61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); | 61 | return superio_ide_inb(hwif->dma_base + ATA_DMA_STATUS); |
62 | } | 62 | } |
63 | 63 | ||
64 | static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 64 | static void superio_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, |
65 | u8 valid) | ||
65 | { | 66 | { |
66 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 67 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
67 | struct ide_taskfile *tf = &cmd->tf; | ||
68 | u8 valid = cmd->valid.in.tf; | ||
69 | |||
70 | /* be sure we're looking at the low order bits */ | ||
71 | ide_write_devctl(hwif, ATA_DEVCTL_OBS); | ||
72 | 68 | ||
73 | if (valid & IDE_VALID_ERROR) | 69 | if (valid & IDE_VALID_ERROR) |
74 | tf->error = inb(io_ports->feature_addr); | 70 | tf->error = inb(io_ports->feature_addr); |
@@ -82,24 +78,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
82 | tf->lbah = inb(io_ports->lbah_addr); | 78 | tf->lbah = inb(io_ports->lbah_addr); |
83 | if (valid & IDE_VALID_DEVICE) | 79 | if (valid & IDE_VALID_DEVICE) |
84 | tf->device = superio_ide_inb(io_ports->device_addr); | 80 | tf->device = superio_ide_inb(io_ports->device_addr); |
85 | |||
86 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
87 | ide_write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
88 | |||
89 | tf = &cmd->hob; | ||
90 | valid = cmd->valid.in.hob; | ||
91 | |||
92 | if (valid & IDE_VALID_ERROR) | ||
93 | tf->error = inb(io_ports->feature_addr); | ||
94 | if (valid & IDE_VALID_NSECT) | ||
95 | tf->nsect = inb(io_ports->nsect_addr); | ||
96 | if (valid & IDE_VALID_LBAL) | ||
97 | tf->lbal = inb(io_ports->lbal_addr); | ||
98 | if (valid & IDE_VALID_LBAM) | ||
99 | tf->lbam = inb(io_ports->lbam_addr); | ||
100 | if (valid & IDE_VALID_LBAH) | ||
101 | tf->lbah = inb(io_ports->lbah_addr); | ||
102 | } | ||
103 | } | 81 | } |
104 | 82 | ||
105 | static void ns87415_dev_select(ide_drive_t *drive); | 83 | static void ns87415_dev_select(ide_drive_t *drive); |
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c index 5ecb70cf29dc..5be41f25204f 100644 --- a/drivers/ide/scc_pata.c +++ b/drivers/ide/scc_pata.c | |||
@@ -663,14 +663,9 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) | |||
663 | scc_ide_outb(tf->device, io_ports->device_addr); | 663 | scc_ide_outb(tf->device, io_ports->device_addr); |
664 | } | 664 | } |
665 | 665 | ||
666 | static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | 666 | static void scc_tf_read(ide_drive_t *drive, struct ide_taskfile *tf, u8 valid) |
667 | { | 667 | { |
668 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; | 668 | struct ide_io_ports *io_ports = &drive->hwif->io_ports; |
669 | struct ide_taskfile *tf = &cmd->tf; | ||
670 | u8 valid = cmd->valid.in.tf; | ||
671 | |||
672 | /* be sure we're looking at the low order bits */ | ||
673 | scc_write_devctl(hwif, ATA_DEVCTL_OBS); | ||
674 | 669 | ||
675 | if (valid & IDE_VALID_ERROR) | 670 | if (valid & IDE_VALID_ERROR) |
676 | tf->error = scc_ide_inb(io_ports->feature_addr); | 671 | tf->error = scc_ide_inb(io_ports->feature_addr); |
@@ -684,24 +679,6 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd) | |||
684 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); | 679 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); |
685 | if (valid & IDE_VALID_DEVICE) | 680 | if (valid & IDE_VALID_DEVICE) |
686 | tf->device = scc_ide_inb(io_ports->device_addr); | 681 | tf->device = scc_ide_inb(io_ports->device_addr); |
687 | |||
688 | if (cmd->tf_flags & IDE_TFLAG_LBA48) { | ||
689 | scc_write_devctl(hwif, ATA_HOB | ATA_DEVCTL_OBS); | ||
690 | |||
691 | tf = &cmd->hob; | ||
692 | valid = cmd->valid.in.hob; | ||
693 | |||
694 | if (valid & IDE_VALID_ERROR) | ||
695 | tf->error = scc_ide_inb(io_ports->feature_addr); | ||
696 | if (valid & IDE_VALID_NSECT) | ||
697 | tf->nsect = scc_ide_inb(io_ports->nsect_addr); | ||
698 | if (valid & IDE_VALID_LBAL) | ||
699 | tf->lbal = scc_ide_inb(io_ports->lbal_addr); | ||
700 | if (valid & IDE_VALID_LBAM) | ||
701 | tf->lbam = scc_ide_inb(io_ports->lbam_addr); | ||
702 | if (valid & IDE_VALID_LBAH) | ||
703 | tf->lbah = scc_ide_inb(io_ports->lbah_addr); | ||
704 | } | ||
705 | } | 682 | } |
706 | 683 | ||
707 | static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, | 684 | static void scc_input_data(ide_drive_t *drive, struct ide_cmd *cmd, |
diff --git a/include/linux/ide.h b/include/linux/ide.h index 0ba1c6ab97f8..ff65fffb078f 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h | |||
@@ -625,7 +625,7 @@ struct ide_tp_ops { | |||
625 | 625 | ||
626 | void (*dev_select)(ide_drive_t *); | 626 | void (*dev_select)(ide_drive_t *); |
627 | void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8); | 627 | void (*tf_load)(ide_drive_t *, struct ide_taskfile *, u8); |
628 | void (*tf_read)(ide_drive_t *, struct ide_cmd *); | 628 | void (*tf_read)(ide_drive_t *, struct ide_taskfile *, u8); |
629 | 629 | ||
630 | void (*input_data)(ide_drive_t *, struct ide_cmd *, | 630 | void (*input_data)(ide_drive_t *, struct ide_cmd *, |
631 | void *, unsigned int); | 631 | void *, unsigned int); |
@@ -1124,6 +1124,7 @@ extern int ide_devset_execute(ide_drive_t *drive, | |||
1124 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); | 1124 | void ide_complete_cmd(ide_drive_t *, struct ide_cmd *, u8, u8); |
1125 | int ide_complete_rq(ide_drive_t *, int, unsigned int); | 1125 | int ide_complete_rq(ide_drive_t *, int, unsigned int); |
1126 | 1126 | ||
1127 | void ide_tf_readback(ide_drive_t *drive, struct ide_cmd *cmd); | ||
1127 | void ide_tf_dump(const char *, struct ide_cmd *); | 1128 | void ide_tf_dump(const char *, struct ide_cmd *); |
1128 | 1129 | ||
1129 | void ide_exec_command(ide_hwif_t *, u8); | 1130 | void ide_exec_command(ide_hwif_t *, u8); |
@@ -1133,7 +1134,7 @@ void ide_write_devctl(ide_hwif_t *, u8); | |||
1133 | 1134 | ||
1134 | void ide_dev_select(ide_drive_t *); | 1135 | void ide_dev_select(ide_drive_t *); |
1135 | void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8); | 1136 | void ide_tf_load(ide_drive_t *, struct ide_taskfile *, u8); |
1136 | void ide_tf_read(ide_drive_t *, struct ide_cmd *); | 1137 | void ide_tf_read(ide_drive_t *, struct ide_taskfile *, u8); |
1137 | 1138 | ||
1138 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); | 1139 | void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |
1139 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); | 1140 | void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int); |