Commit 335e86a7 authored by 薛德章's avatar 薛德章

Fix take a long time on IDE probe. fix bug 4678.

Kernel is hanging for a long time on probing the IDE, even
when there's no hard disk connected. This patch fix a bug,
Now we can pass parameters to kernel to skip drive probing
if none exist.
Summary of ide driver parameters for kernel command line:
"hdx=noprobe"  : drive may be present, but don't probe for it
parent a4701816
......@@ -496,7 +496,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
CONFIG_IDE=y
CONFIG_IDE_MAX_HWIFS=4
CONFIG_IDE_MAX_HWIFS=1
CONFIG_BLK_DEV_IDE=y
#
......
......@@ -643,6 +643,7 @@ static void hwif_register (ide_hwif_t *hwif)
static int wait_hwif_ready(ide_hwif_t *hwif)
{
int rc;
unsigned int unit;
printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name);
......@@ -659,16 +660,24 @@ static int wait_hwif_ready(ide_hwif_t *hwif)
return rc;
/* Now make sure both master & slave are ready */
SELECT_DRIVE(&hwif->drives[0]);
for (unit = 0; unit < MAX_DRIVES; ++unit) {
/* Ignore disks that we will not probe for later. */
if (!hwif->drives[unit].noprobe ||
hwif->drives[unit].present) {
SELECT_DRIVE(&hwif->drives[unit]);
hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
mdelay(2);
rc = ide_wait_not_busy(hwif, 35000);
if (rc)
if (rc) {
/* Exit function with master reselected */
if (unit != 0)
SELECT_DRIVE(&hwif->drives[0]);
return rc;
SELECT_DRIVE(&hwif->drives[1]);
hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]);
mdelay(2);
rc = ide_wait_not_busy(hwif, 35000);
}
} else {
printk("Skip ide_wait_not_busy for %s:%d\n",hwif->name, unit);
}
}
/* Exit function with master reselected (let's be sane) */
SELECT_DRIVE(&hwif->drives[0]);
......@@ -723,8 +732,6 @@ static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
unsigned long flags;
unsigned int irqd;
if(!hwif->present)
return;
if (hwif->noprobe)
return;
......
......@@ -121,9 +121,16 @@ EXPORT_SYMBOL(ide_hwifs);
static void init_hwif_data(ide_hwif_t *hwif, unsigned int index)
{
unsigned int unit;
unsigned int noprobe[MAX_DRIVES];
/* bulk initialize hwif & drive info with zeros */
for(unit = 0; unit < MAX_DRIVES; unit++) {
noprobe[unit] = hwif->drives[unit].noprobe;
}
memset(hwif, 0, sizeof(ide_hwif_t));
for(unit = 0; unit < MAX_DRIVES; unit++) {
hwif->drives[unit].noprobe = noprobe[unit];
}
/* fill in any non-zero initial values */
hwif->index = index;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment