blob: da5135b2579e6090bfc5bd682b195411ae83f58b [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>
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);
41
Paul Mundt6f527072008-08-06 18:21:03 +090042void arch_send_call_function_single_ipi(int cpu);
Rusty Russell819807d2009-06-12 22:32:35 +093043extern void arch_send_call_function_ipi_mask(const struct cpumask *mask);
Paul Mundtaba10302007-09-21 18:32:32 +090044
Paul Mundt3366e352010-03-30 12:38:01 +090045static inline int hard_smp_processor_id(void)
46{
47 extern struct plat_smp_ops *mp_ops; /* private */
48
49 if (!mp_ops)
50 return 0; /* boot CPU */
51
52 return mp_ops->smp_processor_id();
53}
54
Paul Mundtaba10302007-09-21 18:32:32 +090055#else
Linus Torvalds1da177e2005-04-16 15:20:36 -070056
Paul Mundt027e56e2007-06-20 18:23:49 +090057#define hard_smp_processor_id() (0)
58
Paul Mundtaba10302007-09-21 18:32:32 +090059#endif /* CONFIG_SMP */
60
Linus Torvalds1da177e2005-04-16 15:20:36 -070061#endif /* __ASM_SH_SMP_H */