[OpenBIOS] [PATCH 1/8] pci: add temporary bus-range property to PCI bridge devices

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sun Jun 11 12:00:30 CEST 2017


This enables the bridge (and also any children) to determine their bus number
during the secondary PCI bus scan.

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

diff --git a/drivers/pci.c b/drivers/pci.c
index d56a40e..f8d18c4 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -1262,6 +1262,8 @@ static void ob_configure_pci_bridge(pci_addr addr,
                                     unsigned long *io_base,
                                     int primary_bus, pci_config_t *config)
 {
+    phandle_t ph;
+
     config->primary_bus = primary_bus;
     pci_config_write8(addr, PCI_PRIMARY_BUS, config->primary_bus);
 
@@ -1274,6 +1276,11 @@ static void ob_configure_pci_bridge(pci_addr addr,
     PCI_DPRINTF("scanning new pci bus %u under bridge %s\n",
             config->secondary_bus, config->path);
 
+    /* Temporarily add bus-range property to allow the secondary bus to
+       determine its bus num */
+    ph = find_dev(config->path);
+    set_int_property(ph, "bus-range", *bus_num);
+
     /* make pci bridge parent device, prepare for recursion */
 
     ob_scan_pci_bus(bus_num, mem_base, io_base,
-- 
1.7.10.4




More information about the OpenBIOS mailing list