2 * SMP Support for A2 platforms
4 * Copyright 2007 Benjamin Herrenschmidt, IBM Corp.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
13 #include <linux/cpumask.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
17 #include <linux/smp.h>
19 #include <asm/dbell.h>
20 #include <asm/machdep.h>
26 static void __devinit
smp_a2_setup_cpu(int cpu
)
28 doorbell_setup_this_cpu();
30 if (cpu
!= boot_cpuid
)
34 int __devinit
smp_a2_kick_cpu(int nr
)
36 const char *enable_method
;
37 struct device_node
*np
;
40 if (nr
< 0 || nr
>= NR_CPUS
)
43 np
= of_get_cpu_node(nr
, &thr_idx
);
47 enable_method
= of_get_property(np
, "enable-method", NULL
);
48 pr_devel("CPU%d has enable-method: \"%s\"\n", nr
, enable_method
);
51 printk(KERN_ERR
"CPU%d has no enable-method\n", nr
);
53 } else if (strcmp(enable_method
, "ibm,a2-scom") == 0) {
54 if (a2_scom_startup_cpu(nr
, thr_idx
, np
))
57 printk(KERN_ERR
"CPU%d: Don't understand enable-method \"%s\"\n",
63 * The processor is currently spinning, waiting for the
64 * cpu_start field to become non-zero After we set cpu_start,
65 * the processor will continue on to secondary_start
67 paca
[nr
].cpu_start
= 1;
72 static int __init
smp_a2_probe(void)
74 return cpus_weight(cpu_possible_map
);
77 static struct smp_ops_t a2_smp_ops
= {
78 .message_pass
= smp_muxed_ipi_message_pass
,
79 .cause_ipi
= doorbell_cause_ipi
,
80 .probe
= smp_a2_probe
,
81 .kick_cpu
= smp_a2_kick_cpu
,
82 .setup_cpu
= smp_a2_setup_cpu
,
85 void __init
a2_setup_smp(void)
87 smp_ops
= &a2_smp_ops
;