1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/bitops.h>
6 #include <linux/cpumask.h>
7 #include <asm/smp-ops.h>
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]
28 SMP_MSG_FUNCTION_SINGLE
,
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 */
57 static inline int hard_smp_processor_id(void)
59 extern struct plat_smp_ops
*mp_ops
; /* private */
62 return 0; /* boot CPU */
64 return mp_ops
->smp_processor_id();
67 struct of_cpu_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 }
79 #define hard_smp_processor_id() (0)
81 #endif /* CONFIG_SMP */
83 #endif /* __ASM_SH_SMP_H */