PATCH: move cardbus container to "pci" devclass

From: Eric Jacobs <eaja_at_erols.com>
Date: Wed, 25 Jun 2003 16:05:25 -0400
Hello

I have made a patch for -CURRENT and 5.1-RELEASE that hopefully
improves the support for Cardbus devices by changing the "cardbus"
driver to implement the "pci" devclass rather than the "cardbus"
devclass, and to make their unit numbers correspond with the
PCI secondary bus numbers that their bridges are assigned.

This has a number of advantages:

 - User mode tools that interface with the /dev/pci interface
   such as pciconf and lspci (from ports) are now able to access
   Cardbus devices without modifications.

 - PCI drivers no longer need an additional driver declaration
   in order to support cardbus, e.g., in

./pci/if_xl.c:DRIVER_MODULE(xl, cardbus, xl_driver, xl_devclass, 0, 0);
./pci/if_xl.c:DRIVER_MODULE(xl, pci, xl_driver, xl_devclass, 0, 0);

   only the second line is required. (The first is harmless though.)

 - Because the unit numbers in the "pci" devclass now represent
   the PCI bus numbers in use in the system, we now have a good
   way of assigning bus numbers to the Cardbus bridges in lieu
   of the PCI BIOS doing so, which is not something we can expect
   all BIOSes to do. (The old code incremented a static counter
   starting from 2 by 3 every time this condition occurred,
   which wasn't correct because there could already be a pci2
   in the system, and the counter would eventually recycle.)


And a couple of potential drawbacks:

 - Drivers that need to behave differently for Cardbus devices
   can't do so by declaring another driver_t specifically for
   cardbus. (No driver that I'm aware of does this, however;
   they all use the same driver_t.)

 - Users that are accustomed to newbus nameunits containing
   descriptive information about devices may prefer to see,
   for example, "cardbus0" rather than "pci2". Note that
   using newbus in this way defeats a good deal of its
   potential for object-oriented design.


The patches are at

http://users.erols.com/eaja/cardbus51.diff
http://users.erols.com/eaja/cardbuscurrent.diff


Any comments?

Thanks,
Eric
Received on Wed Jun 25 2003 - 11:07:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC