blob: 7f13d46ec8d7f9cc563498d626dd0aabc1f6cf9d [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <asm/atomic.h>
12#include <asm/current.h>
13
Ingo Molnar39c715b2005-06-21 17:14:34 -070014#define raw_smp_processor_id() (current_thread_info()->cpu)
Paul Mundtaba10302007-09-21 18:32:32 +090015
16/* Map from cpu id to sequential logical cpu number. */
17extern int __cpu_number_map[NR_CPUS];
18#define cpu_number_map(cpu) __cpu_number_map[cpu]
19
20/* The reverse map from sequential logical cpu number to cpu id. */
21extern int __cpu_logical_map[NR_CPUS];
22#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
Paul Mundt6f527072008-08-06 18:21:03 +090024enum {
25 SMP_MSG_FUNCTION,
26 SMP_MSG_RESCHEDULE,
27 SMP_MSG_FUNCTION_SINGLE,
28 SMP_MSG_TIMER,
29
30 SMP_MSG_NR, /* must be last */
31};
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Paul Mundt173a44d2008-08-06 18:02:48 +090033void smp_message_recv(unsigned int msg);
Rusty Russell320ab2b2008-12-13 21:20:26 +103034void smp_timer_broadcast(const struct cpumask *mask);
Paul Mundt6f527072008-08-06 18:21:03 +090035
Paul Mundt8c245942008-08-06 18:37:07 +090036void local_timer_interrupt(void);
37void local_timer_setup(unsigned int cpu);
38
Paul Mundt6f527072008-08-06 18:21:03 +090039void arch_send_call_function_single_ipi(int cpu);
Rusty Russell819807d2009-06-12 22:32:35 +093040extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
Paul Mundtaba10302007-09-21 18:32:32 +090041
Paul Mundt3366e352010-03-30 12:38:01 +090042static inline int hard_smp_processor_id(void)
43{
44 extern struct plat_smp_ops *mp_ops; /* private */
45
46 if (!mp_ops)
47 return 0; /* boot CPU */
48
49 return mp_ops->smp_processor_id();
50}
51
Paul Mundtaba10302007-09-21 18:32:32 +090052#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
Paul Mundt027e56e2007-06-20 18:23:49 +090054#define hard_smp_processor_id() (0)
55
Paul Mundtaba10302007-09-21 18:32:32 +090056#endif /* CONFIG_SMP */
57
Linus Torvalds1da177e2005-04-16 15:20:36 -070058#endif /* __ASM_SH_SMP_H */