Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | #ifndef __ASM_SH_SMP_H |
2 | #define __ASM_SH_SMP_H | |
3 | ||
1da177e4 LT |
4 | #include <linux/bitops.h> |
5 | #include <linux/cpumask.h> | |
3366e358 | 6 | #include <asm/smp-ops.h> |
1da177e4 LT |
7 | |
8 | #ifdef CONFIG_SMP | |
9 | ||
66c5227e | 10 | #include <linux/spinlock.h> |
60063497 | 11 | #include <linux/atomic.h> |
1da177e4 | 12 | #include <asm/current.h> |
9715b8c7 | 13 | #include <asm/percpu.h> |
1da177e4 | 14 | |
39c715b7 | 15 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
aba1030a PM |
16 | |
17 | /* Map from cpu id to sequential logical cpu number. */ | |
18 | extern int __cpu_number_map[NR_CPUS]; | |
19 | #define cpu_number_map(cpu) __cpu_number_map[cpu] | |
20 | ||
21 | /* The reverse map from sequential logical cpu number to cpu id. */ | |
22 | extern int __cpu_logical_map[NR_CPUS]; | |
23 | #define cpu_logical_map(cpu) __cpu_logical_map[cpu] | |
1da177e4 | 24 | |
6f52707e PM |
25 | enum { |
26 | SMP_MSG_FUNCTION, | |
27 | SMP_MSG_RESCHEDULE, | |
28 | SMP_MSG_FUNCTION_SINGLE, | |
29 | SMP_MSG_TIMER, | |
30 | ||
31 | SMP_MSG_NR, /* must be last */ | |
32 | }; | |
1da177e4 | 33 | |
9715b8c7 PM |
34 | DECLARE_PER_CPU(int, cpu_state); |
35 | ||
173a44dd | 36 | void smp_message_recv(unsigned int msg); |
8c24594d | 37 | |
6f52707e | 38 | void arch_send_call_function_single_ipi(int cpu); |
763142d1 PM |
39 | void arch_send_call_function_ipi_mask(const struct cpumask *mask); |
40 | ||
41 | void native_play_dead(void); | |
42 | void native_cpu_die(unsigned int cpu); | |
43 | int native_cpu_disable(unsigned int cpu); | |
44 | ||
45 | #ifdef CONFIG_HOTPLUG_CPU | |
46 | void play_dead_common(void); | |
47 | extern int __cpu_disable(void); | |
48 | ||
49 | static inline void __cpu_die(unsigned int cpu) | |
50 | { | |
51 | extern struct plat_smp_ops *mp_ops; /* private */ | |
52 | ||
53 | mp_ops->cpu_die(cpu); | |
54 | } | |
55 | #endif | |
aba1030a | 56 | |
3366e358 PM |
57 | static inline int hard_smp_processor_id(void) |
58 | { | |
59 | extern struct plat_smp_ops *mp_ops; /* private */ | |
60 | ||
61 | if (!mp_ops) | |
62 | return 0; /* boot CPU */ | |
63 | ||
64 | return mp_ops->smp_processor_id(); | |
65 | } | |
66 | ||
044b81f8 RF |
67 | struct of_cpu_method { |
68 | const char *method; | |
69 | struct plat_smp_ops *ops; | |
70 | }; | |
71 | ||
72 | #define CPU_METHOD_OF_DECLARE(name, _method, _ops) \ | |
73 | static const struct of_cpu_method __cpu_method_of_table_##name \ | |
74 | __used __section(__cpu_method_of_table) \ | |
75 | = { .method = _method, .ops = _ops } | |
76 | ||
aba1030a | 77 | #else |
1da177e4 | 78 | |
027e56e6 PM |
79 | #define hard_smp_processor_id() (0) |
80 | ||
aba1030a PM |
81 | #endif /* CONFIG_SMP */ |
82 | ||
1da177e4 | 83 | #endif /* __ASM_SH_SMP_H */ |