aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-03-31 14:15:31 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-31 14:15:31 -0400
commit35218d1ca808ed19b8c6f079ce91872b3deb2219 (patch)
tree4cc1748e9046ef26701c88b3c6448734f1a7e874 /drivers
parentbac08cee93f9cb37b40ecfa8eaf1f6d8daf3909b (diff)
ide: move data register access out of tf_{read|load}() methods (take 2)
Move IDE_FTFLAG_{IN|OUT}_DATA flag handling out of tf_{read|load}() methods into the only two functions where these flags actually need to be handled: do_rw_taskfile() and ide_complete_cmd()... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/at91_ide.c15
-rw-r--r--drivers/ide/ide-h8300.c15
-rw-r--r--drivers/ide/ide-io-std.c15
-rw-r--r--drivers/ide/ide-io.c12
-rw-r--r--drivers/ide/ide-taskfile.c6
-rw-r--r--drivers/ide/ns87415.c9
-rw-r--r--drivers/ide/scc_pata.c15
-rw-r--r--drivers/ide/tx4938ide.c15
-rw-r--r--drivers/ide/tx4939ide.c15
9 files changed, 17 insertions, 100 deletions
diff --git a/drivers/ide/at91_ide.c b/drivers/ide/at91_ide.c
index b7be66d600f8..04b39ff02d76 100644
--- a/drivers/ide/at91_ide.c
+++ b/drivers/ide/at91_ide.c
@@ -195,12 +195,6 @@ static void at91_ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
195 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 195 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
196 HIHI = 0xFF; 196 HIHI = 0xFF;
197 197
198 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
199 u8 data[2] = { tf->data, tf->hob_data };
200
201 at91_ide_output_data(drive, cmd, data, 2);
202 }
203
204 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 198 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
205 ide_mm_outb(tf->hob_feature, io_ports->feature_addr); 199 ide_mm_outb(tf->hob_feature, io_ports->feature_addr);
206 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 200 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -233,15 +227,6 @@ static void at91_ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
233 struct ide_io_ports *io_ports = &hwif->io_ports; 227 struct ide_io_ports *io_ports = &hwif->io_ports;
234 struct ide_taskfile *tf = &cmd->tf; 228 struct ide_taskfile *tf = &cmd->tf;
235 229
236 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
237 u8 data[2];
238
239 at91_ide_input_data(drive, cmd, data, 2);
240
241 tf->data = data[0];
242 tf->hob_data = data[1];
243 }
244
245 /* be sure we're looking at the low order bits */ 230 /* be sure we're looking at the low order bits */
246 ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 231 ide_mm_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
247 232
diff --git a/drivers/ide/ide-h8300.c b/drivers/ide/ide-h8300.c
index 6cb1785d32e6..8541a9abd7ac 100644
--- a/drivers/ide/ide-h8300.c
+++ b/drivers/ide/ide-h8300.c
@@ -54,12 +54,6 @@ static void h8300_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
54 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 54 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
55 HIHI = 0xFF; 55 HIHI = 0xFF;
56 56
57 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
58 u8 data[2] = { tf->data, tf->hob_data };
59
60 h8300_output_data(drive, cmd, data, 2);
61 }
62
63 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 57 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
64 outb(tf->hob_feature, io_ports->feature_addr); 58 outb(tf->hob_feature, io_ports->feature_addr);
65 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 59 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -93,15 +87,6 @@ static void h8300_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
93 struct ide_io_ports *io_ports = &hwif->io_ports; 87 struct ide_io_ports *io_ports = &hwif->io_ports;
94 struct ide_taskfile *tf = &cmd->tf; 88 struct ide_taskfile *tf = &cmd->tf;
95 89
96 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
97 u8 data[2];
98
99 h8300_input_data(drive, cmd, data, 2);
100
101 tf->data = data[0];
102 tf->hob_data = data[1];
103 }
104
105 /* be sure we're looking at the low order bits */ 90 /* be sure we're looking at the low order bits */
106 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 91 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
107 92
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c
index f06940df255e..7f77bb7db488 100644
--- a/drivers/ide/ide-io-std.c
+++ b/drivers/ide/ide-io-std.c
@@ -90,12 +90,6 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
90 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 90 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
91 HIHI = 0xFF; 91 HIHI = 0xFF;
92 92
93 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
94 u8 data[2] = { tf->data, tf->hob_data };
95
96 ide_output_data(drive, cmd, data, 2);
97 }
98
99 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 93 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
100 tf_outb(tf->hob_feature, io_ports->feature_addr); 94 tf_outb(tf->hob_feature, io_ports->feature_addr);
101 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 95 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -141,15 +135,6 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
141 tf_inb = ide_inb; 135 tf_inb = ide_inb;
142 } 136 }
143 137
144 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
145 u8 data[2];
146
147 ide_input_data(drive, cmd, data, 2);
148
149 tf->data = data[0];
150 tf->hob_data = data[1];
151 }
152
153 /* be sure we're looking at the low order bits */ 138 /* be sure we're looking at the low order bits */
154 tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 139 tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
155 140
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 5b57905a7d71..5589dce88674 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -73,6 +73,7 @@ EXPORT_SYMBOL_GPL(ide_end_rq);
73 73
74void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) 74void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
75{ 75{
76 const struct ide_tp_ops *tp_ops = drive->hwif->tp_ops;
76 struct ide_taskfile *tf = &cmd->tf; 77 struct ide_taskfile *tf = &cmd->tf;
77 struct request *rq = cmd->rq; 78 struct request *rq = cmd->rq;
78 u8 tf_cmd = tf->command; 79 u8 tf_cmd = tf->command;
@@ -80,7 +81,16 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err)
80 tf->error = err; 81 tf->error = err;
81 tf->status = stat; 82 tf->status = stat;
82 83
83 drive->hwif->tp_ops->tf_read(drive, cmd); 84 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
85 u8 data[2];
86
87 tp_ops->input_data(drive, cmd, data, 2);
88
89 tf->data = data[0];
90 tf->hob_data = data[1];
91 }
92
93 tp_ops->tf_read(drive, cmd);
84 94
85 if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) && 95 if ((cmd->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) &&
86 tf_cmd == ATA_CMD_IDLEIMMEDIATE) { 96 tf_cmd == ATA_CMD_IDLEIMMEDIATE) {
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 47f13cd11031..243421ce40d0 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -82,6 +82,12 @@ ide_startstop_t do_rw_taskfile(ide_drive_t *drive, struct ide_cmd *orig_cmd)
82 ide_tf_dump(drive->name, tf); 82 ide_tf_dump(drive->name, tf);
83 tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS); 83 tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
84 SELECT_MASK(drive, 0); 84 SELECT_MASK(drive, 0);
85
86 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
87 u8 data[2] = { tf->data, tf->hob_data };
88
89 tp_ops->output_data(drive, cmd, data, 2);
90 }
85 tp_ops->tf_load(drive, cmd); 91 tp_ops->tf_load(drive, cmd);
86 } 92 }
87 93
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index 7d64bc079fa8..9f6dff83b141 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -66,15 +66,6 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
66 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 66 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
67 struct ide_taskfile *tf = &cmd->tf; 67 struct ide_taskfile *tf = &cmd->tf;
68 68
69 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
70 u8 data[2];
71
72 ide_input_data(drive, cmd, data, 2);
73
74 tf->data = data[0];
75 tf->hob_data = data[1];
76 }
77
78 /* be sure we're looking at the low order bits */ 69 /* be sure we're looking at the low order bits */
79 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 70 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
80 71
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 9c47cbf8c506..97f8e0ef21b1 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -656,12 +656,6 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
656 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 656 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
657 HIHI = 0xFF; 657 HIHI = 0xFF;
658 658
659 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
660 u8 data[2] = { tf->data, tf->hob_data };
661
662 scc_output_data(drive, NULL, data, 2);
663 }
664
665 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 659 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
666 scc_ide_outb(tf->hob_feature, io_ports->feature_addr); 660 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
667 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 661 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -694,15 +688,6 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
694 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 688 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
695 struct ide_taskfile *tf = &cmd->tf; 689 struct ide_taskfile *tf = &cmd->tf;
696 690
697 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
698 u8 data[2];
699
700 scc_input_data(drive, cmd, data, 2);
701
702 tf->data = data[0];
703 tf->hob_data = data[1];
704 }
705
706 /* be sure we're looking at the low order bits */ 691 /* be sure we're looking at the low order bits */
707 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 692 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
708 693
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index c075464308a0..be391b615963 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -92,12 +92,6 @@ static void tx4938ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
92 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 92 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
93 HIHI = 0xFF; 93 HIHI = 0xFF;
94 94
95 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
96 u8 data[2] = { tf->data, tf->hob_data };
97
98 hwif->tp_ops->output_data(drive, cmd, data, 2);
99 }
100
101 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 95 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
102 tx4938ide_outb(tf->hob_feature, io_ports->feature_addr); 96 tx4938ide_outb(tf->hob_feature, io_ports->feature_addr);
103 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 97 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -131,15 +125,6 @@ static void tx4938ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
131 struct ide_io_ports *io_ports = &hwif->io_ports; 125 struct ide_io_ports *io_ports = &hwif->io_ports;
132 struct ide_taskfile *tf = &cmd->tf; 126 struct ide_taskfile *tf = &cmd->tf;
133 127
134 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
135 u8 data[2];
136
137 hwif->tp_ops->input_data(drive, cmd, data, 2);
138
139 tf->data = data[0];
140 tf->hob_data = data[1];
141 }
142
143 /* be sure we're looking at the low order bits */ 128 /* be sure we're looking at the low order bits */
144 tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 129 tx4938ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
145 130
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index c350d0c7ba4a..5a614d1c94f1 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -457,12 +457,6 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
457 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 457 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
458 HIHI = 0xFF; 458 HIHI = 0xFF;
459 459
460 if (cmd->ftf_flags & IDE_FTFLAG_OUT_DATA) {
461 u8 data[2] = { tf->data, tf->hob_data };
462
463 hwif->tp_ops->output_data(drive, cmd, data, 2);
464 }
465
466 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 460 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE)
467 tx4939ide_outb(tf->hob_feature, io_ports->feature_addr); 461 tx4939ide_outb(tf->hob_feature, io_ports->feature_addr);
468 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 462 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT)
@@ -498,15 +492,6 @@ static void tx4939ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
498 struct ide_io_ports *io_ports = &hwif->io_ports; 492 struct ide_io_ports *io_ports = &hwif->io_ports;
499 struct ide_taskfile *tf = &cmd->tf; 493 struct ide_taskfile *tf = &cmd->tf;
500 494
501 if (cmd->ftf_flags & IDE_FTFLAG_IN_DATA) {
502 u8 data[2];
503
504 hwif->tp_ops->input_data(drive, cmd, data, 2);
505
506 tf->data = data[0];
507 tf->hob_data = data[1];
508 }
509
510 /* be sure we're looking at the low order bits */ 495 /* be sure we're looking at the low order bits */
511 tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 496 tx4939ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
512 497