aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:21 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-10-10 16:39:21 -0400
commitaaaade3f059fa1b57283d4a7c8351a42ec747bf0 (patch)
tree3c2e80f0317fc52d9866b0bb83b8cc89ed764b57 /drivers/ide
parenta4f19040a3a6cd431efe0a10b9d2e8d5e3904865 (diff)
ide: WIN_* -> ATA_CMD_*
* Use ATA_CMD_* defines instead of WIN_* ones. While at it: * EXABYTE_ENABLE_NEXT -> ATA_EXABYTE_ENABLE_NEST * SETFEATURES_{EN,DIS}_WCACHE -> SETFEATURES_WC_{ON,OFF} * SETFEATURES_{EN,DIS}_AAM -> SETFEATURES_AAM_{ON,OFF} * SMART_* -> ATA_SMART_* * Remove stale comment from ide-proc.c. Partially based on earlier work by Chris Wedgwood. Acked-by: Chris Wedgwood <cw@f00f.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-atapi.c2
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-disk.c68
-rw-r--r--drivers/ide/ide-io.c27
-rw-r--r--drivers/ide/ide-iops.c10
-rw-r--r--drivers/ide/ide-probe.c34
-rw-r--r--drivers/ide/ide-proc.c10
-rw-r--r--drivers/ide/ide-taskfile.c27
8 files changed, 88 insertions, 92 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index adf04f99cdeb..2433fce6c111 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -303,7 +303,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_atapi_pc *pc,
303 303
304 /* Issue the packet command */ 304 /* Issue the packet command */
305 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) { 305 if (drive->atapi_flags & IDE_AFLAG_DRQ_INTERRUPT) {
306 ide_execute_command(drive, WIN_PACKETCMD, handler, 306 ide_execute_command(drive, ATA_CMD_PACKET, handler,
307 timeout, NULL); 307 timeout, NULL);
308 return ide_started; 308 return ide_started;
309 } else { 309 } else {
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 46f9720f1ec9..77e0f9ab7698 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -541,7 +541,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
541 drive->waiting_for_dma = 0; 541 drive->waiting_for_dma = 0;
542 542
543 /* packet command */ 543 /* packet command */
544 ide_execute_command(drive, WIN_PACKETCMD, handler, 544 ide_execute_command(drive, ATA_CMD_PACKET, handler,
545 ATAPI_WAIT_PC, cdrom_timer_expiry); 545 ATAPI_WAIT_PC, cdrom_timer_expiry);
546 return ide_started; 546 return ide_started;
547 } else { 547 } else {
diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 40253c51ace4..83da9a98dabc 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -141,18 +141,18 @@ static int lba_capacity_is_ok(u16 *id)
141} 141}
142 142
143static const u8 ide_rw_cmds[] = { 143static const u8 ide_rw_cmds[] = {
144 WIN_MULTREAD, 144 ATA_CMD_READ_MULTI,
145 WIN_MULTWRITE, 145 ATA_CMD_WRITE_MULTI,
146 WIN_MULTREAD_EXT, 146 ATA_CMD_READ_MULTI_EXT,
147 WIN_MULTWRITE_EXT, 147 ATA_CMD_WRITE_MULTI_EXT,
148 WIN_READ, 148 ATA_CMD_PIO_READ,
149 WIN_WRITE, 149 ATA_CMD_PIO_WRITE,
150 WIN_READ_EXT, 150 ATA_CMD_PIO_READ_EXT,
151 WIN_WRITE_EXT, 151 ATA_CMD_PIO_WRITE_EXT,
152 WIN_READDMA, 152 ATA_CMD_READ,
153 WIN_WRITEDMA, 153 ATA_CMD_WRITE,
154 WIN_READDMA_EXT, 154 ATA_CMD_READ_EXT,
155 WIN_WRITEDMA_EXT, 155 ATA_CMD_WRITE_EXT,
156}; 156};
157 157
158static const u8 ide_data_phases[] = { 158static const u8 ide_data_phases[] = {
@@ -323,9 +323,9 @@ static u64 idedisk_read_native_max_address(ide_drive_t *drive, int lba48)
323 /* Create IDE/ATA command request structure */ 323 /* Create IDE/ATA command request structure */
324 memset(&args, 0, sizeof(ide_task_t)); 324 memset(&args, 0, sizeof(ide_task_t));
325 if (lba48) 325 if (lba48)
326 tf->command = WIN_READ_NATIVE_MAX_EXT; 326 tf->command = ATA_CMD_READ_NATIVE_MAX_EXT;
327 else 327 else
328 tf->command = WIN_READ_NATIVE_MAX; 328 tf->command = ATA_CMD_READ_NATIVE_MAX;
329 tf->device = ATA_LBA; 329 tf->device = ATA_LBA;
330 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 330 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
331 if (lba48) 331 if (lba48)
@@ -360,10 +360,10 @@ static u64 idedisk_set_max_address(ide_drive_t *drive, u64 addr_req, int lba48)
360 tf->hob_lbal = (addr_req >>= 8) & 0xff; 360 tf->hob_lbal = (addr_req >>= 8) & 0xff;
361 tf->hob_lbam = (addr_req >>= 8) & 0xff; 361 tf->hob_lbam = (addr_req >>= 8) & 0xff;
362 tf->hob_lbah = (addr_req >>= 8) & 0xff; 362 tf->hob_lbah = (addr_req >>= 8) & 0xff;
363 tf->command = WIN_SET_MAX_EXT; 363 tf->command = ATA_CMD_SET_MAX_EXT;
364 } else { 364 } else {
365 tf->device = (addr_req >>= 8) & 0x0f; 365 tf->device = (addr_req >>= 8) & 0x0f;
366 tf->command = WIN_SET_MAX; 366 tf->command = ATA_CMD_SET_MAX;
367 } 367 }
368 tf->device |= ATA_LBA; 368 tf->device |= ATA_LBA;
369 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 369 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
@@ -482,10 +482,10 @@ static int smart_enable(ide_drive_t *drive)
482 struct ide_taskfile *tf = &args.tf; 482 struct ide_taskfile *tf = &args.tf;
483 483
484 memset(&args, 0, sizeof(ide_task_t)); 484 memset(&args, 0, sizeof(ide_task_t));
485 tf->feature = SMART_ENABLE; 485 tf->feature = ATA_SMART_ENABLE;
486 tf->lbam = SMART_LCYL_PASS; 486 tf->lbam = ATA_SMART_LBAM_PASS;
487 tf->lbah = SMART_HCYL_PASS; 487 tf->lbah = ATA_SMART_LBAH_PASS;
488 tf->command = WIN_SMART; 488 tf->command = ATA_CMD_SMART;
489 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 489 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
490 return ide_no_data_taskfile(drive, &args); 490 return ide_no_data_taskfile(drive, &args);
491} 491}
@@ -498,9 +498,9 @@ static int get_smart_data(ide_drive_t *drive, u8 *buf, u8 sub_cmd)
498 memset(&args, 0, sizeof(ide_task_t)); 498 memset(&args, 0, sizeof(ide_task_t));
499 tf->feature = sub_cmd; 499 tf->feature = sub_cmd;
500 tf->nsect = 0x01; 500 tf->nsect = 0x01;
501 tf->lbam = SMART_LCYL_PASS; 501 tf->lbam = ATA_SMART_LBAM_PASS;
502 tf->lbah = SMART_HCYL_PASS; 502 tf->lbah = ATA_SMART_LBAH_PASS;
503 tf->command = WIN_SMART; 503 tf->command = ATA_CMD_SMART;
504 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 504 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
505 args.data_phase = TASKFILE_IN; 505 args.data_phase = TASKFILE_IN;
506 (void) smart_enable(drive); 506 (void) smart_enable(drive);
@@ -558,14 +558,14 @@ static int proc_idedisk_read_sv
558 (char *page, char **start, off_t off, int count, int *eof, void *data) 558 (char *page, char **start, off_t off, int count, int *eof, void *data)
559{ 559{
560 return proc_idedisk_read_smart(page, start, off, count, eof, data, 560 return proc_idedisk_read_smart(page, start, off, count, eof, data,
561 SMART_READ_VALUES); 561 ATA_SMART_READ_VALUES);
562} 562}
563 563
564static int proc_idedisk_read_st 564static int proc_idedisk_read_st
565 (char *page, char **start, off_t off, int count, int *eof, void *data) 565 (char *page, char **start, off_t off, int count, int *eof, void *data)
566{ 566{
567 return proc_idedisk_read_smart(page, start, off, count, eof, data, 567 return proc_idedisk_read_smart(page, start, off, count, eof, data,
568 SMART_READ_THRESHOLDS); 568 ATA_SMART_READ_THRESHOLDS);
569} 569}
570 570
571static ide_proc_entry_t idedisk_proc[] = { 571static ide_proc_entry_t idedisk_proc[] = {
@@ -589,9 +589,9 @@ static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
589 memset(task, 0, sizeof(*task)); 589 memset(task, 0, sizeof(*task));
590 if (ide_id_has_flush_cache_ext(drive->id) && 590 if (ide_id_has_flush_cache_ext(drive->id) &&
591 (drive->capacity64 >= (1UL << 28))) 591 (drive->capacity64 >= (1UL << 28)))
592 task->tf.command = WIN_FLUSH_CACHE_EXT; 592 task->tf.command = ATA_CMD_FLUSH_EXT;
593 else 593 else
594 task->tf.command = WIN_FLUSH_CACHE; 594 task->tf.command = ATA_CMD_FLUSH;
595 task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE | 595 task->tf_flags = IDE_TFLAG_OUT_TF | IDE_TFLAG_OUT_DEVICE |
596 IDE_TFLAG_DYN; 596 IDE_TFLAG_DYN;
597 task->data_phase = TASKFILE_NO_DATA; 597 task->data_phase = TASKFILE_NO_DATA;
@@ -686,8 +686,8 @@ static int write_cache(ide_drive_t *drive, int arg)
686 if (ide_id_has_flush_cache(drive->id)) { 686 if (ide_id_has_flush_cache(drive->id)) {
687 memset(&args, 0, sizeof(ide_task_t)); 687 memset(&args, 0, sizeof(ide_task_t));
688 args.tf.feature = arg ? 688 args.tf.feature = arg ?
689 SETFEATURES_EN_WCACHE : SETFEATURES_DIS_WCACHE; 689 SETFEATURES_WC_ON : SETFEATURES_WC_OFF;
690 args.tf.command = WIN_SETFEATURES; 690 args.tf.command = ATA_CMD_SET_FEATURES;
691 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 691 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
692 err = ide_no_data_taskfile(drive, &args); 692 err = ide_no_data_taskfile(drive, &args);
693 if (err == 0) 693 if (err == 0)
@@ -705,9 +705,9 @@ static int do_idedisk_flushcache(ide_drive_t *drive)
705 705
706 memset(&args, 0, sizeof(ide_task_t)); 706 memset(&args, 0, sizeof(ide_task_t));
707 if (ide_id_has_flush_cache_ext(drive->id)) 707 if (ide_id_has_flush_cache_ext(drive->id))
708 args.tf.command = WIN_FLUSH_CACHE_EXT; 708 args.tf.command = ATA_CMD_FLUSH_EXT;
709 else 709 else
710 args.tf.command = WIN_FLUSH_CACHE; 710 args.tf.command = ATA_CMD_FLUSH;
711 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 711 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
712 return ide_no_data_taskfile(drive, &args); 712 return ide_no_data_taskfile(drive, &args);
713} 713}
@@ -720,9 +720,9 @@ static int set_acoustic(ide_drive_t *drive, int arg)
720 return -EINVAL; 720 return -EINVAL;
721 721
722 memset(&args, 0, sizeof(ide_task_t)); 722 memset(&args, 0, sizeof(ide_task_t));
723 args.tf.feature = arg ? SETFEATURES_EN_AAM : SETFEATURES_DIS_AAM; 723 args.tf.feature = arg ? SETFEATURES_AAM_ON : SETFEATURES_AAM_OFF;
724 args.tf.nsect = arg; 724 args.tf.nsect = arg;
725 args.tf.command = WIN_SETFEATURES; 725 args.tf.command = ATA_CMD_SET_FEATURES;
726 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 726 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
727 ide_no_data_taskfile(drive, &args); 727 ide_no_data_taskfile(drive, &args);
728 drive->acoustic = arg; 728 drive->acoustic = arg;
@@ -985,7 +985,7 @@ static int idedisk_set_doorlock(ide_drive_t *drive, int on)
985 ide_task_t task; 985 ide_task_t task;
986 986
987 memset(&task, 0, sizeof(task)); 987 memset(&task, 0, sizeof(task));
988 task.tf.command = on ? WIN_DOORLOCK : WIN_DOORUNLOCK; 988 task.tf.command = on ? ATA_CMD_MEDIA_LOCK : ATA_CMD_MEDIA_UNLOCK;
989 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 989 task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
990 990
991 return ide_no_data_taskfile(drive, &task); 991 return ide_no_data_taskfile(drive, &task);
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 1678043701df..ce9ecd138836 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -188,13 +188,13 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
188 return ide_stopped; 188 return ide_stopped;
189 } 189 }
190 if (ide_id_has_flush_cache_ext(drive->id)) 190 if (ide_id_has_flush_cache_ext(drive->id))
191 args->tf.command = WIN_FLUSH_CACHE_EXT; 191 args->tf.command = ATA_CMD_FLUSH_EXT;
192 else 192 else
193 args->tf.command = WIN_FLUSH_CACHE; 193 args->tf.command = ATA_CMD_FLUSH;
194 goto out_do_tf; 194 goto out_do_tf;
195 195
196 case idedisk_pm_standby: /* Suspend step 2 (standby) */ 196 case idedisk_pm_standby: /* Suspend step 2 (standby) */
197 args->tf.command = WIN_STANDBYNOW1; 197 args->tf.command = ATA_CMD_STANDBYNOW1;
198 goto out_do_tf; 198 goto out_do_tf;
199 199
200 case idedisk_pm_restore_pio: /* Resume step 1 (restore PIO) */ 200 case idedisk_pm_restore_pio: /* Resume step 1 (restore PIO) */
@@ -209,7 +209,7 @@ static ide_startstop_t ide_start_power_step(ide_drive_t *drive, struct request *
209 return ide_stopped; 209 return ide_stopped;
210 210
211 case idedisk_pm_idle: /* Resume step 2 (idle) */ 211 case idedisk_pm_idle: /* Resume step 2 (idle) */
212 args->tf.command = WIN_IDLEIMMEDIATE; 212 args->tf.command = ATA_CMD_IDLEIMMEDIATE;
213 goto out_do_tf; 213 goto out_do_tf;
214 214
215 case ide_pm_restore_dma: /* Resume step 3 (restore DMA) */ 215 case ide_pm_restore_dma: /* Resume step 3 (restore DMA) */
@@ -380,8 +380,8 @@ static ide_startstop_t ide_ata_error(ide_drive_t *drive, struct request *rq, u8
380 /* err has different meaning on cdrom and tape */ 380 /* err has different meaning on cdrom and tape */
381 if (err == ABRT_ERR) { 381 if (err == ABRT_ERR) {
382 if (drive->select.b.lba && 382 if (drive->select.b.lba &&
383 /* some newer drives don't support WIN_SPECIFY */ 383 /* some newer drives don't support ATA_CMD_INIT_DEV_PARAMS */
384 hwif->tp_ops->read_status(hwif) == WIN_SPECIFY) 384 hwif->tp_ops->read_status(hwif) == ATA_CMD_INIT_DEV_PARAMS)
385 return ide_stopped; 385 return ide_stopped;
386 } else if ((err & BAD_CRC) == BAD_CRC) { 386 } else if ((err & BAD_CRC) == BAD_CRC) {
387 /* UDMA crc error, just retry the operation */ 387 /* UDMA crc error, just retry the operation */
@@ -436,7 +436,7 @@ static ide_startstop_t ide_atapi_error(ide_drive_t *drive, struct request *rq, u
436 436
437 if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT)) 437 if (hwif->tp_ops->read_status(hwif) & (BUSY_STAT | DRQ_STAT))
438 /* force an abort */ 438 /* force an abort */
439 hwif->tp_ops->exec_command(hwif, WIN_IDLEIMMEDIATE); 439 hwif->tp_ops->exec_command(hwif, ATA_CMD_IDLEIMMEDIATE);
440 440
441 if (rq->errors >= ERROR_MAX) { 441 if (rq->errors >= ERROR_MAX) {
442 ide_kill_rq(drive, rq); 442 ide_kill_rq(drive, rq);
@@ -509,19 +509,19 @@ static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
509 tf->lbam = drive->cyl; 509 tf->lbam = drive->cyl;
510 tf->lbah = drive->cyl >> 8; 510 tf->lbah = drive->cyl >> 8;
511 tf->device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA; 511 tf->device = ((drive->head - 1) | drive->select.all) & ~ATA_LBA;
512 tf->command = WIN_SPECIFY; 512 tf->command = ATA_CMD_INIT_DEV_PARAMS;
513} 513}
514 514
515static void ide_tf_set_restore_cmd(ide_drive_t *drive, struct ide_taskfile *tf) 515static void ide_tf_set_restore_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
516{ 516{
517 tf->nsect = drive->sect; 517 tf->nsect = drive->sect;
518 tf->command = WIN_RESTORE; 518 tf->command = ATA_CMD_RESTORE;
519} 519}
520 520
521static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf) 521static void ide_tf_set_setmult_cmd(ide_drive_t *drive, struct ide_taskfile *tf)
522{ 522{
523 tf->nsect = drive->mult_req; 523 tf->nsect = drive->mult_req;
524 tf->command = WIN_SETMULT; 524 tf->command = ATA_CMD_SET_MULTI;
525} 525}
526 526
527static ide_startstop_t ide_disk_special(ide_drive_t *drive) 527static ide_startstop_t ide_disk_special(ide_drive_t *drive)
@@ -584,9 +584,10 @@ static int set_pio_mode_abuse(ide_hwif_t *hwif, u8 req_pio)
584 * do_special - issue some special commands 584 * do_special - issue some special commands
585 * @drive: drive the command is for 585 * @drive: drive the command is for
586 * 586 *
587 * do_special() is used to issue WIN_SPECIFY, WIN_RESTORE, and WIN_SETMULT 587 * do_special() is used to issue ATA_CMD_INIT_DEV_PARAMS,
588 * commands to a drive. It used to do much more, but has been scaled 588 * ATA_CMD_RESTORE and ATA_CMD_SET_MULTI commands to a drive.
589 * back. 589 *
590 * It used to do much more, but has been scaled back.
590 */ 591 */
591 592
592static ide_startstop_t do_special (ide_drive_t *drive) 593static ide_startstop_t do_special (ide_drive_t *drive)
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 95495e4219ff..21647a2eaff9 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -418,7 +418,7 @@ void ide_fix_driveid(u16 *id)
418 * ide_fixstring() cleans up and (optionally) byte-swaps a text string, 418 * ide_fixstring() cleans up and (optionally) byte-swaps a text string,
419 * removing leading/trailing blanks and compressing internal blanks. 419 * removing leading/trailing blanks and compressing internal blanks.
420 * It is primarily used to tidy up the model name/number fields as 420 * It is primarily used to tidy up the model name/number fields as
421 * returned by the WIN_[P]IDENTIFY commands. 421 * returned by the ATA_CMD_ID_ATA[PI] commands.
422 */ 422 */
423 423
424void ide_fixstring (u8 *s, const int bytecount, const int byteswap) 424void ide_fixstring (u8 *s, const int bytecount, const int byteswap)
@@ -675,7 +675,7 @@ int ide_driveid_update(ide_drive_t *drive)
675 SELECT_MASK(drive, 1); 675 SELECT_MASK(drive, 1);
676 tp_ops->set_irq(hwif, 0); 676 tp_ops->set_irq(hwif, 0);
677 msleep(50); 677 msleep(50);
678 tp_ops->exec_command(hwif, WIN_IDENTIFY); 678 tp_ops->exec_command(hwif, ATA_CMD_ID_ATA);
679 timeout = jiffies + WAIT_WORSTCASE; 679 timeout = jiffies + WAIT_WORSTCASE;
680 do { 680 do {
681 if (time_after(jiffies, timeout)) { 681 if (time_after(jiffies, timeout)) {
@@ -770,7 +770,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
770 770
771 tp_ops->tf_load(drive, &task); 771 tp_ops->tf_load(drive, &task);
772 772
773 tp_ops->exec_command(hwif, WIN_SETFEATURES); 773 tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES);
774 774
775 if (drive->quirk_list == 2) 775 if (drive->quirk_list == 2)
776 tp_ops->set_irq(hwif, 1); 776 tp_ops->set_irq(hwif, 1);
@@ -890,7 +890,7 @@ void ide_execute_pkt_cmd(ide_drive_t *drive)
890 unsigned long flags; 890 unsigned long flags;
891 891
892 spin_lock_irqsave(&ide_lock, flags); 892 spin_lock_irqsave(&ide_lock, flags);
893 hwif->tp_ops->exec_command(hwif, WIN_PACKETCMD); 893 hwif->tp_ops->exec_command(hwif, ATA_CMD_PACKET);
894 ndelay(400); 894 ndelay(400);
895 spin_unlock_irqrestore(&ide_lock, flags); 895 spin_unlock_irqrestore(&ide_lock, flags);
896} 896}
@@ -1100,7 +1100,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
1100 pre_reset(drive); 1100 pre_reset(drive);
1101 SELECT_DRIVE(drive); 1101 SELECT_DRIVE(drive);
1102 udelay (20); 1102 udelay (20);
1103 tp_ops->exec_command(hwif, WIN_SRST); 1103 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
1104 ndelay(400); 1104 ndelay(400);
1105 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE; 1105 hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
1106 hwgroup->polling = 1; 1106 hwgroup->polling = 1;
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 2f105f4bbdec..4829daacb342 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -132,10 +132,10 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
132 ide_fix_driveid(id); 132 ide_fix_driveid(id);
133 133
134 /* 134 /*
135 * WIN_IDENTIFY returns little-endian info, 135 * ATA_CMD_ID_ATA returns little-endian info,
136 * WIN_PIDENTIFY *usually* returns little-endian info. 136 * ATA_CMD_ID_ATAPI *usually* returns little-endian info.
137 */ 137 */
138 if (cmd == WIN_PIDENTIFY) { 138 if (cmd == ATA_CMD_ID_ATAPI) {
139 if ((m[0] == 'N' && m[1] == 'E') || /* NEC */ 139 if ((m[0] == 'N' && m[1] == 'E') || /* NEC */
140 (m[0] == 'F' && m[1] == 'X') || /* Mitsumi */ 140 (m[0] == 'F' && m[1] == 'X') || /* Mitsumi */
141 (m[0] == 'P' && m[1] == 'i')) /* Pioneer */ 141 (m[0] == 'P' && m[1] == 'i')) /* Pioneer */
@@ -161,7 +161,7 @@ static inline void do_identify (ide_drive_t *drive, u8 cmd)
161 /* 161 /*
162 * Check for an ATAPI device 162 * Check for an ATAPI device
163 */ 163 */
164 if (cmd == WIN_PIDENTIFY) { 164 if (cmd == ATA_CMD_ID_ATAPI) {
165 u8 type = (id[ATA_ID_CONFIG] >> 8) & 0x1f; 165 u8 type = (id[ATA_ID_CONFIG] >> 8) & 0x1f;
166 166
167 printk(KERN_CONT "ATAPI "); 167 printk(KERN_CONT "ATAPI ");
@@ -277,7 +277,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
277 /* set features register for atapi 277 /* set features register for atapi
278 * identify command to be sure of reply 278 * identify command to be sure of reply
279 */ 279 */
280 if (cmd == WIN_PIDENTIFY) { 280 if (cmd == ATA_CMD_ID_ATAPI) {
281 ide_task_t task; 281 ide_task_t task;
282 282
283 memset(&task, 0, sizeof(task)); 283 memset(&task, 0, sizeof(task));
@@ -290,7 +290,7 @@ static int actual_try_to_identify (ide_drive_t *drive, u8 cmd)
290 /* ask drive for ID */ 290 /* ask drive for ID */
291 tp_ops->exec_command(hwif, cmd); 291 tp_ops->exec_command(hwif, cmd);
292 292
293 timeout = ((cmd == WIN_IDENTIFY) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2; 293 timeout = ((cmd == ATA_CMD_ID_ATA) ? WAIT_WORSTCASE : WAIT_PIDENTIFY) / 2;
294 timeout += jiffies; 294 timeout += jiffies;
295 do { 295 do {
296 if (time_after(jiffies, timeout)) { 296 if (time_after(jiffies, timeout)) {
@@ -440,13 +440,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
440 440
441 if (drive->present) { 441 if (drive->present) {
442 /* avoid waiting for inappropriate probes */ 442 /* avoid waiting for inappropriate probes */
443 if ((drive->media != ide_disk) && (cmd == WIN_IDENTIFY)) 443 if (drive->media != ide_disk && cmd == ATA_CMD_ID_ATA)
444 return 4; 444 return 4;
445 } 445 }
446#ifdef DEBUG 446#ifdef DEBUG
447 printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n", 447 printk(KERN_INFO "probing for %s: present=%d, media=%d, probetype=%s\n",
448 drive->name, drive->present, drive->media, 448 drive->name, drive->present, drive->media,
449 (cmd == WIN_IDENTIFY) ? "ATA" : "ATAPI"); 449 (cmd == ATA_CMD_ID_ATA) ? "ATA" : "ATAPI");
450#endif 450#endif
451 451
452 /* needed for some systems 452 /* needed for some systems
@@ -470,7 +470,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
470 stat = tp_ops->read_status(hwif); 470 stat = tp_ops->read_status(hwif);
471 471
472 if (OK_STAT(stat, READY_STAT, BUSY_STAT) || 472 if (OK_STAT(stat, READY_STAT, BUSY_STAT) ||
473 drive->present || cmd == WIN_PIDENTIFY) { 473 drive->present || cmd == ATA_CMD_ID_ATAPI) {
474 /* send cmd and wait */ 474 /* send cmd and wait */
475 if ((rc = try_to_identify(drive, cmd))) { 475 if ((rc = try_to_identify(drive, cmd))) {
476 /* failed: try again */ 476 /* failed: try again */
@@ -482,13 +482,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
482 if (stat == (BUSY_STAT | READY_STAT)) 482 if (stat == (BUSY_STAT | READY_STAT))
483 return 4; 483 return 4;
484 484
485 if (rc == 1 && cmd == WIN_PIDENTIFY) { 485 if (rc == 1 && cmd == ATA_CMD_ID_ATAPI) {
486 printk(KERN_ERR "%s: no response (status = 0x%02x), " 486 printk(KERN_ERR "%s: no response (status = 0x%02x), "
487 "resetting drive\n", drive->name, stat); 487 "resetting drive\n", drive->name, stat);
488 msleep(50); 488 msleep(50);
489 SELECT_DRIVE(drive); 489 SELECT_DRIVE(drive);
490 msleep(50); 490 msleep(50);
491 tp_ops->exec_command(hwif, WIN_SRST); 491 tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
492 (void)ide_busy_sleep(hwif); 492 (void)ide_busy_sleep(hwif);
493 rc = try_to_identify(drive, cmd); 493 rc = try_to_identify(drive, cmd);
494 } 494 }
@@ -527,7 +527,7 @@ static void enable_nest (ide_drive_t *drive)
527 527
528 SELECT_DRIVE(drive); 528 SELECT_DRIVE(drive);
529 msleep(50); 529 msleep(50);
530 tp_ops->exec_command(hwif, EXABYTE_ENABLE_NEST); 530 tp_ops->exec_command(hwif, ATA_EXABYTE_ENABLE_NEST);
531 531
532 if (ide_busy_sleep(hwif)) { 532 if (ide_busy_sleep(hwif)) {
533 printk(KERN_CONT "failed (timeout)\n"); 533 printk(KERN_CONT "failed (timeout)\n");
@@ -544,10 +544,9 @@ static void enable_nest (ide_drive_t *drive)
544 printk(KERN_CONT "success\n"); 544 printk(KERN_CONT "success\n");
545 545
546 /* if !(success||timed-out) */ 546 /* if !(success||timed-out) */
547 if (do_probe(drive, WIN_IDENTIFY) >= 2) { 547 if (do_probe(drive, ATA_CMD_ID_ATA) >= 2)
548 /* look for ATAPI device */ 548 /* look for ATAPI device */
549 (void) do_probe(drive, WIN_PIDENTIFY); 549 (void)do_probe(drive, ATA_CMD_ID_ATAPI);
550 }
551} 550}
552 551
553/** 552/**
@@ -590,10 +589,9 @@ static inline u8 probe_for_drive (ide_drive_t *drive)
590 if (!drive->noprobe) 589 if (!drive->noprobe)
591 { 590 {
592 /* if !(success||timed-out) */ 591 /* if !(success||timed-out) */
593 if (do_probe(drive, WIN_IDENTIFY) >= 2) { 592 if (do_probe(drive, ATA_CMD_ID_ATA) >= 2)
594 /* look for ATAPI device */ 593 /* look for ATAPI device */
595 (void) do_probe(drive, WIN_PIDENTIFY); 594 (void)do_probe(drive, ATA_CMD_ID_ATAPI);
596 }
597 if (!drive->present) 595 if (!drive->present)
598 /* drive not found */ 596 /* drive not found */
599 return 0; 597 return 0;
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c
index 0bdbb9bf90ba..22f41fa4e5b6 100644
--- a/drivers/ide/ide-proc.c
+++ b/drivers/ide/ide-proc.c
@@ -12,14 +12,6 @@
12 * "settings" files. e.g. "cat /proc/ide0/hda/settings" 12 * "settings" files. e.g. "cat /proc/ide0/hda/settings"
13 * To write a new value "val" into a specific setting "name", use: 13 * To write a new value "val" into a specific setting "name", use:
14 * echo "name:val" >/proc/ide/ide0/hda/settings 14 * echo "name:val" >/proc/ide/ide0/hda/settings
15 *
16 * Also useful, "cat /proc/ide0/hda/[identify, smart_values,
17 * smart_thresholds, capabilities]" will issue an IDENTIFY /
18 * PACKET_IDENTIFY / SMART_READ_VALUES / SMART_READ_THRESHOLDS /
19 * SENSE CAPABILITIES command to /dev/hda, and then dump out the
20 * returned data as 256 16-bit words. The "hdparm" utility will
21 * be updated someday soon to use this mechanism.
22 *
23 */ 15 */
24 16
25#include <linux/module.h> 17#include <linux/module.h>
@@ -349,7 +341,7 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
349 return -EINVAL; 341 return -EINVAL;
350 342
351 memset(&task, 0, sizeof(task)); 343 memset(&task, 0, sizeof(task));
352 task.tf.command = WIN_SETFEATURES; 344 task.tf.command = ATA_CMD_SET_FEATURES;
353 task.tf.feature = SETFEATURES_XFER; 345 task.tf.feature = SETFEATURES_XFER;
354 task.tf.nsect = (u8)arg; 346 task.tf.nsect = (u8)arg;
355 task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT | 347 task.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT |
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index f889373d7f95..9224f6797186 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -44,9 +44,9 @@ int taskfile_lib_get_identify (ide_drive_t *drive, u8 *buf)
44 memset(&args, 0, sizeof(ide_task_t)); 44 memset(&args, 0, sizeof(ide_task_t));
45 args.tf.nsect = 0x01; 45 args.tf.nsect = 0x01;
46 if (drive->media == ide_disk) 46 if (drive->media == ide_disk)
47 args.tf.command = WIN_IDENTIFY; 47 args.tf.command = ATA_CMD_ID_ATA;
48 else 48 else
49 args.tf.command = WIN_PIDENTIFY; 49 args.tf.command = ATA_CMD_ID_ATAPI;
50 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; 50 args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE;
51 args.data_phase = TASKFILE_IN; 51 args.data_phase = TASKFILE_IN;
52 return ide_raw_taskfile(drive, &args, buf, 1); 52 return ide_raw_taskfile(drive, &args, buf, 1);
@@ -99,12 +99,17 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
99 case TASKFILE_NO_DATA: 99 case TASKFILE_NO_DATA:
100 if (handler == NULL) 100 if (handler == NULL)
101 handler = task_no_data_intr; 101 handler = task_no_data_intr;
102 /* WIN_{SPECIFY,RESTORE,SETMULT} use custom handlers */
103 if (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) { 102 if (task->tf_flags & IDE_TFLAG_CUSTOM_HANDLER) {
104 switch (tf->command) { 103 switch (tf->command) {
105 case WIN_SPECIFY: handler = set_geometry_intr; break; 104 case ATA_CMD_INIT_DEV_PARAMS:
106 case WIN_RESTORE: handler = recal_intr; break; 105 handler = set_geometry_intr;
107 case WIN_SETMULT: handler = set_multmode_intr; break; 106 break;
107 case ATA_CMD_RESTORE:
108 handler = recal_intr;
109 break;
110 case ATA_CMD_SET_MULTI:
111 handler = set_multmode_intr;
112 break;
108 } 113 }
109 } 114 }
110 ide_execute_command(drive, tf->command, handler, 115 ide_execute_command(drive, tf->command, handler,
@@ -121,7 +126,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
121EXPORT_SYMBOL_GPL(do_rw_taskfile); 126EXPORT_SYMBOL_GPL(do_rw_taskfile);
122 127
123/* 128/*
124 * set_multmode_intr() is invoked on completion of a WIN_SETMULT cmd. 129 * set_multmode_intr() is invoked on completion of a ATA_CMD_SET_MULTI cmd.
125 */ 130 */
126static ide_startstop_t set_multmode_intr(ide_drive_t *drive) 131static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
127{ 132{
@@ -142,7 +147,7 @@ static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
142} 147}
143 148
144/* 149/*
145 * set_geometry_intr() is invoked on completion of a WIN_SPECIFY cmd. 150 * set_geometry_intr() is invoked on completion of a ATA_CMD_INIT_DEV_PARAMS cmd.
146 */ 151 */
147static ide_startstop_t set_geometry_intr(ide_drive_t *drive) 152static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
148{ 153{
@@ -170,7 +175,7 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
170} 175}
171 176
172/* 177/*
173 * recal_intr() is invoked on completion of a WIN_RESTORE (recalibrate) cmd. 178 * recal_intr() is invoked on completion of a ATA_CMD_RESTORE (recalibrate) cmd.
174 */ 179 */
175static ide_startstop_t recal_intr(ide_drive_t *drive) 180static ide_startstop_t recal_intr(ide_drive_t *drive)
176{ 181{
@@ -747,7 +752,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
747 752
748 memset(&tfargs, 0, sizeof(ide_task_t)); 753 memset(&tfargs, 0, sizeof(ide_task_t));
749 tf->feature = args[2]; 754 tf->feature = args[2];
750 if (args[0] == WIN_SMART) { 755 if (args[0] == ATA_CMD_SMART) {
751 tf->nsect = args[3]; 756 tf->nsect = args[3];
752 tf->lbal = args[1]; 757 tf->lbal = args[1];
753 tf->lbam = 0x4f; 758 tf->lbam = 0x4f;
@@ -769,7 +774,7 @@ int ide_cmd_ioctl (ide_drive_t *drive, unsigned int cmd, unsigned long arg)
769 return -ENOMEM; 774 return -ENOMEM;
770 } 775 }
771 776
772 if (tf->command == WIN_SETFEATURES && 777 if (tf->command == ATA_CMD_SET_FEATURES &&
773 tf->feature == SETFEATURES_XFER && 778 tf->feature == SETFEATURES_XFER &&
774 tf->nsect >= XFER_SW_DMA_0 && 779 tf->nsect >= XFER_SW_DMA_0 &&
775 (id[ATA_ID_UDMA_MODES] || 780 (id[ATA_ID_UDMA_MODES] ||