[OpenBIOS] [PATCH] pci: fix accidental io_base reset for PCI host bridge

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jul 9 19:48:50 CEST 2017


Commit c80a58b added a workaround to allow ioport access through the first PCI
bridge found until its base and limits were programmed, so that on-board devices
not directly attached to the PCI host bus could be used during OpenBIOS
initialisation.

Unfortunately the logic was broken, and in fact the reset should only occur if
we're the first PCI bridge that isn't the host bridge - otherwise we end up
resetting io_base for the PCI host bus causing its devices to be mapped over
existing in-built ioports causing strange behaviour.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 drivers/pci.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci.c b/drivers/pci.c
index db92683..92938a4 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -1426,7 +1426,7 @@ static void ob_configure_pci_bridge(pci_addr addr,
     /* Always expose the legacy ioports on the first PCI bridge. If we
        must have legacy devices behind a PCI bridge then they must be
        on the first one discovered to ensure that the ioports will work. */
-    if (*io_base < 0x1000) {
+    if (primary_bus > 0 && *io_base < 0x1000) {
         *io_base = 0x0;
     }
 
-- 
1.7.10.4




More information about the OpenBIOS mailing list