Skip to contentSkip to conversation

ide: use ide_tf_load() in execute_drive_cmd()

PATCH In review Bartlomiej Zolnierkiewicz 1 participant 1 message Oct 27, 2007 libata

lore
Share & tools
lore
#0 lore raw

PATCH 9/15 ide: use ide_tf_load() in execute_drive_cmd()

* Add IDE_TFLAG_OUT_DEVICE taskfile flag to indicate the need of writing the Device register and handle it in ide_tf_load().

Update ide_tf_load() and {do_rw,flagged}_taskfile() users accordingly.

* Use struct ide_taskfile and ide_tf_load() in execute_drive_cmd().

* Make the debugging code dump all taskfile registers for both REQ_ATA_TYPE_{CMD,TASK} requests and move it to ide_tf_load() so it also covers REQ_ATA_TYPE_TASKFILE requests.

There should be no functionality changes caused by this patch (unless DEBUG is defined).

---
 drivers/ide/ide-disk.c     |    2 -
 drivers/ide/ide-io.c       |   60 ++++++++++++++++++---------------------------
 drivers/ide/ide-taskfile.c |   10 ++++++-
 include/linux/ide.h        |    1 
 4 files changed, 36 insertions(+), 37 deletions(-)
drivers/ide/ide-disk.c +1 -1
Index: b/drivers/ide/ide-disk.c
===================================================================
@@ -185,7 +185,7 @@ static ide_startstop_t __ide_do_rw_disk(
 
 	memset(&task, 0, sizeof(task));
 	task.tf_flags = IDE_TFLAG_NO_SELECT_MASK;  /* FIXME? */
-	task.tf_flags |= IDE_TFLAG_OUT_TF;
+	task.tf_flags |= (IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE);
 
 	if (drive->select.b.lba) {
 		if (lba48) {
drivers/ide/ide-io.c +25 -35

97 lines not on this page · raw message

drivers/ide/ide-taskfile.c +9 -1
Index: b/drivers/ide/ide-taskfile.c
===================================================================
@@ -72,6 +72,13 @@ void ide_tf_load(ide_drive_t *drive, ide
 	if (task->tf_flags & IDE_TFLAG_FLAGGED)
 		HIHI = 0xFF;
 
+#ifdef DEBUG
+	printk("%s: tf: feat 0x%02x nsect 0x%02x lbal 0x%02x "
+		"lbam 0x%02x lbah 0x%02x dev 0x%02x cmd 0x%02x\n",
+		drive->name, tf->feature, tf->nsect, tf->lbal,
+		tf->lbam, tf->lbah, tf->device, tf->command);
+#endif
+
 	if (IDE_CONTROL_REG)
 		hwif->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
 
@@ -103,7 +110,8 @@ void ide_tf_load(ide_drive_t *drive, ide
 	if (task->tf_flags & IDE_TFLAG_OUT_LBAH)
 		hwif->OUTB(tf->lbah, IDE_HCYL_REG);
 
-	hwif->OUTB((tf->device & HIHI) | drive->select.all, IDE_SELECT_REG);
+	if (task->tf_flags & IDE_TFLAG_OUT_DEVICE)
+		hwif->OUTB((tf->device & HIHI) | drive->select.all, IDE_SELECT_REG);
 }
 
 EXPORT_SYMBOL_GPL(ide_tf_load);
include/linux/ide.h +1 -0
Index: b/include/linux/ide.h
===================================================================
@@ -1073,6 +1073,7 @@ enum {
 					  IDE_TFLAG_OUT_LBAL |
 					  IDE_TFLAG_OUT_LBAM |
 					  IDE_TFLAG_OUT_LBAH,
+	IDE_TFLAG_OUT_DEVICE		= (1 << 14),
 };
 
 struct ide_taskfile {