I'm looking for how kernel to do PCI/PCIe enumeration and BAR assigning.
I thought that kernel will assign PCI base addresses of BAR when start-up, but when I tried pci earlydump (before kernel initial PCI subsystem) to see the BARs valuse, I found all base addresses are already assigned !? Does it mean that BIOS do PCI/PCIe enumeration and BAR assigning? How BIOS know each pci devices base addresses and assign these without conflict?
And if so, how the embedded system(without BIOS ) to enumerate and assign base address for PCI/PCIe devices?
By the way, my PC is Ubuntu 14.04.1 LTS (x86_64)
On all IBM PC-compatible machines, BARs are assigned by the BIOS. Linux simply scans through the buses and records the BAR values.
Some MIPS boards adopt similar approaches, where BARs are assigned by firmware. However, the quality of BAR assignment by firmware vary quite a bit. Some firmware simply assigns BARs to on-board PCI devices and ignore all add-on PCI cards. In that case, Linux cannot solely rely on the firmware's assignment.
There is another issue of depending on the firmware assignment. You need to stick with the address range setup by the firmware. In other words, if the firmware assigns PCI memory space from 0x10000000 to 0x14000000, you cannot easily move it to a different address space somewhere else in Linux. Source: Bar asssignment in Linux
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With