Order in which a driver attaches to devices
John Baldwin
jhb at freebsd.org
Thu Sep 13 14:27:57 UTC 2012
On Friday, September 07, 2012 10:48:39 am John Baldwin wrote:
> On Thursday, September 06, 2012 5:08:27 pm Navdeep Parhar wrote:
> > I have a system with multiple cards supported by cxgbe(4). When I build
> > a kernel with the driver compiled in, it attaches to the cards in a
> > different order from when it's loaded as a module. Why? The network
> > interfaces get re-ordered and this is quite annoying.
>
> Hmmmm. The boot time probe does a depth first walk of the PCI bus. This is
> what is suggested by PCI-SIG for enumerating PCI buses (and is normally how
> BIOSs walk the bus assigning bus numbers). The walk that is done at kldload
> time walks the 'pciX' bus devices in numerical order (rather than walking the
> tree). I suspect your BIOS is doing something weird and assigning bus numbers
> in a non-depth first ordering so that the two orderings are not consisent as
> they are on other machines.
BTW, another fix is to stop trying to force unit numbers to patch PCI bus
numbers (e.g. change pcib_attach() in pci_pci.c to use -1 instead of
sc->secbus). A few other places would need to be changed as well:
acpi_pcib_attach(), legacy_pcib_attach(), qpi_pcib_attach(),
mptable_hostb_attach(). If we went this route we should probably do it on
other platforms as well. (Some, such as sparc64 already do this.)
--
John Baldwin
More information about the freebsd-hackers
mailing list