[haiku-development] USB cannot find host controllers modules at boot time.

  • From: Siarzhuk Zharski <zharik@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Fri, 25 May 2007 11:34:54 +0200

Good afternoon,

Probably, this mail-list is a better place to discuss such questions. ;-) Well, below is my e-mail about problem I observed during porting my usb_scsi to Haiku Drivers API. Mentioned problem was solved by adding "missed" link to usb bus_manager in "....../add-ons/kernel/boot/" directory. OK, at least now I know a bit more. ;-) But the following problem comes in the light - the code from USB bus manager Stack::Stack(...) constructor looks like not working at boot time:

==== Stack.cpp r21042
...

        /// Check for host controller modules
/       *void* *moduleList = open_module_list(*"busses/usb"*);
        *char* moduleName[B_PATH_NAME_LENGTH];
        size_t bufferSize = *sizeof*(moduleName);

        TRACE((*"USB Stack: looking for host controller modules\n"*));
        *while*(read_next_module_name(moduleList, moduleName, &bufferSize) == 
B_OK) {
                bufferSize = *sizeof*(moduleName);
                TRACE((*"USB Stack: found module %s\n"*, moduleName));

                host_controller_info *module = NULL;
                *if* (get_module(moduleName, (module_info **)&module) != B_OK)
                        *continue*;

                *if* (module->add_to(*this*) < B_OK)
                        *continue*;

                TRACE((*"USB Stack: module %s successfully loaded\n"*, 
moduleName));
        }

        close_module_list(moduleList);

        *if* (fBusManagers.Count() == 0) {
                TRACE_ERROR((*"USB Stack: no bus managers available\n"*));
                *return*;
        }

....
====

Of course, I have all those host controller binaries at right place, but see the "**USB Stack: no bus managers available\n**" message in my syslog during boot time. I have also created links to ehci,ohci and uhci binaries in "...../add-ons/kernel/boot/" subdirectory. It doesn't help. Looks like modules iteration functions do not working at boot time. Are there any alternatives that work in such circumstances? As solution we can replace that code with direct loading of ehci, ohci and uhci controller modules?

-------- Original Message --------
Subject: Re: [Haiku-commits] r20951 - in haiku/trunk/src/tests/add-ons/kernel: . busses busses/scsi busses/scsi/example
Date:   Wed, 23 May 2007 23:01:13 +0200
From:   Siarzhuk Zharski <zharik@xxxxxx>
Reply-To: SVN commits to the Haiku source repository <haiku-commits@xxxxxxxxxxxxxxxx> To: SVN commits to the Haiku source repository <haiku-commits@xxxxxxxxxxxxxxxx>
References:     <32775941748-BeMail@zon>


Hi, Axel!

you wrote:
Looks like the problem was in the "name" variable of the module_info structure. Your sample has "busses/scsi/example/v1" in this variable. I have replaced it with "busses/scsi/example/device_v1" and this bus module was loaded successfully. BTW I have to create the "boot symlink" too.

To All: Any comments about this "device_v1" issue?

Yes, that's how the device manager recognizes device driver modules - the "device_v1" names the interface that the driver is using.
It's me again. I have tried to load usb bus manager module from our example_scsi but failed. First I tried get_module,put_module functions but was KDL-ed at Haiku boot time. After that I tried to put B_USB_MODULE_NAME to module_dependencies[] list. This time Haiku does not attempt to shoot me, but.... Syslog say that "bus_managers/usb/v2" module not found. I checked the usb bus manager binary. It was at his place. The B_USB_MODULE_NAME looks like correspond to module declarations in usb bus manager. No more ideas...

I have activated TRACE in kernel module.cpp and receive a bit more information. Below a cut from the syslog. SCSI and DeviceManager modules are also in module_dependencies list. They are loaded without problems, I think.
....
KERN: get_module(busses/scsi/example/device_v1)
KERN: get_module_image(path = "example_scsi", _image = 0x800fec74)
KERN: resolving module dependencies...
KERN: get_module(bus_managers/scsi/sim/v1)
KERN: get_module_image(path = "/boot/beos/system/add-ons/kernel/bus_managers/scsi", _image = 0x800fec14)
KERN: resolving module dependencies...
KERN: get_module(system/device_manager/v1)
KERN: initializing module system/device_manager/v1 (at 0x8005b4ac)...
KERN: ...done (No error)
KERN: get_module(generic/locked_pool/v1)
KERN: get_module_image(path = "/boot/beos/system/add-ons/kernel/generic/locked_pool", _image = 0x800febb4)
KERN: initializing module generic/locked_pool/v1 (at 0x80282394)...
KERN: ...done (No error)
KERN: initializing module bus_managers/scsi/sim/v1 (at 0x80326894)...
KERN: ...done (No error)
KERN: get_module(system/device_manager/v1)
KERN: get_module(bus_managers/usb/v2)
KERN: search_module(bus_managers/usb/v2)
KERN: module: Search for bus_managers/usb/v2 failed.
KERN: loading dependent module "bus_managers/usb/v2" failed!
.....
Note that I tried both v2 USB module interface and v3 one. The same effect.

Just to be sure before putting this into Trac: is it enough to just add

{B_USB_MODULE_NAME, (module_info*), &usb},

into module_dependencies[] list to automatically load this module?

BTW, I see that in case loading the module by module_dependencies I have not to use get_module, put_module funtions? Is it right?

Thank you!

======= End of the Quote. =======

Thank you!

---
Kind Regards,
  S.Zharski




Other related posts: