Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / mips / sgi-ip27 / ip27-smp.c
index 1e5ce4c..09fa7f5 100644 (file)
@@ -8,6 +8,7 @@
  */
 #include <linux/init.h>
 #include <linux/sched.h>
+#include <linux/nodemask.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 #include <asm/sn/arch.h>
@@ -108,60 +109,48 @@ void cpu_node_probe(void)
        for (i = 0; i < MAXCPUS; i++)
                cpuid_to_compact_node[i] = INVALID_CNODEID;
 
-       numnodes = 0;
+       /*
+        * MCD - this whole "compact node" stuff can probably be dropped,
+        * as we can handle sparse numbering now
+        */
+       nodes_clear(node_online_map);
        for (i = 0; i < MAX_COMPACT_NODES; i++) {
                nasid_t nasid = gdap->g_nasidtable[i];
                if (nasid == INVALID_NASID)
                        break;
                compact_to_nasid_node[i] = nasid;
                nasid_to_compact_node[nasid] = i;
-               numnodes++;
+               node_set_online(num_online_nodes());
                highest = do_cpumask(i, nasid, highest);
        }
 
-       printk("Discovered %d cpus on %d nodes\n", highest + 1, numnodes);
+       printk("Discovered %d cpus on %d nodes\n", highest + 1, num_online_nodes());
 }
 
-void __init prom_build_cpu_map(void)
+static __init void intr_clear_all(nasid_t nasid)
 {
-}
-
-static void intr_clear_bits(nasid_t nasid, volatile hubreg_t *pend,
-       int base_level)
-{
-       volatile hubreg_t bits;
        int i;
 
-       /* Check pending interrupts */
-       if ((bits = HUB_L(pend)) != 0)
-               for (i = 0; i < N_INTPEND_BITS; i++)
-                       if (bits & (1 << i))
-                               LOCAL_HUB_CLR_INTR(base_level + i);
-}
-
-static void intr_clear_all(nasid_t nasid)
-{
        REMOTE_HUB_S(nasid, PI_INT_MASK0_A, 0);
        REMOTE_HUB_S(nasid, PI_INT_MASK0_B, 0);
        REMOTE_HUB_S(nasid, PI_INT_MASK1_A, 0);
        REMOTE_HUB_S(nasid, PI_INT_MASK1_B, 0);
-       intr_clear_bits(nasid, REMOTE_HUB_ADDR(nasid, PI_INT_PEND0),
-                       INT_PEND0_BASELVL);
-       intr_clear_bits(nasid, REMOTE_HUB_ADDR(nasid, PI_INT_PEND1),
-                       INT_PEND1_BASELVL);
+
+       for (i = 0; i < 128; i++)
+               REMOTE_HUB_CLR_INTR(nasid, i);
 }
 
-void __init prom_prepare_cpus(unsigned int max_cpus)
+void __init plat_smp_setup(void)
 {
        cnodeid_t       cnode;
 
-       for (cnode = 0; cnode < numnodes; cnode++)
+       for_each_online_node(cnode) {
+               if (cnode == 0)
+                       continue;
                intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
+       }
 
-       /* Master has already done per_cpu_init() */
-       install_ipi();
-
-       replicate_kernel_text(numnodes);
+       replicate_kernel_text();
 
        /*
         * Assumption to be fixed: we're always booted on logical / physical
@@ -172,6 +161,11 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
        alloc_cpupda(0, 0);
 }
 
+void __init plat_prepare_cpus(unsigned int max_cpus)
+{
+       /* We already did everything necessary earlier */
+}
+
 /*
  * Launch a slave into smp_bootstrap().  It doesn't take an argument, and we
  * set sp to the kernel stack of the newly created idle process, gp to the proc
@@ -179,8 +173,8 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
  */
 void __init prom_boot_secondary(int cpu, struct task_struct *idle)
 {
-       unsigned long gp = (unsigned long) idle->thread_info;
-       unsigned long sp = gp + THREAD_SIZE - 32;
+       unsigned long gp = (unsigned long)task_thread_info(idle);
+       unsigned long sp = __KSTK_TOS(idle);
 
        LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu),
                (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap),