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 a70656d421917704336744575a08723c58e536bc..5b47d6b65275ba6835043e8a050958ba014d0ed2 100644 (file)
@@ -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,30 +140,54 @@ 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)
+{
+       unsigned int i;
+
+       for_each_cpu_mask(i, mask)
+               ip27_send_ipi_single(i, action);
+}
+
+static void __cpuinit ip27_init_secondary(void)
+{
+       per_cpu_init();
+}
+
+static void __cpuinit ip27_smp_finish(void)
+{
+       extern void hub_rt_clock_event_init(void);
+
+       hub_rt_clock_event_init();
+       local_irq_enable();
+}
+
+static void __init ip27_cpus_done(void)
 {
-       /* We already did everything necessary earlier */
 }
 
 /*
@@ -171,7 +195,7 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
  * 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 __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle)
+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);
@@ -181,41 +205,39 @@ void __cpuinit prom_boot_secondary(int cpu, struct task_struct *idle)
                0, (void *) sp, (void *) gp);
 }
 
-void __cpuinit prom_init_secondary(void)
-{
-       per_cpu_init();
-       local_irq_enable();
-}
-
-void __init prom_cpus_done(void)
+static void __init ip27_smp_setup(void)
 {
-}
-
-void __cpuinit prom_smp_finish(void)
-{
-}
-
-void core_send_ipi(int destid, unsigned int action)
-{
-       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,
+};