Date: Thu, 13 Sep 2012 10:22:24 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Navdeep Parhar <np@freebsd.org> Subject: Re: Order in which a driver attaches to devices Message-ID: <201209131022.24898.jhb@freebsd.org> In-Reply-To: <201209071048.39664.jhb@freebsd.org> References: <504910CB.8050007@FreeBSD.org> <201209071048.39664.jhb@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209131022.24898.jhb>