diff options
Diffstat (limited to 'drivers/ide/ide-probe.c')
-rw-r--r-- | drivers/ide/ide-probe.c | 34 |
1 files changed, 16 insertions, 18 deletions
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; |