linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / arch / powerpc / kernel / rtas_pci.c
index cda0226..7442775 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * arch/ppc64/kernel/rtas_pci.c
+ *
  * Copyright (C) 2001 Dave Engebretsen, IBM Corporation
  * Copyright (C) 2003 Anton Blanchard <anton@au.ibm.com>, IBM
  *
@@ -297,15 +299,23 @@ unsigned long __init find_and_init_phbs(void)
        struct device_node *node;
        struct pci_controller *phb;
        unsigned int index;
+       unsigned int root_size_cells = 0;
+       unsigned int *opprop = NULL;
        struct device_node *root = of_find_node_by_path("/");
 
+       if (ppc64_interrupt_controller == IC_OPEN_PIC) {
+               opprop = (unsigned int *)get_property(root,
+                               "platform-open-pic", NULL);
+       }
+
+       root_size_cells = prom_n_size_cells(root);
+
        index = 0;
+
        for (node = of_get_next_child(root, NULL);
             node != NULL;
             node = of_get_next_child(root, node)) {
-
-               if (node->type == NULL || (strcmp(node->type, "pci") != 0 &&
-                                          strcmp(node->type, "pciex") != 0))
+               if (node->type == NULL || strcmp(node->type, "pci") != 0)
                        continue;
 
                phb = pcibios_alloc_controller(node);
@@ -314,6 +324,13 @@ unsigned long __init find_and_init_phbs(void)
                setup_phb(node, phb);
                pci_process_bridge_OF_ranges(phb, node, 0);
                pci_setup_phb_io(phb, index == 0);
+#ifdef CONFIG_PPC_PSERIES
+               /* XXX This code need serious fixing ... --BenH */
+               if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) {
+                       int addr = root_size_cells * (index + 2) - 1;
+                       mpic_assign_isu(pSeries_mpic, index, opprop[addr]);
+               }
+#endif
                index++;
        }