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/spinlock.h>
12 #include <linux/atomic.h>
13 #include <asm/current.h>
14 #include <asm/percpu.h>
16 #define raw_smp_processor_id() (current_thread_info()->cpu)
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]
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]
29 SMP_MSG_FUNCTION_SINGLE
,
32 SMP_MSG_NR
, /* must be last */
35 DECLARE_PER_CPU(int, cpu_state
);
37 void smp_message_recv(unsigned int msg
);
39 void arch_send_call_function_single_ipi(int cpu
);
40 void arch_send_call_function_ipi_mask(const struct cpumask
*mask
);
42 void native_play_dead(void);
43 void native_cpu_die(unsigned int cpu
);
44 int native_cpu_disable(unsigned int cpu
);
46 #ifdef CONFIG_HOTPLUG_CPU
47 void play_dead_common(void);
48 extern int __cpu_disable(void);
50 static inline void __cpu_die(unsigned int cpu
)
52 extern struct plat_smp_ops
*mp_ops
; /* private */
58 static inline int hard_smp_processor_id(void)
60 extern struct plat_smp_ops
*mp_ops
; /* private */
63 return 0; /* boot CPU */
65 return mp_ops
->smp_processor_id();
68 struct of_cpu_method
{
70 struct plat_smp_ops
*ops
;
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 }
80 #define hard_smp_processor_id() (0)
82 #endif /* CONFIG_SMP */
84 #endif /* __ASM_SH_SMP_H */