WIP FPC-III support
[linux/fpc-iii.git] / arch / sh / include / asm / smp.h
blob199381f77293c798ef8998fa14581d8c9b6f07a0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_SMP_H
3 #define __ASM_SH_SMP_H
5 #include <linux/bitops.h>
6 #include <linux/cpumask.h>
7 #include <asm/smp-ops.h>
9 #ifdef CONFIG_SMP
11 #include <linux/atomic.h>
12 #include <asm/current.h>
13 #include <asm/percpu.h>
15 #define raw_smp_processor_id() (current_thread_info()->cpu)
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]
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]
25 enum {
26 SMP_MSG_FUNCTION,
27 SMP_MSG_RESCHEDULE,
28 SMP_MSG_FUNCTION_SINGLE,
29 SMP_MSG_TIMER,
31 SMP_MSG_NR, /* must be last */
34 DECLARE_PER_CPU(int, cpu_state);
36 void smp_message_recv(unsigned int msg);
38 void arch_send_call_function_single_ipi(int cpu);
39 void arch_send_call_function_ipi_mask(const struct cpumask *mask);
41 void native_play_dead(void);
42 void native_cpu_die(unsigned int cpu);
43 int native_cpu_disable(unsigned int cpu);
45 #ifdef CONFIG_HOTPLUG_CPU
46 void play_dead_common(void);
47 extern int __cpu_disable(void);
49 static inline void __cpu_die(unsigned int cpu)
51 extern struct plat_smp_ops *mp_ops; /* private */
53 mp_ops->cpu_die(cpu);
55 #endif
57 static inline int hard_smp_processor_id(void)
59 extern struct plat_smp_ops *mp_ops; /* private */
61 if (!mp_ops)
62 return 0; /* boot CPU */
64 return mp_ops->smp_processor_id();
67 struct of_cpu_method {
68 const char *method;
69 struct plat_smp_ops *ops;
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 }
77 #else
79 #define hard_smp_processor_id() (0)
81 #endif /* CONFIG_SMP */
83 #endif /* __ASM_SH_SMP_H */