blob: 78b0d0f4b24b24ca07b186bc2bfbd475e99863a6 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef __ASM_SH_SMP_H
2#define __ASM_SH_SMP_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/bitops.h>
5#include <linux/cpumask.h>
Paul Mundt3366e352010-03-30 12:38:01 +09006#include <asm/smp-ops.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007
8#ifdef CONFIG_SMP
9
Evgeniy Polyakov66c52272007-05-31 13:46:21 +090010#include <linux/spinlock.h>
Arun Sharma600634972011-07-26 16:09:06 -070011#include <linux/atomic.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/current.h>
Paul Mundt9715b8c2010-04-26 18:49:58 +090013#include <asm/percpu.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Ingo Molnar39c715b2005-06-21 17:14:34 -070015#define raw_smp_processor_id() (current_thread_info()->cpu)
Paul Mundtaba10302007-09-21 18:32:32 +090016
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]
Linus Torvalds1da177e2005-04-16 15:20:36 -070024
Paul Mundt6f527072008-08-06 18:21:03 +090025enum {
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};
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Paul Mundt9715b8c2010-04-26 18:49:58 +090034DECLARE_PER_CPU(int, cpu_state);
35
Paul Mundt173a44d2008-08-06 18:02:48 +090036void smp_message_recv(unsigned int msg);
Rusty Russell320ab2b2008-12-13 21:20:26 +103037void smp_timer_broadcast(const struct cpumask *mask);
Paul Mundt6f527072008-08-06 18:21:03 +090038
Paul Mundt8c245942008-08-06 18:37:07 +090039void local_timer_interrupt(void);
40void local_timer_setup(unsigned int cpu);
Paul Mundt763142d2010-04-26 19:08:55 +090041void local_timer_stop(unsigned int cpu);
Paul Mundt8c245942008-08-06 18:37:07 +090042
Paul Mundt6f527072008-08-06 18:21:03 +090043void arch_send_call_function_single_ipi(int cpu);
Paul Mundt763142d2010-04-26 19:08:55 +090044void 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
Paul Mundtaba10302007-09-21 18:32:32 +090061
Paul Mundt3366e352010-03-30 12:38:01 +090062static 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
Paul Mundtaba10302007-09-21 18:32:32 +090072#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Paul Mundt027e56e2007-06-20 18:23:49 +090074#define hard_smp_processor_id() (0)
75
Paul Mundtaba10302007-09-21 18:32:32 +090076#endif /* CONFIG_SMP */
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078#endif /* __ASM_SH_SMP_H */