mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
Update flags patch for the !ISA case.
* Get flags first, in case there is no devclass. * Reset flags after each probe in case the next driver has no hints so it doesn't inherit the old ones. * Set them again before the winning probe. Tested ok both with and without ACPI for ISA device flags. Reviewed by: imp MFC after: 1 day
This commit is contained in:
parent
256d6e16b0
commit
66ae9f6384
1 changed files with 14 additions and 5 deletions
|
|
@ -1578,7 +1578,15 @@ device_probe_child(device_t dev, device_t child)
|
|||
device_set_driver(child, dl->driver);
|
||||
if (!hasclass)
|
||||
device_set_devclass(child, dl->driver->name);
|
||||
|
||||
/* Fetch any flags for the device before probing. */
|
||||
resource_int_value(dl->driver->name, child->unit,
|
||||
"flags", &child->devflags);
|
||||
|
||||
result = DEVICE_PROBE(child);
|
||||
|
||||
/* Reset flags and devclass before the next probe. */
|
||||
child->devflags = 0;
|
||||
if (!hasclass)
|
||||
device_set_devclass(child, 0);
|
||||
|
||||
|
|
@ -1645,9 +1653,14 @@ device_probe_child(device_t dev, device_t child)
|
|||
if (child->state > DS_ALIVE && best->driver != child->driver)
|
||||
if ((result = device_detach(dev)) != 0)
|
||||
return (result);
|
||||
|
||||
/* Set the winning driver, devclass, and flags. */
|
||||
if (!child->devclass)
|
||||
device_set_devclass(child, best->driver->name);
|
||||
device_set_driver(child, best->driver);
|
||||
resource_int_value(best->driver->name, child->unit,
|
||||
"flags", &child->devflags);
|
||||
|
||||
if (pri < 0) {
|
||||
/*
|
||||
* A bit bogus. Call the probe method again to make
|
||||
|
|
@ -2074,7 +2087,7 @@ int
|
|||
device_set_devclass(device_t dev, const char *classname)
|
||||
{
|
||||
devclass_t dc;
|
||||
int error, flags;
|
||||
int error;
|
||||
|
||||
if (!classname) {
|
||||
if (dev->devclass)
|
||||
|
|
@ -2093,10 +2106,6 @@ device_set_devclass(device_t dev, const char *classname)
|
|||
|
||||
error = devclass_add_device(dc, dev);
|
||||
|
||||
/* Fetch any hints for the device before it is probed. */
|
||||
if (resource_int_value(classname, dev->unit, "flags", &flags) == 0)
|
||||
dev->devflags = flags;
|
||||
|
||||
bus_data_generation_update();
|
||||
return (error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue