If devclass_alloc_unit() is called with a wired unit #, and this is

buzy, only search upwards for a free slot to use..

This broke unit numbering on ATA systems where PCI attached controllers
come before the mainboard ones...

Reviewed by: dfr
This commit is contained in:
Søren Schmidt 2000-05-26 13:59:05 +00:00
parent fe81f64ffc
commit d5f65fcbd7

View File

@ -350,27 +350,22 @@ devclass_alloc_unit(devclass_t dc, int *unitp)
PDEBUG(("unit %d in devclass %s", unit, DEVCLANAME(dc)));
/*
* If we have been given a wired unit number, check for existing
* device.
*/
/* If we have been given a wired unit number, check for existing device */
if (unit != -1) {
if (unit >= 0 && unit < dc->maxunit && dc->devices[unit] != NULL) {
if (bootverbose)
printf("%s-: %s%d exists, using next available unit number\n",
dc->name, dc->name, unit);
unit = -1;
/* find the next available slot */
while (++unit < dc->maxunit && dc->devices[unit] != NULL)
;
}
}
/*
* We ended up with an unwired device, so let's find the next available
* slot for it.
*/
if (unit == -1) {
else {
/* Unwired device, find the next available slot for it */
unit = 0;
while (unit < dc->maxunit && dc->devices[unit] != NULL)
unit++;
unit++;
}
/*