diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:14 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 16:17:14 -0500 |
commit | 866e2ec9ce525de0e7c10d02ead8d85af27adffd (patch) | |
tree | a8bdbcd6405bc9eb5aecaeb68fdcf899e205401c /drivers/ide | |
parent | ac026ff254b32915bb14ba97a23b4019d137f181 (diff) |
ide: remove 'tf_in_flags' field from ide_task_t
* Add IDE_TFLAG_IN_DATA taskfile flag to indicate the need of reading
IDE_DATA_REG in ide_end_drive_cmd().
Set the new flag in ide_taskfile_ioctl() if ->in_flags.b.data is set.
* Add IDE_TFLAG_FLAGGED_SET_IN_FLAGS taskfile flag to indicate the
need of modifying ->in_flags in ide_taskfile_ioctl().
Set the new flag in flagged_taskfile() and move the code modifying
->tf_in_flags to ide_taskfile_ioctl().
While at it remove the bogus comment: ->tf_in_flags (except .b.data)
have no effect on selection of registers to read.
* Remove no longer needed 'tf_in_flags' field from ide_task_t.
As the result we finally have the internals of HDIO_DRIVE_TASKFILE ioctl
separated from the core IDE code.
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/ide')
-rw-r--r-- | drivers/ide/ide-io.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-taskfile.c | 29 |
2 files changed, 14 insertions, 17 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index f4f7e3db10ac..1112d8b049b9 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -340,7 +340,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) | |||
340 | if (args) { | 340 | if (args) { |
341 | struct ide_taskfile *tf = &args->tf; | 341 | struct ide_taskfile *tf = &args->tf; |
342 | 342 | ||
343 | if (args->tf_in_flags.b.data) { | 343 | if (args->tf_flags & IDE_TFLAG_IN_DATA) { |
344 | u16 data = hwif->INW(IDE_DATA_REG); | 344 | u16 data = hwif->INW(IDE_DATA_REG); |
345 | 345 | ||
346 | tf->data = data & 0xff; | 346 | tf->data = data & 0xff; |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index ff28449bbcaf..03c4a0c55bf4 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c | |||
@@ -599,8 +599,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
599 | 599 | ||
600 | memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); | 600 | memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2); |
601 | memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); | 601 | memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE); |
602 | args.tf_in_flags = req_task->in_flags; | 602 | |
603 | args.data_phase = req_task->data_phase; | 603 | args.data_phase = req_task->data_phase; |
604 | 604 | ||
605 | args.tf_flags = IDE_TFLAG_OUT_DEVICE; | 605 | args.tf_flags = IDE_TFLAG_OUT_DEVICE; |
606 | if (drive->addressing == 1) | 606 | if (drive->addressing == 1) |
@@ -637,6 +637,9 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
637 | args.tf_flags |= IDE_TFLAG_OUT_HOB; | 637 | args.tf_flags |= IDE_TFLAG_OUT_HOB; |
638 | } | 638 | } |
639 | 639 | ||
640 | if (req_task->in_flags.b.data) | ||
641 | args.tf_flags |= IDE_TFLAG_IN_DATA; | ||
642 | |||
640 | drive->io_32bit = 0; | 643 | drive->io_32bit = 0; |
641 | switch(req_task->data_phase) { | 644 | switch(req_task->data_phase) { |
642 | case TASKFILE_MULTI_OUT: | 645 | case TASKFILE_MULTI_OUT: |
@@ -704,7 +707,13 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg) | |||
704 | 707 | ||
705 | memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2); | 708 | memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2); |
706 | memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE); | 709 | memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE); |
707 | req_task->in_flags = args.tf_in_flags; | 710 | |
711 | if ((args.tf_flags & IDE_TFLAG_FLAGGED_SET_IN_FLAGS) && | ||
712 | req_task->in_flags.all == 0) { | ||
713 | req_task->in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | ||
714 | if (drive->addressing == 1) | ||
715 | req_task->in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8); | ||
716 | } | ||
708 | 717 | ||
709 | if (copy_to_user(buf, req_task, tasksize)) { | 718 | if (copy_to_user(buf, req_task, tasksize)) { |
710 | err = -EFAULT; | 719 | err = -EFAULT; |
@@ -846,19 +855,7 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) | |||
846 | } | 855 | } |
847 | } | 856 | } |
848 | 857 | ||
849 | /* | 858 | task->tf_flags |= IDE_TFLAG_FLAGGED_SET_IN_FLAGS; |
850 | * (ks) Check taskfile in flags. | ||
851 | * If set, then execute as it is defined. | ||
852 | * If not set, then define default settings. | ||
853 | * The default values are: | ||
854 | * read all taskfile registers (except data) | ||
855 | * read the hob registers (sector, nsector, lcyl, hcyl) | ||
856 | */ | ||
857 | if (task->tf_in_flags.all == 0) { | ||
858 | task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; | ||
859 | if (drive->addressing == 1) | ||
860 | task->tf_in_flags.all |= (IDE_HOB_STD_IN_FLAGS << 8); | ||
861 | } | ||
862 | 859 | ||
863 | return do_rw_taskfile(drive, task); | 860 | return do_rw_taskfile(drive, task); |
864 | } | 861 | } |