diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:43 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:43 -0400 |
commit | 65ca5377322c7543163066f373ae9e6b0ad8de8a (patch) | |
tree | 0d333cb6c781f151d82ed66fd4ece26359525366 /drivers/ide/ide-dma.c | |
parent | b6a45a0b1e9a358b81201659cf87b023e3ec73e0 (diff) |
ide: move ide_dma_timeout_retry() to ide-dma.c
Move ide_dma_timeout_retry() to ide-dma.c and add static inline
version for CONFIG_BLK_DEV_IDEDMA=n.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-dma.c')
-rw-r--r-- | drivers/ide/ide-dma.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index 059c90bb5ad2..a878f4734f81 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -470,6 +470,63 @@ void ide_dma_timeout(ide_drive_t *drive) | |||
470 | } | 470 | } |
471 | EXPORT_SYMBOL_GPL(ide_dma_timeout); | 471 | EXPORT_SYMBOL_GPL(ide_dma_timeout); |
472 | 472 | ||
473 | /* | ||
474 | * un-busy the port etc, and clear any pending DMA status. we want to | ||
475 | * retry the current request in pio mode instead of risking tossing it | ||
476 | * all away | ||
477 | */ | ||
478 | ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) | ||
479 | { | ||
480 | ide_hwif_t *hwif = drive->hwif; | ||
481 | struct request *rq; | ||
482 | ide_startstop_t ret = ide_stopped; | ||
483 | |||
484 | /* | ||
485 | * end current dma transaction | ||
486 | */ | ||
487 | |||
488 | if (error < 0) { | ||
489 | printk(KERN_WARNING "%s: DMA timeout error\n", drive->name); | ||
490 | (void)hwif->dma_ops->dma_end(drive); | ||
491 | ret = ide_error(drive, "dma timeout error", | ||
492 | hwif->tp_ops->read_status(hwif)); | ||
493 | } else { | ||
494 | printk(KERN_WARNING "%s: DMA timeout retry\n", drive->name); | ||
495 | hwif->dma_ops->dma_timeout(drive); | ||
496 | } | ||
497 | |||
498 | /* | ||
499 | * disable dma for now, but remember that we did so because of | ||
500 | * a timeout -- we'll reenable after we finish this next request | ||
501 | * (or rather the first chunk of it) in pio. | ||
502 | */ | ||
503 | drive->dev_flags |= IDE_DFLAG_DMA_PIO_RETRY; | ||
504 | drive->retry_pio++; | ||
505 | ide_dma_off_quietly(drive); | ||
506 | |||
507 | /* | ||
508 | * un-busy drive etc and make sure request is sane | ||
509 | */ | ||
510 | |||
511 | rq = hwif->rq; | ||
512 | if (!rq) | ||
513 | goto out; | ||
514 | |||
515 | hwif->rq = NULL; | ||
516 | |||
517 | rq->errors = 0; | ||
518 | |||
519 | if (!rq->bio) | ||
520 | goto out; | ||
521 | |||
522 | rq->sector = rq->bio->bi_sector; | ||
523 | rq->current_nr_sectors = bio_iovec(rq->bio)->bv_len >> 9; | ||
524 | rq->hard_cur_sectors = rq->current_nr_sectors; | ||
525 | rq->buffer = bio_data(rq->bio); | ||
526 | out: | ||
527 | return ret; | ||
528 | } | ||
529 | |||
473 | void ide_release_dma_engine(ide_hwif_t *hwif) | 530 | void ide_release_dma_engine(ide_hwif_t *hwif) |
474 | { | 531 | { |
475 | if (hwif->dmatable_cpu) { | 532 | if (hwif->dmatable_cpu) { |