ide: use do_rw_taskfile() in flagged_taskfile()
PATCH 12/12 ide: use do_rw_taskfile() in flagged_taskfile()
Based on the earlier work by Tejun Heo.
* Move setting IDE_TFLAG_LBA48 taskfile flag from do_rw_taskfile() function to the callers.
* Add IDE_TFLAG_FLAGGED taskfile flag for flagged taskfiles coming from ide_taskfile_ioctl(). Check it instead of ->tf_out_flags.all.
* Add IDE_TFLAG_OUT_DATA taskfile flag to indicate the need to load IDE data register in ide_tf_load().
* Add IDE_TFLAG_OUT_* taskfile flags to indicate the need to load particular IDE taskfile registers in ide_tf_load().
* Update do_rw_taskfile() and ide_tf_load() users to set respective IDE_TFLAG_OUT_* taksfile flags.
* Add task_dma_ok() helper.
* Use IDE_TFLAG_FLAGGED taskfile flag to select HIHI mask in ide_tf_load().
* Use do_rw_taskfile() in flagged_taskfile().
* Remove no longer needed 'tf_out_flags' field from ide_task_t.
There should be no functionality changes caused by this patch.
--- drivers/ide/ide-disk.c | 3 drivers/ide/ide-io.c | 31 +++++-- drivers/ide/ide-taskfile.c | 180 ++++++++++++++++++--------------------------- include/linux/ide.h | 25 +++++- 4 files changed, 119 insertions(+), 120 deletions(-)
drivers/ide/ide-disk.c +2 -1
@@ -185,6 +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 ;if (drive->select.b.lba) {if (lba48) {
@@ -208,7 +209,7 @@ static ide_startstop_t __ide_do_rw_disk( tf->hob_lbah, tf->hob_lbam, tf->hob_lbal, tf->lbah, tf->lbam, tf->lbal);#endif - task.tf_flags |=IDE_TFLAG_LBA48 ; + task.tf_flags |= (IDE_TFLAG_LBA48 |IDE_TFLAG_OUT_HOB ); }else { tf->nsect = nsectors.b.low; tf->lbal = block;
drivers/ide/ide-io.c +21 -10
@@ -192,15 +192,11 @@ static ide_startstop_t ide_start_power_s 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 do_rw_taskfile (drive, args); + goto out_do_tf;case idedisk_pm_standby:/* Suspend step 2 (standby) */ args->tf.command =WIN_STANDBYNOW1 ; - args->command_type =IDE_DRIVE_TASK_NO_DATA ; - args->handler = &task_no_data_intr; -return do_rw_taskfile (drive, args); + goto out_do_tf;case idedisk_pm_restore_pio:/* Resume step 1 (restore PIO) */ ide_set_max_pio (drive);
@@ -215,9 +211,7 @@ static ide_startstop_t ide_start_power_scase idedisk_pm_idle:/* Resume step 2 (idle) */ args->tf.command =WIN_IDLEIMMEDIATE ; - args->command_type =IDE_DRIVE_TASK_NO_DATA ; - args->handler = task_no_data_intr; -return do_rw_taskfile (drive, args); + goto out_do_tf;case ide_pm_restore_dma:/* Resume step 3 (restore DMA) */ /*
@@ -236,6 +230,14 @@ static ide_startstop_t ide_start_power_s } pm->pm_step = ide_pm_state_completed;return ide_stopped; + +out_do_tf: + args->tf_flags =IDE_TFLAG_OUT_TF ; +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); }/**
@@ -761,6 +763,10 @@ static ide_startstop_t ide_disk_special(return ide_stopped; } + args.tf_flags =IDE_TFLAG_OUT_TF ; +if (drive->addressing ==1 ) + args.tf_flags |= (IDE_TFLAG_LBA48 |IDE_TFLAG_OUT_HOB ); +do_rw_taskfile (drive, &args);return ide_started;
@@ -913,8 +919,13 @@ static ide_startstop_t execute_drive_cmdbreak ; } -if (args->tf_out_flags.all !=0 ) +if (args->tf_flags &IDE_TFLAG_FLAGGED )return flagged_taskfile (drive, args); + + args->tf_flags |=IDE_TFLAG_OUT_TF ; +if (drive->addressing ==1 ) + args->tf_flags |= (IDE_TFLAG_LBA48 |IDE_TFLAG_OUT_HOB ); +return do_rw_taskfile (drive, args); }else if (rq->cmd_type ==REQ_TYPE_ATA_TASK ) {u8 *args = rq->buffer;
drivers/ide/ide-taskfile.c +73 -107
246 lines not on this page · raw message
include/linux/ide.h +23 -2
@@ -1073,6 +1073,28 @@ extern int ide_wait_cmd(ide_drive_t *, uenum {IDE_TFLAG_LBA48 = (1 <<0 ),IDE_TFLAG_NO_SELECT_MASK = (1 <<1 ), +IDE_TFLAG_FLAGGED = (1 <<2 ), +IDE_TFLAG_OUT_DATA = (1 <<3 ), +IDE_TFLAG_OUT_HOB_FEATURE = (1 <<4 ), +IDE_TFLAG_OUT_HOB_NSECT = (1 <<5 ), +IDE_TFLAG_OUT_HOB_LBAL = (1 <<6 ), +IDE_TFLAG_OUT_HOB_LBAM = (1 <<7 ), +IDE_TFLAG_OUT_HOB_LBAH = (1 <<8 ), +IDE_TFLAG_OUT_HOB =IDE_TFLAG_OUT_HOB_FEATURE | +IDE_TFLAG_OUT_HOB_NSECT | +IDE_TFLAG_OUT_HOB_LBAL | +IDE_TFLAG_OUT_HOB_LBAM | +IDE_TFLAG_OUT_HOB_LBAH , +IDE_TFLAG_OUT_FEATURE = (1 <<9 ), +IDE_TFLAG_OUT_NSECT = (1 <<10 ), +IDE_TFLAG_OUT_LBAL = (1 <<11 ), +IDE_TFLAG_OUT_LBAM = (1 <<12 ), +IDE_TFLAG_OUT_LBAH = (1 <<13 ), +IDE_TFLAG_OUT_TF =IDE_TFLAG_OUT_FEATURE | +IDE_TFLAG_OUT_NSECT | +IDE_TFLAG_OUT_LBAL | +IDE_TFLAG_OUT_LBAM | +IDE_TFLAG_OUT_LBAH , };struct ide_taskfile {
@@ -1102,8 +1124,7 @@ typedef struct ide_task_s {struct ide_taskfile tf;u8 tf_array[14 ]; }; -u8 tf_flags; -ide_reg_valid_t tf_out_flags; +u16 tf_flags;ide_reg_valid_t tf_in_flags;int data_phase;int command_type;
Quoted 5 lines · Bartlomiej Zolnierkiewicz
Based on the earlier work by Tejun Heo.
* Move setting
IDE_TFLAG_LBA48taskfile flag fromdo_rw_taskfile()function to the callers.
Quoted 8 lines
* Add
IDE_TFLAG_FLAGGEDtaskfile flag for flagged taskfiles coming fromide_taskfile_ioctl(). Check it instead of ->tf_out_flags.all.* Add
IDE_TFLAG_OUT_DATAtaskfile flag to indicate the need to load IDE data register inide_tf_load().* Add IDE_TFLAG_OUT_* taskfile flags to indicate the need to load particular IDE taskfile registers in
ide_tf_load().
These two last paragraphs seem like being kind of duplication. Doesn't the
latter include the former one?
Quoted 12 lines
* Update
do_rw_taskfile()andide_tf_load()users to set respective IDE_TFLAG_OUT_* taksfile flags.* Add
task_dma_ok()helper.* Use
IDE_TFLAG_FLAGGEDtaskfile flag to select HIHI mask inide_tf_load().* Use
do_rw_taskfile()inflagged_taskfile().* Remove no longer needed '
tf_out_flags' field fromide_task_t.There should be no functionality changes caused by this patch.
[...]
drivers/ide/ide-taskfile.c void ide_tf_load(ide_drive_t *drive, ide · line 72
Quoted 10 lines
Index:
b/drivers/ide/ide-taskfile.c
===================================================================drivers/ide/ide-taskfile.c +2
-0@@ -68,25 +68,39 @@ void ide_tf_load(ide_drive_t *drive, idestruct ide_taskfile *tf = &task->tf;u8 HIHI = (task->tf_flags &IDE_TFLAG_LBA48 ) ?0xE0 :0xEF ; +if (task->tf_flags &IDE_TFLAG_FLAGGED ) +HIHI =0xFF ;
Hm, what that's for?
drivers/ide/ide-taskfile.c void ide_tf_load(ide_drive_t *drive, ide · line 75
Quoted 2 lines
drivers/ide/ide-taskfile.c +0
-0if (IDE_CONTROL_REG ) hwif->OUTB (drive->ctl,IDE_CONTROL_REG );/* clear nIEN */
Does this set the HOB bit?
drivers/ide/ide-taskfile.c void ide_tf_load(ide_drive_t *drive, ide · line 81
Quoted 7 lines
drivers/ide/ide-taskfile.c +2
-1if ((task->tf_flags &IDE_TFLAG_NO_SELECT_MASK ) ==0 )SELECT_MASK (drive,0 ); -if (task->tf_flags &IDE_TFLAG_LBA48 ) { +if (task->tf_flags &IDE_TFLAG_OUT_DATA ) + hwif->OUTW ((tf->hob_data <<8 ) | tf->data,IDE_DATA_REG );
I wonder which commands could require a single data register write...
drivers/ide/ide-taskfile.c void ide_tf_load(ide_drive_t *drive, ide · line 83
Quoted 11 lines
drivers/ide/ide-taskfile.c +5
-1+if (task->tf_flags &IDE_TFLAG_OUT_HOB_FEATURE ) hwif->OUTB (tf->hob_feature,IDE_FEATURE_REG ); +if (task->tf_flags &IDE_TFLAG_OUT_HOB_NSECT ) hwif->OUTB (tf->hob_nsect,IDE_NSECTOR_REG ); +if (task->tf_flags &IDE_TFLAG_OUT_HOB_LBAL ) hwif->OUTB (tf->hob_lbal,IDE_SECTOR_REG ); +if (task->tf_flags &IDE_TFLAG_OUT_HOB_LBAM ) hwif->OUTB (tf->hob_lbam,IDE_LCYL_REG ); +if (task->tf_flags &IDE_TFLAG_OUT_HOB_LBAH ) hwif->OUTB (tf->hob_lbah,IDE_HCYL_REG ); - }
I'm not sure we're in HOB mode now... :-|
MBR, Sergei