From 25940705b84d4e1148789f018738a2cfeec74ab6 Mon Sep 17 00:00:00 2001
From: Marcel Apfelbaum <marcel@redhat.com>
Date: Wed, 24 Jun 2015 13:45:12 +0200
Subject: [PATCH 1/2] fw/pci: scan all buses if extraroots romfile is present

Message-id: <1435153513-25431-2-git-send-email-marcel@redhat.com>
Patchwork-id: 66382
O-Subject: [RHEL-7.2 seabios PATCH 1/2] fw/pci: scan all buses if extraroots romfile is present
Bugzilla: 1235381
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>

From: Marcel Apfelbaum <marcel.a@redhat.com>

If there are extra primary root buses, scanning the bus's 0
subtree is not enough. Scan all the range.

Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 5cc7eece39721f20b417770374a4112c454be801)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 src/fw/pciinit.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c
index 2e6382f..b2fd659 100644
--- a/src/fw/pciinit.c
+++ b/src/fw/pciinit.c
@@ -498,8 +498,17 @@ pci_bios_init_bus_rec(int bus, u8 *pci_bus)
 static void
 pci_bios_init_bus(void)
 {
+    u8 extraroots = romfile_loadint("etc/extra-pci-roots", 0);
     u8 pci_bus = 0;
+
     pci_bios_init_bus_rec(0 /* host bus */, &pci_bus);
+
+    if (extraroots) {
+        while (pci_bus < 0xff) {
+            pci_bus++;
+            pci_bios_init_bus_rec(pci_bus, &pci_bus);
+        }
+    }
 }
 
 
-- 
1.8.3.1

