From 3bf91481863ec504d113aa6b94827bf92840e291 Mon Sep 17 00:00:00 2001
From: gaobin <gaobin(a)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(a)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;
+
while (bus < 0xff && (bus < MaxPCIBus || rootbuses < extraroots)) {
bus++;
int bdf;
--
2.17.1