powerpc/pseries: Fix getting the server number size
authorSebastien Dugue <sebastien.dugue@bull.net>
Wed, 22 Oct 2008 04:36:32 +0000 (04:36 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 5 Nov 2008 11:08:28 +0000 (22:08 +1100)
The 'ibm,interrupt-server#-size' properties are not in the cpu nodes,
which is where we currently look for them, but rather live under the
interrupt source controller nodes (which have "ibm,ppc-xics" in their
compatible property).

This moves the code that looks for the ibm,interrupt-server#-size
properties from xics_update_irq_servers() into xics_init_IRQ().

Also this adds a check for mismatched sizes across the interrupt
source controller nodes.  Not sure this is necessary as in this case
the firmware might be seriously busted.

This property only appears on POWER6 boxes and is only used in the
set-indicator(gqirm) call, and apparently firmware currently ignores
the value we pass.  Nevertheless we need to fix it in case future
firmware versions use it.

Signed-off-by: Sebastien Dugue <sebastien.dugue@bull.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/pseries/xics.c

index e190477..75a289b 100644 (file)
@@ -579,7 +579,7 @@ static void xics_update_irq_servers(void)
        int i, j;
        struct device_node *np;
        u32 ilen;
-       const u32 *ireg, *isize;
+       const u32 *ireg;
        u32 hcpuid;
 
        /* Find the server numbers for the boot cpu. */
@@ -607,11 +607,6 @@ static void xics_update_irq_servers(void)
                }
        }
 
-       /* get the bit size of server numbers */
-       isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
-       if (isize)
-               interrupt_server_size = *isize;
-
        of_node_put(np);
 }
 
@@ -682,6 +677,7 @@ void __init xics_init_IRQ(void)
        struct device_node *np;
        u32 indx = 0;
        int found = 0;
+       const u32 *isize;
 
        ppc64_boot_msg(0x20, "XICS Init");
 
@@ -701,6 +697,26 @@ void __init xics_init_IRQ(void)
        if (found == 0)
                return;
 
+       /* get the bit size of server numbers */
+       found = 0;
+
+       for_each_compatible_node(np, NULL, "ibm,ppc-xics") {
+               isize = of_get_property(np, "ibm,interrupt-server#-size", NULL);
+
+               if (!isize)
+                       continue;
+
+               if (!found) {
+                       interrupt_server_size = *isize;
+                       found = 1;
+               } else if (*isize != interrupt_server_size) {
+                       printk(KERN_WARNING "XICS: "
+                              "mismatched ibm,interrupt-server#-size\n");
+                       interrupt_server_size = max(*isize,
+                                                   interrupt_server_size);
+               }
+       }
+
        xics_update_irq_servers();
        xics_init_host();