diff options
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 661b75a89d4d..a896a283f27f 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -330,7 +330,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
330 | tf->error = err; | 330 | tf->error = err; |
331 | tf->status = stat; | 331 | tf->status = stat; |
332 | 332 | ||
333 | drive->hwif->tf_read(drive, task); | 333 | drive->hwif->tp_ops->tf_read(drive, task); |
334 | 334 | ||
335 | if (task->tf_flags & IDE_TFLAG_DYN) | 335 | if (task->tf_flags & IDE_TFLAG_DYN) |
336 | kfree(task); | 336 | kfree(task); |
@@ -381,8 +381,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
381 | if (err == ABRT_ERR) { | 381 | if (err == ABRT_ERR) { |
382 | if (drive->select.b.lba && | 382 | if (drive->select.b.lba && |
383 | /* some newer drives don't support WIN_SPECIFY */ | 383 | /* some newer drives don't support WIN_SPECIFY */ |
384 | hwif->INB(hwif->io_ports.command_addr) == | 384 | hwif->tp_ops->read_status(hwif) == WIN_SPECIFY) |
385 | WIN_SPECIFY) | ||
386 | return ide_stopped; | 385 | return ide_stopped; |
387 | } else if ((err & BAD_CRC) == BAD_CRC) { | 386 | } else if ((err & BAD_CRC) == BAD_CRC) { |
388 | /* UDMA crc error, just retry the operation */ | 387 | /* UDMA crc error, just retry the operation */ |
@@ -408,7 +407,7 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8 | |||
408 | return ide_stopped; | 407 | return ide_stopped; |
409 | } | 408 | } |
410 | 409 | ||
411 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 410 | if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) |
412 | rq->errors |= ERROR_RESET; | 411 | rq->errors |= ERROR_RESET; |
413 | 412 | ||
414 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { | 413 | if ((rq->errors & ERROR_RESET) == ERROR_RESET) { |
@@ -435,10 +434,9 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
435 | /* add decoding error stuff */ | 434 | /* add decoding error stuff */ |
436 | } | 435 | } |
437 | 436 | ||
438 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 437 | if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) |
439 | /* force an abort */ | 438 | /* force an abort */ |
440 | hwif->OUTBSYNC(hwif, WIN_IDLEIMMEDIATE, | 439 | hwif->tp_ops->exec_command(hwif, WIN_IDLEIMMEDIATE); |
441 | hwif->io_ports.command_addr); | ||
442 | 440 | ||
443 | if (rq->errors >= ERROR_MAX) { | 441 | if (rq->errors >= ERROR_MAX) { |
444 | ide_kill_rq(drive, rq); | 442 | ide_kill_rq(drive, rq); |
@@ -712,7 +710,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
712 | #ifdef DEBUG | 710 | #ifdef DEBUG |
713 | printk("%s: DRIVE_CMD (null)\n", drive->name); | 711 | printk("%s: DRIVE_CMD (null)\n", drive->name); |
714 | #endif | 712 | #endif |
715 | ide_end_drive_cmd(drive, ide_read_status(drive), ide_read_error(drive)); | 713 | ide_end_drive_cmd(drive, hwif->tp_ops->read_status(hwif), |
714 | ide_read_error(drive)); | ||
716 | 715 | ||
717 | return ide_stopped; | 716 | return ide_stopped; |
718 | } | 717 | } |
@@ -747,16 +746,17 @@ static void ide_check_pm_state(ide_drive_t *drive, struct request *rq) | |||
747 | * the bus may be broken enough to walk on our toes at this | 746 | * the bus may be broken enough to walk on our toes at this |
748 | * point. | 747 | * point. |
749 | */ | 748 | */ |
749 | ide_hwif_t *hwif = drive->hwif; | ||
750 | int rc; | 750 | int rc; |
751 | #ifdef DEBUG_PM | 751 | #ifdef DEBUG_PM |
752 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); | 752 | printk("%s: Wakeup request inited, waiting for !BSY...\n", drive->name); |
753 | #endif | 753 | #endif |
754 | rc = ide_wait_not_busy(HWIF(drive), 35000); | 754 | rc = ide_wait_not_busy(hwif, 35000); |
755 | if (rc) | 755 | if (rc) |
756 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); | 756 | printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name); |
757 | SELECT_DRIVE(drive); | 757 | SELECT_DRIVE(drive); |
758 | ide_set_irq(drive, 1); | 758 | hwif->tp_ops->set_irq(hwif, 1); |
759 | rc = ide_wait_not_busy(HWIF(drive), 100000); | 759 | rc = ide_wait_not_busy(hwif, 100000); |
760 | if (rc) | 760 | if (rc) |
761 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); | 761 | printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name); |
762 | } | 762 | } |
@@ -1042,7 +1042,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) | |||
1042 | * quirk_list may not like intr setups/cleanups | 1042 | * quirk_list may not like intr setups/cleanups |
1043 | */ | 1043 | */ |
1044 | if (drive->quirk_list != 1) | 1044 | if (drive->quirk_list != 1) |
1045 | ide_set_irq(drive, 0); | 1045 | hwif->tp_ops->set_irq(hwif, 0); |
1046 | } | 1046 | } |
1047 | hwgroup->hwif = hwif; | 1047 | hwgroup->hwif = hwif; |
1048 | hwgroup->drive = drive; | 1048 | hwgroup->drive = drive; |
@@ -1142,7 +1142,7 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | |||
1142 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); | 1142 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); |
1143 | (void)hwif->dma_ops->dma_end(drive); | 1143 | (void)hwif->dma_ops->dma_end(drive); |
1144 | ret = ide_error(drive, "dma timeout error", | 1144 | ret = ide_error(drive, "dma timeout error", |
1145 | ide_read_status(drive)); | 1145 | hwif->tp_ops->read_status(hwif)); |
1146 | } else { | 1146 | } else { |
1147 | printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); | 1147 | printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); |
1148 | hwif->dma_ops->dma_timeout(drive); | 1148 | hwif->dma_ops->dma_timeout(drive); |
@@ -1267,7 +1267,7 @@ void ide_timer_expiry (unsigned long data) | |||
1267 | } else | 1267 | } else |
1268 | startstop = | 1268 | startstop = |
1269 | ide_error(drive, "irq timeout", | 1269 | ide_error(drive, "irq timeout", |
1270 | ide_read_status(drive)); | 1270 | hwif->tp_ops->read_status(hwif)); |
1271 | } | 1271 | } |
1272 | drive->service_time = jiffies - drive->service_start; | 1272 | drive->service_time = jiffies - drive->service_start; |
1273 | spin_lock_irq(&ide_lock); | 1273 | spin_lock_irq(&ide_lock); |
@@ -1323,7 +1323,8 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup) | |||
1323 | */ | 1323 | */ |
1324 | do { | 1324 | do { |
1325 | if (hwif->irq == irq) { | 1325 | if (hwif->irq == irq) { |
1326 | stat = hwif->INB(hwif->io_ports.status_addr); | 1326 | stat = hwif->tp_ops->read_status(hwif); |
1327 | |||
1327 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { | 1328 | if (!OK_STAT(stat, READY_STAT, BAD_STAT)) { |
1328 | /* Try to not flood the console with msgs */ | 1329 | /* Try to not flood the console with msgs */ |
1329 | static unsigned long last_msgtime, count; | 1330 | static unsigned long last_msgtime, count; |
@@ -1413,7 +1414,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) | |||
1413 | * Whack the status register, just in case | 1414 | * Whack the status register, just in case |
1414 | * we have a leftover pending IRQ. | 1415 | * we have a leftover pending IRQ. |
1415 | */ | 1416 | */ |
1416 | (void) hwif->INB(hwif->io_ports.status_addr); | 1417 | (void)hwif->tp_ops->read_status(hwif); |
1417 | #endif /* CONFIG_BLK_DEV_IDEPCI */ | 1418 | #endif /* CONFIG_BLK_DEV_IDEPCI */ |
1418 | } | 1419 | } |
1419 | spin_unlock_irqrestore(&ide_lock, flags); | 1420 | spin_unlock_irqrestore(&ide_lock, flags); |
@@ -1519,6 +1520,7 @@ EXPORT_SYMBOL(ide_do_drive_cmd); | |||
1519 | 1520 | ||
1520 | void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) | 1521 | void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) |
1521 | { | 1522 | { |
1523 | ide_hwif_t *hwif = drive->hwif; | ||
1522 | ide_task_t task; | 1524 | ide_task_t task; |
1523 | 1525 | ||
1524 | memset(&task, 0, sizeof(task)); | 1526 | memset(&task, 0, sizeof(task)); |
@@ -1529,9 +1531,9 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) | |||
1529 | task.tf.lbah = (bcount >> 8) & 0xff; | 1531 | task.tf.lbah = (bcount >> 8) & 0xff; |
1530 | 1532 | ||
1531 | ide_tf_dump(drive->name, &task.tf); | 1533 | ide_tf_dump(drive->name, &task.tf); |
1532 | ide_set_irq(drive, 1); | 1534 | hwif->tp_ops->set_irq(hwif, 1); |
1533 | SELECT_MASK(drive, 0); | 1535 | SELECT_MASK(drive, 0); |
1534 | drive->hwif->tf_load(drive, &task); | 1536 | hwif->tp_ops->tf_load(drive, &task); |
1535 | } | 1537 | } |
1536 | 1538 | ||
1537 | EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); | 1539 | EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); |
@@ -1543,9 +1545,9 @@ void ide_pad_transfer(ide_drive_t *drive, int write, int len) | |||
1543 | 1545 | ||
1544 | while (len > 0) { | 1546 | while (len > 0) { |
1545 | if (write) | 1547 | if (write) |
1546 | hwif->output_data(drive, NULL, buf, min(4, len)); | 1548 | hwif->tp_ops->output_data(drive, NULL, buf, min(4, len)); |
1547 | else | 1549 | else |
1548 | hwif->input_data(drive, NULL, buf, min(4, len)); | 1550 | hwif->tp_ops->input_data(drive, NULL, buf, min(4, len)); |
1549 | len -= 4; | 1551 | len -= 4; |
1550 | } | 1552 | } |
1551 | } | 1553 | } |