aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-io.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:06 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-01-25 16:17:06 -0500
commit650d841d9e053a618dd8ce753422f91b493cf2f6 (patch)
tree70f81acbf856e4a4d8126bdf6d60144b374cc1a9 /drivers/ide/ide-io.c
parentcd2a2d969761c26542095c01324201ca0b3ee896 (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.c61
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 *
189 return ide_stopped; 189 return ide_stopped;
190 } 190 }
191 if (ide_id_has_flush_cache_ext(drive->id)) 191 if (ide_id_has_flush_cache_ext(drive->id))
192 args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; 192 args->tf.command = WIN_FLUSH_CACHE_EXT;
193 else 193 else
194 args->tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; 194 args->tf.command = WIN_FLUSH_CACHE;
195 args->command_type = IDE_DRIVE_TASK_NO_DATA; 195 args->command_type = IDE_DRIVE_TASK_NO_DATA;
196 args->handler = &task_no_data_intr; 196 args->handler = &task_no_data_intr;
197 return do_rw_taskfile(drive, args); 197 return do_rw_taskfile(drive, args);
198 198
199 case idedisk_pm_standby: /* Suspend step 2 (standby) */ 199 case idedisk_pm_standby: /* Suspend step 2 (standby) */
200 args->tfRegister[IDE_COMMAND_OFFSET] = WIN_STANDBYNOW1; 200 args->tf.command = WIN_STANDBYNOW1;
201 args->command_type = IDE_DRIVE_TASK_NO_DATA; 201 args->command_type = IDE_DRIVE_TASK_NO_DATA;
202 args->handler = &task_no_data_intr; 202 args->handler = &task_no_data_intr;
203 return do_rw_taskfile(drive, args); 203 return do_rw_taskfile(drive, args);
@@ -214,7 +214,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
214 return ide_stopped; 214 return ide_stopped;
215 215
216 case idedisk_pm_idle: /* Resume step 2 (idle) */ 216 case idedisk_pm_idle: /* Resume step 2 (idle) */
217 args->tfRegister[IDE_COMMAND_OFFSET] = WIN_IDLEIMMEDIATE; 217 args->tf.command = WIN_IDLEIMMEDIATE;
218 args->command_type = IDE_DRIVE_TASK_NO_DATA; 218 args->command_type = IDE_DRIVE_TASK_NO_DATA;
219 args->handler = task_no_data_intr; 219 args->handler = task_no_data_intr;
220 return do_rw_taskfile(drive, args); 220 return do_rw_taskfile(drive, args);
@@ -354,28 +354,31 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
354 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT); 354 rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
355 355
356 if (args) { 356 if (args) {
357 struct ide_taskfile *tf = &args->tf;
358
357 if (args->tf_in_flags.b.data) { 359 if (args->tf_in_flags.b.data) {
358 u16 data = hwif->INW(IDE_DATA_REG); 360 u16 data = hwif->INW(IDE_DATA_REG);
359 args->tfRegister[IDE_DATA_OFFSET] = (data) & 0xFF; 361
360 args->hobRegister[IDE_DATA_OFFSET] = (data >> 8) & 0xFF; 362 tf->data = data & 0xff;
363 tf->hob_data = (data >> 8) & 0xff;
361 } 364 }
362 args->tfRegister[IDE_ERROR_OFFSET] = err; 365 tf->error = err;
363 /* be sure we're looking at the low order bits */ 366 /* be sure we're looking at the low order bits */
364 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG); 367 hwif->OUTB(drive->ctl & ~0x80, IDE_CONTROL_REG);
365 args->tfRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG); 368 tf->nsect = hwif->INB(IDE_NSECTOR_REG);
366 args->tfRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG); 369 tf->lbal = hwif->INB(IDE_SECTOR_REG);
367 args->tfRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG); 370 tf->lbam = hwif->INB(IDE_LCYL_REG);
368 args->tfRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG); 371 tf->lbah = hwif->INB(IDE_HCYL_REG);
369 args->tfRegister[IDE_SELECT_OFFSET] = hwif->INB(IDE_SELECT_REG); 372 tf->device = hwif->INB(IDE_SELECT_REG);
370 args->tfRegister[IDE_STATUS_OFFSET] = stat; 373 tf->status = stat;
371 374
372 if (drive->addressing == 1) { 375 if (drive->addressing == 1) {
373 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG); 376 hwif->OUTB(drive->ctl|0x80, IDE_CONTROL_REG);
374 args->hobRegister[IDE_FEATURE_OFFSET] = hwif->INB(IDE_FEATURE_REG); 377 tf->hob_feature = hwif->INB(IDE_FEATURE_REG);
375 args->hobRegister[IDE_NSECTOR_OFFSET] = hwif->INB(IDE_NSECTOR_REG); 378 tf->hob_nsect = hwif->INB(IDE_NSECTOR_REG);
376 args->hobRegister[IDE_SECTOR_OFFSET] = hwif->INB(IDE_SECTOR_REG); 379 tf->hob_lbal = hwif->INB(IDE_SECTOR_REG);
377 args->hobRegister[IDE_LCYL_OFFSET] = hwif->INB(IDE_LCYL_REG); 380 tf->hob_lbam = hwif->INB(IDE_LCYL_REG);
378 args->hobRegister[IDE_HCYL_OFFSET] = hwif->INB(IDE_HCYL_REG); 381 tf->hob_lbah = hwif->INB(IDE_HCYL_REG);
379 } 382 }
380 } 383 }
381 } else if (blk_pm_request(rq)) { 384 } else if (blk_pm_request(rq)) {
@@ -675,28 +678,28 @@ static ide_startstop_t drive_cmd_intr (ide_drive_t *drive)
675 678
676static void ide_init_specify_cmd(ide_drive_t *drive, ide_task_t *task) 679static void ide_init_specify_cmd(ide_drive_t *drive, ide_task_t *task)
677{ 680{
678 task->tfRegister[IDE_NSECTOR_OFFSET] = drive->sect; 681 task->tf.nsect = drive->sect;
679 task->tfRegister[IDE_SECTOR_OFFSET] = drive->sect; 682 task->tf.lbal = drive->sect;
680 task->tfRegister[IDE_LCYL_OFFSET] = drive->cyl; 683 task->tf.lbam = drive->cyl;
681 task->tfRegister[IDE_HCYL_OFFSET] = drive->cyl>>8; 684 task->tf.lbah = drive->cyl >> 8;
682 task->tfRegister[IDE_SELECT_OFFSET] = ((drive->head-1)|drive->select.all)&0xBF; 685 task->tf.device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA;
683 task->tfRegister[IDE_COMMAND_OFFSET] = WIN_SPECIFY; 686 task->tf.command = WIN_SPECIFY;
684 687
685 task->handler = &set_geometry_intr; 688 task->handler = &set_geometry_intr;
686} 689}
687 690
688static void ide_init_restore_cmd(ide_drive_t *drive, ide_task_t *task) 691static void ide_init_restore_cmd(ide_drive_t *drive, ide_task_t *task)
689{ 692{
690 task->tfRegister[IDE_NSECTOR_OFFSET] = drive->sect; 693 task->tf.nsect = drive->sect;
691 task->tfRegister[IDE_COMMAND_OFFSET] = WIN_RESTORE; 694 task->tf.command = WIN_RESTORE;
692 695
693 task->handler = &recal_intr; 696 task->handler = &recal_intr;
694} 697}
695 698
696static void ide_init_setmult_cmd(ide_drive_t *drive, ide_task_t *task) 699static void ide_init_setmult_cmd(ide_drive_t *drive, ide_task_t *task)
697{ 700{
698 task->tfRegister[IDE_NSECTOR_OFFSET] = drive->mult_req; 701 task->tf.nsect = drive->mult_req;
699 task->tfRegister[IDE_COMMAND_OFFSET] = WIN_SETMULT; 702 task->tf.command = WIN_SETMULT;
700 703
701 task->handler = &set_multmode_intr; 704 task->handler = &set_multmode_intr;
702} 705}