aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ide/ide-probe.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 970464317bd7..21cea45e9f21 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -410,6 +410,18 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
410 return 1; 410 return 1;
411} 411}
412 412
413static u8 ide_read_device(ide_drive_t *drive)
414{
415 ide_task_t task;
416
417 memset(&task, 0, sizeof(task));
418 task.tf_flags = IDE_TFLAG_IN_DEVICE;
419
420 drive->hwif->tf_read(drive, &task);
421
422 return task.tf.device;
423}
424
413/** 425/**
414 * do_probe - probe an IDE device 426 * do_probe - probe an IDE device
415 * @drive: drive to probe 427 * @drive: drive to probe
@@ -434,7 +446,6 @@ static int ide_busy_sleep(ide_hwif_t *hwif)
434static int do_probe (ide_drive_t *drive, u8 cmd) 446static int do_probe (ide_drive_t *drive, u8 cmd)
435{ 447{
436 ide_hwif_t *hwif = HWIF(drive); 448 ide_hwif_t *hwif = HWIF(drive);
437 struct ide_io_ports *io_ports = &hwif->io_ports;
438 int rc; 449 int rc;
439 u8 stat; 450 u8 stat;
440 451
@@ -455,8 +466,8 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
455 msleep(50); 466 msleep(50);
456 SELECT_DRIVE(drive); 467 SELECT_DRIVE(drive);
457 msleep(50); 468 msleep(50);
458 if (hwif->INB(io_ports->device_addr) != drive->select.all && 469
459 !drive->present) { 470 if (ide_read_device(drive) != drive->select.all && !drive->present) {
460 if (drive->select.b.unit != 0) { 471 if (drive->select.b.unit != 0) {
461 /* exit with drive0 selected */ 472 /* exit with drive0 selected */
462 SELECT_DRIVE(&hwif->drives[0]); 473 SELECT_DRIVE(&hwif->drives[0]);