Linux Audio

Check our new training course

Loading...
v4.17
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __ASM_SH_SMP_H
 3#define __ASM_SH_SMP_H
 4
 5#include <linux/bitops.h>
 6#include <linux/cpumask.h>
 7#include <asm/smp-ops.h>
 8
 9#ifdef CONFIG_SMP
10
11#include <linux/spinlock.h>
12#include <linux/atomic.h>
13#include <asm/current.h>
14#include <asm/percpu.h>
15
16#define raw_smp_processor_id()	(current_thread_info()->cpu)
17
18/* Map from cpu id to sequential logical cpu number. */
19extern 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.  */
23extern int __cpu_logical_map[NR_CPUS];
24#define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
25
26enum {
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};
34
35DECLARE_PER_CPU(int, cpu_state);
36
37void smp_message_recv(unsigned int msg);
 
 
 
 
 
38
39void arch_send_call_function_single_ipi(int cpu);
40void arch_send_call_function_ipi_mask(const struct cpumask *mask);
41
42void native_play_dead(void);
43void native_cpu_die(unsigned int cpu);
44int native_cpu_disable(unsigned int cpu);
45
46#ifdef CONFIG_HOTPLUG_CPU
47void play_dead_common(void);
48extern int __cpu_disable(void);
49
50static 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
57
58static 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
68struct 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
78#else
79
80#define hard_smp_processor_id()	(0)
81
82#endif /* CONFIG_SMP */
83
84#endif /* __ASM_SH_SMP_H */
v3.5.6
 
 1#ifndef __ASM_SH_SMP_H
 2#define __ASM_SH_SMP_H
 3
 4#include <linux/bitops.h>
 5#include <linux/cpumask.h>
 6#include <asm/smp-ops.h>
 7
 8#ifdef CONFIG_SMP
 9
10#include <linux/spinlock.h>
11#include <linux/atomic.h>
12#include <asm/current.h>
13#include <asm/percpu.h>
14
15#define raw_smp_processor_id()	(current_thread_info()->cpu)
16
17/* Map from cpu id to sequential logical cpu number. */
18extern 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.  */
22extern int __cpu_logical_map[NR_CPUS];
23#define cpu_logical_map(cpu)  __cpu_logical_map[cpu]
24
25enum {
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};
33
34DECLARE_PER_CPU(int, cpu_state);
35
36void smp_message_recv(unsigned int msg);
37void smp_timer_broadcast(const struct cpumask *mask);
38
39void local_timer_interrupt(void);
40void local_timer_setup(unsigned int cpu);
41void local_timer_stop(unsigned int cpu);
42
43void arch_send_call_function_single_ipi(int cpu);
44void arch_send_call_function_ipi_mask(const struct cpumask *mask);
45
46void native_play_dead(void);
47void native_cpu_die(unsigned int cpu);
48int native_cpu_disable(unsigned int cpu);
49
50#ifdef CONFIG_HOTPLUG_CPU
51void play_dead_common(void);
52extern int __cpu_disable(void);
53
54static inline void __cpu_die(unsigned int cpu)
55{
56	extern struct plat_smp_ops *mp_ops;     /* private */
57
58	mp_ops->cpu_die(cpu);
59}
60#endif
61
62static inline int hard_smp_processor_id(void)
63{
64	extern struct plat_smp_ops *mp_ops;	/* private */
65
66	if (!mp_ops)
67		return 0;	/* boot CPU */
68
69	return mp_ops->smp_processor_id();
70}
 
 
 
 
 
 
 
 
 
 
71
72#else
73
74#define hard_smp_processor_id()	(0)
75
76#endif /* CONFIG_SMP */
77
78#endif /* __ASM_SH_SMP_H */