From owner-freebsd-drivers@FreeBSD.ORG Sun May 26 04:19:17 2013 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 9F7B7EF1 for ; Sun, 26 May 2013 04:19:17 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id 7AE7B926 for ; Sun, 26 May 2013 04:19:17 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id r4Q4J8Ua021140 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 25 May 2013 21:19:08 -0700 (PDT) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id r4Q4J8ou021139; Sat, 25 May 2013 21:19:08 -0700 (PDT) (envelope-from jmg) Date: Sat, 25 May 2013 21:19:08 -0700 From: John-Mark Gurney To: Jesus Alejandro Padilla Subject: Re: Getting a list of all drivers Message-ID: <20130526041908.GF90852@funkthat.com> Mail-Followup-To: Jesus Alejandro Padilla , freebsd-drivers@freebsd.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Sat, 25 May 2013 21:19:08 -0700 (PDT) Cc: freebsd-drivers@freebsd.org X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 May 2013 04:19:17 -0000 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."