diff options
author | Borislav Petkov <petkovbb@googlemail.com> | 2009-01-02 10:12:55 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-01-02 10:12:55 -0500 |
commit | d77612ab0ad7515623b084b952dfefd547073ada (patch) | |
tree | cce9e341c9241ca831ed92839348296385b27852 /drivers/ide | |
parent | def860d061d0fcab7fbbe193c0b8b8f0b9b4c828 (diff) |
ide-atapi: split drive-specific functionality in ide_issue_pc
There should be no functionality change resulting from this patch.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-atapi.c | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index cf2b99c37364..fa7a70a3f24c 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -564,39 +564,43 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
564 | 564 | ||
565 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout) | 565 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, unsigned int timeout) |
566 | { | 566 | { |
567 | struct ide_atapi_pc *pc = drive->pc; | 567 | struct ide_atapi_pc *pc; |
568 | ide_hwif_t *hwif = drive->hwif; | 568 | ide_hwif_t *hwif = drive->hwif; |
569 | ide_expiry_t *expiry = NULL; | 569 | ide_expiry_t *expiry = NULL; |
570 | u32 tf_flags; | 570 | u32 tf_flags; |
571 | u16 bcount; | 571 | u16 bcount; |
572 | 572 | ||
573 | /* We haven't transferred any data yet */ | ||
574 | pc->xferred = 0; | ||
575 | pc->cur_pos = pc->buf; | ||
576 | |||
577 | if (dev_is_idecd(drive)) { | 573 | if (dev_is_idecd(drive)) { |
578 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; | 574 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; |
579 | bcount = ide_cd_get_xferlen(hwif->hwgroup->rq); | 575 | bcount = ide_cd_get_xferlen(hwif->hwgroup->rq); |
580 | expiry = ide_cd_expiry; | 576 | expiry = ide_cd_expiry; |
577 | |||
578 | if (drive->dma) | ||
579 | drive->dma = !hwif->dma_ops->dma_setup(drive); | ||
581 | } else { | 580 | } else { |
581 | pc = drive->pc; | ||
582 | |||
583 | /* We haven't transferred any data yet */ | ||
584 | pc->xferred = 0; | ||
585 | pc->cur_pos = pc->buf; | ||
586 | |||
582 | tf_flags = IDE_TFLAG_OUT_DEVICE; | 587 | tf_flags = IDE_TFLAG_OUT_DEVICE; |
583 | bcount = ((drive->media == ide_tape) ? | 588 | bcount = ((drive->media == ide_tape) ? |
584 | pc->req_xfer : | 589 | pc->req_xfer : |
585 | min(pc->req_xfer, 63 * 1024)); | 590 | min(pc->req_xfer, 63 * 1024)); |
586 | } | ||
587 | 591 | ||
588 | if (pc->flags & PC_FLAG_DMA_ERROR) { | 592 | if (pc->flags & PC_FLAG_DMA_ERROR) { |
589 | pc->flags &= ~PC_FLAG_DMA_ERROR; | 593 | pc->flags &= ~PC_FLAG_DMA_ERROR; |
590 | ide_dma_off(drive); | 594 | ide_dma_off(drive); |
591 | } | 595 | } |
592 | 596 | ||
593 | if (((pc->flags & PC_FLAG_DMA_OK) && | 597 | if ((pc->flags & PC_FLAG_DMA_OK) && |
594 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) || | 598 | (drive->dev_flags & IDE_DFLAG_USING_DMA)) |
595 | drive->dma) | 599 | drive->dma = !hwif->dma_ops->dma_setup(drive); |
596 | drive->dma = !hwif->dma_ops->dma_setup(drive); | ||
597 | 600 | ||
598 | if (!drive->dma) | 601 | if (!drive->dma) |
599 | pc->flags &= ~PC_FLAG_DMA_OK; | 602 | pc->flags &= ~PC_FLAG_DMA_OK; |
603 | } | ||
600 | 604 | ||
601 | ide_pktcmd_tf_load(drive, tf_flags, bcount, drive->dma); | 605 | ide_pktcmd_tf_load(drive, tf_flags, bcount, drive->dma); |
602 | 606 | ||