[platform][pc] fix up bios32 PCI support, get pci IDE working again
-Spiff up the device driver starting logic to allow for statically started devices, instead of always automatic.
This commit is contained in:
28
dev/driver.c
28
dev/driver.c
@@ -26,6 +26,7 @@
|
||||
#include <err.h>
|
||||
#include <trace.h>
|
||||
|
||||
/* static list of devices constructed with DEVICE_INSTANCE macros */
|
||||
extern struct device __devices[];
|
||||
extern struct device __devices_end[];
|
||||
|
||||
@@ -35,14 +36,15 @@ status_t device_init_all(void)
|
||||
|
||||
struct device *dev = __devices;
|
||||
while (dev != __devices_end) {
|
||||
dprintf(INFO, "dev: initializing device %s:%s\n", dev->driver->type, dev->name);
|
||||
status_t code = device_init(dev);
|
||||
if (dev->flags & DEVICE_FLAG_AUTOINIT) {
|
||||
status_t code = device_init(dev);
|
||||
|
||||
if (code < 0) {
|
||||
TRACEF("Driver init failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
if (code < 0) {
|
||||
TRACEF("Driver init failed for driver \"%s\", device \"%s\", reason %d\n",
|
||||
dev->driver->type, dev->name, code);
|
||||
|
||||
res = code;
|
||||
res = code;
|
||||
}
|
||||
}
|
||||
|
||||
dev++;
|
||||
@@ -81,10 +83,18 @@ status_t device_init(struct device *dev)
|
||||
|
||||
const struct driver_ops *ops = dev->driver->ops;
|
||||
|
||||
if (ops && ops->init)
|
||||
return ops->init(dev);
|
||||
else
|
||||
if (ops && ops->init) {
|
||||
dprintf(INFO, "dev: initializing device %s:%s\n", dev->driver->type, dev->name);
|
||||
status_t err = ops->init(dev);
|
||||
if (err < 0) {
|
||||
dev->device_state = DEVICE_INITIALIZED_FAILED;
|
||||
} else {
|
||||
dev->device_state = DEVICE_INITIALIZED;
|
||||
}
|
||||
return err;
|
||||
} else {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
status_t device_fini(struct device *dev)
|
||||
|
||||
Reference in New Issue
Block a user