aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:10 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:10 -0500
commit807e35d695690011faa1ce3ad67dfc23c1e39bdc (patch)
tree4b9b8328ea27896ea6050a90949d79f6e158d573 /drivers/ide/ide-io.c
parent54688aa372cbc83c4361bfb9236f9bfe02168e19 (diff)
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). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r--drivers/ide/ide-io.c60
1 files changed, 25 insertions, 35 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index c5a7b3ac7c87..9ffab8c71e75 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -232,7 +232,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
232 return ide_stopped; 232 return ide_stopped;
233 233
234out_do_tf: 234out_do_tf:
235 args->tf_flags = IDE_TFLAG_OUT_TF; 235 args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
236 if (drive->addressing == 1) 236 if (drive->addressing == 1)
237 args->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); 237 args->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
238 args->command_type = IDE_DRIVE_TASK_NO_DATA; 238 args->command_type = IDE_DRIVE_TASK_NO_DATA;
@@ -710,7 +710,7 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive)
710 return ide_stopped; 710 return ide_stopped;
711 } 711 }
712 712
713 args.tf_flags = IDE_TFLAG_OUT_TF; 713 args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
714 if (drive->addressing == 1) 714 if (drive->addressing == 1)
715 args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); 715 args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB);
716 716
@@ -849,6 +849,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
849{ 849{
850 ide_hwif_t *hwif = HWIF(drive); 850 ide_hwif_t *hwif = HWIF(drive);
851 u8 *args = rq->buffer; 851 u8 *args = rq->buffer;
852 ide_task_t ltask;
853 struct ide_taskfile *tf = &ltask.tf;
852 854
853 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 855 if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
854 ide_task_t *task = rq->special; 856 ide_task_t *task = rq->special;
@@ -869,6 +871,8 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
869 break; 871 break;
870 } 872 }
871 873
874 task->tf_flags |= IDE_TFLAG_OUT_DEVICE;
875
872 if (task->tf_flags & IDE_TFLAG_FLAGGED) 876 if (task->tf_flags & IDE_TFLAG_FLAGGED)
873 return flagged_taskfile(drive, task); 877 return flagged_taskfile(drive, task);
874 878
@@ -882,46 +886,32 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive,
882 if (args == NULL) 886 if (args == NULL)
883 goto done; 887 goto done;
884 888
885 if (IDE_CONTROL_REG) 889 memset(&ltask, 0, sizeof(ltask));
886 hwif->OUTB(drive->ctl, IDE_CONTROL_REG); /* clear nIEN */
887
888 SELECT_MASK(drive, 0);
889
890 if (rq->cmd_type == REQ_TYPE_ATA_TASK) { 890 if (rq->cmd_type == REQ_TYPE_ATA_TASK) {
891#ifdef DEBUG 891#ifdef DEBUG
892 printk("%s: DRIVE_TASK_CMD ", drive->name); 892 printk("%s: DRIVE_TASK_CMD\n", drive->name);
893 printk("cmd=0x%02x ", args[0]);
894 printk("fr=0x%02x ", args[1]);
895 printk("ns=0x%02x ", args[2]);
896 printk("sc=0x%02x ", args[3]);
897 printk("lcyl=0x%02x ", args[4]);
898 printk("hcyl=0x%02x ", args[5]);
899 printk("sel=0x%02x\n", args[6]);
900#endif 893#endif
901 hwif->OUTB(args[1], IDE_FEATURE_REG); 894 memcpy(&ltask.tf_array[7], &args[1], 6);
902 hwif->OUTB(args[2], IDE_NSECTOR_REG); 895 ltask.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE;
903 hwif->OUTB(args[3], IDE_SECTOR_REG);
904 hwif->OUTB(args[4], IDE_LCYL_REG);
905 hwif->OUTB(args[5], IDE_HCYL_REG);
906 hwif->OUTB((args[6] & 0xEF)|drive->select.all, IDE_SELECT_REG);
907 } else { /* rq->cmd_type == REQ_TYPE_ATA_CMD */ 896 } else { /* rq->cmd_type == REQ_TYPE_ATA_CMD */
908#ifdef DEBUG 897#ifdef DEBUG
909 printk("%s: DRIVE_CMD ", drive->name); 898 printk("%s: DRIVE_CMD\n", drive->name);
910 printk("cmd=0x%02x ", args[0]);
911 printk("sc=0x%02x ", args[1]);
912 printk("fr=0x%02x ", args[2]);
913 printk("xx=0x%02x\n", args[3]);
914#endif 899#endif
915 hwif->OUTB(args[2], IDE_FEATURE_REG); 900 tf->feature = args[2];
916 if (args[0] == WIN_SMART) { 901 if (args[0] == WIN_SMART) {
917 hwif->OUTB(args[3],IDE_NSECTOR_REG); 902 tf->nsect = args[3];
918 hwif->OUTB(args[1],IDE_SECTOR_REG); 903 tf->lbal = args[1];
919 hwif->OUTB(0x4f, IDE_LCYL_REG); 904 tf->lbam = 0x4f;
920 hwif->OUTB(0xc2, IDE_HCYL_REG); 905 tf->lbah = 0xc2;
921 } else 906 ltask.tf_flags = IDE_TFLAG_OUT_TF;
922 hwif->OUTB(args[1], IDE_NSECTOR_REG); 907 } else {
908 tf->nsect = args[1];
909 ltask.tf_flags = IDE_TFLAG_OUT_FEATURE |
910 IDE_TFLAG_OUT_NSECT;
911 }
923 } 912 }
924 913 tf->command = args[0];
914 ide_tf_load(drive, &ltask);
925 ide_execute_command(drive, args[0], &drive_cmd_intr, WAIT_CMD, NULL); 915 ide_execute_command(drive, args[0], &drive_cmd_intr, WAIT_CMD, NULL);
926 return ide_started; 916 return ide_started;
927 917