Replace CONFIG_PCI_ROOT1/2 with CONFIG_EXTRA_PCI_ROOTS.
authorKevin O'Connor <kevin@koconnor.net>
Sat, 2 Jul 2011 22:39:03 +0000 (18:39 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 3 Jul 2011 03:38:47 +0000 (23:38 -0400)
Instead of defining the bus id of each extra root bus, define the
number of extra root buses.  The bus id isn't necessarily stable from
one boot to the next.

src/Kconfig
src/pci.c

index bbed963683fef7bd56a52b98aad1691f53ff1abf..70e350965456b634111553f730b878814b502dd0 100644 (file)
@@ -201,19 +201,15 @@ menu "Hardware support"
             Support parallel ports. This also enables int 17 parallel port calls.
 
     config EXTRA_PCI_ROOTS
-        bool "Extra root buses"
-        default n
+        int "Number of extra root buses"
+        default 0
         help
-            If the target machine has multiple independent root buses,
-            the extra buses may be specified here.
-    config PCI_ROOT1
-        depends on EXTRA_PCI_ROOTS
-        hex "Extra primary PCI root bus number"
-        default 0x00
-    config PCI_ROOT2
-        depends on EXTRA_PCI_ROOTS
-        hex "Extra secondary PCI root bus number"
-        default 0x00
+            If the target machine has multiple independent root buses
+            set this to a positive value.  The SeaBIOS PCI probe will
+            then search for the given number of extra root buses.
+
+            Most machines do not have multiple root buses and this
+            setting should be zero.
 
     config USE_SMM
         depends on !COREBOOT
index 0de8ec5feeac4b2bc463f7b2d6bc27b5de02d7c7..23a6878a6440fb613c942ca2e2d51715cdbc8da6 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -93,16 +93,12 @@ void
 pci_probe(void)
 {
     dprintf(3, "PCI probe\n");
-    if (CONFIG_PCI_ROOT1 && CONFIG_PCI_ROOT1 > MaxPCIBus)
-        MaxPCIBus = CONFIG_PCI_ROOT1;
-    if (CONFIG_PCI_ROOT2 && CONFIG_PCI_ROOT2 > MaxPCIBus)
-        MaxPCIBus = CONFIG_PCI_ROOT2;
-
     struct pci_device *busdevs[256];
     memset(busdevs, 0, sizeof(busdevs));
     struct pci_device **pprev = &PCIDevices;
     int bus = -1, lastbus = 0, rootbuses = 0, count=0;
-    while (bus < MaxPCIBus) {
+    while (bus < 0xff && (bus < MaxPCIBus
+                          || rootbuses < CONFIG_EXTRA_PCI_ROOTS)) {
         bus++;
         int bdf;
         foreachbdf(bdf, bus) {
@@ -125,6 +121,8 @@ pci_probe(void)
                     rootbuses++;
                 lastbus = bus;
                 rootbus = rootbuses;
+                if (bus > MaxPCIBus)
+                    MaxPCIBus = bus;
             } else {
                 rootbus = parent->rootbus;
             }