Getting a list of all drivers
John-Mark Gurney
jmg at funkthat.com
Sun May 26 04:19:17 UTC 2013
Jesus Alejandro Padilla wrote this message on Tue, May 21, 2013 at 20:31 -0400:
> I?m trying to get a comprehensive list of all the drivers in FreeBSD (I?m
> talking about all the drivers available, not only the ones installed in my
> system). I was thinking of getting them from the kernel source code (/sys),
> but I?ve had some problems. Here?s what I?ve tried so far.
>
> - Get all loadable kernel modules. The problem with this approach is
> that there are many modules that are not drivers (like MAC policies).
> - Get the ?device? entries in the GENERIC and NOTES configuration files.
> However, this has the same problem as the loadable kernel modules; there
> are ?devices? that are not drivers, and I think that these files don?t
> contain all drivers, only the ones that will be compiled statically with
> the kernel, right?
> - Get the modules under /sys/dev. The problem is that there are other
> drivers that are outside this folder.
>
> Do you know if there?s a better way of building this list? Is there a file,
> like a MAINTAINERS file that contains this information up to date? I?d
> really appreciate any help.
>
> Thank you very much!
>
> Alex
>
> PS: I know that some proprietary drivers, like Nvidia's, might be hard to
> get, but I?d like to get at least all the list of the drivers included in
> the kernel source code (/sys).
Getting the complete list might be a bit hard. When I did my How
to Write a FreeBSD Device Driver for BSDCan, I put together an awk
script (I can't seem to find it right now) that would extract all
the DRIVER_MODULE like lines, and build up a dot graph:
http://people.freebsd.org/~jmg/drivers/driver.tree.pdf
There are also lines:
EARLY_DRIVER_MODULE
EARLY_DRIVER_MODULE_ORDERED
DRIVER_MODULE_ORDERED
The lines are like:
DRIVER_MODULE(musbotg, atmelarm, musbotg_driver, musbotg_devclass, 0, 0);
where the first arg, musbotg is the driver, and atmelarm is the bus
it conencts to... A single driver can connect to multiple busses...
A good example of that is a driver like ed:
if_ed_cbus.c:DRIVER_MODULE(ed, isa, ed_cbus_driver, ed_devclass, 0, 0);
if_ed_isa.c:DRIVER_MODULE(ed, isa, ed_isa_driver, ed_devclass, 0, 0);
if_ed_pccard.c:DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, 0);
if_ed_pccard.c:DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, 0);
if_ed_pci.c:DRIVER_MODULE(ed, pci, ed_pci_driver, ed_devclass, 0, 0);
It connects to isa, pci and pccard, but it has a subbus which is the
miibus..
The difficulty is that there isn't too much distinction between a
driver and a bus... You can't just look for all the leaves, since as
I just demonstrated, ed is a driver, but it has a subbus...
Good luck!
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
More information about the freebsd-drivers
mailing list