From 650d841d9e053a618dd8ce753422f91b493cf2f6 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 25 Jan 2008 22:17:06 +0100 Subject: ide: add struct ide_taskfile (take 2) * Don't set write-only ide_task_t.hobRegister[6] and ide_task_t.hobRegister[7] in idedisk_set_max_address_ext(). * Add struct ide_taskfile and use it in ide_task_t instead of tfRegister[] and hobRegister[]. * Remove no longer needed IDE_CONTROL_OFFSET_HOB define. * Add #ifndef/#endif __KERNEL__ around definitions of {task,hob}_struct_t. While at it: * Use ATA_LBA define for LBA bit (0x40) as suggested by Tejun Heo. v2: * Add missing newlines. (Noticed by Sergei) * Use ~ATA_LBA instead of 0xBF. (Noticed by Sergei) * Use unnamed unions for error/feature and status/command. (Suggested by Sergei). There should be no functionality changes caused by this patch. Acked-by: Sergei Shtylyov Cc: Tejun Heo Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-acpi.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'drivers/ide/ide-acpi.c') diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 899d56536e8..747c51889f7 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -388,13 +388,7 @@ static int taskfile_load_raw(ide_drive_t *drive, args.handler = &task_no_data_intr; /* convert gtf to IDE Taskfile */ - args.tfRegister[1] = gtf->tfa[0]; /* 0x1f1 */ - args.tfRegister[2] = gtf->tfa[1]; /* 0x1f2 */ - args.tfRegister[3] = gtf->tfa[2]; /* 0x1f3 */ - args.tfRegister[4] = gtf->tfa[3]; /* 0x1f4 */ - args.tfRegister[5] = gtf->tfa[4]; /* 0x1f5 */ - args.tfRegister[6] = gtf->tfa[5]; /* 0x1f6 */ - args.tfRegister[7] = gtf->tfa[6]; /* 0x1f7 */ + memcpy(&args.tf_array[7], >f->tfa, 7); if (ide_noacpitfs) { DEBPRINT("_GTF execution disabled\n"); -- cgit v1.2.3-70-g09d2 From 9a3c49be5c5f7388eefb712be9a383904140532e Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 25 Jan 2008 22:17:07 +0100 Subject: ide: add ide_no_data_taskfile() helper * Add ide_no_data_taskfile() helper and convert ide_raw_taskfile() w/ NO DATA protocol users to use it instead. * Set ->data_phase explicitly in ide_no_data_taskfile() (TASKFILE_NO_DATA is defined as 0x0000). * Unexport task_no_data_intr(). Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-acpi.c | 7 ++----- drivers/ide/ide-disk.c | 32 ++++++++------------------------ drivers/ide/ide-taskfile.c | 12 ++++++++++-- include/linux/ide.h | 2 ++ 4 files changed, 22 insertions(+), 31 deletions(-) (limited to 'drivers/ide/ide-acpi.c') diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 747c51889f7..f0a6a3d6d2d 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -383,9 +383,6 @@ static int taskfile_load_raw(ide_drive_t *drive, gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); memset(&args, 0, sizeof(ide_task_t)); - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.data_phase = TASKFILE_NO_DATA; - args.handler = &task_no_data_intr; /* convert gtf to IDE Taskfile */ memcpy(&args.tf_array[7], >f->tfa, 7); @@ -395,9 +392,9 @@ static int taskfile_load_raw(ide_drive_t *drive, return err; } - err = ide_raw_taskfile(drive, &args, NULL); + err = ide_no_data_taskfile(drive, &args); if (err) - printk(KERN_ERR "%s: ide_raw_taskfile failed: %u\n", + printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", __FUNCTION__, err); return err; diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 6387222dd20..b534fe97d47 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -303,10 +303,8 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) else tf->command = WIN_READ_NATIVE_MAX; tf->device = ATA_LBA; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; /* submit command request */ - ide_raw_taskfile(drive, &args, NULL); + ide_no_data_taskfile(drive, &args); /* if OK, compute maximum address value */ if ((tf->status & 0x01) == 0) { @@ -350,10 +348,8 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) tf->command = WIN_SET_MAX; } tf->device |= ATA_LBA; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; /* submit command request */ - ide_raw_taskfile(drive, &args, NULL); + ide_no_data_taskfile(drive, &args); /* if OK, compute maximum address value */ if ((tf->status & 0x01) == 0) { u32 high, low; @@ -500,9 +496,7 @@ static int smart_enable(ide_drive_t *drive) tf->lbam = SMART_LCYL_PASS; tf->lbah = SMART_HCYL_PASS; tf->command = WIN_SMART; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; - return ide_raw_taskfile(drive, &args, NULL); + return ide_no_data_taskfile(drive, &args); } static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) @@ -695,9 +689,7 @@ static int write_cache(ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; args.tf.command = WIN_SETFEATURES; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; - err = ide_raw_taskfile(drive, &args, NULL); + err = ide_no_data_taskfile(drive, &args); if (err == 0) drive->wcache = arg; } @@ -716,9 +708,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) args.tf.command = WIN_FLUSH_CACHE_EXT; else args.tf.command = WIN_FLUSH_CACHE; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; - return ide_raw_taskfile(drive, &args, NULL); + return ide_no_data_taskfile(drive, &args); } static int set_acoustic (ide_drive_t *drive, int arg) @@ -732,9 +722,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; args.tf.nsect = arg; args.tf.command = WIN_SETFEATURES; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; - ide_raw_taskfile(drive, &args, NULL); + ide_no_data_taskfile(drive, &args); drive->acoustic = arg; return 0; } @@ -996,15 +984,13 @@ static int idedisk_open(struct inode *inode, struct file *filp) ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); args.tf.command = WIN_DOORLOCK; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; check_disk_change(inode->i_bdev); /* * Ignore the return code from door_lock, * since the open() has already succeeded, * and the door_lock is irrelevant at this point. */ - if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) + if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) drive->doorlocking = 0; } return 0; @@ -1023,9 +1009,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); args.tf.command = WIN_DOORUNLOCK; - args.command_type = IDE_DRIVE_TASK_NO_DATA; - args.handler = &task_no_data_intr; - if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) + if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) drive->doorlocking = 0; } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index a79150e6be0..7cb674f8131 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -229,8 +229,6 @@ ide_startstop_t task_no_data_intr (ide_drive_t *drive) return ide_stopped; } -EXPORT_SYMBOL(task_no_data_intr); - static u8 wait_drive_not_busy(ide_drive_t *drive) { ide_hwif_t *hwif = HWIF(drive); @@ -524,6 +522,16 @@ int ide_raw_taskfile (ide_drive_t *drive, ide_task_t *args, u8 *buf) EXPORT_SYMBOL(ide_raw_taskfile); +int ide_no_data_taskfile(ide_drive_t *drive, ide_task_t *task) +{ + task->command_type = IDE_DRIVE_TASK_NO_DATA; + task->data_phase = TASKFILE_NO_DATA; + task->handler = task_no_data_intr; + + return ide_raw_taskfile(drive, task, NULL); +} +EXPORT_SYMBOL_GPL(ide_no_data_taskfile); + #ifdef CONFIG_IDE_TASK_IOCTL int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) { diff --git a/include/linux/ide.h b/include/linux/ide.h index e25fd0b1dd7..11bfbc40c50 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -1140,6 +1140,8 @@ extern ide_startstop_t pre_task_out_intr(ide_drive_t *, struct request *); extern int ide_raw_taskfile(ide_drive_t *, ide_task_t *, u8 *); +int ide_no_data_taskfile(ide_drive_t *, ide_task_t *); + int ide_taskfile_ioctl(ide_drive_t *, unsigned int, unsigned long); int ide_cmd_ioctl(ide_drive_t *, unsigned int, unsigned long); int ide_task_ioctl(ide_drive_t *, unsigned int, unsigned long); -- cgit v1.2.3-70-g09d2 From a3bbb9d882dc94fe3a1361596ab9ce55d84059ea Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Fri, 25 Jan 2008 22:17:10 +0100 Subject: ide: remove unnecessary writes to HOB taskfile registers * Set taskfile flags for REQ_TYPE_ATA_TASKFILE requests before adding the request to the queue. * Cleanup execute_drive_cmd(). * Remove unnecessary writes to HOB taskfile registers when using LBA48 disk for the following cases: - Power Management requests (WIN_FLUSH_CACHE[_EXT], WIN_STANDBYNOW1, WIN_IDLEIMMEDIATE commands) - special commands (WIN_SPECIFY, WIN_RESTORE, WIN_SETMULT) - Host Protected Area support (WIN_READ_NATIVE_MAX, WIN_SET_MAX) - /proc/ide/ SMART support (WIN_SMART with SMART_ENABLE, SMART_READ_VALUES and SMART_READ_THRESHOLDS subcommands) - write cache enabling/disabling in ide-disk (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_WCACHE) - write cache flushing in ide-disk (WIN_FLUSH_CACHE[_EXT]) - acoustic management in ide-disk (WIN_SETFEATURES with SETFEATURES_{EN,DIS}_AAM) - door (un)locking in ide-disk (WIN_DOORLOCK, WIN_DOORUNLOCK) - /proc/ide/hd?/identify support (WIN_IDENTIFY) - ACPI _GTF taskfiles Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-acpi.c | 1 + drivers/ide/ide-disk.c | 13 +++++++++++++ drivers/ide/ide-io.c | 12 ------------ drivers/ide/ide-taskfile.c | 9 +++++++++ 4 files changed, 23 insertions(+), 12 deletions(-) (limited to 'drivers/ide/ide-acpi.c') diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index f0a6a3d6d2d..e0bb0cfa7bd 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -386,6 +386,7 @@ static int taskfile_load_raw(ide_drive_t *drive, /* convert gtf to IDE Taskfile */ memcpy(&args.tf_array[7], >f->tfa, 7); + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; if (ide_noacpitfs) { DEBPRINT("_GTF execution disabled\n"); diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 3e03d0c1a47..fc785e760bd 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -304,6 +304,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) else tf->command = WIN_READ_NATIVE_MAX; tf->device = ATA_LBA; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + if (lba48) + args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); /* submit command request */ ide_no_data_taskfile(drive, &args); @@ -349,6 +352,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) tf->command = WIN_SET_MAX; } tf->device |= ATA_LBA; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + if (lba48) + args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); /* submit command request */ ide_no_data_taskfile(drive, &args); /* if OK, compute maximum address value */ @@ -497,6 +503,7 @@ static int smart_enable(ide_drive_t *drive) tf->lbam = SMART_LCYL_PASS; tf->lbah = SMART_HCYL_PASS; tf->command = WIN_SMART; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; return ide_no_data_taskfile(drive, &args); } @@ -511,6 +518,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) tf->lbam = SMART_LCYL_PASS; tf->lbah = SMART_HCYL_PASS; tf->command = WIN_SMART; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; args.command_type = IDE_DRIVE_TASK_IN; args.data_phase = TASKFILE_IN; args.handler = &task_in_intr; @@ -690,6 +698,7 @@ static int write_cache(ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; args.tf.command = WIN_SETFEATURES; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; err = ide_no_data_taskfile(drive, &args); if (err == 0) drive->wcache = arg; @@ -709,6 +718,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) args.tf.command = WIN_FLUSH_CACHE_EXT; else args.tf.command = WIN_FLUSH_CACHE; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; return ide_no_data_taskfile(drive, &args); } @@ -723,6 +733,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; args.tf.nsect = arg; args.tf.command = WIN_SETFEATURES; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; ide_no_data_taskfile(drive, &args); drive->acoustic = arg; return 0; @@ -985,6 +996,7 @@ static int idedisk_open(struct inode *inode, struct file *filp) ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); args.tf.command = WIN_DOORLOCK; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; check_disk_change(inode->i_bdev); /* * Ignore the return code from door_lock, @@ -1010,6 +1022,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) ide_task_t args; memset(&args, 0, sizeof(ide_task_t)); args.tf.command = WIN_DOORUNLOCK; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) drive->doorlocking = 0; } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 859cf7f4133..1526d79f87e 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -233,8 +233,6 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * out_do_tf: args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; - if (drive->addressing == 1) - args->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); args->command_type = IDE_DRIVE_TASK_NO_DATA; args->handler = task_no_data_intr; return do_rw_taskfile(drive, args); @@ -711,8 +709,6 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) } args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; - if (drive->addressing == 1) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); do_rw_taskfile(drive, &args); @@ -871,17 +867,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, break; } - task->tf_flags |= IDE_TFLAG_OUT_DEVICE; - if (drive->addressing == 1) - task->tf_flags |= IDE_TFLAG_LBA48; - if (task->tf_flags & IDE_TFLAG_FLAGGED) return flagged_taskfile(drive, task); - task->tf_flags |= IDE_TFLAG_OUT_TF; - if (task->tf_flags & IDE_TFLAG_LBA48) - task->tf_flags |= IDE_TFLAG_OUT_HOB; - return do_rw_taskfile(drive, task); } diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 8a5a10fdcfc..7ae4a42cfa5 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -126,6 +126,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) args.tf.command = WIN_IDENTIFY; else args.tf.command = WIN_PIDENTIFY; + args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; args.command_type = IDE_DRIVE_TASK_IN; args.data_phase = TASKFILE_IN; args.handler = &task_in_intr; @@ -619,6 +620,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) args.data_phase = req_task->data_phase; args.command_type = req_task->req_cmd; + args.tf_flags = IDE_TFLAG_OUT_DEVICE; + if (drive->addressing == 1) + args.tf_flags |= IDE_TFLAG_LBA48; + if (req_task->out_flags.all) { args.tf_flags |= IDE_TFLAG_FLAGGED; @@ -644,6 +649,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) args.tf_flags |= IDE_TFLAG_OUT_LBAM; if (req_task->out_flags.b.hcyl) args.tf_flags |= IDE_TFLAG_OUT_LBAH; + } else { + args.tf_flags |= IDE_TFLAG_OUT_TF; + if (args.tf_flags & IDE_TFLAG_LBA48) + args.tf_flags |= IDE_TFLAG_OUT_HOB; } drive->io_32bit = 0; -- cgit v1.2.3-70-g09d2 From 657cc1a8f6cd6a9e2974cba3af9fccd8c25e06ad Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 26 Jan 2008 20:13:10 +0100 Subject: ide: set IDE_TFLAG_IN_* flags before queuing/executing command * Add IDE_TFLAG_{HOB,TF,DEVICE} defines. * Set IDE_TFLAG_IN_* flags in {do_rw,ide_no_data,ide_raw}_taskfile() users. * Remove no longer needed ->tf_flags setup from ide_end_drive_cmd(). There should be no functionality changes caused by this patch. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-acpi.c | 2 +- drivers/ide/ide-disk.c | 24 ++++++++++++------------ drivers/ide/ide-io.c | 8 ++------ drivers/ide/ide-taskfile.c | 9 +++++---- include/linux/ide.h | 6 ++++++ 5 files changed, 26 insertions(+), 23 deletions(-) (limited to 'drivers/ide/ide-acpi.c') diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index e0bb0cfa7bd..e888fc35b27 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c @@ -386,7 +386,7 @@ static int taskfile_load_raw(ide_drive_t *drive, /* convert gtf to IDE Taskfile */ memcpy(&args.tf_array[7], >f->tfa, 7); - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (ide_noacpitfs) { DEBPRINT("_GTF execution disabled\n"); diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 041be43a62c..027bf439759 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -201,7 +201,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, memset(&task, 0, sizeof(task)); task.tf_flags = IDE_TFLAG_NO_SELECT_MASK; /* FIXME? */ - task.tf_flags |= (IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE); + task.tf_flags |= (IDE_TFLAG_TF | IDE_TFLAG_DEVICE); if (drive->select.b.lba) { if (lba48) { @@ -220,7 +220,7 @@ static ide_startstop_t __ide_do_rw_disk(ide_drive_t *drive, struct request *rq, tf->lbam = (u8)(block >> 8); tf->lbah = (u8)(block >> 16); - task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); + task.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); } else { tf->nsect = nsectors & 0xff; tf->lbal = block; @@ -314,9 +314,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48) else tf->command = WIN_READ_NATIVE_MAX; tf->device = ATA_LBA; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (lba48) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); + args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); /* submit command request */ ide_no_data_taskfile(drive, &args); @@ -353,9 +353,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) tf->command = WIN_SET_MAX; } tf->device |= ATA_LBA; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; if (lba48) - args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); + args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_HOB); /* submit command request */ ide_no_data_taskfile(drive, &args); /* if OK, compute maximum address value */ @@ -495,7 +495,7 @@ static int smart_enable(ide_drive_t *drive) tf->lbam = SMART_LCYL_PASS; tf->lbah = SMART_HCYL_PASS; tf->command = WIN_SMART; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; return ide_no_data_taskfile(drive, &args); } @@ -510,7 +510,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) tf->lbam = SMART_LCYL_PASS; tf->lbah = SMART_HCYL_PASS; tf->command = WIN_SMART; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; args.data_phase = TASKFILE_IN; (void) smart_enable(drive); return ide_raw_taskfile(drive, &args, buf, 1); @@ -689,7 +689,7 @@ static int write_cache(ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; args.tf.command = WIN_SETFEATURES; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; err = ide_no_data_taskfile(drive, &args); if (err == 0) drive->wcache = arg; @@ -709,7 +709,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) args.tf.command = WIN_FLUSH_CACHE_EXT; else args.tf.command = WIN_FLUSH_CACHE; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; return ide_no_data_taskfile(drive, &args); } @@ -724,7 +724,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; args.tf.nsect = arg; args.tf.command = WIN_SETFEATURES; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; ide_no_data_taskfile(drive, &args); drive->acoustic = arg; return 0; @@ -975,7 +975,7 @@ static int idedisk_set_doorlock(ide_drive_t *drive, int on) memset(&task, 0, sizeof(task)); task.tf.command = on ? WIN_DOORLOCK : WIN_DOORUNLOCK; - task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; return ide_no_data_taskfile(drive, &task); } diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index f01b103e55f..0f3e2f4f9c2 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -231,7 +231,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * return ide_stopped; out_do_tf: - args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args->tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; args->data_phase = TASKFILE_NO_DATA; return do_rw_taskfile(drive, args); } @@ -385,10 +385,6 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) tf->error = err; tf->status = stat; - args->tf_flags |= (IDE_TFLAG_IN_TF|IDE_TFLAG_IN_DEVICE); - if (args->tf_flags & IDE_TFLAG_LBA48) - args->tf_flags |= IDE_TFLAG_IN_HOB; - ide_tf_read(drive, args); } } else if (blk_pm_request(rq)) { @@ -712,7 +708,7 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) return ide_stopped; } - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE | IDE_TFLAG_CUSTOM_HANDLER; do_rw_taskfile(drive, &args); diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index bc3d8aed9a8..1f664ea57e5 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -99,7 +99,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) args.tf.command = WIN_IDENTIFY; else args.tf.command = WIN_PIDENTIFY; - args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; args.data_phase = TASKFILE_IN; return ide_raw_taskfile(drive, &args, buf, 1); } @@ -618,9 +618,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) args.data_phase = req_task->data_phase; - args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_OUT_DEVICE; + args.tf_flags = IDE_TFLAG_IO_16BIT | IDE_TFLAG_DEVICE | + IDE_TFLAG_IN_TF; if (drive->addressing == 1) - args.tf_flags |= IDE_TFLAG_LBA48; + args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_IN_HOB); if (req_task->out_flags.all) { args.tf_flags |= IDE_TFLAG_FLAGGED; @@ -836,7 +837,7 @@ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) memset(&task, 0, sizeof(task)); memcpy(&task.tf_array[7], &args[1], 6); task.tf.command = args[0]; - task.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; + task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; err = ide_no_data_taskfile(drive, &task); diff --git a/include/linux/ide.h b/include/linux/ide.h index c1a8b8bb93a..02493dbb156 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -931,6 +931,12 @@ enum { IDE_TFLAG_IN_TF = IDE_TFLAG_IN_NSECT | IDE_TFLAG_IN_LBA, IDE_TFLAG_IN_DEVICE = (1 << 29), + IDE_TFLAG_HOB = IDE_TFLAG_OUT_HOB | + IDE_TFLAG_IN_HOB, + IDE_TFLAG_TF = IDE_TFLAG_OUT_TF | + IDE_TFLAG_IN_TF, + IDE_TFLAG_DEVICE = IDE_TFLAG_OUT_DEVICE | + IDE_TFLAG_IN_DEVICE, /* force 16-bit I/O operations */ IDE_TFLAG_IO_16BIT = (1 << 30), }; -- cgit v1.2.3-70-g09d2