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