[OpenBIOS] [commit] r1325 - trunk/openbios-devel/drivers

repository service svn at openbios.org
Fri Nov 14 20:17:43 CET 2014


Author: mcayland
Date: Fri Nov 14 20:17:43 2014
New Revision: 1325
URL: http://tracker.coreboot.org/trac/openbios/changeset/1325

Log:
pci.c: move PPC openpic interrupt mapping to post-PCI-bus scan

Move the openpic interrupt mapping from the pre-scan
pci_host_set_interrupt_map() to the post-scan ob_pci_host_set_interrupt_map()
function.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>

Modified:
   trunk/openbios-devel/drivers/pci.c

Modified: trunk/openbios-devel/drivers/pci.c
==============================================================================
--- trunk/openbios-devel/drivers/pci.c	Fri Nov 14 20:17:40 2014	(r1324)
+++ trunk/openbios-devel/drivers/pci.c	Fri Nov 14 20:17:43 2014	(r1325)
@@ -431,32 +431,7 @@
  *     It would be great if someone clever could come up with a more universal
  *     mechanism here.
  */
-#if defined(CONFIG_PPC)
-	u32 props[7 * 8];
-	int i;
-
-	/* Oldworld macs do interrupt maps differently */
-	if(!is_newworld())
-		return;
-
-	for (i = 0; i < (7*8); i+=7) {
-		props[i+PCI_INT_MAP_PCI0] = 0;
-		props[i+PCI_INT_MAP_PCI1] = 0;
-		props[i+PCI_INT_MAP_PCI2] = 0;
-		props[i+PCI_INT_MAP_PCI_INT] = (i / 7) + 1; // starts at PINA=1
-		props[i+PCI_INT_MAP_PIC_HANDLE] = 0; // gets patched in later
-		props[i+PCI_INT_MAP_PIC_INT] = arch->irqs[i / 7];
-		props[i+PCI_INT_MAP_PIC_POL] = 3;
-	}
-	set_property(dev, "interrupt-map", (char *)props, 7 * 8 * sizeof(props[0]));
-
-	props[PCI_INT_MAP_PCI0] = 0;
-	props[PCI_INT_MAP_PCI1] = 0;
-	props[PCI_INT_MAP_PCI2] = 0;
-	props[PCI_INT_MAP_PCI_INT] = 0x7;
-
-	set_property(dev, "interrupt-map-mask", (char *)props, 4 * sizeof(props[0]));
-#elif defined(CONFIG_SPARC64)
+#if defined(CONFIG_SPARC64)
 	uint32_t props[12];
 	int ncells, device, i;
 
@@ -1440,9 +1415,9 @@
 {
 #if defined(CONFIG_PPC)
     phandle_t dnode = 0;
+    u32 props[56];
     phandle_t target_node;
-    u32 *interrupt_map;
-    int len, i;
+    int i;
 
     /* Oldworld macs do interrupt maps differently */
     if (!is_newworld())
@@ -1478,11 +1453,24 @@
         target_node = find_dev("/pci");
         set_int_property(target_node, "interrupt-parent", dnode);
 
-        interrupt_map = (u32 *)get_property(target_node, "interrupt-map", &len);
-        for (i = 0; i < 8; i++) {
-            interrupt_map[(i * 7) + PCI_INT_MAP_PIC_HANDLE] = (u32)dnode;
+        /* openpic interrupt mapping */
+        for (i = 0; i < (7*8); i += 7) {
+            props[i + PCI_INT_MAP_PCI0] = 0;
+            props[i + PCI_INT_MAP_PCI1] = 0;
+            props[i + PCI_INT_MAP_PCI2] = 0;
+            props[i + PCI_INT_MAP_PCI_INT] = (i / 7) + 1; // starts at PINA=1
+            props[i + PCI_INT_MAP_PIC_HANDLE] = dnode;
+            props[i + PCI_INT_MAP_PIC_INT] = arch->irqs[i / 7];
+            props[i + PCI_INT_MAP_PIC_POL] = 3;
         }
-        set_property(target_node, "interrupt-map", (char *)interrupt_map, len);
+        set_property(host, "interrupt-map", (char *)props, 7 * 8 * sizeof(props[0]));
+
+        props[PCI_INT_MAP_PCI0] = 0;
+        props[PCI_INT_MAP_PCI1] = 0;
+        props[PCI_INT_MAP_PCI2] = 0;
+        props[PCI_INT_MAP_PCI_INT] = 0x7;
+
+        set_property(host, "interrupt-map-mask", (char *)props, 4 * sizeof(props[0]));
     }
 #endif
 }



More information about the OpenBIOS mailing list