[OpenBIOS] [PATCH 2/4] pci: Do not use hard coded name for pci bus, get it from phandle instead

BALATON Zoltan balaton at eik.bme.hu
Sun Nov 20 18:57:34 CET 2016


Signed-off-by: BALATON Zoltan <balaton at eik.bme.hu>
---
 drivers/pci.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/pci.c b/drivers/pci.c
index b75ca0f..7ad5202 100644
--- a/drivers/pci.c
+++ b/drivers/pci.c
@@ -1481,27 +1481,35 @@ static void ob_pci_host_set_interrupt_map(phandle_t host)
 
 #if defined(CONFIG_PPC)
     phandle_t target_node;
+    char *path, buf[256];
 
     /* Oldworld macs do interrupt maps differently */
     if (!is_newworld())
         return;
 
+    PCI_DPRINTF("setting up interrupt map for host %x\n", host);
     dnode = dt_iterate_type(0, "open-pic");
-    if (dnode) {
+    path = get_path_from_ph(host);
+    if (dnode && path) {
         /* patch in openpic interrupt-parent properties */
-        target_node = find_dev("/pci/mac-io");
+        snprintf(buf, sizeof(buf), "%s/mac-io", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/escc/ch-a");
+        snprintf(buf, sizeof(buf), "%s/mac-io/escc/ch-a", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/escc/ch-b");
+        snprintf(buf, sizeof(buf), "%s/mac-io/escc/ch-b", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/escc-legacy/ch-a");
+        snprintf(buf, sizeof(buf), "%s/mac-io/escc-legacy/ch-a", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/escc-legacy/ch-b");
+        snprintf(buf, sizeof(buf), "%s/mac-io/escc-legacy/ch-b", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
         /* QEMU only emulates 2 of the 3 ata buses currently */
@@ -1510,16 +1518,19 @@ static void ob_pci_host_set_interrupt_map(phandle_t host)
          * On g3beige they all called just ide.
          * We take 2 x ata-3 buses which seems to work for
          * at least the clients we care about */
-        target_node = find_dev("/pci/mac-io/ata-3 at 20000");
+        snprintf(buf, sizeof(buf), "%s/mac-io/ata-3 at 20000", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/ata-3 at 21000");
+        snprintf(buf, sizeof(buf), "%s/mac-io/ata-3 at 21000", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci/mac-io/via-cuda");
+        snprintf(buf, sizeof(buf), "%s/mac-io/via-cuda", path);
+        target_node = find_dev(buf);
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        target_node = find_dev("/pci");
+        target_node = find_dev(path);
         set_int_property(target_node, "interrupt-parent", dnode);
     }
 #else
-- 
2.7.4




More information about the OpenBIOS mailing list