diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:10 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:10 -0500 |
commit | a3bbb9d882dc94fe3a1361596ab9ce55d84059ea (patch) | |
tree | b2b7af290b6300be00a2cbd6c5d0dba19905dc65 /drivers/ide | |
parent | 868e672ac8db650dde695a5707a6caf5a757e7d9 (diff) |
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 <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/ide-acpi.c | 1 | ||||
-rw-r--r-- | drivers/ide/ide-disk.c | 13 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 12 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 9 |
4 files changed, 23 insertions, 12 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index f0a6a3d6d2d3..e0bb0cfa7bdd 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, | |||
386 | 386 | ||
387 | /* convert gtf to IDE Taskfile */ | 387 | /* convert gtf to IDE Taskfile */ |
388 | memcpy(&args.tf_array[7], >f->tfa, 7); | 388 | memcpy(&args.tf_array[7], >f->tfa, 7); |
389 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
389 | 390 | ||
390 | if (ide_noacpitfs) { | 391 | if (ide_noacpitfs) { |
391 | DEBPRINT("_GTF execution disabled\n"); | 392 | DEBPRINT("_GTF execution disabled\n"); |
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 3e03d0c1a475..fc785e760bd8 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) | |||
304 | else | 304 | else |
305 | tf->command = WIN_READ_NATIVE_MAX; | 305 | tf->command = WIN_READ_NATIVE_MAX; |
306 | tf->device = ATA_LBA; | 306 | tf->device = ATA_LBA; |
307 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
308 | if (lba48) | ||
309 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | ||
307 | /* submit command request */ | 310 | /* submit command request */ |
308 | ide_no_data_taskfile(drive, &args); | 311 | ide_no_data_taskfile(drive, &args); |
309 | 312 | ||
@@ -349,6 +352,9 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48) | |||
349 | tf->command = WIN_SET_MAX; | 352 | tf->command = WIN_SET_MAX; |
350 | } | 353 | } |
351 | tf->device |= ATA_LBA; | 354 | tf->device |= ATA_LBA; |
355 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
356 | if (lba48) | ||
357 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | ||
352 | /* submit command request */ | 358 | /* submit command request */ |
353 | ide_no_data_taskfile(drive, &args); | 359 | ide_no_data_taskfile(drive, &args); |
354 | /* if OK, compute maximum address value */ | 360 | /* if OK, compute maximum address value */ |
@@ -497,6 +503,7 @@ static int smart_enable(ide_drive_t *drive) | |||
497 | tf->lbam = SMART_LCYL_PASS; | 503 | tf->lbam = SMART_LCYL_PASS; |
498 | tf->lbah = SMART_HCYL_PASS; | 504 | tf->lbah = SMART_HCYL_PASS; |
499 | tf->command = WIN_SMART; | 505 | tf->command = WIN_SMART; |
506 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
500 | return ide_no_data_taskfile(drive, &args); | 507 | return ide_no_data_taskfile(drive, &args); |
501 | } | 508 | } |
502 | 509 | ||
@@ -511,6 +518,7 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) | |||
511 | tf->lbam = SMART_LCYL_PASS; | 518 | tf->lbam = SMART_LCYL_PASS; |
512 | tf->lbah = SMART_HCYL_PASS; | 519 | tf->lbah = SMART_HCYL_PASS; |
513 | tf->command = WIN_SMART; | 520 | tf->command = WIN_SMART; |
521 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
514 | args.command_type = IDE_DRIVE_TASK_IN; | 522 | args.command_type = IDE_DRIVE_TASK_IN; |
515 | args.data_phase = TASKFILE_IN; | 523 | args.data_phase = TASKFILE_IN; |
516 | args.handler = &task_in_intr; | 524 | args.handler = &task_in_intr; |
@@ -690,6 +698,7 @@ static int write_cache(ide_drive_t *drive, int arg) | |||
690 | args.tf.feature = arg ? | 698 | args.tf.feature = arg ? |
691 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; | 699 | SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; |
692 | args.tf.command = WIN_SETFEATURES; | 700 | args.tf.command = WIN_SETFEATURES; |
701 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
693 | err = ide_no_data_taskfile(drive, &args); | 702 | err = ide_no_data_taskfile(drive, &args); |
694 | if (err == 0) | 703 | if (err == 0) |
695 | drive->wcache = arg; | 704 | drive->wcache = arg; |
@@ -709,6 +718,7 @@ static int do_idedisk_flushcache (ide_drive_t *drive) | |||
709 | args.tf.command = WIN_FLUSH_CACHE_EXT; | 718 | args.tf.command = WIN_FLUSH_CACHE_EXT; |
710 | else | 719 | else |
711 | args.tf.command = WIN_FLUSH_CACHE; | 720 | args.tf.command = WIN_FLUSH_CACHE; |
721 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
712 | return ide_no_data_taskfile(drive, &args); | 722 | return ide_no_data_taskfile(drive, &args); |
713 | } | 723 | } |
714 | 724 | ||
@@ -723,6 +733,7 @@ static int set_acoustic (ide_drive_t *drive, int arg) | |||
723 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; | 733 | args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; |
724 | args.tf.nsect = arg; | 734 | args.tf.nsect = arg; |
725 | args.tf.command = WIN_SETFEATURES; | 735 | args.tf.command = WIN_SETFEATURES; |
736 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
726 | ide_no_data_taskfile(drive, &args); | 737 | ide_no_data_taskfile(drive, &args); |
727 | drive->acoustic = arg; | 738 | drive->acoustic = arg; |
728 | return 0; | 739 | return 0; |
@@ -985,6 +996,7 @@ static int idedisk_open(struct inode *inode, struct file *filp) | |||
985 | ide_task_t args; | 996 | ide_task_t args; |
986 | memset(&args, 0, sizeof(ide_task_t)); | 997 | memset(&args, 0, sizeof(ide_task_t)); |
987 | args.tf.command = WIN_DOORLOCK; | 998 | args.tf.command = WIN_DOORLOCK; |
999 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
988 | check_disk_change(inode->i_bdev); | 1000 | check_disk_change(inode->i_bdev); |
989 | /* | 1001 | /* |
990 | * Ignore the return code from door_lock, | 1002 | * Ignore the return code from door_lock, |
@@ -1010,6 +1022,7 @@ static int idedisk_release(struct inode *inode, struct file *filp) | |||
1010 | ide_task_t args; | 1022 | ide_task_t args; |
1011 | memset(&args, 0, sizeof(ide_task_t)); | 1023 | memset(&args, 0, sizeof(ide_task_t)); |
1012 | args.tf.command = WIN_DOORUNLOCK; | 1024 | args.tf.command = WIN_DOORUNLOCK; |
1025 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
1013 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) | 1026 | if (drive->doorlocking && ide_no_data_taskfile(drive, &args)) |
1014 | drive->doorlocking = 0; | 1027 | drive->doorlocking = 0; |
1015 | } | 1028 | } |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 859cf7f4133f..1526d79f87e4 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 * | |||
233 | 233 | ||
234 | out_do_tf: | 234 | out_do_tf: |
235 | args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 235 | args->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; |
236 | if (drive->addressing == 1) | ||
237 | args->tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | ||
238 | args->command_type = IDE_DRIVE_TASK_NO_DATA; | 236 | args->command_type = IDE_DRIVE_TASK_NO_DATA; |
239 | args->handler = task_no_data_intr; | 237 | args->handler = task_no_data_intr; |
240 | return do_rw_taskfile(drive, args); | 238 | return do_rw_taskfile(drive, args); |
@@ -711,8 +709,6 @@ static ide_startstop_t ide_disk_special(ide_drive_t *drive) | |||
711 | } | 709 | } |
712 | 710 | ||
713 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | 711 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; |
714 | if (drive->addressing == 1) | ||
715 | args.tf_flags |= (IDE_TFLAG_LBA48 | IDE_TFLAG_OUT_HOB); | ||
716 | 712 | ||
717 | do_rw_taskfile(drive, &args); | 713 | do_rw_taskfile(drive, &args); |
718 | 714 | ||
@@ -871,17 +867,9 @@ static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, | |||
871 | break; | 867 | break; |
872 | } | 868 | } |
873 | 869 | ||
874 | task->tf_flags |= IDE_TFLAG_OUT_DEVICE; | ||
875 | if (drive->addressing == 1) | ||
876 | task->tf_flags |= IDE_TFLAG_LBA48; | ||
877 | |||
878 | if (task->tf_flags & IDE_TFLAG_FLAGGED) | 870 | if (task->tf_flags & IDE_TFLAG_FLAGGED) |
879 | return flagged_taskfile(drive, task); | 871 | return flagged_taskfile(drive, task); |
880 | 872 | ||
881 | task->tf_flags |= IDE_TFLAG_OUT_TF; | ||
882 | if (task->tf_flags & IDE_TFLAG_LBA48) | ||
883 | task->tf_flags |= IDE_TFLAG_OUT_HOB; | ||
884 | |||
885 | return do_rw_taskfile(drive, task); | 873 | return do_rw_taskfile(drive, task); |
886 | } | 874 | } |
887 | 875 | ||
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 8a5a10fdcfcb..7ae4a42cfa5a 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) | |||
126 | args.tf.command = WIN_IDENTIFY; | 126 | args.tf.command = WIN_IDENTIFY; |
127 | else | 127 | else |
128 | args.tf.command = WIN_PIDENTIFY; | 128 | args.tf.command = WIN_PIDENTIFY; |
129 | args.tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE; | ||
129 | args.command_type = IDE_DRIVE_TASK_IN; | 130 | args.command_type = IDE_DRIVE_TASK_IN; |
130 | args.data_phase = TASKFILE_IN; | 131 | args.data_phase = TASKFILE_IN; |
131 | args.handler = &task_in_intr; | 132 | args.handler = &task_in_intr; |
@@ -619,6 +620,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
619 | args.data_phase = req_task->data_phase; | 620 | args.data_phase = req_task->data_phase; |
620 | args.command_type = req_task->req_cmd; | 621 | args.command_type = req_task->req_cmd; |
621 | 622 | ||
623 | args.tf_flags = IDE_TFLAG_OUT_DEVICE; | ||
624 | if (drive->addressing == 1) | ||
625 | args.tf_flags |= IDE_TFLAG_LBA48; | ||
626 | |||
622 | if (req_task->out_flags.all) { | 627 | if (req_task->out_flags.all) { |
623 | args.tf_flags |= IDE_TFLAG_FLAGGED; | 628 | args.tf_flags |= IDE_TFLAG_FLAGGED; |
624 | 629 | ||
@@ -644,6 +649,10 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
644 | args.tf_flags |= IDE_TFLAG_OUT_LBAM; | 649 | args.tf_flags |= IDE_TFLAG_OUT_LBAM; |
645 | if (req_task->out_flags.b.hcyl) | 650 | if (req_task->out_flags.b.hcyl) |
646 | args.tf_flags |= IDE_TFLAG_OUT_LBAH; | 651 | args.tf_flags |= IDE_TFLAG_OUT_LBAH; |
652 | } else { | ||
653 | args.tf_flags |= IDE_TFLAG_OUT_TF; | ||
654 | if (args.tf_flags & IDE_TFLAG_LBA48) | ||
655 | args.tf_flags |= IDE_TFLAG_OUT_HOB; | ||
647 | } | 656 | } |
648 | 657 | ||
649 | drive->io_32bit = 0; | 658 | drive->io_32bit = 0; |