Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / arch / sh / include / asm / smp.h
blob78b0d0f4b24b24ca07b186bc2bfbd475e99863a6
1 #ifndef __ASM_SH_SMP_H
2 #define __ASM_SH_SMP_H
4 #include <linux/bitops.h>
5 #include <linux/cpumask.h>
6 #include <asm/smp-ops.h>
8 #ifdef CONFIG_SMP
10 #include <linux/spinlock.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]
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);
37 void smp_timer_broadcast(const struct cpumask *mask);
39 void local_timer_interrupt(void);
40 void local_timer_setup(unsigned int cpu);
41 void local_timer_stop(unsigned int cpu);
43 void arch_send_call_function_single_ipi(int cpu);
44 void arch_send_call_function_ipi_mask(const struct cpumask *mask);
46 void native_play_dead(void);
47 void native_cpu_die(unsigned int cpu);
48 int native_cpu_disable(unsigned int cpu);
50 #ifdef CONFIG_HOTPLUG_CPU
51 void play_dead_common(void);
52 extern int __cpu_disable(void);
54 static inline void __cpu_die(unsigned int cpu)
56 extern struct plat_smp_ops *mp_ops; /* private */
58 mp_ops->cpu_die(cpu);
60 #endif
62 static inline int hard_smp_processor_id(void)
64 extern struct plat_smp_ops *mp_ops; /* private */
66 if (!mp_ops)
67 return 0; /* boot CPU */
69 return mp_ops->smp_processor_id();
72 #else
74 #define hard_smp_processor_id() (0)
76 #endif /* CONFIG_SMP */
78 #endif /* __ASM_SH_SMP_H */