aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-disk.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:16 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:16 -0500
commitf6e29e35cc0f9facf2eb0b0454f9b09021b5aa6f (patch)
tree66f022af5e3b1a7ef5a0854c684604b6d2b64a9c /drivers/ide/ide-disk.c
parentba76ae3883ad9faa32a6b35271c6a407d6c96ca9 (diff)
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>
Diffstat (limited to 'drivers/ide/ide-disk.c')
-rw-r--r--drivers/ide/ide-disk.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 97abc91db7d0..3d7127ba67a0 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -185,6 +185,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
185 u8 lba48 = (drive->addressing == 1) ? 1 : 0; 185 u8 lba48 = (drive->addressing == 1) ? 1 : 0;
186 ide_task_t task; 186 ide_task_t task;
187 struct ide_taskfile *tf = &task.tf; 187 struct ide_taskfile *tf = &task.tf;
188 ide_startstop_t rc;
188 189
189 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) { 190 if ((hwif->host_flags & IDE_HFLAG_NO_LBA48_DMA) && lba48 && dma) {
190 if (block + rq->nr_sectors > 1ULL << 28) 191 if (block + rq->nr_sectors > 1ULL << 28)
@@ -252,32 +253,22 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq,
252 task.tf_flags |= IDE_TFLAG_WRITE; 253 task.tf_flags |= IDE_TFLAG_WRITE;
253 254
254 ide_tf_set_cmd(drive, &task, dma); 255 ide_tf_set_cmd(drive, &task, dma);
256 if (!dma)
257 hwif->data_phase = task.data_phase;
258 task.rq = rq;
255 259
256 ide_tf_load(drive, &task); 260 rc = do_rw_taskfile(drive, &task);
257 261
258 if (dma) { 262 if (rc == ide_stopped && dma) {
259 if (!hwif->dma_setup(drive)) {
260 hwif->dma_exec_cmd(drive, tf->command);
261 hwif->dma_start(drive);
262 return ide_started;
263 }
264 /* fallback to PIO */ 263 /* fallback to PIO */
264 task.tf_flags |= IDE_TFLAG_DMA_PIO_FALLBACK;
265 ide_tf_set_cmd(drive, &task, 0); 265 ide_tf_set_cmd(drive, &task, 0);
266 hwif->data_phase = task.data_phase;
266 ide_init_sg_cmd(drive, rq); 267 ide_init_sg_cmd(drive, rq);
268 rc = do_rw_taskfile(drive, &task);
267 } 269 }
268 270
269 hwif->data_phase = task.data_phase; 271 return rc;
270
271 if (rq_data_dir(rq) == READ) {
272 ide_execute_command(drive, tf->command, &task_in_intr,
273 WAIT_WORSTCASE, NULL);
274 return ide_started;
275 } else {
276 hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG);
277 ndelay(400); /* FIXME */
278
279 return pre_task_out_intr(drive, rq);
280 }
281} 272}
282 273
283/* 274/*