On Wed, Nov 27, 2019 at 08:08:23AM +0100, Gerd Hoffmann wrote:
On Mon, Nov 25, 2019 at 07:25:26PM -0800, Your Real Name wrote:
From 3bf91481863ec504d113aa6b94827bf92840e291 Mon Sep 17 00:00:00 2001 From: gaobin gaobin@amazon.com Date: Thu, 19 Sep 2019 11:23:04 -0700 Subject: [PATCH 2/4] pci: Allow scanning pci bus number up to 255 in CSM mode
On real hardware especially server platforms, there are many pci devices, bridges, either SoC integrated or addon. They can exhaust all the pci bus numbers. So when scanning the pci bus, we need to allow the bus number up to 255.
Signed-off-by: gaobin gaobin@amazon.com
src/hw/pcidevice.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/src/hw/pcidevice.c b/src/hw/pcidevice.c index 8853cf7..acf15b4 100644 --- a/src/hw/pcidevice.c +++ b/src/hw/pcidevice.c @@ -26,6 +26,12 @@ pci_probe_devices(void) struct hlist_node **pprev = &PCIDevices.first; int extraroots = romfile_loadint("etc/extra-pci-roots", 0); int bus = -1, lastbus = 0, rootbuses = 0, count=0;
- // On real hardware especially server platforms, the bus number
- // could run up to the top value, i.e. 0xff
- if (CONFIG_CSM)
extraroots = 0xff;
What exactly you are trying to fix here?
seabios should find all pci devices behind bridges without problems.
The problem is from the following statement:
while (bus < 0xff && (bus < MaxPCIBus || rootbuses < extraroots)) {
extraroots always returns 0 in csm mode, and "bus < MaxPCIBus" returns false very early. So the while loop ends early, leaving many pci devices un-scanned.
Without the patch, I got: "Found 33 PCI devices (max PCI bus is 02)"
With the patch, I got: "Found 159 PCI devices (max PCI bus is b2)"
cheers, Gerd