diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:13 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:13 -0500 |
commit | 2fc573881957337c4ea1c84b92d2f27d076cad57 (patch) | |
tree | 790726063934a7ea8c384f2314d44bc03b22f779 /drivers/ide | |
parent | 932aead6d21b631b2058255981824008a6eae32e (diff) |
ide: add ide_pktcmd_tf_load() helper
Add ide_pktcmd_tf_load() helper and convert ATAPI device drivers to use it.
There should be no functionality changes caused by this patch.
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-cd.c | 10 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 9 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 16 | ||||
-rw-r--r-- | drivers/ide/ide-tape.c | 9 |
4 files changed, 23 insertions, 21 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 855a23c1c815..44b033ec0ab0 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -922,14 +922,8 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive, | |||
922 | info->dma = !hwif->dma_setup(drive); | 922 | info->dma = !hwif->dma_setup(drive); |
923 | 923 | ||
924 | /* Set up the controller registers. */ | 924 | /* Set up the controller registers. */ |
925 | if (IDE_CONTROL_REG) | 925 | ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL | |
926 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | 926 | IDE_TFLAG_NO_SELECT_MASK, xferlen, info->dma); |
927 | HWIF(drive)->OUTB(info->dma, IDE_FEATURE_REG); | ||
928 | HWIF(drive)->OUTB(0, IDE_IREASON_REG); | ||
929 | HWIF(drive)->OUTB(0, IDE_SECTOR_REG); | ||
930 | |||
931 | HWIF(drive)->OUTB(xferlen & 0xff, IDE_BCOUNTL_REG); | ||
932 | HWIF(drive)->OUTB(xferlen >> 8 , IDE_BCOUNTH_REG); | ||
933 | 927 | ||
934 | if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { | 928 | if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { |
935 | /* waiting for CDB interrupt, not DMA yet. */ | 929 | /* waiting for CDB interrupt, not DMA yet. */ |
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index d4fd064cc76c..ff8232ef9659 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -1067,13 +1067,8 @@ static ide_startstop_t idefloppy_issue_pc (ide_drive_t *drive, idefloppy_pc_t *p | |||
1067 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) | 1067 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) |
1068 | dma = !hwif->dma_setup(drive); | 1068 | dma = !hwif->dma_setup(drive); |
1069 | 1069 | ||
1070 | if (IDE_CONTROL_REG) | 1070 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | |
1071 | HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG); | 1071 | IDE_TFLAG_OUT_DEVICE, bcount, dma); |
1072 | /* Use PIO/DMA */ | ||
1073 | hwif->OUTB(dma, IDE_FEATURE_REG); | ||
1074 | hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG); | ||
1075 | hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG); | ||
1076 | HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG); | ||
1077 | 1072 | ||
1078 | if (dma) { /* Begin DMA, if necessary */ | 1073 | if (dma) { /* Begin DMA, if necessary */ |
1079 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 1074 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index d36df77c7519..1ed7a8627cca 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -1734,3 +1734,19 @@ int ide_do_drive_cmd (ide_drive_t *drive, struct request *rq, ide_action_t actio | |||
1734 | } | 1734 | } |
1735 | 1735 | ||
1736 | EXPORT_SYMBOL(ide_do_drive_cmd); | 1736 | EXPORT_SYMBOL(ide_do_drive_cmd); |
1737 | |||
1738 | void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma) | ||
1739 | { | ||
1740 | ide_task_t task; | ||
1741 | |||
1742 | memset(&task, 0, sizeof(task)); | ||
1743 | task.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM | | ||
1744 | IDE_TFLAG_OUT_FEATURE | tf_flags; | ||
1745 | task.tf.feature = dma; /* Use PIO/DMA */ | ||
1746 | task.tf.lbam = bcount & 0xff; | ||
1747 | task.tf.lbah = (bcount >> 8) & 0xff; | ||
1748 | |||
1749 | ide_tf_load(drive, &task); | ||
1750 | } | ||
1751 | |||
1752 | EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load); | ||
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index d1f2446739a4..3cbca3f4628a 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -2171,12 +2171,9 @@ static ide_startstop_t idetape_issue_packet_command (ide_drive_t *drive, idetape | |||
2171 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) | 2171 | if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma) |
2172 | dma_ok = !hwif->dma_setup(drive); | 2172 | dma_ok = !hwif->dma_setup(drive); |
2173 | 2173 | ||
2174 | if (IDE_CONTROL_REG) | 2174 | ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK | |
2175 | hwif->OUTB(drive->ctl, IDE_CONTROL_REG); | 2175 | IDE_TFLAG_OUT_DEVICE, bcount, dma_ok); |
2176 | hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */ | 2176 | |
2177 | hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG); | ||
2178 | hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG); | ||
2179 | hwif->OUTB(drive->select.all, IDE_SELECT_REG); | ||
2180 | if (dma_ok) /* Will begin DMA later */ | 2177 | if (dma_ok) /* Will begin DMA later */ |
2181 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); | 2178 | set_bit(PC_DMA_IN_PROGRESS, &pc->flags); |
2182 | if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { | 2179 | if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) { |