aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-taskfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-taskfile.c')
-rw-r--r--drivers/ide/ide-taskfile.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 4e1da1c78cb5..0518a2e948cf 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -189,12 +189,11 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
189 */ 189 */
190static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 190static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
191{ 191{
192 ide_hwif_t *hwif = HWIF(drive); 192 u8 stat = ide_read_status(drive);
193 u8 stat;
194 193
195 if (OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) { 194 if (OK_STAT(stat, READY_STAT, BAD_STAT))
196 drive->mult_count = drive->mult_req; 195 drive->mult_count = drive->mult_req;
197 } else { 196 else {
198 drive->mult_req = drive->mult_count = 0; 197 drive->mult_req = drive->mult_count = 0;
199 drive->special.b.recalibrate = 1; 198 drive->special.b.recalibrate = 1;
200 (void) ide_dump_status(drive, "set_multmode", stat); 199 (void) ide_dump_status(drive, "set_multmode", stat);
@@ -207,11 +206,10 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
207 */ 206 */
208static ide_startstop_t set_geometry_intr(ide_drive_t *drive) 207static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
209{ 208{
210 ide_hwif_t *hwif = HWIF(drive);
211 int retries = 5; 209 int retries = 5;
212 u8 stat; 210 u8 stat;
213 211
214 while (((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) && retries--) 212 while (((stat = ide_read_status(drive)) & BUSY_STAT) && retries--)
215 udelay(10); 213 udelay(10);
216 214
217 if (OK_STAT(stat, READY_STAT, BAD_STAT)) 215 if (OK_STAT(stat, READY_STAT, BAD_STAT))
@@ -230,10 +228,9 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
230 */ 228 */
231static ide_startstop_t recal_intr(ide_drive_t *drive) 229static ide_startstop_t recal_intr(ide_drive_t *drive)
232{ 230{
233 ide_hwif_t *hwif = HWIF(drive); 231 u8 stat = ide_read_status(drive);
234 u8 stat;
235 232
236 if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG), READY_STAT, BAD_STAT)) 233 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
237 return ide_error(drive, "recal_intr", stat); 234 return ide_error(drive, "recal_intr", stat);
238 return ide_stopped; 235 return ide_stopped;
239} 236}
@@ -244,23 +241,23 @@ static ide_startstop_t recal_intr(ide_drive_t *drive)
244static ide_startstop_t task_no_data_intr(ide_drive_t *drive) 241static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
245{ 242{
246 ide_task_t *args = HWGROUP(drive)->rq->special; 243 ide_task_t *args = HWGROUP(drive)->rq->special;
247 ide_hwif_t *hwif = HWIF(drive);
248 u8 stat; 244 u8 stat;
249 245
250 local_irq_enable_in_hardirq(); 246 local_irq_enable_in_hardirq();
251 if (!OK_STAT(stat = hwif->INB(IDE_STATUS_REG),READY_STAT,BAD_STAT)) { 247 stat = ide_read_status(drive);
248
249 if (!OK_STAT(stat, READY_STAT, BAD_STAT))
252 return ide_error(drive, "task_no_data_intr", stat); 250 return ide_error(drive, "task_no_data_intr", stat);
253 /* calls ide_end_drive_cmd */ 251 /* calls ide_end_drive_cmd */
254 } 252
255 if (args) 253 if (args)
256 ide_end_drive_cmd(drive, stat, hwif->INB(IDE_ERROR_REG)); 254 ide_end_drive_cmd(drive, stat, ide_read_error(drive));
257 255
258 return ide_stopped; 256 return ide_stopped;
259} 257}
260 258
261static u8 wait_drive_not_busy(ide_drive_t *drive) 259static u8 wait_drive_not_busy(ide_drive_t *drive)
262{ 260{
263 ide_hwif_t *hwif = HWIF(drive);
264 int retries; 261 int retries;
265 u8 stat; 262 u8 stat;
266 263
@@ -269,7 +266,9 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
269 * This can take up to 10 usec, but we will wait max 1 ms. 266 * This can take up to 10 usec, but we will wait max 1 ms.
270 */ 267 */
271 for (retries = 0; retries < 100; retries++) { 268 for (retries = 0; retries < 100; retries++) {
272 if ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) 269 stat = ide_read_status(drive);
270
271 if (stat & BUSY_STAT)
273 udelay(10); 272 udelay(10);
274 else 273 else
275 break; 274 break;
@@ -408,7 +407,7 @@ static ide_startstop_t task_error(ide_drive_t *drive, struct request *rq,
408void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat) 407void task_end_request(ide_drive_t *drive, struct request *rq, u8 stat)
409{ 408{
410 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 409 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
411 u8 err = drive->hwif->INB(IDE_ERROR_REG); 410 u8 err = ide_read_error(drive);
412 411
413 ide_end_drive_cmd(drive, stat, err); 412 ide_end_drive_cmd(drive, stat, err);
414 return; 413 return;
@@ -430,7 +429,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
430{ 429{
431 ide_hwif_t *hwif = drive->hwif; 430 ide_hwif_t *hwif = drive->hwif;
432 struct request *rq = HWGROUP(drive)->rq; 431 struct request *rq = HWGROUP(drive)->rq;
433 u8 stat = hwif->INB(IDE_STATUS_REG); 432 u8 stat = ide_read_status(drive);
434 433
435 /* new way for dealing with premature shared PCI interrupts */ 434 /* new way for dealing with premature shared PCI interrupts */
436 if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) { 435 if (!OK_STAT(stat, DRQ_STAT, BAD_R_STAT)) {
@@ -465,7 +464,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
465{ 464{
466 ide_hwif_t *hwif = drive->hwif; 465 ide_hwif_t *hwif = drive->hwif;
467 struct request *rq = HWGROUP(drive)->rq; 466 struct request *rq = HWGROUP(drive)->rq;
468 u8 stat = hwif->INB(IDE_STATUS_REG); 467 u8 stat = ide_read_status(drive);
469 468
470 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat)) 469 if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
471 return task_error(drive, rq, __FUNCTION__, stat); 470 return task_error(drive, rq, __FUNCTION__, stat);