aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-acpi.c3
-rw-r--r--drivers/ide/ide-atapi.c21
-rw-r--r--drivers/ide/ide-disk.c40
-rw-r--r--drivers/ide/ide-disk_proc.c6
-rw-r--r--drivers/ide/ide-io-std.c50
-rw-r--r--drivers/ide/ide-io.c5
-rw-r--r--drivers/ide/ide-ioctls.c10
-rw-r--r--drivers/ide/ide-iops.c4
-rw-r--r--drivers/ide/ide-lib.c11
-rw-r--r--drivers/ide/ide-park.c3
-rw-r--r--drivers/ide/ide-pm.c3
-rw-r--r--drivers/ide/ide-probe.c4
-rw-r--r--drivers/ide/ide-proc.c4
-rw-r--r--drivers/ide/ide-taskfile.c36
-rw-r--r--drivers/ide/ns87415.c25
-rw-r--r--drivers/ide/scc_pata.c50
-rw-r--r--drivers/ide/tx4939ide.c2
17 files changed, 159 insertions, 118 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 12f436951bff..f0db4d349c60 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -319,7 +319,8 @@ static int do_drive_set_taskfiles(ide_drive_t *drive,
319 /* convert GTF to taskfile */ 319 /* convert GTF to taskfile */
320 memset(&cmd, 0, sizeof(cmd)); 320 memset(&cmd, 0, sizeof(cmd));
321 memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF); 321 memcpy(&cmd.tf_array[7], gtf, REGS_PER_GTF);
322 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 322 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
323 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
323 324
324 err = ide_no_data_taskfile(drive, &cmd); 325 err = ide_no_data_taskfile(drive, &cmd);
325 if (err) { 326 if (err) {
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 3e43b889dd64..a359323d8ffe 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -257,8 +257,7 @@ void ide_read_bcount_and_ireason(ide_drive_t *drive, u16 *bcount, u8 *ireason)
257 struct ide_cmd cmd; 257 struct ide_cmd cmd;
258 258
259 memset(&cmd, 0, sizeof(cmd)); 259 memset(&cmd, 0, sizeof(cmd));
260 cmd.tf_flags = IDE_TFLAG_IN_LBAH | IDE_TFLAG_IN_LBAM | 260 cmd.valid.in.tf = IDE_VALID_LBAH | IDE_VALID_LBAM | IDE_VALID_NSECT;
261 IDE_TFLAG_IN_NSECT;
262 261
263 drive->hwif->tp_ops->tf_read(drive, &cmd); 262 drive->hwif->tp_ops->tf_read(drive, &cmd);
264 263
@@ -439,12 +438,12 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
439 return ide_started; 438 return ide_started;
440} 439}
441 440
442static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, 441static void ide_init_packet_cmd(struct ide_cmd *cmd, u8 valid_tf,
443 u16 bcount, u8 dma) 442 u16 bcount, u8 dma)
444{ 443{
445 cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; 444 cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO;
446 cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | 445 cmd->valid.out.tf = IDE_VALID_LBAH | IDE_VALID_LBAM |
447 IDE_TFLAG_OUT_FEATURE | tf_flags; 446 IDE_VALID_FEATURE | valid_tf;
448 cmd->tf.command = ATA_CMD_PACKET; 447 cmd->tf.command = ATA_CMD_PACKET;
449 cmd->tf.feature = dma; /* Use PIO/DMA */ 448 cmd->tf.feature = dma; /* Use PIO/DMA */
450 cmd->tf.lbam = bcount & 0xff; 449 cmd->tf.lbam = bcount & 0xff;
@@ -456,7 +455,7 @@ static u8 ide_read_ireason(ide_drive_t *drive)
456 struct ide_cmd cmd; 455 struct ide_cmd cmd;
457 456
458 memset(&cmd, 0, sizeof(cmd)); 457 memset(&cmd, 0, sizeof(cmd));
459 cmd.tf_flags = IDE_TFLAG_IN_NSECT; 458 cmd.valid.in.tf = IDE_VALID_NSECT;
460 459
461 drive->hwif->tp_ops->tf_read(drive, &cmd); 460 drive->hwif->tp_ops->tf_read(drive, &cmd);
462 461
@@ -588,12 +587,12 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
588 ide_expiry_t *expiry = NULL; 587 ide_expiry_t *expiry = NULL;
589 struct request *rq = hwif->rq; 588 struct request *rq = hwif->rq;
590 unsigned int timeout; 589 unsigned int timeout;
591 u32 tf_flags;
592 u16 bcount; 590 u16 bcount;
591 u8 valid_tf;
593 u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT); 592 u8 drq_int = !!(drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT);
594 593
595 if (dev_is_idecd(drive)) { 594 if (dev_is_idecd(drive)) {
596 tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; 595 valid_tf = IDE_VALID_NSECT | IDE_VALID_LBAL;
597 bcount = ide_cd_get_xferlen(rq); 596 bcount = ide_cd_get_xferlen(rq);
598 expiry = ide_cd_expiry; 597 expiry = ide_cd_expiry;
599 timeout = ATAPI_WAIT_PC; 598 timeout = ATAPI_WAIT_PC;
@@ -607,7 +606,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
607 pc->xferred = 0; 606 pc->xferred = 0;
608 pc->cur_pos = pc->buf; 607 pc->cur_pos = pc->buf;
609 608
610 tf_flags = IDE_TFLAG_OUT_DEVICE; 609 valid_tf = IDE_VALID_DEVICE;
611 bcount = ((drive->media == ide_tape) ? 610 bcount = ((drive->media == ide_tape) ?
612 pc->req_xfer : 611 pc->req_xfer :
613 min(pc->req_xfer, 63 * 1024)); 612 min(pc->req_xfer, 63 * 1024));
@@ -627,7 +626,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
627 : WAIT_TAPE_CMD; 626 : WAIT_TAPE_CMD;
628 } 627 }
629 628
630 ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); 629 ide_init_packet_cmd(cmd, valid_tf, bcount, drive->dma);
631 630
632 (void)do_rw_taskfile(drive, cmd); 631 (void)do_rw_taskfile(drive, cmd);
633 632
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index c998cf8e971a..235263e51dd9 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -97,7 +97,8 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
97 } 97 }
98 98
99 memset(&cmd, 0, sizeof(cmd)); 99 memset(&cmd, 0, sizeof(cmd));
100 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 100 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
101 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
101 102
102 if (drive->dev_flags & IDE_DFLAG_LBA) { 103 if (drive->dev_flags & IDE_DFLAG_LBA) {
103 if (lba48) { 104 if (lba48) {
@@ -116,7 +117,9 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
116 tf->lbam = (u8)(block >> 8); 117 tf->lbam = (u8)(block >> 8);
117 tf->lbah = (u8)(block >> 16); 118 tf->lbah = (u8)(block >> 16);
118 119
119 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 120 cmd.valid.out.hob = IDE_VALID_OUT_HOB;
121 cmd.valid.in.hob = IDE_VALID_IN_HOB;
122 cmd.tf_flags |= IDE_TFLAG_LBA48;
120 } else { 123 } else {
121 tf->nsect = nsectors & 0xff; 124 tf->nsect = nsectors & 0xff;
122 tf->lbal = block; 125 tf->lbal = block;
@@ -220,9 +223,13 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
220 tf->command = ATA_CMD_READ_NATIVE_MAX; 223 tf->command = ATA_CMD_READ_NATIVE_MAX;
221 tf->device = ATA_LBA; 224 tf->device = ATA_LBA;
222 225
223 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 226 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
224 if (lba48) 227 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
225 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 228 if (lba48) {
229 cmd.valid.out.hob = IDE_VALID_OUT_HOB;
230 cmd.valid.in.hob = IDE_VALID_IN_HOB;
231 cmd.tf_flags = IDE_TFLAG_LBA48;
232 }
226 233
227 ide_no_data_taskfile(drive, &cmd); 234 ide_no_data_taskfile(drive, &cmd);
228 235
@@ -260,9 +267,13 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
260 } 267 }
261 tf->device |= ATA_LBA; 268 tf->device |= ATA_LBA;
262 269
263 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 270 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
264 if (lba48) 271 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
265 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); 272 if (lba48) {
273 cmd.valid.out.hob = IDE_VALID_OUT_HOB;
274 cmd.valid.in.hob = IDE_VALID_IN_HOB;
275 cmd.tf_flags = IDE_TFLAG_LBA48;
276 }
266 277
267 ide_no_data_taskfile(drive, &cmd); 278 ide_no_data_taskfile(drive, &cmd);
268 279
@@ -395,8 +406,8 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
395 cmd->tf.command = ATA_CMD_FLUSH_EXT; 406 cmd->tf.command = ATA_CMD_FLUSH_EXT;
396 else 407 else
397 cmd->tf.command = ATA_CMD_FLUSH; 408 cmd->tf.command = ATA_CMD_FLUSH;
398 cmd->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | 409 cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
399 IDE_TFLAG_DYN; 410 cmd->tf_flags = IDE_TFLAG_DYN;
400 cmd->protocol = ATA_PROT_NODATA; 411 cmd->protocol = ATA_PROT_NODATA;
401 412
402 rq->cmd_type = REQ_TYPE_ATA_TASKFILE; 413 rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
@@ -457,7 +468,8 @@ static int ide_do_setfeature(ide_drive_t *drive, u8 feature, u8 nsect)
457 cmd.tf.feature = feature; 468 cmd.tf.feature = feature;
458 cmd.tf.nsect = nsect; 469 cmd.tf.nsect = nsect;
459 cmd.tf.command = ATA_CMD_SET_FEATURES; 470 cmd.tf.command = ATA_CMD_SET_FEATURES;
460 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 471 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
472 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
461 473
462 return ide_no_data_taskfile(drive, &cmd); 474 return ide_no_data_taskfile(drive, &cmd);
463} 475}
@@ -533,7 +545,8 @@ static int do_idedisk_flushcache(ide_drive_t *drive)
533 cmd.tf.command = ATA_CMD_FLUSH_EXT; 545 cmd.tf.command = ATA_CMD_FLUSH_EXT;
534 else 546 else
535 cmd.tf.command = ATA_CMD_FLUSH; 547 cmd.tf.command = ATA_CMD_FLUSH;
536 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 548 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
549 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
537 550
538 return ide_no_data_taskfile(drive, &cmd); 551 return ide_no_data_taskfile(drive, &cmd);
539} 552}
@@ -715,7 +728,8 @@ static int ide_disk_set_doorlock(ide_drive_t *drive, struct gendisk *disk,
715 728
716 memset(&cmd, 0, sizeof(cmd)); 729 memset(&cmd, 0, sizeof(cmd));
717 cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK; 730 cmd.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
718 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 731 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
732 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
719 733
720 ret = ide_no_data_taskfile(drive, &cmd); 734 ret = ide_no_data_taskfile(drive, &cmd);
721 735
diff --git a/drivers/ide/ide-disk_proc.c b/drivers/ide/ide-disk_proc.c
index eaea3bef2073..19f263bf0a9e 100644
--- a/drivers/ide/ide-disk_proc.c
+++ b/drivers/ide/ide-disk_proc.c
@@ -13,7 +13,8 @@ static int smart_enable(ide_drive_t *drive)
13 tf->lbam = ATA_SMART_LBAM_PASS; 13 tf->lbam = ATA_SMART_LBAM_PASS;
14 tf->lbah = ATA_SMART_LBAH_PASS; 14 tf->lbah = ATA_SMART_LBAH_PASS;
15 tf->command = ATA_CMD_SMART; 15 tf->command = ATA_CMD_SMART;
16 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 16 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
17 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
17 18
18 return ide_no_data_taskfile(drive, &cmd); 19 return ide_no_data_taskfile(drive, &cmd);
19} 20}
@@ -29,7 +30,8 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
29 tf->lbam = ATA_SMART_LBAM_PASS; 30 tf->lbam = ATA_SMART_LBAM_PASS;
30 tf->lbah = ATA_SMART_LBAH_PASS; 31 tf->lbah = ATA_SMART_LBAH_PASS;
31 tf->command = ATA_CMD_SMART; 32 tf->command = ATA_CMD_SMART;
32 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 33 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
34 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
33 cmd.protocol = ATA_PROT_PIO; 35 cmd.protocol = ATA_PROT_PIO;
34 36
35 return ide_raw_taskfile(drive, &cmd, buf, 1); 37 return ide_raw_taskfile(drive, &cmd, buf, 1);
diff --git a/drivers/ide/ide-io-std.c b/drivers/ide/ide-io-std.c
index 9cac281d82c4..8b0b2e9ccf5b 100644
--- a/drivers/ide/ide-io-std.c
+++ b/drivers/ide/ide-io-std.c
@@ -91,6 +91,7 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
91 struct ide_io_ports *io_ports = &hwif->io_ports; 91 struct ide_io_ports *io_ports = &hwif->io_ports;
92 struct ide_taskfile *tf = &cmd->tf; 92 struct ide_taskfile *tf = &cmd->tf;
93 void (*tf_outb)(u8 addr, unsigned long port); 93 void (*tf_outb)(u8 addr, unsigned long port);
94 u8 valid = cmd->valid.out.hob;
94 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 95 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
95 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 96 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
96 97
@@ -102,29 +103,31 @@ void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
102 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 103 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
103 HIHI = 0xFF; 104 HIHI = 0xFF;
104 105
105 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 106 if (valid & IDE_VALID_FEATURE)
106 tf_outb(tf->hob_feature, io_ports->feature_addr); 107 tf_outb(tf->hob_feature, io_ports->feature_addr);
107 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 108 if (valid & IDE_VALID_NSECT)
108 tf_outb(tf->hob_nsect, io_ports->nsect_addr); 109 tf_outb(tf->hob_nsect, io_ports->nsect_addr);
109 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 110 if (valid & IDE_VALID_LBAL)
110 tf_outb(tf->hob_lbal, io_ports->lbal_addr); 111 tf_outb(tf->hob_lbal, io_ports->lbal_addr);
111 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 112 if (valid & IDE_VALID_LBAM)
112 tf_outb(tf->hob_lbam, io_ports->lbam_addr); 113 tf_outb(tf->hob_lbam, io_ports->lbam_addr);
113 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 114 if (valid & IDE_VALID_LBAH)
114 tf_outb(tf->hob_lbah, io_ports->lbah_addr); 115 tf_outb(tf->hob_lbah, io_ports->lbah_addr);
115 116
116 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) 117 valid = cmd->valid.out.tf;
118
119 if (valid & IDE_VALID_FEATURE)
117 tf_outb(tf->feature, io_ports->feature_addr); 120 tf_outb(tf->feature, io_ports->feature_addr);
118 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) 121 if (valid & IDE_VALID_NSECT)
119 tf_outb(tf->nsect, io_ports->nsect_addr); 122 tf_outb(tf->nsect, io_ports->nsect_addr);
120 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) 123 if (valid & IDE_VALID_LBAL)
121 tf_outb(tf->lbal, io_ports->lbal_addr); 124 tf_outb(tf->lbal, io_ports->lbal_addr);
122 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) 125 if (valid & IDE_VALID_LBAM)
123 tf_outb(tf->lbam, io_ports->lbam_addr); 126 tf_outb(tf->lbam, io_ports->lbam_addr);
124 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) 127 if (valid & IDE_VALID_LBAH)
125 tf_outb(tf->lbah, io_ports->lbah_addr); 128 tf_outb(tf->lbah, io_ports->lbah_addr);
126 129
127 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) 130 if (valid & IDE_VALID_DEVICE)
128 tf_outb((tf->device & HIHI) | drive->select, 131 tf_outb((tf->device & HIHI) | drive->select,
129 io_ports->device_addr); 132 io_ports->device_addr);
130} 133}
@@ -137,6 +140,7 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
137 struct ide_taskfile *tf = &cmd->tf; 140 struct ide_taskfile *tf = &cmd->tf;
138 void (*tf_outb)(u8 addr, unsigned long port); 141 void (*tf_outb)(u8 addr, unsigned long port);
139 u8 (*tf_inb)(unsigned long port); 142 u8 (*tf_inb)(unsigned long port);
143 u8 valid = cmd->valid.in.tf;
140 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; 144 u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
141 145
142 if (mmio) { 146 if (mmio) {
@@ -150,31 +154,33 @@ void ide_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
150 /* be sure we're looking at the low order bits */ 154 /* be sure we're looking at the low order bits */
151 tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 155 tf_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
152 156
153 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) 157 if (valid & IDE_VALID_ERROR)
154 tf->error = tf_inb(io_ports->feature_addr); 158 tf->error = tf_inb(io_ports->feature_addr);
155 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 159 if (valid & IDE_VALID_NSECT)
156 tf->nsect = tf_inb(io_ports->nsect_addr); 160 tf->nsect = tf_inb(io_ports->nsect_addr);
157 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 161 if (valid & IDE_VALID_LBAL)
158 tf->lbal = tf_inb(io_ports->lbal_addr); 162 tf->lbal = tf_inb(io_ports->lbal_addr);
159 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) 163 if (valid & IDE_VALID_LBAM)
160 tf->lbam = tf_inb(io_ports->lbam_addr); 164 tf->lbam = tf_inb(io_ports->lbam_addr);
161 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) 165 if (valid & IDE_VALID_LBAH)
162 tf->lbah = tf_inb(io_ports->lbah_addr); 166 tf->lbah = tf_inb(io_ports->lbah_addr);
163 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) 167 if (valid & IDE_VALID_DEVICE)
164 tf->device = tf_inb(io_ports->device_addr); 168 tf->device = tf_inb(io_ports->device_addr);
165 169
166 if (cmd->tf_flags & IDE_TFLAG_LBA48) { 170 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
167 tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); 171 tf_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
168 172
169 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) 173 valid = cmd->valid.in.hob;
174
175 if (valid & IDE_VALID_ERROR)
170 tf->hob_error = tf_inb(io_ports->feature_addr); 176 tf->hob_error = tf_inb(io_ports->feature_addr);
171 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 177 if (valid & IDE_VALID_NSECT)
172 tf->hob_nsect = tf_inb(io_ports->nsect_addr); 178 tf->hob_nsect = tf_inb(io_ports->nsect_addr);
173 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 179 if (valid & IDE_VALID_LBAL)
174 tf->hob_lbal = tf_inb(io_ports->lbal_addr); 180 tf->hob_lbal = tf_inb(io_ports->lbal_addr);
175 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 181 if (valid & IDE_VALID_LBAM)
176 tf->hob_lbam = tf_inb(io_ports->lbam_addr); 182 tf->hob_lbam = tf_inb(io_ports->lbam_addr);
177 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 183 if (valid & IDE_VALID_LBAH)
178 tf->hob_lbah = tf_inb(io_ports->lbah_addr); 184 tf->hob_lbah = tf_inb(io_ports->lbah_addr);
179 } 185 }
180} 186}
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 1deb6d29b186..99bb0a9a67e8 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -205,8 +205,9 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
205 return ide_stopped; 205 return ide_stopped;
206 } 206 }
207 207
208 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | 208 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
209 IDE_TFLAG_CUSTOM_HANDLER; 209 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
210 cmd.tf_flags = IDE_TFLAG_CUSTOM_HANDLER;
210 211
211 do_rw_taskfile(drive, &cmd); 212 do_rw_taskfile(drive, &cmd);
212 213
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index 770142767437..b11df4b7998e 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -141,11 +141,12 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
141 tf->lbal = args[1]; 141 tf->lbal = args[1];
142 tf->lbam = 0x4f; 142 tf->lbam = 0x4f;
143 tf->lbah = 0xc2; 143 tf->lbah = 0xc2;
144 cmd.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_IN_NSECT; 144 cmd.valid.out.tf = IDE_VALID_OUT_TF;
145 cmd.valid.in.tf = IDE_VALID_NSECT;
145 } else { 146 } else {
146 tf->nsect = args[1]; 147 tf->nsect = args[1];
147 cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | 148 cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
148 IDE_TFLAG_IN_NSECT; 149 cmd.valid.in.tf = IDE_VALID_NSECT;
149 } 150 }
150 tf->command = args[0]; 151 tf->command = args[0];
151 cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA; 152 cmd.protocol = args[3] ? ATA_PROT_PIO : ATA_PROT_NODATA;
@@ -207,7 +208,8 @@ static int ide_task_ioctl(ide_drive_t *drive, unsigned long arg)
207 memset(&cmd, 0, sizeof(cmd)); 208 memset(&cmd, 0, sizeof(cmd));
208 memcpy(&cmd.tf_array[7], &args[1], 6); 209 memcpy(&cmd.tf_array[7], &args[1], 6);
209 cmd.tf.command = args[0]; 210 cmd.tf.command = args[0];
210 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 211 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
212 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
211 213
212 err = ide_no_data_taskfile(drive, &cmd); 214 err = ide_no_data_taskfile(drive, &cmd);
213 215
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 27bb70ddd459..0fdf0dfb5743 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -40,7 +40,7 @@ u8 ide_read_error(ide_drive_t *drive)
40 struct ide_cmd cmd; 40 struct ide_cmd cmd;
41 41
42 memset(&cmd, 0, sizeof(cmd)); 42 memset(&cmd, 0, sizeof(cmd));
43 cmd.tf_flags = IDE_TFLAG_IN_ERROR; 43 cmd.valid.in.tf = IDE_VALID_ERROR;
44 44
45 drive->hwif->tp_ops->tf_read(drive, &cmd); 45 drive->hwif->tp_ops->tf_read(drive, &cmd);
46 46
@@ -348,7 +348,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
348 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS); 348 tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
349 349
350 memset(&cmd, 0, sizeof(cmd)); 350 memset(&cmd, 0, sizeof(cmd));
351 cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT; 351 cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
352 cmd.tf.feature = SETFEATURES_XFER; 352 cmd.tf.feature = SETFEATURES_XFER;
353 cmd.tf.nsect = speed; 353 cmd.tf.nsect = speed;
354 354
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 217b7fdf2b17..c9ef77c5d62e 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -71,11 +71,12 @@ static void ide_dump_sector(ide_drive_t *drive)
71 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48); 71 u8 lba48 = !!(drive->dev_flags & IDE_DFLAG_LBA48);
72 72
73 memset(&cmd, 0, sizeof(cmd)); 73 memset(&cmd, 0, sizeof(cmd));
74 if (lba48) 74 if (lba48) {
75 cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_HOB_LBA | 75 cmd.valid.in.tf = IDE_VALID_LBA;
76 IDE_TFLAG_LBA48; 76 cmd.valid.in.hob = IDE_VALID_LBA;
77 else 77 cmd.tf_flags = IDE_TFLAG_LBA48;
78 cmd.tf_flags = IDE_TFLAG_IN_LBA | IDE_TFLAG_IN_DEVICE; 78 } else
79 cmd.valid.in.tf = IDE_VALID_LBA | IDE_VALID_DEVICE;
79 80
80 drive->hwif->tp_ops->tf_read(drive, &cmd); 81 drive->hwif->tp_ops->tf_read(drive, &cmd);
81 82
diff --git a/drivers/ide/ide-park.c b/drivers/ide/ide-park.c
index 9490b446519f..310d03f2b5b7 100644
--- a/drivers/ide/ide-park.c
+++ b/drivers/ide/ide-park.c
@@ -74,7 +74,8 @@ ide_startstop_t ide_do_park_unpark(ide_drive_t *drive, struct request *rq)
74 tf->lbal = 0x4c; 74 tf->lbal = 0x4c;
75 tf->lbam = 0x4e; 75 tf->lbam = 0x4e;
76 tf->lbah = 0x55; 76 tf->lbah = 0x55;
77 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 77 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
78 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
78 } else /* cmd == REQ_UNPARK_HEADS */ 79 } else /* cmd == REQ_UNPARK_HEADS */
79 tf->command = ATA_CMD_CHK_POWER; 80 tf->command = ATA_CMD_CHK_POWER;
80 81
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c
index bb7858ebb7d1..0d8a151c0a01 100644
--- a/drivers/ide/ide-pm.c
+++ b/drivers/ide/ide-pm.c
@@ -163,7 +163,8 @@ ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *rq)
163 return ide_stopped; 163 return ide_stopped;
164 164
165out_do_tf: 165out_do_tf:
166 cmd->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 166 cmd->valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
167 cmd->valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
167 cmd->protocol = ATA_PROT_NODATA; 168 cmd->protocol = ATA_PROT_NODATA;
168 169
169 return do_rw_taskfile(drive, cmd); 170 return do_rw_taskfile(drive, cmd);
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index c1ef8c8c785e..6a98d7c1681a 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -287,7 +287,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
287 287
288 memset(&cmd, 0, sizeof(cmd)); 288 memset(&cmd, 0, sizeof(cmd));
289 /* disable DMA & overlap */ 289 /* disable DMA & overlap */
290 cmd.tf_flags = IDE_TFLAG_OUT_FEATURE; 290 cmd.valid.out.tf = IDE_VALID_FEATURE;
291 291
292 tp_ops->tf_load(drive, &cmd); 292 tp_ops->tf_load(drive, &cmd);
293 } 293 }
@@ -340,7 +340,7 @@ static u8 ide_read_device(ide_drive_t *drive)
340 struct ide_cmd cmd; 340 struct ide_cmd cmd;
341 341
342 memset(&cmd, 0, sizeof(cmd)); 342 memset(&cmd, 0, sizeof(cmd));
343 cmd.tf_flags = IDE_TFLAG_IN_DEVICE; 343 cmd.valid.in.tf = IDE_VALID_DEVICE;
344 344
345 drive->hwif->tp_ops->tf_read(drive, &cmd); 345 drive->hwif->tp_ops->tf_read(drive, &cmd);
346 346
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 10a88bf3eefa..3242698832a4 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -204,8 +204,8 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
204 cmd.tf.command = ATA_CMD_SET_FEATURES; 204 cmd.tf.command = ATA_CMD_SET_FEATURES;
205 cmd.tf.feature = SETFEATURES_XFER; 205 cmd.tf.feature = SETFEATURES_XFER;
206 cmd.tf.nsect = (u8)arg; 206 cmd.tf.nsect = (u8)arg;
207 cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | 207 cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
208 IDE_TFLAG_IN_NSECT; 208 cmd.valid.in.tf = IDE_VALID_NSECT;
209 209
210 err = ide_no_data_taskfile(drive, &cmd); 210 err = ide_no_data_taskfile(drive, &cmd);
211 211
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 243421ce40d0..dc84f8bde52a 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -47,7 +47,8 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
47 cmd.tf.command = ATA_CMD_ID_ATA; 47 cmd.tf.command = ATA_CMD_ID_ATA;
48 else 48 else
49 cmd.tf.command = ATA_CMD_ID_ATAPI; 49 cmd.tf.command = ATA_CMD_ID_ATAPI;
50 cmd.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 50 cmd.valid.out.tf = IDE_VALID_OUT_TF | IDE_VALID_DEVICE;
51 cmd.valid.in.tf = IDE_VALID_IN_TF | IDE_VALID_DEVICE;
51 cmd.protocol = ATA_PROT_PIO; 52 cmd.protocol = ATA_PROT_PIO;
52 53
53 return ide_raw_taskfile(drive, &cmd, buf, 1); 54 return ide_raw_taskfile(drive, &cmd, buf, 1);
@@ -494,11 +495,14 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
494 memcpy(&cmd.tf_array[6], req_task->io_ports, 495 memcpy(&cmd.tf_array[6], req_task->io_ports,
495 HDIO_DRIVE_TASK_HDR_SIZE); 496 HDIO_DRIVE_TASK_HDR_SIZE);
496 497
497 cmd.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | 498 cmd.valid.out.tf = IDE_VALID_DEVICE;
498 IDE_TFLAG_IN_TF; 499 cmd.valid.in.tf = IDE_VALID_DEVICE | IDE_VALID_IN_TF;
500 cmd.tf_flags = IDE_TFLAG_IO_16BIT;
499 501
500 if (drive->dev_flags & IDE_DFLAG_LBA48) 502 if (drive->dev_flags & IDE_DFLAG_LBA48) {
501 cmd.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); 503 cmd.tf_flags |= IDE_TFLAG_LBA48;
504 cmd.valid.in.hob = IDE_VALID_IN_HOB;
505 }
502 506
503 if (req_task->out_flags.all) { 507 if (req_task->out_flags.all) {
504 cmd.ftf_flags |= IDE_FTFLAG_FLAGGED; 508 cmd.ftf_flags |= IDE_FTFLAG_FLAGGED;
@@ -507,28 +511,28 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg)
507 cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA; 511 cmd.ftf_flags |= IDE_FTFLAG_OUT_DATA;
508 512
509 if (req_task->out_flags.b.nsector_hob) 513 if (req_task->out_flags.b.nsector_hob)
510 cmd.tf_flags |= IDE_TFLAG_OUT_HOB_NSECT; 514 cmd.valid.out.hob |= IDE_VALID_NSECT;
511 if (req_task->out_flags.b.sector_hob) 515 if (req_task->out_flags.b.sector_hob)
512 cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAL; 516 cmd.valid.out.hob |= IDE_VALID_LBAL;
513 if (req_task->out_flags.b.lcyl_hob) 517 if (req_task->out_flags.b.lcyl_hob)
514 cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAM; 518 cmd.valid.out.hob |= IDE_VALID_LBAM;
515 if (req_task->out_flags.b.hcyl_hob) 519 if (req_task->out_flags.b.hcyl_hob)
516 cmd.tf_flags |= IDE_TFLAG_OUT_HOB_LBAH; 520 cmd.valid.out.hob |= IDE_VALID_LBAH;
517 521
518 if (req_task->out_flags.b.error_feature) 522 if (req_task->out_flags.b.error_feature)
519 cmd.tf_flags |= IDE_TFLAG_OUT_FEATURE; 523 cmd.valid.out.tf |= IDE_VALID_FEATURE;
520 if (req_task->out_flags.b.nsector) 524 if (req_task->out_flags.b.nsector)
521 cmd.tf_flags |= IDE_TFLAG_OUT_NSECT; 525 cmd.valid.out.tf |= IDE_VALID_NSECT;
522 if (req_task->out_flags.b.sector) 526 if (req_task->out_flags.b.sector)
523 cmd.tf_flags |= IDE_TFLAG_OUT_LBAL; 527 cmd.valid.out.tf |= IDE_VALID_LBAL;
524 if (req_task->out_flags.b.lcyl) 528 if (req_task->out_flags.b.lcyl)
525 cmd.tf_flags |= IDE_TFLAG_OUT_LBAM; 529 cmd.valid.out.tf |= IDE_VALID_LBAM;
526 if (req_task->out_flags.b.hcyl) 530 if (req_task->out_flags.b.hcyl)
527 cmd.tf_flags |= IDE_TFLAG_OUT_LBAH; 531 cmd.valid.out.tf |= IDE_VALID_LBAH;
528 } else { 532 } else {
529 cmd.tf_flags |= IDE_TFLAG_OUT_TF; 533 cmd.valid.out.tf |= IDE_VALID_OUT_TF;
530 if (cmd.tf_flags & IDE_TFLAG_LBA48) 534 if (cmd.tf_flags & IDE_TFLAG_LBA48)
531 cmd.tf_flags |= IDE_TFLAG_OUT_HOB; 535 cmd.valid.out.hob |= IDE_VALID_OUT_HOB;
532 } 536 }
533 537
534 if (req_task->in_flags.b.data) 538 if (req_task->in_flags.b.data)
diff --git a/drivers/ide/ns87415.c b/drivers/ide/ns87415.c
index 71a39fb3856f..0208dd35c1a3 100644
--- a/drivers/ide/ns87415.c
+++ b/drivers/ide/ns87415.c
@@ -65,35 +65,38 @@ static void superio_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
65{ 65{
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 u8 valid = cmd->valid.in.tf;
68 69
69 /* be sure we're looking at the low order bits */ 70 /* be sure we're looking at the low order bits */
70 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 71 outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
71 72
72 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) 73 if (valid & IDE_VALID_ERROR)
73 tf->error = inb(io_ports->feature_addr); 74 tf->error = inb(io_ports->feature_addr);
74 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 75 if (valid & IDE_VALID_NSECT)
75 tf->nsect = inb(io_ports->nsect_addr); 76 tf->nsect = inb(io_ports->nsect_addr);
76 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 77 if (valid & IDE_VALID_LBAL)
77 tf->lbal = inb(io_ports->lbal_addr); 78 tf->lbal = inb(io_ports->lbal_addr);
78 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) 79 if (valid & IDE_VALID_LBAM)
79 tf->lbam = inb(io_ports->lbam_addr); 80 tf->lbam = inb(io_ports->lbam_addr);
80 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) 81 if (valid & IDE_VALID_LBAH)
81 tf->lbah = inb(io_ports->lbah_addr); 82 tf->lbah = inb(io_ports->lbah_addr);
82 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) 83 if (valid & IDE_VALID_DEVICE)
83 tf->device = superio_ide_inb(io_ports->device_addr); 84 tf->device = superio_ide_inb(io_ports->device_addr);
84 85
85 if (cmd->tf_flags & IDE_TFLAG_LBA48) { 86 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
86 outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); 87 outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
87 88
88 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) 89 valid = cmd->valid.in.hob;
90
91 if (valid & IDE_VALID_ERROR)
89 tf->hob_error = inb(io_ports->feature_addr); 92 tf->hob_error = inb(io_ports->feature_addr);
90 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 93 if (valid & IDE_VALID_NSECT)
91 tf->hob_nsect = inb(io_ports->nsect_addr); 94 tf->hob_nsect = inb(io_ports->nsect_addr);
92 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 95 if (valid & IDE_VALID_LBAL)
93 tf->hob_lbal = inb(io_ports->lbal_addr); 96 tf->hob_lbal = inb(io_ports->lbal_addr);
94 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 97 if (valid & IDE_VALID_LBAM)
95 tf->hob_lbam = inb(io_ports->lbam_addr); 98 tf->hob_lbam = inb(io_ports->lbam_addr);
96 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 99 if (valid & IDE_VALID_LBAH)
97 tf->hob_lbah = inb(io_ports->lbah_addr); 100 tf->hob_lbah = inb(io_ports->lbah_addr);
98 } 101 }
99} 102}
diff --git a/drivers/ide/scc_pata.c b/drivers/ide/scc_pata.c
index 55e48db7d1be..38a715e293d4 100644
--- a/drivers/ide/scc_pata.c
+++ b/drivers/ide/scc_pata.c
@@ -649,34 +649,37 @@ static void scc_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
649{ 649{
650 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 650 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
651 struct ide_taskfile *tf = &cmd->tf; 651 struct ide_taskfile *tf = &cmd->tf;
652 u8 valid = cmd->valid.out.hob;
652 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF; 653 u8 HIHI = (cmd->tf_flags & IDE_TFLAG_LBA48) ? 0xE0 : 0xEF;
653 654
654 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED) 655 if (cmd->ftf_flags & IDE_FTFLAG_FLAGGED)
655 HIHI = 0xFF; 656 HIHI = 0xFF;
656 657
657 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_FEATURE) 658 if (valid & IDE_VALID_FEATURE)
658 scc_ide_outb(tf->hob_feature, io_ports->feature_addr); 659 scc_ide_outb(tf->hob_feature, io_ports->feature_addr);
659 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_NSECT) 660 if (valid & IDE_VALID_NSECT)
660 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr); 661 scc_ide_outb(tf->hob_nsect, io_ports->nsect_addr);
661 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAL) 662 if (valid & IDE_VALID_LBAL)
662 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr); 663 scc_ide_outb(tf->hob_lbal, io_ports->lbal_addr);
663 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAM) 664 if (valid & IDE_VALID_LBAM)
664 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr); 665 scc_ide_outb(tf->hob_lbam, io_ports->lbam_addr);
665 if (cmd->tf_flags & IDE_TFLAG_OUT_HOB_LBAH) 666 if (valid & IDE_VALID_LBAH)
666 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr); 667 scc_ide_outb(tf->hob_lbah, io_ports->lbah_addr);
667 668
668 if (cmd->tf_flags & IDE_TFLAG_OUT_FEATURE) 669 valid = cmd->valid.out.tf;
670
671 if (valid & IDE_VALID_FEATURE)
669 scc_ide_outb(tf->feature, io_ports->feature_addr); 672 scc_ide_outb(tf->feature, io_ports->feature_addr);
670 if (cmd->tf_flags & IDE_TFLAG_OUT_NSECT) 673 if (valid & IDE_VALID_NSECT)
671 scc_ide_outb(tf->nsect, io_ports->nsect_addr); 674 scc_ide_outb(tf->nsect, io_ports->nsect_addr);
672 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAL) 675 if (valid & IDE_VALID_LBAL)
673 scc_ide_outb(tf->lbal, io_ports->lbal_addr); 676 scc_ide_outb(tf->lbal, io_ports->lbal_addr);
674 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAM) 677 if (valid & IDE_VALID_LBAM)
675 scc_ide_outb(tf->lbam, io_ports->lbam_addr); 678 scc_ide_outb(tf->lbam, io_ports->lbam_addr);
676 if (cmd->tf_flags & IDE_TFLAG_OUT_LBAH) 679 if (valid & IDE_VALID_LBAH)
677 scc_ide_outb(tf->lbah, io_ports->lbah_addr); 680 scc_ide_outb(tf->lbah, io_ports->lbah_addr);
678 681
679 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) 682 if (valid & IDE_VALID_DEVICE)
680 scc_ide_outb((tf->device & HIHI) | drive->select, 683 scc_ide_outb((tf->device & HIHI) | drive->select,
681 io_ports->device_addr); 684 io_ports->device_addr);
682} 685}
@@ -685,35 +688,38 @@ static void scc_tf_read(ide_drive_t *drive, struct ide_cmd *cmd)
685{ 688{
686 struct ide_io_ports *io_ports = &drive->hwif->io_ports; 689 struct ide_io_ports *io_ports = &drive->hwif->io_ports;
687 struct ide_taskfile *tf = &cmd->tf; 690 struct ide_taskfile *tf = &cmd->tf;
691 u8 valid = cmd->valid.in.tf;
688 692
689 /* be sure we're looking at the low order bits */ 693 /* be sure we're looking at the low order bits */
690 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr); 694 scc_ide_outb(ATA_DEVCTL_OBS, io_ports->ctl_addr);
691 695
692 if (cmd->tf_flags & IDE_TFLAG_IN_ERROR) 696 if (valid & IDE_VALID_ERROR)
693 tf->error = scc_ide_inb(io_ports->feature_addr); 697 tf->error = scc_ide_inb(io_ports->feature_addr);
694 if (cmd->tf_flags & IDE_TFLAG_IN_NSECT) 698 if (valid & IDE_VALID_NSECT)
695 tf->nsect = scc_ide_inb(io_ports->nsect_addr); 699 tf->nsect = scc_ide_inb(io_ports->nsect_addr);
696 if (cmd->tf_flags & IDE_TFLAG_IN_LBAL) 700 if (valid & IDE_VALID_LBAL)
697 tf->lbal = scc_ide_inb(io_ports->lbal_addr); 701 tf->lbal = scc_ide_inb(io_ports->lbal_addr);
698 if (cmd->tf_flags & IDE_TFLAG_IN_LBAM) 702 if (valid & IDE_VALID_LBAM)
699 tf->lbam = scc_ide_inb(io_ports->lbam_addr); 703 tf->lbam = scc_ide_inb(io_ports->lbam_addr);
700 if (cmd->tf_flags & IDE_TFLAG_IN_LBAH) 704 if (valid & IDE_VALID_LBAH)
701 tf->lbah = scc_ide_inb(io_ports->lbah_addr); 705 tf->lbah = scc_ide_inb(io_ports->lbah_addr);
702 if (cmd->tf_flags & IDE_TFLAG_IN_DEVICE) 706 if (valid & IDE_VALID_DEVICE)
703 tf->device = scc_ide_inb(io_ports->device_addr); 707 tf->device = scc_ide_inb(io_ports->device_addr);
704 708
705 if (cmd->tf_flags & IDE_TFLAG_LBA48) { 709 if (cmd->tf_flags & IDE_TFLAG_LBA48) {
706 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr); 710 scc_ide_outb(ATA_HOB | ATA_DEVCTL_OBS, io_ports->ctl_addr);
707 711
708 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_ERROR) 712 valid = cmd->valid.in.hob;
713
714 if (valid & IDE_VALID_ERROR)
709 tf->hob_error = scc_ide_inb(io_ports->feature_addr); 715 tf->hob_error = scc_ide_inb(io_ports->feature_addr);
710 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_NSECT) 716 if (valid & IDE_VALID_NSECT)
711 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr); 717 tf->hob_nsect = scc_ide_inb(io_ports->nsect_addr);
712 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAL) 718 if (valid & IDE_VALID_LBAL)
713 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr); 719 tf->hob_lbal = scc_ide_inb(io_ports->lbal_addr);
714 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAM) 720 if (valid & IDE_VALID_LBAM)
715 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr); 721 tf->hob_lbam = scc_ide_inb(io_ports->lbam_addr);
716 if (cmd->tf_flags & IDE_TFLAG_IN_HOB_LBAH) 722 if (valid & IDE_VALID_LBAH)
717 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr); 723 tf->hob_lbah = scc_ide_inb(io_ports->lbah_addr);
718 } 724 }
719} 725}
diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index bee9461f13b3..af8b0f68d5cf 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -438,7 +438,7 @@ static void tx4939ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
438{ 438{
439 ide_tf_load(drive, cmd); 439 ide_tf_load(drive, cmd);
440 440
441 if (cmd->tf_flags & IDE_TFLAG_OUT_DEVICE) 441 if (cmd->valid.out.tf & IDE_VALID_DEVICE)
442 tx4939ide_tf_load_fixup(drive); 442 tx4939ide_tf_load_fixup(drive);
443} 443}
444 444