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/include | |
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/include')
-rw-r--r-- | arch/sh/include/asm/smp-ops.h | 39 | ||||
-rw-r--r-- | arch/sh/include/asm/smp.h | 18 |
2 files changed, 50 insertions, 7 deletions
diff --git a/arch/sh/include/asm/smp-ops.h b/arch/sh/include/asm/smp-ops.h new file mode 100644 index 000000000000..0581b2a4c8ce --- /dev/null +++ b/arch/sh/include/asm/smp-ops.h | |||
@@ -0,0 +1,39 @@ | |||
1 | #ifndef __ASM_SH_SMP_OPS_H | ||
2 | #define __ASM_SH_SMP_OPS_H | ||
3 | |||
4 | struct plat_smp_ops { | ||
5 | void (*smp_setup)(void); | ||
6 | unsigned int (*smp_processor_id)(void); | ||
7 | void (*prepare_cpus)(unsigned int max_cpus); | ||
8 | void (*start_cpu)(unsigned int cpu, unsigned long entry_point); | ||
9 | void (*send_ipi)(unsigned int cpu, unsigned int message); | ||
10 | }; | ||
11 | |||
12 | extern struct plat_smp_ops shx3_smp_ops; | ||
13 | |||
14 | #ifdef CONFIG_SMP | ||
15 | |||
16 | static inline void plat_smp_setup(void) | ||
17 | { | ||
18 | extern struct plat_smp_ops *mp_ops; /* private */ | ||
19 | |||
20 | BUG_ON(!mp_ops); | ||
21 | mp_ops->smp_setup(); | ||
22 | } | ||
23 | |||
24 | extern void register_smp_ops(struct plat_smp_ops *ops); | ||
25 | |||
26 | #else | ||
27 | |||
28 | static inline void plat_smp_setup(void) | ||
29 | { | ||
30 | /* UP, nothing to do ... */ | ||
31 | } | ||
32 | |||
33 | static inline void register_smp_ops(struct plat_smp_ops *ops) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | #endif /* CONFIG_SMP */ | ||
38 | |||
39 | #endif /* __ASM_SH_SMP_OPS_H */ | ||
diff --git a/arch/sh/include/asm/smp.h b/arch/sh/include/asm/smp.h index 53ef26ced75f..7f13d46ec8d7 100644 --- a/arch/sh/include/asm/smp.h +++ b/arch/sh/include/asm/smp.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/bitops.h> | 4 | #include <linux/bitops.h> |
5 | #include <linux/cpumask.h> | 5 | #include <linux/cpumask.h> |
6 | #include <asm/smp-ops.h> | ||
6 | 7 | ||
7 | #ifdef CONFIG_SMP | 8 | #ifdef CONFIG_SMP |
8 | 9 | ||
@@ -11,7 +12,6 @@ | |||
11 | #include <asm/current.h> | 12 | #include <asm/current.h> |
12 | 13 | ||
13 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 14 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
14 | #define hard_smp_processor_id() plat_smp_processor_id() | ||
15 | 15 | ||
16 | /* Map from cpu id to sequential logical cpu number. */ | 16 | /* Map from cpu id to sequential logical cpu number. */ |
17 | extern int __cpu_number_map[NR_CPUS]; | 17 | extern int __cpu_number_map[NR_CPUS]; |
@@ -36,15 +36,19 @@ void smp_timer_broadcast(const struct cpumask *mask); | |||
36 | void local_timer_interrupt(void); | 36 | void local_timer_interrupt(void); |
37 | void local_timer_setup(unsigned int cpu); | 37 | void local_timer_setup(unsigned int cpu); |
38 | 38 | ||
39 | void plat_smp_setup(void); | ||
40 | void plat_prepare_cpus(unsigned int max_cpus); | ||
41 | int plat_smp_processor_id(void); | ||
42 | void plat_start_cpu(unsigned int cpu, unsigned long entry_point); | ||
43 | void plat_send_ipi(unsigned int cpu, unsigned int message); | ||
44 | |||
45 | void arch_send_call_function_single_ipi(int cpu); | 39 | void arch_send_call_function_single_ipi(int cpu); |
46 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 40 | extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
47 | 41 | ||
42 | static inline int hard_smp_processor_id(void) | ||
43 | { | ||
44 | extern struct plat_smp_ops *mp_ops; /* private */ | ||
45 | |||
46 | if (!mp_ops) | ||
47 | return 0; /* boot CPU */ | ||
48 | |||
49 | return mp_ops->smp_processor_id(); | ||
50 | } | ||
51 | |||
48 | #else | 52 | #else |
49 | 53 | ||
50 | #define hard_smp_processor_id() (0) | 54 | #define hard_smp_processor_id() (0) |