Use a list of host controller modules instead of using open_module_list() and
read_next_module_name(). This is ugly and less flexible but it allows us to explicitly force an initialization order. As detailed by the added comment there seem to be controllers/BIOSes that require the EHCI controller to be initialized after the companion host controller or else they refuse to publish any high speed devices. This was the case for bug #1236 and my laptop when legacy emulation is enabled and any device was plugged in at boot. This change fixed the problem for me and hopefully closes bug #1236 too. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24926 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -52,27 +52,37 @@ Stack::Stack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for host controller modules
|
// Check for host controller modules
|
||||||
void *moduleList = open_module_list("busses/usb");
|
// While using a fixed list of names is inflexible it allows us to control
|
||||||
char moduleName[B_PATH_NAME_LENGTH];
|
// the order in which we try modules. There are controllers/BIOSes that
|
||||||
size_t bufferSize = sizeof(moduleName);
|
// require UHCI/OHCI to be initialized before EHCI or otherwise they
|
||||||
|
// refuse to publish any high-speed devices.
|
||||||
|
// On other systems the ordering is probably ensured because the EHCI
|
||||||
|
// controller is required to have a higher PCI function number than the
|
||||||
|
// companion host controllers (per the EHCI specs) and it would therefore
|
||||||
|
// be enumerated as the last item. As this does not apply to us we have to
|
||||||
|
// ensure ordering using another method.
|
||||||
|
const char *moduleNames[] = {
|
||||||
|
"busses/usb/uhci",
|
||||||
|
"busses/usb/ohci",
|
||||||
|
"busses/usb/ehci",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
TRACE(("USB Stack: looking for host controller modules\n"));
|
TRACE(("USB Stack: looking for host controller modules\n"));
|
||||||
while (read_next_module_name(moduleList, moduleName, &bufferSize) == B_OK) {
|
for (uint32 i = 0; moduleNames[i]; i++) {
|
||||||
bufferSize = sizeof(moduleName);
|
TRACE(("USB Stack: looking for module %s\n", moduleNames[i]));
|
||||||
TRACE(("USB Stack: found module %s\n", moduleName));
|
|
||||||
|
|
||||||
usb_host_controller_info *module = NULL;
|
usb_host_controller_info *module = NULL;
|
||||||
if (get_module(moduleName, (module_info **)&module) != B_OK)
|
if (get_module(moduleNames[i], (module_info **)&module) != B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
TRACE(("USB Stack: adding module %s\n", moduleNames[i]));
|
||||||
if (module->add_to(this) < B_OK)
|
if (module->add_to(this) < B_OK)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
TRACE(("USB Stack: module %s successfully loaded\n", moduleName));
|
TRACE(("USB Stack: module %s successfully loaded\n", moduleNames[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
close_module_list(moduleList);
|
|
||||||
|
|
||||||
if (fBusManagers.Count() == 0) {
|
if (fBusManagers.Count() == 0) {
|
||||||
TRACE_ERROR(("USB Stack: no bus managers available\n"));
|
TRACE_ERROR(("USB Stack: no bus managers available\n"));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user