diff options
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 68 |
1 files changed, 21 insertions, 47 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 3a2d8930d17f..788783da9025 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -295,49 +295,6 @@ static void ide_complete_pm_request (ide_drive_t *drive, struct request *rq) | |||
295 | spin_unlock_irqrestore(&ide_lock, flags); | 295 | spin_unlock_irqrestore(&ide_lock, flags); |
296 | } | 296 | } |
297 | 297 | ||
298 | void ide_tf_read(ide_drive_t *drive, ide_task_t *task) | ||
299 | { | ||
300 | ide_hwif_t *hwif = drive->hwif; | ||
301 | struct ide_io_ports *io_ports = &hwif->io_ports; | ||
302 | struct ide_taskfile *tf = &task->tf; | ||
303 | |||
304 | if (task->tf_flags & IDE_TFLAG_IN_DATA) { | ||
305 | u16 data = hwif->INW(io_ports->data_addr); | ||
306 | |||
307 | tf->data = data & 0xff; | ||
308 | tf->hob_data = (data >> 8) & 0xff; | ||
309 | } | ||
310 | |||
311 | /* be sure we're looking at the low order bits */ | ||
312 | hwif->OUTB(drive->ctl & ~0x80, io_ports->ctl_addr); | ||
313 | |||
314 | if (task->tf_flags & IDE_TFLAG_IN_NSECT) | ||
315 | tf->nsect = hwif->INB(io_ports->nsect_addr); | ||
316 | if (task->tf_flags & IDE_TFLAG_IN_LBAL) | ||
317 | tf->lbal = hwif->INB(io_ports->lbal_addr); | ||
318 | if (task->tf_flags & IDE_TFLAG_IN_LBAM) | ||
319 | tf->lbam = hwif->INB(io_ports->lbam_addr); | ||
320 | if (task->tf_flags & IDE_TFLAG_IN_LBAH) | ||
321 | tf->lbah = hwif->INB(io_ports->lbah_addr); | ||
322 | if (task->tf_flags & IDE_TFLAG_IN_DEVICE) | ||
323 | tf->device = hwif->INB(io_ports->device_addr); | ||
324 | |||
325 | if (task->tf_flags & IDE_TFLAG_LBA48) { | ||
326 | hwif->OUTB(drive->ctl | 0x80, io_ports->ctl_addr); | ||
327 | |||
328 | if (task->tf_flags & IDE_TFLAG_IN_HOB_FEATURE) | ||
329 | tf->hob_feature = hwif->INB(io_ports->feature_addr); | ||
330 | if (task->tf_flags & IDE_TFLAG_IN_HOB_NSECT) | ||
331 | tf->hob_nsect = hwif->INB(io_ports->nsect_addr); | ||
332 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAL) | ||
333 | tf->hob_lbal = hwif->INB(io_ports->lbal_addr); | ||
334 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAM) | ||
335 | tf->hob_lbam = hwif->INB(io_ports->lbam_addr); | ||
336 | if (task->tf_flags & IDE_TFLAG_IN_HOB_LBAH) | ||
337 | tf->hob_lbah = hwif->INB(io_ports->lbah_addr); | ||
338 | } | ||
339 | } | ||
340 | |||
341 | /** | 298 | /** |
342 | * ide_end_drive_cmd - end an explicit drive command | 299 | * ide_end_drive_cmd - end an explicit drive command |
343 | * @drive: command | 300 | * @drive: command |
@@ -373,7 +330,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
373 | tf->error = err; | 330 | tf->error = err; |
374 | tf->status = stat; | 331 | tf->status = stat; |
375 | 332 | ||
376 | ide_tf_read(drive, task); | 333 | drive->hwif->tf_read(drive, task); |
377 | 334 | ||
378 | if (task->tf_flags & IDE_TFLAG_DYN) | 335 | if (task->tf_flags & IDE_TFLAG_DYN) |
379 | kfree(task); | 336 | kfree(task); |
@@ -422,7 +379,7 @@ static void try_to_flush_leftover_data (ide_drive_t *drive) | |||
422 | u32 wcount = (i > 16) ? 16 : i; | 379 | u32 wcount = (i > 16) ? 16 : i; |
423 | 380 | ||
424 | i -= wcount; | 381 | i -= wcount; |
425 | HWIF(drive)->ata_input_data(drive, buffer, wcount); | 382 | drive->hwif->input_data(drive, NULL, buffer, wcount * 4); |
426 | } | 383 | } |
427 | } | 384 | } |
428 | 385 | ||
@@ -502,7 +459,8 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u | |||
502 | 459 | ||
503 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) | 460 | if (ide_read_status(drive) & (BUSY_STAT | DRQ_STAT)) |
504 | /* force an abort */ | 461 | /* force an abort */ |
505 | hwif->OUTB(WIN_IDLEIMMEDIATE, hwif->io_ports.command_addr); | 462 | hwif->OUTBSYNC(drive, WIN_IDLEIMMEDIATE, |
463 | hwif->io_ports.command_addr); | ||
506 | 464 | ||
507 | if (rq->errors >= ERROR_MAX) { | 465 | if (rq->errors >= ERROR_MAX) { |
508 | ide_kill_rq(drive, rq); | 466 | ide_kill_rq(drive, rq); |
@@ -1679,7 +1637,23 @@ void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) | |||
1679 | task.tf.lbam = bcount & 0xff; | 1637 | task.tf.lbam = bcount & 0xff; |
1680 | task.tf.lbah = (bcount >> 8) & 0xff; | 1638 | task.tf.lbah = (bcount >> 8) & 0xff; |
1681 | 1639 | ||
1682 | ide_tf_load(drive, &task); | 1640 | ide_tf_dump(drive->name, &task.tf); |
1641 | drive->hwif->tf_load(drive, &task); | ||
1683 | } | 1642 | } |
1684 | 1643 | ||
1685 | EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); | 1644 | EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); |
1645 | |||
1646 | void ide_pad_transfer(ide_drive_t *drive, int write, int len) | ||
1647 | { | ||
1648 | ide_hwif_t *hwif = drive->hwif; | ||
1649 | u8 buf[4] = { 0 }; | ||
1650 | |||
1651 | while (len > 0) { | ||
1652 | if (write) | ||
1653 | hwif->output_data(drive, NULL, buf, min(4, len)); | ||
1654 | else | ||
1655 | hwif->input_data(drive, NULL, buf, min(4, len)); | ||
1656 | len -= 4; | ||
1657 | } | ||
1658 | } | ||
1659 | EXPORT_SYMBOL_GPL(ide_pad_transfer); | ||