aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-atapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r--drivers/ide/ide-atapi.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index c3fd528a1b4d..b56af49f876b 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -638,12 +638,20 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
638{ 638{
639 struct ide_atapi_pc *pc; 639 struct ide_atapi_pc *pc;
640 ide_hwif_t *hwif = drive->hwif; 640 ide_hwif_t *hwif = drive->hwif;
641 const struct ide_dma_ops *dma_ops = hwif->dma_ops;
642 struct ide_cmd *cmd = &hwif->cmd;
641 ide_expiry_t *expiry = NULL; 643 ide_expiry_t *expiry = NULL;
642 struct request *rq = hwif->rq; 644 struct request *rq = hwif->rq;
643 unsigned int timeout; 645 unsigned int timeout;
644 u32 tf_flags; 646 u32 tf_flags;
645 u16 bcount; 647 u16 bcount;
646 648
649 if (drive->media != ide_floppy) {
650 if (rq_data_dir(rq))
651 cmd->tf_flags |= IDE_TFLAG_WRITE;
652 cmd->rq = rq;
653 }
654
647 if (dev_is_idecd(drive)) { 655 if (dev_is_idecd(drive)) {
648 tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; 656 tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
649 bcount = ide_cd_get_xferlen(rq); 657 bcount = ide_cd_get_xferlen(rq);
@@ -651,8 +659,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
651 timeout = ATAPI_WAIT_PC; 659 timeout = ATAPI_WAIT_PC;
652 660
653 if (drive->dma) { 661 if (drive->dma) {
654 if (ide_build_sglist(drive, rq)) 662 if (ide_build_sglist(drive, cmd))
655 drive->dma = !hwif->dma_ops->dma_setup(drive); 663 drive->dma = !dma_ops->dma_setup(drive, cmd);
656 else 664 else
657 drive->dma = 0; 665 drive->dma = 0;
658 } 666 }
@@ -675,8 +683,8 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
675 683
676 if ((pc->flags & PC_FLAG_DMA_OK) && 684 if ((pc->flags & PC_FLAG_DMA_OK) &&
677 (drive->dev_flags & IDE_DFLAG_USING_DMA)) { 685 (drive->dev_flags & IDE_DFLAG_USING_DMA)) {
678 if (ide_build_sglist(drive, rq)) 686 if (ide_build_sglist(drive, cmd))
679 drive->dma = !hwif->dma_ops->dma_setup(drive); 687 drive->dma = !dma_ops->dma_setup(drive, cmd);
680 else 688 else
681 drive->dma = 0; 689 drive->dma = 0;
682 } 690 }