diff options
author | Paul Mundt <lethal@linux-sh.org> | 2010-03-29 23:38:01 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2010-04-20 23:23:25 -0400 |
commit | 3366e3585fbf0d40ce6f2382b544851cf4df1654 (patch) | |
tree | 2d0e01291d103d28bdb67afffb816fa1d7023fbb /arch/sh/kernel/smp.c | |
parent | 4a6feab0ee5240c4bd5378d9f8a46b85718c68a7 (diff) |
sh: Move platform smp ops in to their own structure.
This cribs the MIPS plat_smp_ops approach for wrapping up the platform
ops. This will allow for mixing and matching different ops on the same
platform in the future.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/kernel/smp.c')
-rw-r--r-- | arch/sh/kernel/smp.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 002cc612deef..2f348fda0159 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * SMP support for the SuperH processors. | 4 | * SMP support for the SuperH processors. |
5 | * | 5 | * |
6 | * Copyright (C) 2002 - 2008 Paul Mundt | 6 | * Copyright (C) 2002 - 2010 Paul Mundt |
7 | * Copyright (C) 2006 - 2007 Akio Idehara | 7 | * Copyright (C) 2006 - 2007 Akio Idehara |
8 | * | 8 | * |
9 | * This file is subject to the terms and conditions of the GNU General Public | 9 | * This file is subject to the terms and conditions of the GNU General Public |
@@ -31,6 +31,16 @@ | |||
31 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ | 31 | int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ |
32 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ | 32 | int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ |
33 | 33 | ||
34 | struct plat_smp_ops *mp_ops = NULL; | ||
35 | |||
36 | void __cpuinit register_smp_ops(struct plat_smp_ops *ops) | ||
37 | { | ||
38 | if (mp_ops) | ||
39 | printk(KERN_WARNING "Overriding previously set SMP ops\n"); | ||
40 | |||
41 | mp_ops = ops; | ||
42 | } | ||
43 | |||
34 | static inline void __init smp_store_cpu_info(unsigned int cpu) | 44 | static inline void __init smp_store_cpu_info(unsigned int cpu) |
35 | { | 45 | { |
36 | struct sh_cpuinfo *c = cpu_data + cpu; | 46 | struct sh_cpuinfo *c = cpu_data + cpu; |
@@ -46,7 +56,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) | |||
46 | 56 | ||
47 | init_new_context(current, &init_mm); | 57 | init_new_context(current, &init_mm); |
48 | current_thread_info()->cpu = cpu; | 58 | current_thread_info()->cpu = cpu; |
49 | plat_prepare_cpus(max_cpus); | 59 | mp_ops->prepare_cpus(max_cpus); |
50 | 60 | ||
51 | #ifndef CONFIG_HOTPLUG_CPU | 61 | #ifndef CONFIG_HOTPLUG_CPU |
52 | init_cpu_present(&cpu_possible_map); | 62 | init_cpu_present(&cpu_possible_map); |
@@ -127,7 +137,7 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
127 | (unsigned long)&stack_start + sizeof(stack_start)); | 137 | (unsigned long)&stack_start + sizeof(stack_start)); |
128 | wmb(); | 138 | wmb(); |
129 | 139 | ||
130 | plat_start_cpu(cpu, (unsigned long)_stext); | 140 | mp_ops->start_cpu(cpu, (unsigned long)_stext); |
131 | 141 | ||
132 | timeout = jiffies + HZ; | 142 | timeout = jiffies + HZ; |
133 | while (time_before(jiffies, timeout)) { | 143 | while (time_before(jiffies, timeout)) { |
@@ -159,7 +169,7 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
159 | 169 | ||
160 | void smp_send_reschedule(int cpu) | 170 | void smp_send_reschedule(int cpu) |
161 | { | 171 | { |
162 | plat_send_ipi(cpu, SMP_MSG_RESCHEDULE); | 172 | mp_ops->send_ipi(cpu, SMP_MSG_RESCHEDULE); |
163 | } | 173 | } |
164 | 174 | ||
165 | void smp_send_stop(void) | 175 | void smp_send_stop(void) |
@@ -172,12 +182,12 @@ void arch_send_call_function_ipi_mask(const struct cpumask *mask) | |||
172 | int cpu; | 182 | int cpu; |
173 | 183 | ||
174 | for_each_cpu(cpu, mask) | 184 | for_each_cpu(cpu, mask) |
175 | plat_send_ipi(cpu, SMP_MSG_FUNCTION); | 185 | mp_ops->send_ipi(cpu, SMP_MSG_FUNCTION); |
176 | } | 186 | } |
177 | 187 | ||
178 | void arch_send_call_function_single_ipi(int cpu) | 188 | void arch_send_call_function_single_ipi(int cpu) |
179 | { | 189 | { |
180 | plat_send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE); | 190 | mp_ops->send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE); |
181 | } | 191 | } |
182 | 192 | ||
183 | void smp_timer_broadcast(const struct cpumask *mask) | 193 | void smp_timer_broadcast(const struct cpumask *mask) |
@@ -185,7 +195,7 @@ void smp_timer_broadcast(const struct cpumask *mask) | |||
185 | int cpu; | 195 | int cpu; |
186 | 196 | ||
187 | for_each_cpu(cpu, mask) | 197 | for_each_cpu(cpu, mask) |
188 | plat_send_ipi(cpu, SMP_MSG_TIMER); | 198 | mp_ops->send_ipi(cpu, SMP_MSG_TIMER); |
189 | } | 199 | } |
190 | 200 | ||
191 | static void ipi_timer(void) | 201 | static void ipi_timer(void) |