aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-acpi.c8
-rw-r--r--drivers/ide/ide-disk.c120
-rw-r--r--drivers/ide/ide-io.c61
-rw-r--r--drivers/ide/ide-iops.c12
-rw-r--r--drivers/ide/ide-lib.c3
-rw-r--r--drivers/ide/ide-taskfile.c99
-rw-r--r--include/linux/hdreg.h4
-rw-r--r--include/linux/ide.h43
8 files changed, 179 insertions, 171 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c
index 899d56536e80..747c51889f7d 100644
--- a/drivers/ide/ide-acpi.c
+++ b/drivers/ide/ide-acpi.c
@@ -388,13 +388,7 @@ static int taskfile_load_raw(ide_drive_t *drive,
388 args.handler = &task_no_data_intr; 388 args.handler = &task_no_data_intr;
389 389
390 /* convert gtf to IDE Taskfile */ 390 /* convert gtf to IDE Taskfile */
391 args.tfRegister[1] = gtf->tfa[0]; /* 0x1f1 */ 391 memcpy(&args.tf_array[7], &gtf->tfa, 7);
392 args.tfRegister[2] = gtf->tfa[1]; /* 0x1f2 */
393 args.tfRegister[3] = gtf->tfa[2]; /* 0x1f3 */
394 args.tfRegister[4] = gtf->tfa[3]; /* 0x1f4 */
395 args.tfRegister[5] = gtf->tfa[4]; /* 0x1f5 */
396 args.tfRegister[6] = gtf->tfa[5]; /* 0x1f6 */
397 args.tfRegister[7] = gtf->tfa[6]; /* 0x1f7 */
398 392
399 if (ide_noacpitfs) { 393 if (ide_noacpitfs) {
400 DEBPRINT("_GTF execution disabled\n"); 394 DEBPRINT("_GTF execution disabled\n");
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 322c4691836a..a4c4d4350560 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -310,23 +310,22 @@ static ide_startstop_t ide_do_rw_disk (ide_drive_t *drive, struct request *rq, s
310static unsigned long idedisk_read_native_max_address(ide_drive_t *drive) 310static unsigned long idedisk_read_native_max_address(ide_drive_t *drive)
311{ 311{
312 ide_task_t args; 312 ide_task_t args;
313 struct ide_taskfile *tf = &args.tf;
313 unsigned long addr = 0; 314 unsigned long addr = 0;
314 315
315 /* Create IDE/ATA command request structure */ 316 /* Create IDE/ATA command request structure */
316 memset(&args, 0, sizeof(ide_task_t)); 317 memset(&args, 0, sizeof(ide_task_t));
317 args.tfRegister[IDE_SELECT_OFFSET] = 0x40; 318 tf->device = ATA_LBA;
318 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX; 319 tf->command = WIN_READ_NATIVE_MAX;
319 args.command_type = IDE_DRIVE_TASK_NO_DATA; 320 args.command_type = IDE_DRIVE_TASK_NO_DATA;
320 args.handler = &task_no_data_intr; 321 args.handler = &task_no_data_intr;
321 /* submit command request */ 322 /* submit command request */
322 ide_raw_taskfile(drive, &args, NULL); 323 ide_raw_taskfile(drive, &args, NULL);
323 324
324 /* if OK, compute maximum address value */ 325 /* if OK, compute maximum address value */
325 if ((args.tfRegister[IDE_STATUS_OFFSET] & 0x01) == 0) { 326 if ((tf->status & 0x01) == 0) {
326 addr = ((args.tfRegister[IDE_SELECT_OFFSET] & 0x0f) << 24) 327 addr = ((tf->device & 0xf) << 24) |
327 | ((args.tfRegister[ IDE_HCYL_OFFSET] ) << 16) 328 (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
328 | ((args.tfRegister[ IDE_LCYL_OFFSET] ) << 8)
329 | ((args.tfRegister[IDE_SECTOR_OFFSET] ));
330 addr++; /* since the return value is (maxlba - 1), we add 1 */ 329 addr++; /* since the return value is (maxlba - 1), we add 1 */
331 } 330 }
332 return addr; 331 return addr;
@@ -335,26 +334,24 @@ static unsigned long idedisk_read_native_max_address(ide_drive_t *drive)
335static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive) 334static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive)
336{ 335{
337 ide_task_t args; 336 ide_task_t args;
337 struct ide_taskfile *tf = &args.tf;
338 unsigned long long addr = 0; 338 unsigned long long addr = 0;
339 339
340 /* Create IDE/ATA command request structure */ 340 /* Create IDE/ATA command request structure */
341 memset(&args, 0, sizeof(ide_task_t)); 341 memset(&args, 0, sizeof(ide_task_t));
342 342 tf->device = ATA_LBA;
343 args.tfRegister[IDE_SELECT_OFFSET] = 0x40; 343 tf->command = WIN_READ_NATIVE_MAX_EXT;
344 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_READ_NATIVE_MAX_EXT;
345 args.command_type = IDE_DRIVE_TASK_NO_DATA; 344 args.command_type = IDE_DRIVE_TASK_NO_DATA;
346 args.handler = &task_no_data_intr; 345 args.handler = &task_no_data_intr;
347 /* submit command request */ 346 /* submit command request */
348 ide_raw_taskfile(drive, &args, NULL); 347 ide_raw_taskfile(drive, &args, NULL);
349 348
350 /* if OK, compute maximum address value */ 349 /* if OK, compute maximum address value */
351 if ((args.tfRegister[IDE_STATUS_OFFSET] & 0x01) == 0) { 350 if ((tf->status & 0x01) == 0) {
352 u32 high = (args.hobRegister[IDE_HCYL_OFFSET] << 16) | 351 u32 high, low;
353 (args.hobRegister[IDE_LCYL_OFFSET] << 8) | 352
354 args.hobRegister[IDE_SECTOR_OFFSET]; 353 high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) | tf->hob_lbal;
355 u32 low = ((args.tfRegister[IDE_HCYL_OFFSET])<<16) | 354 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
356 ((args.tfRegister[IDE_LCYL_OFFSET])<<8) |
357 (args.tfRegister[IDE_SECTOR_OFFSET]);
358 addr = ((__u64)high << 24) | low; 355 addr = ((__u64)high << 24) | low;
359 addr++; /* since the return value is (maxlba - 1), we add 1 */ 356 addr++; /* since the return value is (maxlba - 1), we add 1 */
360 } 357 }
@@ -368,26 +365,25 @@ static unsigned long long idedisk_read_native_max_address_ext(ide_drive_t *drive
368static unsigned long idedisk_set_max_address(ide_drive_t *drive, unsigned long addr_req) 365static unsigned long idedisk_set_max_address(ide_drive_t *drive, unsigned long addr_req)
369{ 366{
370 ide_task_t args; 367 ide_task_t args;
368 struct ide_taskfile *tf = &args.tf;
371 unsigned long addr_set = 0; 369 unsigned long addr_set = 0;
372 370
373 addr_req--; 371 addr_req--;
374 /* Create IDE/ATA command request structure */ 372 /* Create IDE/ATA command request structure */
375 memset(&args, 0, sizeof(ide_task_t)); 373 memset(&args, 0, sizeof(ide_task_t));
376 args.tfRegister[IDE_SECTOR_OFFSET] = ((addr_req >> 0) & 0xff); 374 tf->lbal = (addr_req >> 0) & 0xff;
377 args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >> 8) & 0xff); 375 tf->lbam = (addr_req >> 8) & 0xff;
378 args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >> 16) & 0xff); 376 tf->lbah = (addr_req >> 16) & 0xff;
379 args.tfRegister[IDE_SELECT_OFFSET] = ((addr_req >> 24) & 0x0f) | 0x40; 377 tf->device = ((addr_req >> 24) & 0x0f) | ATA_LBA;
380 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX; 378 tf->command = WIN_SET_MAX;
381 args.command_type = IDE_DRIVE_TASK_NO_DATA; 379 args.command_type = IDE_DRIVE_TASK_NO_DATA;
382 args.handler = &task_no_data_intr; 380 args.handler = &task_no_data_intr;
383 /* submit command request */ 381 /* submit command request */
384 ide_raw_taskfile(drive, &args, NULL); 382 ide_raw_taskfile(drive, &args, NULL);
385 /* if OK, read new maximum address value */ 383 /* if OK, read new maximum address value */
386 if ((args.tfRegister[IDE_STATUS_OFFSET] & 0x01) == 0) { 384 if ((tf->status & 0x01) == 0) {
387 addr_set = ((args.tfRegister[IDE_SELECT_OFFSET] & 0x0f) << 24) 385 addr_set = ((tf->device & 0xf) << 24) |
388 | ((args.tfRegister[ IDE_HCYL_OFFSET] ) << 16) 386 (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
389 | ((args.tfRegister[ IDE_LCYL_OFFSET] ) << 8)
390 | ((args.tfRegister[IDE_SECTOR_OFFSET] ));
391 addr_set++; 387 addr_set++;
392 } 388 }
393 return addr_set; 389 return addr_set;
@@ -396,33 +392,30 @@ static unsigned long idedisk_set_max_address(ide_drive_t *drive, unsigned long a
396static unsigned long long idedisk_set_max_address_ext(ide_drive_t *drive, unsigned long long addr_req) 392static unsigned long long idedisk_set_max_address_ext(ide_drive_t *drive, unsigned long long addr_req)
397{ 393{
398 ide_task_t args; 394 ide_task_t args;
395 struct ide_taskfile *tf = &args.tf;
399 unsigned long long addr_set = 0; 396 unsigned long long addr_set = 0;
400 397
401 addr_req--; 398 addr_req--;
402 /* Create IDE/ATA command request structure */ 399 /* Create IDE/ATA command request structure */
403 memset(&args, 0, sizeof(ide_task_t)); 400 memset(&args, 0, sizeof(ide_task_t));
404 args.tfRegister[IDE_SECTOR_OFFSET] = ((addr_req >> 0) & 0xff); 401 tf->lbal = (addr_req >> 0) & 0xff;
405 args.tfRegister[IDE_LCYL_OFFSET] = ((addr_req >>= 8) & 0xff); 402 tf->lbam = (addr_req >>= 8) & 0xff;
406 args.tfRegister[IDE_HCYL_OFFSET] = ((addr_req >>= 8) & 0xff); 403 tf->lbah = (addr_req >>= 8) & 0xff;
407 args.tfRegister[IDE_SELECT_OFFSET] = 0x40; 404 tf->device = ATA_LBA;
408 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SET_MAX_EXT; 405 tf->command = WIN_SET_MAX_EXT;
409 args.hobRegister[IDE_SECTOR_OFFSET] = (addr_req >>= 8) & 0xff; 406 tf->hob_lbal = (addr_req >>= 8) & 0xff;
410 args.hobRegister[IDE_LCYL_OFFSET] = (addr_req >>= 8) & 0xff; 407 tf->hob_lbam = (addr_req >>= 8) & 0xff;
411 args.hobRegister[IDE_HCYL_OFFSET] = (addr_req >>= 8) & 0xff; 408 tf->hob_lbah = (addr_req >>= 8) & 0xff;
412 args.hobRegister[IDE_SELECT_OFFSET] = 0x40;
413 args.hobRegister[IDE_CONTROL_OFFSET_HOB]= (drive->ctl|0x80);
414 args.command_type = IDE_DRIVE_TASK_NO_DATA; 409 args.command_type = IDE_DRIVE_TASK_NO_DATA;
415 args.handler = &task_no_data_intr; 410 args.handler = &task_no_data_intr;
416 /* submit command request */ 411 /* submit command request */
417 ide_raw_taskfile(drive, &args, NULL); 412 ide_raw_taskfile(drive, &args, NULL);
418 /* if OK, compute maximum address value */ 413 /* if OK, compute maximum address value */
419 if ((args.tfRegister[IDE_STATUS_OFFSET] & 0x01) == 0) { 414 if ((tf->status & 0x01) == 0) {
420 u32 high = (args.hobRegister[IDE_HCYL_OFFSET] << 16) | 415 u32 high, low;
421 (args.hobRegister[IDE_LCYL_OFFSET] << 8) | 416
422 args.hobRegister[IDE_SECTOR_OFFSET]; 417 high = (tf->hob_lbah << 16) | (tf->hob_lbam << 8) | tf->hob_lbal;
423 u32 low = ((args.tfRegister[IDE_HCYL_OFFSET])<<16) | 418 low = (tf->lbah << 16) | (tf->lbam << 8) | tf->lbal;
424 ((args.tfRegister[IDE_LCYL_OFFSET])<<8) |
425 (args.tfRegister[IDE_SECTOR_OFFSET]);
426 addr_set = ((__u64)high << 24) | low; 419 addr_set = ((__u64)high << 24) | low;
427 addr_set++; 420 addr_set++;
428 } 421 }
@@ -556,12 +549,13 @@ static sector_t idedisk_capacity (ide_drive_t *drive)
556static int smart_enable(ide_drive_t *drive) 549static int smart_enable(ide_drive_t *drive)
557{ 550{
558 ide_task_t args; 551 ide_task_t args;
552 struct ide_taskfile *tf = &args.tf;
559 553
560 memset(&args, 0, sizeof(ide_task_t)); 554 memset(&args, 0, sizeof(ide_task_t));
561 args.tfRegister[IDE_FEATURE_OFFSET] = SMART_ENABLE; 555 tf->feature = SMART_ENABLE;
562 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; 556 tf->lbam = SMART_LCYL_PASS;
563 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; 557 tf->lbah = SMART_HCYL_PASS;
564 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; 558 tf->command = WIN_SMART;
565 args.command_type = IDE_DRIVE_TASK_NO_DATA; 559 args.command_type = IDE_DRIVE_TASK_NO_DATA;
566 args.handler = &task_no_data_intr; 560 args.handler = &task_no_data_intr;
567 return ide_raw_taskfile(drive, &args, NULL); 561 return ide_raw_taskfile(drive, &args, NULL);
@@ -570,13 +564,14 @@ static int smart_enable(ide_drive_t *drive)
570static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd) 564static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
571{ 565{
572 ide_task_t args; 566 ide_task_t args;
567 struct ide_taskfile *tf = &args.tf;
573 568
574 memset(&args, 0, sizeof(ide_task_t)); 569 memset(&args, 0, sizeof(ide_task_t));
575 args.tfRegister[IDE_FEATURE_OFFSET] = sub_cmd; 570 tf->feature = sub_cmd;
576 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; 571 tf->nsect = 0x01;
577 args.tfRegister[IDE_LCYL_OFFSET] = SMART_LCYL_PASS; 572 tf->lbam = SMART_LCYL_PASS;
578 args.tfRegister[IDE_HCYL_OFFSET] = SMART_HCYL_PASS; 573 tf->lbah = SMART_HCYL_PASS;
579 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SMART; 574 tf->command = WIN_SMART;
580 args.command_type = IDE_DRIVE_TASK_IN; 575 args.command_type = IDE_DRIVE_TASK_IN;
581 args.data_phase = TASKFILE_IN; 576 args.data_phase = TASKFILE_IN;
582 args.handler = &task_in_intr; 577 args.handler = &task_in_intr;
@@ -753,9 +748,9 @@ static int write_cache(ide_drive_t *drive, int arg)
753 748
754 if (ide_id_has_flush_cache(drive->id)) { 749 if (ide_id_has_flush_cache(drive->id)) {
755 memset(&args, 0, sizeof(ide_task_t)); 750 memset(&args, 0, sizeof(ide_task_t));
756 args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? 751 args.tf.feature = arg ?
757 SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; 752 SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE;
758 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES; 753 args.tf.command = WIN_SETFEATURES;
759 args.command_type = IDE_DRIVE_TASK_NO_DATA; 754 args.command_type = IDE_DRIVE_TASK_NO_DATA;
760 args.handler = &task_no_data_intr; 755 args.handler = &task_no_data_intr;
761 err = ide_raw_taskfile(drive, &args, NULL); 756 err = ide_raw_taskfile(drive, &args, NULL);
@@ -774,9 +769,9 @@ static int do_idedisk_flushcache (ide_drive_t *drive)
774 769
775 memset(&args, 0, sizeof(ide_task_t)); 770 memset(&args, 0, sizeof(ide_task_t));
776 if (ide_id_has_flush_cache_ext(drive->id)) 771 if (ide_id_has_flush_cache_ext(drive->id))
777 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE_EXT; 772 args.tf.command = WIN_FLUSH_CACHE_EXT;
778 else 773 else
779 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_FLUSH_CACHE; 774 args.tf.command = WIN_FLUSH_CACHE;
780 args.command_type = IDE_DRIVE_TASK_NO_DATA; 775 args.command_type = IDE_DRIVE_TASK_NO_DATA;
781 args.handler = &task_no_data_intr; 776 args.handler = &task_no_data_intr;
782 return ide_raw_taskfile(drive, &args, NULL); 777 return ide_raw_taskfile(drive, &args, NULL);
@@ -790,10 +785,9 @@ static int set_acoustic (ide_drive_t *drive, int arg)
790 return -EINVAL; 785 return -EINVAL;
791 786
792 memset(&args, 0, sizeof(ide_task_t)); 787 memset(&args, 0, sizeof(ide_task_t));
793 args.tfRegister[IDE_FEATURE_OFFSET] = (arg) ? SETFEATURES_EN_AAM : 788 args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM;
794 SETFEATURES_DIS_AAM; 789 args.tf.nsect = arg;
795 args.tfRegister[IDE_NSECTOR_OFFSET] = arg; 790 args.tf.command = WIN_SETFEATURES;
796 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_SETFEATURES;
797 args.command_type = IDE_DRIVE_TASK_NO_DATA; 791 args.command_type = IDE_DRIVE_TASK_NO_DATA;
798 args.handler = &task_no_data_intr; 792 args.handler = &task_no_data_intr;
799 ide_raw_taskfile(drive, &args, NULL); 793 ide_raw_taskfile(drive, &args, NULL);
@@ -1057,7 +1051,7 @@ static int idedisk_open(struct inode *inode, struct file *filp)
1057 if (drive->removable && idkp->openers == 1) { 1051 if (drive->removable && idkp->openers == 1) {
1058 ide_task_t args; 1052 ide_task_t args;
1059 memset(&args, 0, sizeof(ide_task_t)); 1053 memset(&args, 0, sizeof(ide_task_t));
1060 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORLOCK; 1054 args.tf.command = WIN_DOORLOCK;
1061 args.command_type = IDE_DRIVE_TASK_NO_DATA; 1055 args.command_type = IDE_DRIVE_TASK_NO_DATA;
1062 args.handler = &task_no_data_intr; 1056 args.handler = &task_no_data_intr;
1063 check_disk_change(inode->i_bdev); 1057 check_disk_change(inode->i_bdev);
@@ -1084,7 +1078,7 @@ static int idedisk_release(struct inode *inode, struct file *filp)
1084 if (drive->removable && idkp->openers == 1) { 1078 if (drive->removable && idkp->openers == 1) {
1085 ide_task_t args; 1079 ide_task_t args;
1086 memset(&args, 0, sizeof(ide_task_t)); 1080 memset(&args, 0, sizeof(ide_task_t));
1087 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_DOORUNLOCK; 1081 args.tf.command = WIN_DOORUNLOCK;
1088 args.command_type = IDE_DRIVE_TASK_NO_DATA; 1082 args.command_type = IDE_DRIVE_TASK_NO_DATA;
1089 args.handler = &task_no_data_intr; 1083 args.handler = &task_no_data_intr;
1090 if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL)) 1084 if (drive->doorlocking && ide_raw_taskfile(drive, &args, NULL))
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}
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index f4e8a0cf06e2..4aac1cc7101d 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -642,9 +642,9 @@ no_80w:
642 642
643int ide_ata66_check (ide_drive_t *drive, ide_task_t *args) 643int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
644{ 644{
645 if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && 645 if (args->tf.command == WIN_SETFEATURES &&
646 (args->tfRegister[IDE_SECTOR_OFFSET] > XFER_UDMA_2) && 646 args->tf.lbal > XFER_UDMA_2 &&
647 (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER)) { 647 args->tf.feature == SETFEATURES_XFER) {
648 if (eighty_ninty_three(drive) == 0) { 648 if (eighty_ninty_three(drive) == 0) {
649 printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot " 649 printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
650 "be set\n", drive->name); 650 "be set\n", drive->name);
@@ -662,9 +662,9 @@ int ide_ata66_check (ide_drive_t *drive, ide_task_t *args)
662 */ 662 */
663int set_transfer (ide_drive_t *drive, ide_task_t *args) 663int set_transfer (ide_drive_t *drive, ide_task_t *args)
664{ 664{
665 if ((args->tfRegister[IDE_COMMAND_OFFSET] == WIN_SETFEATURES) && 665 if (args->tf.command == WIN_SETFEATURES &&
666 (args->tfRegister[IDE_SECTOR_OFFSET] >= XFER_SW_DMA_0) && 666 args->tf.lbal >= XFER_SW_DMA_0 &&
667 (args->tfRegister[IDE_FEATURE_OFFSET] == SETFEATURES_XFER) && 667 args->tf.feature == SETFEATURES_XFER &&
668 (drive->id->dma_ultra || 668 (drive->id->dma_ultra ||
669 drive->id->dma_mword || 669 drive->id->dma_mword ||
670 drive->id->dma_1word)) 670 drive->id->dma_1word))
diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c
index 062d3bcb2471..6dbf2af0d215 100644
--- a/drivers/ide/ide-lib.c
+++ b/drivers/ide/ide-lib.c
@@ -468,8 +468,7 @@ static void ide_dump_opcode(ide_drive_t *drive)
468 } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { 468 } else if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
469 ide_task_t *args = rq->special; 469 ide_task_t *args = rq->special;
470 if (args) { 470 if (args) {
471 task_struct_t *tf = (task_struct_t *) args->tfRegister; 471 opcode = args->tf.command;
472 opcode = tf->command;
473 found = 1; 472 found = 1;
474 } 473 }
475 } 474 }
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 91948a46cc6e..5a1a9f7846b6 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -66,12 +66,13 @@ static void taskfile_output_data(ide_drive_t *drive, void *buffer, u32 wcount)
66int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf) 66int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
67{ 67{
68 ide_task_t args; 68 ide_task_t args;
69
69 memset(&args, 0, sizeof(ide_task_t)); 70 memset(&args, 0, sizeof(ide_task_t));
70 args.tfRegister[IDE_NSECTOR_OFFSET] = 0x01; 71 args.tf.nsect = 0x01;
71 if (drive->media == ide_disk) 72 if (drive->media == ide_disk)
72 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_IDENTIFY; 73 args.tf.command = WIN_IDENTIFY;
73 else 74 else
74 args.tfRegister[IDE_COMMAND_OFFSET] = WIN_PIDENTIFY; 75 args.tf.command = WIN_PIDENTIFY;
75 args.command_type = IDE_DRIVE_TASK_IN; 76 args.command_type = IDE_DRIVE_TASK_IN;
76 args.data_phase = TASKFILE_IN; 77 args.data_phase = TASKFILE_IN;
77 args.handler = &task_in_intr; 78 args.handler = &task_in_intr;
@@ -81,8 +82,7 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
81ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task) 82ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
82{ 83{
83 ide_hwif_t *hwif = HWIF(drive); 84 ide_hwif_t *hwif = HWIF(drive);
84 task_struct_t *taskfile = (task_struct_t *) task->tfRegister; 85 struct ide_taskfile *tf = &task->tf;
85 hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister;
86 u8 HIHI = (drive->addressing == 1) ? 0xE0 : 0xEF; 86 u8 HIHI = (drive->addressing == 1) ? 0xE0 : 0xEF;
87 87
88 /* ALL Command Block Executions SHALL clear nIEN, unless otherwise */ 88 /* ALL Command Block Executions SHALL clear nIEN, unless otherwise */
@@ -93,35 +93,35 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
93 SELECT_MASK(drive, 0); 93 SELECT_MASK(drive, 0);
94 94
95 if (drive->addressing == 1) { 95 if (drive->addressing == 1) {
96 hwif->OUTB(hobfile->feature, IDE_FEATURE_REG); 96 hwif->OUTB(tf->hob_feature, IDE_FEATURE_REG);
97 hwif->OUTB(hobfile->sector_count, IDE_NSECTOR_REG); 97 hwif->OUTB(tf->hob_nsect, IDE_NSECTOR_REG);
98 hwif->OUTB(hobfile->sector_number, IDE_SECTOR_REG); 98 hwif->OUTB(tf->hob_lbal, IDE_SECTOR_REG);
99 hwif->OUTB(hobfile->low_cylinder, IDE_LCYL_REG); 99 hwif->OUTB(tf->hob_lbam, IDE_LCYL_REG);
100 hwif->OUTB(hobfile->high_cylinder, IDE_HCYL_REG); 100 hwif->OUTB(tf->hob_lbah, IDE_HCYL_REG);
101 } 101 }
102 102
103 hwif->OUTB(taskfile->feature, IDE_FEATURE_REG); 103 hwif->OUTB(tf->feature, IDE_FEATURE_REG);
104 hwif->OUTB(taskfile->sector_count, IDE_NSECTOR_REG); 104 hwif->OUTB(tf->nsect, IDE_NSECTOR_REG);
105 hwif->OUTB(taskfile->sector_number, IDE_SECTOR_REG); 105 hwif->OUTB(tf->lbal, IDE_SECTOR_REG);
106 hwif->OUTB(taskfile->low_cylinder, IDE_LCYL_REG); 106 hwif->OUTB(tf->lbam, IDE_LCYL_REG);
107 hwif->OUTB(taskfile->high_cylinder, IDE_HCYL_REG); 107 hwif->OUTB(tf->lbah, IDE_HCYL_REG);
108 108
109 hwif->OUTB((taskfile->device_head & HIHI) | drive->select.all, IDE_SELECT_REG); 109 hwif->OUTB((tf->device & HIHI) | drive->select.all, IDE_SELECT_REG);
110 110
111 if (task->handler != NULL) { 111 if (task->handler != NULL) {
112 if (task->prehandler != NULL) { 112 if (task->prehandler != NULL) {
113 hwif->OUTBSYNC(drive, taskfile->command, IDE_COMMAND_REG); 113 hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG);
114 ndelay(400); /* FIXME */ 114 ndelay(400); /* FIXME */
115 return task->prehandler(drive, task->rq); 115 return task->prehandler(drive, task->rq);
116 } 116 }
117 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); 117 ide_execute_command(drive, tf->command, task->handler, WAIT_WORSTCASE, NULL);
118 return ide_started; 118 return ide_started;
119 } 119 }
120 120
121 if (!drive->using_dma) 121 if (!drive->using_dma)
122 return ide_stopped; 122 return ide_stopped;
123 123
124 switch (taskfile->command) { 124 switch (tf->command) {
125 case WIN_WRITEDMA_ONCE: 125 case WIN_WRITEDMA_ONCE:
126 case WIN_WRITEDMA: 126 case WIN_WRITEDMA:
127 case WIN_WRITEDMA_EXT: 127 case WIN_WRITEDMA_EXT:
@@ -130,7 +130,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
130 case WIN_READDMA_EXT: 130 case WIN_READDMA_EXT:
131 case WIN_IDENTIFY_DMA: 131 case WIN_IDENTIFY_DMA:
132 if (!hwif->dma_setup(drive)) { 132 if (!hwif->dma_setup(drive)) {
133 hwif->dma_exec_cmd(drive, taskfile->command); 133 hwif->dma_exec_cmd(drive, tf->command);
134 hwif->dma_start(drive); 134 hwif->dma_start(drive);
135 return ide_started; 135 return ide_started;
136 } 136 }
@@ -483,7 +483,7 @@ static int ide_diag_taskfile(ide_drive_t *drive, ide_task_t *args, unsigned long
483 */ 483 */
484 if (args->command_type != IDE_DRIVE_TASK_NO_DATA) { 484 if (args->command_type != IDE_DRIVE_TASK_NO_DATA) {
485 if (data_size == 0) 485 if (data_size == 0)
486 rq.nr_sectors = (args->hobRegister[IDE_NSECTOR_OFFSET] << 8) | args->tfRegister[IDE_NSECTOR_OFFSET]; 486 rq.nr_sectors = (args->tf.hob_nsect << 8) | args->tf.nsect;
487 else 487 else
488 rq.nr_sectors = data_size / SECTOR_SIZE; 488 rq.nr_sectors = data_size / SECTOR_SIZE;
489 489
@@ -519,8 +519,6 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
519 ide_task_t args; 519 ide_task_t args;
520 u8 *outbuf = NULL; 520 u8 *outbuf = NULL;
521 u8 *inbuf = NULL; 521 u8 *inbuf = NULL;
522 u8 *argsptr = args.tfRegister;
523 u8 *hobsptr = args.hobRegister;
524 int err = 0; 522 int err = 0;
525 int tasksize = sizeof(struct ide_task_request_s); 523 int tasksize = sizeof(struct ide_task_request_s);
526 unsigned int taskin = 0; 524 unsigned int taskin = 0;
@@ -572,9 +570,9 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
572 } 570 }
573 571
574 memset(&args, 0, sizeof(ide_task_t)); 572 memset(&args, 0, sizeof(ide_task_t));
575 memcpy(argsptr, req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE);
576 memcpy(hobsptr, req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE);
577 573
574 memcpy(&args.tf_array[0], req_task->hob_ports, HDIO_DRIVE_HOB_HDR_SIZE - 2);
575 memcpy(&args.tf_array[6], req_task->io_ports, HDIO_DRIVE_TASK_HDR_SIZE);
578 args.tf_in_flags = req_task->in_flags; 576 args.tf_in_flags = req_task->in_flags;
579 args.tf_out_flags = req_task->out_flags; 577 args.tf_out_flags = req_task->out_flags;
580 args.data_phase = req_task->data_phase; 578 args.data_phase = req_task->data_phase;
@@ -628,8 +626,8 @@ int ide_taskfile_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
628 goto abort; 626 goto abort;
629 } 627 }
630 628
631 memcpy(req_task->io_ports, &(args.tfRegister), HDIO_DRIVE_TASK_HDR_SIZE); 629 memcpy(req_task->hob_ports, &args.tf_array[0], HDIO_DRIVE_HOB_HDR_SIZE - 2);
632 memcpy(req_task->hob_ports, &(args.hobRegister), HDIO_DRIVE_HOB_HDR_SIZE); 630 memcpy(req_task->io_ports, &args.tf_array[6], HDIO_DRIVE_TASK_HDR_SIZE);
633 req_task->in_flags = args.tf_in_flags; 631 req_task->in_flags = args.tf_in_flags;
634 req_task->out_flags = args.tf_out_flags; 632 req_task->out_flags = args.tf_out_flags;
635 633
@@ -688,6 +686,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
688 u8 xfer_rate = 0; 686 u8 xfer_rate = 0;
689 int argsize = 4; 687 int argsize = 4;
690 ide_task_t tfargs; 688 ide_task_t tfargs;
689 struct ide_taskfile *tf = &tfargs.tf;
691 690
692 if (NULL == (void *) arg) { 691 if (NULL == (void *) arg) {
693 struct request rq; 692 struct request rq;
@@ -699,13 +698,10 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
699 return -EFAULT; 698 return -EFAULT;
700 699
701 memset(&tfargs, 0, sizeof(ide_task_t)); 700 memset(&tfargs, 0, sizeof(ide_task_t));
702 tfargs.tfRegister[IDE_FEATURE_OFFSET] = args[2]; 701 tf->feature = args[2];
703 tfargs.tfRegister[IDE_NSECTOR_OFFSET] = args[3]; 702 tf->nsect = args[3];
704 tfargs.tfRegister[IDE_SECTOR_OFFSET] = args[1]; 703 tf->lbal = args[1];
705 tfargs.tfRegister[IDE_LCYL_OFFSET] = 0x00; 704 tf->command = args[0];
706 tfargs.tfRegister[IDE_HCYL_OFFSET] = 0x00;
707 tfargs.tfRegister[IDE_SELECT_OFFSET] = 0x00;
708 tfargs.tfRegister[IDE_COMMAND_OFFSET] = args[0];
709 705
710 if (args[3]) { 706 if (args[3]) {
711 argsize = 4 + (SECTOR_WORDS * 4 * args[3]); 707 argsize = 4 + (SECTOR_WORDS * 4 * args[3]);
@@ -767,8 +763,7 @@ int ide_task_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
767ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) 763ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
768{ 764{
769 ide_hwif_t *hwif = HWIF(drive); 765 ide_hwif_t *hwif = HWIF(drive);
770 task_struct_t *taskfile = (task_struct_t *) task->tfRegister; 766 struct ide_taskfile *tf = &task->tf;
771 hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister;
772 767
773 if (task->data_phase == TASKFILE_MULTI_IN || 768 if (task->data_phase == TASKFILE_MULTI_IN ||
774 task->data_phase == TASKFILE_MULTI_OUT) { 769 task->data_phase == TASKFILE_MULTI_OUT) {
@@ -798,34 +793,32 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
798 hwif->OUTB(drive->ctl, IDE_CONTROL_REG); 793 hwif->OUTB(drive->ctl, IDE_CONTROL_REG);
799 SELECT_MASK(drive, 0); 794 SELECT_MASK(drive, 0);
800 795
801 if (task->tf_out_flags.b.data) { 796 if (task->tf_out_flags.b.data)
802 u16 data = taskfile->data + (hobfile->data << 8); 797 hwif->OUTW((tf->hob_data << 8) | tf->data, IDE_DATA_REG);
803 hwif->OUTW(data, IDE_DATA_REG);
804 }
805 798
806 /* (ks) send hob registers first */ 799 /* (ks) send hob registers first */
807 if (task->tf_out_flags.b.nsector_hob) 800 if (task->tf_out_flags.b.nsector_hob)
808 hwif->OUTB(hobfile->sector_count, IDE_NSECTOR_REG); 801 hwif->OUTB(tf->hob_nsect, IDE_NSECTOR_REG);
809 if (task->tf_out_flags.b.sector_hob) 802 if (task->tf_out_flags.b.sector_hob)
810 hwif->OUTB(hobfile->sector_number, IDE_SECTOR_REG); 803 hwif->OUTB(tf->hob_lbal, IDE_SECTOR_REG);
811 if (task->tf_out_flags.b.lcyl_hob) 804 if (task->tf_out_flags.b.lcyl_hob)
812 hwif->OUTB(hobfile->low_cylinder, IDE_LCYL_REG); 805 hwif->OUTB(tf->hob_lbam, IDE_LCYL_REG);
813 if (task->tf_out_flags.b.hcyl_hob) 806 if (task->tf_out_flags.b.hcyl_hob)
814 hwif->OUTB(hobfile->high_cylinder, IDE_HCYL_REG); 807 hwif->OUTB(tf->hob_lbah, IDE_HCYL_REG);
815 808
816 /* (ks) Send now the standard registers */ 809 /* (ks) Send now the standard registers */
817 if (task->tf_out_flags.b.error_feature) 810 if (task->tf_out_flags.b.error_feature)
818 hwif->OUTB(taskfile->feature, IDE_FEATURE_REG); 811 hwif->OUTB(tf->feature, IDE_FEATURE_REG);
819 /* refers to number of sectors to transfer */ 812 /* refers to number of sectors to transfer */
820 if (task->tf_out_flags.b.nsector) 813 if (task->tf_out_flags.b.nsector)
821 hwif->OUTB(taskfile->sector_count, IDE_NSECTOR_REG); 814 hwif->OUTB(tf->nsect, IDE_NSECTOR_REG);
822 /* refers to sector offset or start sector */ 815 /* refers to sector offset or start sector */
823 if (task->tf_out_flags.b.sector) 816 if (task->tf_out_flags.b.sector)
824 hwif->OUTB(taskfile->sector_number, IDE_SECTOR_REG); 817 hwif->OUTB(tf->lbal, IDE_SECTOR_REG);
825 if (task->tf_out_flags.b.lcyl) 818 if (task->tf_out_flags.b.lcyl)
826 hwif->OUTB(taskfile->low_cylinder, IDE_LCYL_REG); 819 hwif->OUTB(tf->lbam, IDE_LCYL_REG);
827 if (task->tf_out_flags.b.hcyl) 820 if (task->tf_out_flags.b.hcyl)
828 hwif->OUTB(taskfile->high_cylinder, IDE_HCYL_REG); 821 hwif->OUTB(tf->lbah, IDE_HCYL_REG);
829 822
830 /* 823 /*
831 * (ks) In the flagged taskfile approch, we will use all specified 824 * (ks) In the flagged taskfile approch, we will use all specified
@@ -833,7 +826,7 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
833 * select bit (master/slave) in the drive_head register. We must make 826 * select bit (master/slave) in the drive_head register. We must make
834 * sure that the desired drive is selected. 827 * sure that the desired drive is selected.
835 */ 828 */
836 hwif->OUTB(taskfile->device_head | drive->select.all, IDE_SELECT_REG); 829 hwif->OUTB(tf->device | drive->select.all, IDE_SELECT_REG);
837 switch(task->data_phase) { 830 switch(task->data_phase) {
838 831
839 case TASKFILE_OUT_DMAQ: 832 case TASKFILE_OUT_DMAQ:
@@ -844,7 +837,7 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
844 break; 837 break;
845 838
846 if (!hwif->dma_setup(drive)) { 839 if (!hwif->dma_setup(drive)) {
847 hwif->dma_exec_cmd(drive, taskfile->command); 840 hwif->dma_exec_cmd(drive, tf->command);
848 hwif->dma_start(drive); 841 hwif->dma_start(drive);
849 return ide_started; 842 return ide_started;
850 } 843 }
@@ -856,11 +849,11 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task)
856 849
857 /* Issue the command */ 850 /* Issue the command */
858 if (task->prehandler) { 851 if (task->prehandler) {
859 hwif->OUTBSYNC(drive, taskfile->command, IDE_COMMAND_REG); 852 hwif->OUTBSYNC(drive, tf->command, IDE_COMMAND_REG);
860 ndelay(400); /* FIXME */ 853 ndelay(400); /* FIXME */
861 return task->prehandler(drive, task->rq); 854 return task->prehandler(drive, task->rq);
862 } 855 }
863 ide_execute_command(drive, taskfile->command, task->handler, WAIT_WORSTCASE, NULL); 856 ide_execute_command(drive, tf->command, task->handler, WAIT_WORSTCASE, NULL);
864 return ide_started; 857 return ide_started;
865 } 858 }
866 859
diff --git a/include/linux/hdreg.h b/include/linux/hdreg.h
index 3bcb88560418..df17bf767d98 100644
--- a/include/linux/hdreg.h
+++ b/include/linux/hdreg.h
@@ -117,7 +117,7 @@ typedef union ide_reg_valid_s {
117 117
118typedef struct ide_task_request_s { 118typedef struct ide_task_request_s {
119 __u8 io_ports[8]; 119 __u8 io_ports[8];
120 __u8 hob_ports[8]; 120 __u8 hob_ports[8]; /* bytes 6 and 7 are unused */
121 ide_reg_valid_t out_flags; 121 ide_reg_valid_t out_flags;
122 ide_reg_valid_t in_flags; 122 ide_reg_valid_t in_flags;
123 int data_phase; 123 int data_phase;
@@ -139,6 +139,7 @@ struct hd_drive_cmd_hdr {
139 __u8 sector_count; 139 __u8 sector_count;
140}; 140};
141 141
142#ifndef __KERNEL__
142typedef struct hd_drive_task_hdr { 143typedef struct hd_drive_task_hdr {
143 __u8 data; 144 __u8 data;
144 __u8 feature; 145 __u8 feature;
@@ -160,6 +161,7 @@ typedef struct hd_drive_hob_hdr {
160 __u8 device_head; 161 __u8 device_head;
161 __u8 control; 162 __u8 control;
162} hob_struct_t; 163} hob_struct_t;
164#endif
163 165
164#define TASKFILE_INVALID 0x7fff 166#define TASKFILE_INVALID 0x7fff
165#define TASKFILE_48 0x8000 167#define TASKFILE_48 0x8000
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 66a38f101175..69b78bb39caf 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -103,8 +103,6 @@ typedef unsigned char byte; /* used everywhere */
103#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET 103#define IDE_FEATURE_OFFSET IDE_ERROR_OFFSET
104#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET 104#define IDE_COMMAND_OFFSET IDE_STATUS_OFFSET
105 105
106#define IDE_CONTROL_OFFSET_HOB (7)
107
108#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET]) 106#define IDE_DATA_REG (HWIF(drive)->io_ports[IDE_DATA_OFFSET])
109#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET]) 107#define IDE_ERROR_REG (HWIF(drive)->io_ports[IDE_ERROR_OFFSET])
110#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET]) 108#define IDE_NSECTOR_REG (HWIF(drive)->io_ports[IDE_NSECTOR_OFFSET])
@@ -1062,15 +1060,40 @@ extern void ide_end_drive_cmd(ide_drive_t *, u8, u8);
1062 */ 1060 */
1063extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *); 1061extern int ide_wait_cmd(ide_drive_t *, u8, u8, u8, u8, u8 *);
1064 1062
1063struct ide_taskfile {
1064 u8 hob_data; /* 0: high data byte (for TASKFILE IOCTL) */
1065
1066 u8 hob_feature; /* 1-5: additional data to support LBA48 */
1067 u8 hob_nsect;
1068 u8 hob_lbal;
1069 u8 hob_lbam;
1070 u8 hob_lbah;
1071
1072 u8 data; /* 6: low data byte (for TASKFILE IOCTL) */
1073
1074 union { /*  7: */
1075 u8 error; /* read: error */
1076 u8 feature; /* write: feature */
1077 };
1078
1079 u8 nsect; /* 8: number of sectors */
1080 u8 lbal; /* 9: LBA low */
1081 u8 lbam; /* 10: LBA mid */
1082 u8 lbah; /* 11: LBA high */
1083
1084 u8 device; /* 12: device select */
1085
1086 union { /* 13: */
1087 u8 status; /*  read: status  */
1088 u8 command; /* write: command */
1089 };
1090};
1091
1065typedef struct ide_task_s { 1092typedef struct ide_task_s {
1066/* 1093 union {
1067 * struct hd_drive_task_hdr tf; 1094 struct ide_taskfile tf;
1068 * task_struct_t tf; 1095 u8 tf_array[14];
1069 * struct hd_drive_hob_hdr hobf; 1096 };
1070 * hob_struct_t hobf;
1071 */
1072 u8 tfRegister[8];
1073 u8 hobRegister[8];
1074 ide_reg_valid_t tf_out_flags; 1097 ide_reg_valid_t tf_out_flags;
1075 ide_reg_valid_t tf_in_flags; 1098 ide_reg_valid_t tf_in_flags;
1076 int data_phase; 1099 int data_phase;