Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
[sfrench/cifs-2.6.git] / arch / mips / sgi-ip27 / ip27-smp.c
index 08e79141b47c9ecb0e2c4d9b6122dc832333022d..5b47d6b65275ba6835043e8a050958ba014d0ed2 100644 (file)
@@ -33,7 +33,7 @@ static void alloc_cpupda(cpuid_t cpu, int cpunum)
        nasid_t nasid = COMPACT_TO_NASID_NODEID(node);
 
        cputonasid(cpunum) = nasid;
-       cpu_data[cpunum].p_nodeid = node;
+       sn_cpu_info[cpunum].p_nodeid = node;
        cputoslice(cpunum) = get_cpu_slice(cpu);
 }
 
@@ -76,7 +76,7 @@ static int do_cpumask(cnodeid_t cnode, nasid_t nasid, int highest)
                        /* Only let it join in if it's marked enabled */
                        if ((acpu->cpu_info.flags & KLINFO_ENABLE) &&
                            (tot_cpus_found != NR_CPUS)) {
-                               cpu_set(cpuid, phys_cpu_present_map);
+                               cpu_set(cpuid, cpu_possible_map);
                                alloc_cpupda(cpuid, tot_cpus_found);
                                cpus_found++;
                                tot_cpus_found++;
@@ -140,82 +140,104 @@ static __init void intr_clear_all(nasid_t nasid)
                REMOTE_HUB_CLR_INTR(nasid, i);
 }
 
-void __init plat_smp_setup(void)
+static void ip27_send_ipi_single(int destid, unsigned int action)
 {
-       cnodeid_t       cnode;
+       int irq;
 
-       for_each_online_node(cnode) {
-               if (cnode == 0)
-                       continue;
-               intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
+       switch (action) {
+       case SMP_RESCHEDULE_YOURSELF:
+               irq = CPU_RESCHED_A_IRQ;
+               break;
+       case SMP_CALL_FUNCTION:
+               irq = CPU_CALL_A_IRQ;
+               break;
+       default:
+               panic("sendintr");
        }
 
-       replicate_kernel_text();
+       irq += cputoslice(destid);
 
        /*
-        * Assumption to be fixed: we're always booted on logical / physical
-        * processor 0.  While we're always running on logical processor 0
-        * this still means this is physical processor zero; it might for
-        * example be disabled in the firwware.
+        * Convert the compact hub number to the NASID to get the correct
+        * part of the address space.  Then set the interrupt bit associated
+        * with the CPU we want to send the interrupt to.
         */
-       alloc_cpupda(0, 0);
+       REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq);
 }
 
-void __init plat_prepare_cpus(unsigned int max_cpus)
+static void ip27_send_ipi_mask(cpumask_t mask, unsigned int action)
 {
-       /* We already did everything necessary earlier */
+       unsigned int i;
+
+       for_each_cpu_mask(i, mask)
+               ip27_send_ipi_single(i, action);
 }
 
-/*
- * 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
- * struct so that current_thread_info() will work.
- */
-void __init prom_boot_secondary(int cpu, struct task_struct *idle)
+static void __cpuinit ip27_init_secondary(void)
 {
-       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),
-               0, (void *) sp, (void *) gp);
+       per_cpu_init();
 }
 
-void __cpuinit prom_init_secondary(void)
+static void __cpuinit ip27_smp_finish(void)
 {
-       per_cpu_init();
+       extern void hub_rt_clock_event_init(void);
+
+       hub_rt_clock_event_init();
        local_irq_enable();
 }
 
-void __init prom_cpus_done(void)
+static void __init ip27_cpus_done(void)
 {
 }
 
-void prom_smp_finish(void)
+/*
+ * 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
+ * struct so that current_thread_info() will work.
+ */
+static void __cpuinit ip27_boot_secondary(int cpu, struct task_struct *idle)
 {
+       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),
+               0, (void *) sp, (void *) gp);
 }
 
-void core_send_ipi(int destid, unsigned int action)
+static void __init ip27_smp_setup(void)
 {
-       int irq;
+       cnodeid_t       cnode;
 
-       switch (action) {
-       case SMP_RESCHEDULE_YOURSELF:
-               irq = CPU_RESCHED_A_IRQ;
-               break;
-       case SMP_CALL_FUNCTION:
-               irq = CPU_CALL_A_IRQ;
-               break;
-       default:
-               panic("sendintr");
+       for_each_online_node(cnode) {
+               if (cnode == 0)
+                       continue;
+               intr_clear_all(COMPACT_TO_NASID_NODEID(cnode));
        }
 
-       irq += cputoslice(destid);
+       replicate_kernel_text();
 
        /*
-        * Convert the compact hub number to the NASID to get the correct
-        * part of the address space.  Then set the interrupt bit associated
-        * with the CPU we want to send the interrupt to.
+        * Assumption to be fixed: we're always booted on logical / physical
+        * processor 0.  While we're always running on logical processor 0
+        * this still means this is physical processor zero; it might for
+        * example be disabled in the firwware.
         */
-       REMOTE_HUB_SEND_INTR(COMPACT_TO_NASID_NODEID(cpu_to_node(destid)), irq);
+       alloc_cpupda(0, 0);
 }
+
+static void __init ip27_prepare_cpus(unsigned int max_cpus)
+{
+       /* We already did everything necessary earlier */
+}
+
+struct plat_smp_ops ip27_smp_ops = {
+       .send_ipi_single        = ip27_send_ipi_single,
+       .send_ipi_mask          = ip27_send_ipi_mask,
+       .init_secondary         = ip27_init_secondary,
+       .smp_finish             = ip27_smp_finish,
+       .cpus_done              = ip27_cpus_done,
+       .boot_secondary         = ip27_boot_secondary,
+       .smp_setup              = ip27_smp_setup,
+       .prepare_cpus           = ip27_prepare_cpus,
+};