aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io-std.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2009-04-08 08:13:01 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-04-08 08:13:01 -0400
commit60f85019c6c8c1aebf3485a313e0da094bc95d07 (patch)
tree5cbb0e1a733b59887308a50ce083613c4e7c0ede /drivers/ide/ide-io-std.c
parent674f0ea111bc9bff1b4e4841d7da38933c5e3b59 (diff)
ide: replace IDE_TFLAG_* flags by IDE_VALID_*
Replace IDE_TFLAG_{IN|OUT}_* flags meaning to the taskfile register validity on input/output by the IDE_VALID_* flags and introduce 4 symmetric 8-bit register validity indicator subfields, 'valid.{input/output}.{tf|hob}', into the 'struct ide_cmd' instead of using the 'tf_flags' field for that purpose (this field can then be turned from 32-bit into 8-bit one). Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io-std.c')
-rw-r--r--drivers/ide/ide-io-std.c50
1 files changed, 28 insertions, 22 deletions
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}