diff options
Diffstat (limited to 'arch/powerpc/platforms/chrp/smp.c')
-rw-r--r-- | arch/powerpc/platforms/chrp/smp.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/arch/powerpc/platforms/chrp/smp.c b/arch/powerpc/platforms/chrp/smp.c index bf68282670dd..31ee49c25014 100644 --- a/arch/powerpc/platforms/chrp/smp.c +++ b/arch/powerpc/platforms/chrp/smp.c | |||
@@ -32,15 +32,44 @@ | |||
32 | #include <asm/time.h> | 32 | #include <asm/time.h> |
33 | #include <asm/open_pic.h> | 33 | #include <asm/open_pic.h> |
34 | #include <asm/machdep.h> | 34 | #include <asm/machdep.h> |
35 | #include <asm/smp.h> | ||
36 | #include <asm/mpic.h> | ||
35 | 37 | ||
36 | extern unsigned long smp_chrp_cpu_nr; | 38 | extern unsigned long smp_chrp_cpu_nr; |
37 | 39 | ||
38 | static int __init smp_chrp_probe(void) | 40 | static int __init smp_chrp_probe(void) |
39 | { | 41 | { |
40 | if (smp_chrp_cpu_nr > 1) | 42 | struct device_node *cpus = NULL; |
41 | openpic_request_IPIs(); | 43 | unsigned int *reg; |
44 | int reglen; | ||
45 | int ncpus = 0; | ||
46 | int cpuid; | ||
47 | unsigned int phys; | ||
48 | |||
49 | /* Count CPUs in the device-tree */ | ||
50 | cpuid = 1; /* the boot cpu is logical cpu 0 */ | ||
51 | while ((cpus = of_find_node_by_type(cpus, "cpu")) != NULL) { | ||
52 | phys = ncpus; | ||
53 | reg = (unsigned int *) get_property(cpus, "reg", ®len); | ||
54 | if (reg && reglen >= sizeof(unsigned int)) | ||
55 | /* hmmm, not having a reg property would be bad */ | ||
56 | phys = *reg; | ||
57 | if (phys != boot_cpuid_phys) { | ||
58 | set_hard_smp_processor_id(cpuid, phys); | ||
59 | ++cpuid; | ||
60 | } | ||
61 | ++ncpus; | ||
62 | } | ||
63 | |||
64 | printk(KERN_INFO "CHRP SMP probe found %d cpus\n", ncpus); | ||
65 | |||
66 | /* Nothing more to do if less than 2 of them */ | ||
67 | if (ncpus <= 1) | ||
68 | return 1; | ||
69 | |||
70 | mpic_request_ipis(); | ||
42 | 71 | ||
43 | return smp_chrp_cpu_nr; | 72 | return ncpus; |
44 | } | 73 | } |
45 | 74 | ||
46 | static void __devinit smp_chrp_kick_cpu(int nr) | 75 | static void __devinit smp_chrp_kick_cpu(int nr) |
@@ -51,8 +80,7 @@ static void __devinit smp_chrp_kick_cpu(int nr) | |||
51 | 80 | ||
52 | static void __devinit smp_chrp_setup_cpu(int cpu_nr) | 81 | static void __devinit smp_chrp_setup_cpu(int cpu_nr) |
53 | { | 82 | { |
54 | if (OpenPIC_Addr) | 83 | mpic_setup_this_cpu(); |
55 | do_openpic_setup_cpu(); | ||
56 | } | 84 | } |
57 | 85 | ||
58 | static DEFINE_SPINLOCK(timebase_lock); | 86 | static DEFINE_SPINLOCK(timebase_lock); |
@@ -85,7 +113,7 @@ void __devinit smp_chrp_take_timebase(void) | |||
85 | 113 | ||
86 | /* CHRP with openpic */ | 114 | /* CHRP with openpic */ |
87 | struct smp_ops_t chrp_smp_ops = { | 115 | struct smp_ops_t chrp_smp_ops = { |
88 | .message_pass = smp_openpic_message_pass, | 116 | .message_pass = smp_mpic_message_pass, |
89 | .probe = smp_chrp_probe, | 117 | .probe = smp_chrp_probe, |
90 | .kick_cpu = smp_chrp_kick_cpu, | 118 | .kick_cpu = smp_chrp_kick_cpu, |
91 | .setup_cpu = smp_chrp_setup_cpu, | 119 | .setup_cpu = smp_chrp_setup_cpu, |