diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 22:17:06 +0100 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-25 22:17:06 +0100 |
commit | 650d841d9e053a618dd8ce753422f91b493cf2f6 (patch) | |
tree | 70f81acbf856e4a4d8126bdf6d60144b374cc1a9 /drivers/ide/ide-io.c | |
parent | cd2a2d969761c26542095c01324201ca0b3ee896 (diff) |
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 <sshtylyov@ru.mvista.com>
Cc: Tejun Heo <htejun@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-io.c')
-rw-r--r-- | drivers/ide/ide-io.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index bb1b0a884cfc..dc984c5b0d13 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -189,15 +189,15 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * return ide_stopped; } if (ide_id_has_flush_cache_ext(drive->id)) - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; + args->tf.command = WIN_FLUSH_CACHE_EXT; else - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; + 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); case idedisk_pm_standby: /* Suspend step 2 (standby) */ - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_STANDBYNOW1; + 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); @@ -214,7 +214,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request * return ide_stopped; case idedisk_pm_idle: /* Resume step 2 (idle) */ - args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE; + 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); @@ -354,28 +354,31 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); if (args) { + struct ide_taskfile *tf = &args->tf; + if (args->tf_in_flags.b.data) { - u16 data = hwif->INW(IDE_DATA_REG); - args->tfRegister[IDE_DATA_OFFSET] = (data) & 0xFF; - args->hobRegister[IDE_DATA_OFFSET] = (data >> 8) & 0xFF; + u16 data = hwif->INW(IDE_DATA_REG); + + tf->data = data & 0xff; + tf->hob_data = (data >> 8) & 0xff; } - args->tfRegister[IDE_ERROR_OFFSET] = err; + tf->error = err; /* be sure we're looking at the low order bits */ hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); - args->tfRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG); - args->tfRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG); - args->tfRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG); - args->tfRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG); - args->tfRegister[IDE_SELECT_OFFSET] = hwif->INB(IDE_SELECT_REG); - args->tfRegister[IDE_STATUS_OFFSET] = stat; + tf->nsect = hwif->INB(IDE_NSECTOR_REG); + tf->lbal = hwif->INB(IDE_SECTOR_REG); + tf->lbam = hwif->INB(IDE_LCYL_REG); + tf->lbah = hwif->INB(IDE_HCYL_REG); + tf->device = hwif->INB(IDE_SELECT_REG); + tf->status = stat; if (drive->addressing == 1) { hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); - args->hobRegister[IDE_FEATURE_OFFSET] = hwif->INB(IDE_FEATURE_REG); - args->hobRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG); - args->hobRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG); - args->hobRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG); - args->hobRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG); + tf->hob_feature = hwif->INB(IDE_FEATURE_REG); + tf->hob_nsect = hwif->INB(IDE_NSECTOR_REG); + tf->hob_lbal = hwif->INB(IDE_SECTOR_REG); + tf->hob_lbam = hwif->INB(IDE_LCYL_REG); + tf->hob_lbah = hwif->INB(IDE_HCYL_REG); } } } else if (blk_pm_request(rq)) { @@ -675,28 +678,28 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive) static void ide_init_specify_cmd(ide_drive_t *drive, ide_task_t *task) { - task->tfRegister[IDE_NSECTOR_OFFSET] = drive->sect; - task->tfRegister[IDE_SECTOR_OFFSET] = drive->sect; - task->tfRegister[IDE_LCYL_OFFSET] = drive->cyl; - task->tfRegister[IDE_HCYL_OFFSET] = drive->cyl>>8; - task->tfRegister[IDE_SELECT_OFFSET] = ((drive->head-1)|drive->select.all)&0xBF; - task->tfRegister[IDE_COMMAND_OFFSET] = WIN_SPECIFY; + task->tf.nsect = drive->sect; + task->tf.lbal = drive->sect; + task->tf.lbam = drive->cyl; + task->tf.lbah = drive->cyl >> 8; + task->tf.device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA; + task->tf.command = WIN_SPECIFY; task->handler = &set_geometry_intr; } static void ide_init_restore_cmd(ide_drive_t *drive, ide_task_t *task) { - task->tfRegister[IDE_NSECTOR_OFFSET] = drive->sect; - task->tfRegister[IDE_COMMAND_OFFSET] = WIN_RESTORE; + task->tf.nsect = drive->sect; + task->tf.command = WIN_RESTORE; task->handler = &recal_intr; } static void ide_init_setmult_cmd(ide_drive_t *drive, ide_task_t *task) { - task->tfRegister[IDE_NSECTOR_OFFSET] = drive->mult_req; - task->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETMULT; + task->tf.nsect = drive->mult_req; + task->tf.command = WIN_SETMULT; task->handler = &set_multmode_intr; } |