ide-disk: use do_rw_taskfile() (take 2)
* Add IDE_TFLAG_DMA_PIO_FALLBACK taskfile flag to indicate the need
to skip loading taskfile registers in do_rw_taskfile().
* Export do_rw_taskfile().
* Convert __ide_do_rw_disk() to use do_rw_taskfile().
* Unexport ide_tf_load().
* Unexport {pre_task_out,task_in}_intr() and make it static.
* Remove incorrect comment about do_rw_taskfile() from <linux/ide.h>.
There should be no functionality changes caused by this patch.
v2:
* Add missing blk_fs_request() check to task_dma_ok() (for VDMA).
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 97abc91..3d7127b 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -185,6 +185,7 @@
u8 lba48 = (drive->addressing == 1) ? 1 : 0;
ide_task_t task;
struct ide_taskfile *tf = &task.tf;
+ ide_startstop_t rc;
if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
if (block + rq->nr_sectors > 1ULL << 28)
@@ -252,32 +253,22 @@
task.tf_flags |= IDE_TFLAG_WRITE;
ide_tf_set_cmd(drive, &task, dma);
+ if (!dma)
+ hwif->data_phase = task.data_phase;
+ task.rq = rq;
- ide_tf_load(drive, &task);
+ rc = do_rw_taskfile(drive, &task);
- if (dma) {
- if (!hwif->dma_setup(drive)) {
- hwif->dma_exec_cmd(drive, tf->command);
- hwif->dma_start(drive);
- return ide_started;
- }
+ if (rc == ide_stopped && dma) {
/* fallback to PIO */
+ task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
ide_tf_set_cmd(drive, &task, 0);
+ hwif->data_phase = task.data_phase;
ide_init_sg_cmd(drive, rq);
+ rc = do_rw_taskfile(drive, &task);
}
- hwif->data_phase = task.data_phase;
-
- if (rq_data_dir(rq) == READ) {
- ide_execute_command(drive, tf->command, &task_in_intr,
- WAIT_WORSTCASE, NULL);
- return ide_started;
- } else {
- hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG);
- ndelay(400); /* FIXME */
-
- return pre_task_out_intr(drive, rq);
- }
+ return rc;
}
/*