fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / powerpc / platforms / powermac / smp.c
index 6d64a9b..eeb2ae5 100644 (file)
@@ -21,7 +21,6 @@
  *  as published by the Free Software Foundation; either version
  *  2 of the License, or (at your option) any later version.
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/smp.h>
@@ -161,7 +160,7 @@ static inline void psurge_clr_ipi(int cpu)
  */
 static unsigned long psurge_smp_message[NR_CPUS];
 
-void psurge_smp_message_recv(struct pt_regs *regs)
+void psurge_smp_message_recv(void)
 {
        int cpu = smp_processor_id();
        int msg;
@@ -175,12 +174,12 @@ void psurge_smp_message_recv(struct pt_regs *regs)
        /* make sure there is a message there */
        for (msg = 0; msg < 4; msg++)
                if (test_and_clear_bit(msg, &psurge_smp_message[cpu]))
-                       smp_message_recv(msg, regs);
+                       smp_message_recv(msg);
 }
 
-irqreturn_t psurge_primary_intr(int irq, void *d, struct pt_regs *regs)
+irqreturn_t psurge_primary_intr(int irq, void *d)
 {
-       psurge_smp_message_recv(regs);
+       psurge_smp_message_recv();
        return IRQ_HANDLED;
 }
 
@@ -191,9 +190,7 @@ static void smp_psurge_message_pass(int target, int msg)
        if (num_online_cpus() < 2)
                return;
 
-       for (i = 0; i < NR_CPUS; i++) {
-               if (!cpu_online(i))
-                       continue;
+       for_each_online_cpu(i) {
                if (target == MSG_ALL
                    || (target == MSG_ALL_BUT_SELF && i != smp_processor_id())
                    || target == i) {
@@ -331,6 +328,7 @@ static void __init smp_psurge_kick_cpu(int nr)
 {
        unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
        unsigned long a;
+       int i;
 
        /* may need to flush here if secondary bats aren't setup */
        for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32)
@@ -343,7 +341,11 @@ static void __init smp_psurge_kick_cpu(int nr)
        mb();
 
        psurge_set_ipi(nr);
-       udelay(10);
+       /*
+        * We can't use udelay here because the timebase is now frozen.
+        */
+       for (i = 0; i < 2000; ++i)
+               barrier();
        psurge_clr_ipi(nr);
 
        if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354);
@@ -380,7 +382,7 @@ static void __init psurge_dual_sync_tb(int cpu_nr)
 
 static struct irqaction psurge_irqaction = {
        .handler = psurge_primary_intr,
-       .flags = SA_INTERRUPT,
+       .flags = IRQF_DISABLED,
        .mask = CPU_MASK_NONE,
        .name = "primary IPI",
 };
@@ -551,7 +553,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
        struct device_node *cc = NULL;  
        struct device_node *p;
        const char *name = NULL;
-       u32 *reg;
+       const u32 *reg;
        int ok;
 
        /* Look for the clock chip */
@@ -565,7 +567,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus)
                pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc);
                if (pmac_tb_clock_chip_host == NULL)
                        continue;
-               reg = (u32 *)get_property(cc, "reg", NULL);
+               reg = get_property(cc, "reg", NULL);
                if (reg == NULL)
                        continue;
                switch (*reg) {
@@ -705,13 +707,12 @@ static void __init smp_core99_setup(int ncpus)
        /* GPIO based HW sync on ppc32 Core99 */
        if (pmac_tb_freeze == NULL && !machine_is_compatible("MacRISC4")) {
                struct device_node *cpu;
-               u32 *tbprop = NULL;
+               const u32 *tbprop = NULL;
 
                core99_tb_gpio = KL_GPIO_TB_ENABLE;     /* default value */
                cpu = of_find_node_by_type(NULL, "cpu");
                if (cpu != NULL) {
-                       tbprop = (u32 *)get_property(cpu, "timebase-enable",
-                                                    NULL);
+                       tbprop = get_property(cpu, "timebase-enable", NULL);
                        if (tbprop)
                                core99_tb_gpio = *tbprop;
                        of_node_put(cpu);