aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/include
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-03-29 23:38:01 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-20 23:23:25 -0400
commit3366e3585fbf0d40ce6f2382b544851cf4df1654 (patch)
tree2d0e01291d103d28bdb67afffb816fa1d7023fbb /arch/sh/include
parent4a6feab0ee5240c4bd5378d9f8a46b85718c68a7 (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.h39
-rw-r--r--arch/sh/include/asm/smp.h18
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
4struct 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
12extern struct plat_smp_ops shx3_smp_ops;
13
14#ifdef CONFIG_SMP
15
16static 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
24extern void register_smp_ops(struct plat_smp_ops *ops);
25
26#else
27
28static inline void plat_smp_setup(void)
29{
30 /* UP, nothing to do ... */
31}
32
33static 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. */
17extern int __cpu_number_map[NR_CPUS]; 17extern int __cpu_number_map[NR_CPUS];
@@ -36,15 +36,19 @@ void smp_timer_broadcast(const struct cpumask *mask);
36void local_timer_interrupt(void); 36void local_timer_interrupt(void);
37void local_timer_setup(unsigned int cpu); 37void local_timer_setup(unsigned int cpu);
38 38
39void plat_smp_setup(void);
40void plat_prepare_cpus(unsigned int max_cpus);
41int plat_smp_processor_id(void);
42void plat_start_cpu(unsigned int cpu, unsigned long entry_point);
43void plat_send_ipi(unsigned int cpu, unsigned int message);
44
45void arch_send_call_function_single_ipi(int cpu); 39void arch_send_call_function_single_ipi(int cpu);
46extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); 40extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
47 41
42static 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)