summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 22:17:13 +0100
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 22:17:13 +0100
commit2fc573881957337c4ea1c84b92d2f27d076cad57 (patch)
tree790726063934a7ea8c384f2314d44bc03b22f779 /drivers
parent932aead6d21b631b2058255981824008a6eae32e (diff)
downloadop-kernel-dev-2fc573881957337c4ea1c84b92d2f27d076cad57.zip
op-kernel-dev-2fc573881957337c4ea1c84b92d2f27d076cad57.tar.gz
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')
-rw-r--r--drivers/ide/ide-cd.c10
-rw-r--r--drivers/ide/ide-floppy.c9
-rw-r--r--drivers/ide/ide-io.c16
-rw-r--r--drivers/ide/ide-tape.c9
-rw-r--r--drivers/scsi/ide-scsi.c6
5 files changed, 24 insertions, 26 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 855a23c..44b033e 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,
info->dma = !hwif->dma_setup(drive);
/* Set up the controller registers. */
- if (IDE_CONTROL_REG)
- HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
- HWIF(drive)->OUTB(info->dma, IDE_FEATURE_REG);
- HWIF(drive)->OUTB(0, IDE_IREASON_REG);
- HWIF(drive)->OUTB(0, IDE_SECTOR_REG);
-
- HWIF(drive)->OUTB(xferlen & 0xff, IDE_BCOUNTL_REG);
- HWIF(drive)->OUTB(xferlen >> 8 , IDE_BCOUNTH_REG);
+ ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL |
+ IDE_TFLAG_NO_SELECT_MASK, xferlen, info->dma);
if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) {
/* waiting for CDB interrupt, not DMA yet. */
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index d4fd064..ff8232e 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
if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
dma = !hwif->dma_setup(drive);
- if (IDE_CONTROL_REG)
- HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
- /* Use PIO/DMA */
- hwif->OUTB(dma, IDE_FEATURE_REG);
- hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
- hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
- HWIF(drive)->OUTB(drive->select.all, IDE_SELECT_REG);
+ ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
+ IDE_TFLAG_OUT_DEVICE, bcount, dma);
if (dma) { /* Begin DMA, if necessary */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index d36df77..1ed7a86 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
}
EXPORT_SYMBOL(ide_do_drive_cmd);
+
+void ide_pktcmd_tf_load(ide_drive_t *drive, u32 tf_flags, u16 bcount, u8 dma)
+{
+ ide_task_t task;
+
+ memset(&task, 0, sizeof(task));
+ task.tf_flags = IDE_TFLAG_OUT_LBAH | IDE_TFLAG_OUT_LBAM |
+ IDE_TFLAG_OUT_FEATURE | tf_flags;
+ task.tf.feature = dma; /* Use PIO/DMA */
+ task.tf.lbam = bcount & 0xff;
+ task.tf.lbah = (bcount >> 8) & 0xff;
+
+ ide_tf_load(drive, &task);
+}
+
+EXPORT_SYMBOL_GPL(ide_pktcmd_tf_load);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index d1f2446..3cbca3f 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
if (test_bit(PC_DMA_RECOMMENDED, &pc->flags) && drive->using_dma)
dma_ok = !hwif->dma_setup(drive);
- if (IDE_CONTROL_REG)
- hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
- hwif->OUTB(dma_ok ? 1 : 0, IDE_FEATURE_REG); /* Use PIO/DMA */
- hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
- hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
- hwif->OUTB(drive->select.all, IDE_SELECT_REG);
+ ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
+ IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
+
if (dma_ok) /* Will begin DMA later */
set_bit(PC_DMA_IN_PROGRESS, &pc->flags);
if (test_bit(IDETAPE_DRQ_INTERRUPT, &tape->flags)) {
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 76f0ccd..02e9189 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -590,12 +590,8 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
}
SELECT_DRIVE(drive);
- if (IDE_CONTROL_REG)
- HWIF(drive)->OUTB(drive->ctl, IDE_CONTROL_REG);
- hwif->OUTB(dma, IDE_FEATURE_REG);
- hwif->OUTB(bcount & 0xff, IDE_BCOUNTL_REG);
- hwif->OUTB((bcount >> 8) & 0xff, IDE_BCOUNTH_REG);
+ ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK, bcount, dma);
if (dma)
set_bit(PC_DMA_OK, &pc->flags);
OpenPOWER on IntegriCloud