diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:46 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-27 07:46:46 -0400 |
commit | b788ee9c6561fd9219a503216284d61036a0dc0b (patch) | |
tree | d83198a6c1a38661e60ac7454d1d82889c0472b3 /drivers/ide/ide-atapi.c | |
parent | 2298169418f43ba5e0919762a4bab95a1227872a (diff) |
ide: use do_rw_taskfile() for ATA_CMD_PACKET commands
* Pass command to ide_issue_pc() and update ->do_request methods
in ide-{cd,floppy,tape}.c accordingly.
* Convert ide_pktcmd_tf_load() to ide_init_packet_cmd() which
just initializes command structure and use do_rw_taskfile()
to load ATA_CMD_PACKET commands.
While at it:
* Rename ide{floppy,tape}_issue_pc() to ide_{floppy,tape}_issue_pc().
There should be no functional changes caused by this patch.
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-atapi.c')
-rw-r--r-- | drivers/ide/ide-atapi.c | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c index b56af49f876b..75df05add1b9 100644 --- a/drivers/ide/ide-atapi.c +++ b/drivers/ide/ide-atapi.c | |||
@@ -487,23 +487,15 @@ next_irq: | |||
487 | return ide_started; | 487 | return ide_started; |
488 | } | 488 | } |
489 | 489 | ||
490 | static void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount) | 490 | static void ide_init_packet_cmd(struct ide_cmd *cmd, u32 tf_flags, |
491 | u16 bcount, u8 dma) | ||
491 | { | 492 | { |
492 | ide_hwif_t *hwif = drive->hwif; | 493 | cmd->protocol = dma ? ATAPI_PROT_DMA : ATAPI_PROT_PIO; |
493 | struct ide_cmd cmd; | 494 | cmd->tf_flags |= IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | |
494 | u8 dma = drive->dma; | 495 | IDE_TFLAG_OUT_FEATURE | tf_flags; |
495 | 496 | cmd->tf.feature = dma; /* Use PIO/DMA */ | |
496 | memset(&cmd, 0, sizeof(cmd)); | 497 | cmd->tf.lbam = bcount & 0xff; |
497 | cmd.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | | 498 | cmd->tf.lbah = (bcount >> 8) & 0xff; |
498 | IDE_TFLAG_OUT_FEATURE | tf_flags; | ||
499 | cmd.tf.feature = dma; /* Use PIO/DMA */ | ||
500 | cmd.tf.lbam = bcount & 0xff; | ||
501 | cmd.tf.lbah = (bcount >> 8) & 0xff; | ||
502 | |||
503 | ide_tf_dump(drive->name, &cmd.tf); | ||
504 | hwif->tp_ops->set_irq(hwif, 1); | ||
505 | SELECT_MASK(drive, 0); | ||
506 | hwif->tp_ops->tf_load(drive, &cmd); | ||
507 | } | 499 | } |
508 | 500 | ||
509 | static u8 ide_read_ireason(ide_drive_t *drive) | 501 | static u8 ide_read_ireason(ide_drive_t *drive) |
@@ -634,24 +626,17 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) | |||
634 | return ide_started; | 626 | return ide_started; |
635 | } | 627 | } |
636 | 628 | ||
637 | ide_startstop_t ide_issue_pc(ide_drive_t *drive) | 629 | ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd) |
638 | { | 630 | { |
639 | struct ide_atapi_pc *pc; | 631 | struct ide_atapi_pc *pc; |
640 | ide_hwif_t *hwif = drive->hwif; | 632 | ide_hwif_t *hwif = drive->hwif; |
641 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; | 633 | const struct ide_dma_ops *dma_ops = hwif->dma_ops; |
642 | struct ide_cmd *cmd = &hwif->cmd; | ||
643 | ide_expiry_t *expiry = NULL; | 634 | ide_expiry_t *expiry = NULL; |
644 | struct request *rq = hwif->rq; | 635 | struct request *rq = hwif->rq; |
645 | unsigned int timeout; | 636 | unsigned int timeout; |
646 | u32 tf_flags; | 637 | u32 tf_flags; |
647 | u16 bcount; | 638 | u16 bcount; |
648 | 639 | ||
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 | |||
655 | if (dev_is_idecd(drive)) { | 640 | if (dev_is_idecd(drive)) { |
656 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; | 641 | tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; |
657 | bcount = ide_cd_get_xferlen(rq); | 642 | bcount = ide_cd_get_xferlen(rq); |
@@ -696,7 +681,9 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) | |||
696 | : WAIT_TAPE_CMD; | 681 | : WAIT_TAPE_CMD; |
697 | } | 682 | } |
698 | 683 | ||
699 | ide_pktcmd_tf_load(drive, tf_flags, bcount); | 684 | ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma); |
685 | |||
686 | (void)do_rw_taskfile(drive, cmd); | ||
700 | 687 | ||
701 | /* Issue the packet command */ | 688 | /* Issue the packet command */ |
702 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { | 689 | if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { |