diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-11-19 07:23:51 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:57 -0500 |
commit | 87353d8ac39c52784da605ecbe965ecdfad609ad (patch) | |
tree | c95ce7cbe9b099c21cab71a195621801b04bc05a /arch/mips/kernel/smp.c | |
parent | 19388fb092d89e179575bd0b44f51b57e175edf5 (diff) |
[MIPS] SMP: Call platform methods via ops structure.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/smp.c')
-rw-r--r-- | arch/mips/kernel/smp.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 335be9bcf0dc..1e5dfc28294a 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/processor.h> | 37 | #include <asm/processor.h> |
38 | #include <asm/system.h> | 38 | #include <asm/system.h> |
39 | #include <asm/mmu_context.h> | 39 | #include <asm/mmu_context.h> |
40 | #include <asm/smp.h> | ||
41 | #include <asm/time.h> | 40 | #include <asm/time.h> |
42 | 41 | ||
43 | #ifdef CONFIG_MIPS_MT_SMTC | 42 | #ifdef CONFIG_MIPS_MT_SMTC |
@@ -84,6 +83,16 @@ static inline void set_cpu_sibling_map(int cpu) | |||
84 | cpu_set(cpu, cpu_sibling_map[cpu]); | 83 | cpu_set(cpu, cpu_sibling_map[cpu]); |
85 | } | 84 | } |
86 | 85 | ||
86 | struct plat_smp_ops *mp_ops; | ||
87 | |||
88 | __cpuinit void register_smp_ops(struct plat_smp_ops *ops) | ||
89 | { | ||
90 | if (ops) | ||
91 | printk(KERN_WARNING "Overriding previous set SMP ops\n"); | ||
92 | |||
93 | mp_ops = ops; | ||
94 | } | ||
95 | |||
87 | /* | 96 | /* |
88 | * First C code run on the secondary CPUs after being started up by | 97 | * First C code run on the secondary CPUs after being started up by |
89 | * the master. | 98 | * the master. |
@@ -100,7 +109,7 @@ asmlinkage __cpuinit void start_secondary(void) | |||
100 | cpu_report(); | 109 | cpu_report(); |
101 | per_cpu_trap_init(); | 110 | per_cpu_trap_init(); |
102 | mips_clockevent_init(); | 111 | mips_clockevent_init(); |
103 | prom_init_secondary(); | 112 | mp_ops->init_secondary(); |
104 | 113 | ||
105 | /* | 114 | /* |
106 | * XXX parity protection should be folded in here when it's converted | 115 | * XXX parity protection should be folded in here when it's converted |
@@ -112,7 +121,7 @@ asmlinkage __cpuinit void start_secondary(void) | |||
112 | cpu = smp_processor_id(); | 121 | cpu = smp_processor_id(); |
113 | cpu_data[cpu].udelay_val = loops_per_jiffy; | 122 | cpu_data[cpu].udelay_val = loops_per_jiffy; |
114 | 123 | ||
115 | prom_smp_finish(); | 124 | mp_ops->smp_finish(); |
116 | set_cpu_sibling_map(cpu); | 125 | set_cpu_sibling_map(cpu); |
117 | 126 | ||
118 | cpu_set(cpu, cpu_callin_map); | 127 | cpu_set(cpu, cpu_callin_map); |
@@ -184,7 +193,7 @@ int smp_call_function_mask(cpumask_t mask, void (*func) (void *info), | |||
184 | smp_mb(); | 193 | smp_mb(); |
185 | 194 | ||
186 | /* Send a message to all other CPUs and wait for them to respond */ | 195 | /* Send a message to all other CPUs and wait for them to respond */ |
187 | core_send_ipi_mask(mask, SMP_CALL_FUNCTION); | 196 | mp_ops->send_ipi_mask(mask, SMP_CALL_FUNCTION); |
188 | 197 | ||
189 | /* Wait for response */ | 198 | /* Wait for response */ |
190 | /* FIXME: lock-up detection, backtrace on lock-up */ | 199 | /* FIXME: lock-up detection, backtrace on lock-up */ |
@@ -278,7 +287,7 @@ void smp_send_stop(void) | |||
278 | 287 | ||
279 | void __init smp_cpus_done(unsigned int max_cpus) | 288 | void __init smp_cpus_done(unsigned int max_cpus) |
280 | { | 289 | { |
281 | prom_cpus_done(); | 290 | mp_ops->cpus_done(); |
282 | } | 291 | } |
283 | 292 | ||
284 | /* called from main before smp_init() */ | 293 | /* called from main before smp_init() */ |
@@ -286,7 +295,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
286 | { | 295 | { |
287 | init_new_context(current, &init_mm); | 296 | init_new_context(current, &init_mm); |
288 | current_thread_info()->cpu = 0; | 297 | current_thread_info()->cpu = 0; |
289 | plat_prepare_cpus(max_cpus); | 298 | mp_ops->prepare_cpus(max_cpus); |
290 | set_cpu_sibling_map(0); | 299 | set_cpu_sibling_map(0); |
291 | #ifndef CONFIG_HOTPLUG_CPU | 300 | #ifndef CONFIG_HOTPLUG_CPU |
292 | cpu_present_map = cpu_possible_map; | 301 | cpu_present_map = cpu_possible_map; |
@@ -325,7 +334,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
325 | if (IS_ERR(idle)) | 334 | if (IS_ERR(idle)) |
326 | panic(KERN_ERR "Fork failed for CPU %d", cpu); | 335 | panic(KERN_ERR "Fork failed for CPU %d", cpu); |
327 | 336 | ||
328 | prom_boot_secondary(cpu, idle); | 337 | mp_ops->boot_secondary(cpu, idle); |
329 | 338 | ||
330 | /* | 339 | /* |
331 | * Trust is futile. We should really have timeouts ... | 340 | * Trust is futile. We should really have timeouts ... |