| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef __ASM_SH_SMP_H | 
|  | 2 | #define __ASM_SH_SMP_H | 
|  | 3 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <linux/bitops.h> | 
|  | 5 | #include <linux/cpumask.h> | 
| Paul Mundt | 3366e35 | 2010-03-30 12:38:01 +0900 | [diff] [blame] | 6 | #include <asm/smp-ops.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 |  | 
|  | 8 | #ifdef CONFIG_SMP | 
|  | 9 |  | 
| Evgeniy Polyakov | 66c5227 | 2007-05-31 13:46:21 +0900 | [diff] [blame] | 10 | #include <linux/spinlock.h> | 
| Arun Sharma | 60063497 | 2011-07-26 16:09:06 -0700 | [diff] [blame] | 11 | #include <linux/atomic.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | #include <asm/current.h> | 
| Paul Mundt | 9715b8c | 2010-04-26 18:49:58 +0900 | [diff] [blame] | 13 | #include <asm/percpu.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 |  | 
| Ingo Molnar | 39c715b | 2005-06-21 17:14:34 -0700 | [diff] [blame] | 15 | #define raw_smp_processor_id()	(current_thread_info()->cpu) | 
| Paul Mundt | aba1030 | 2007-09-21 18:32:32 +0900 | [diff] [blame] | 16 |  | 
|  | 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] | 
|  | 20 |  | 
|  | 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] | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 |  | 
| Paul Mundt | 6f52707 | 2008-08-06 18:21:03 +0900 | [diff] [blame] | 25 | enum { | 
|  | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 |  | 
| Paul Mundt | 9715b8c | 2010-04-26 18:49:58 +0900 | [diff] [blame] | 34 | DECLARE_PER_CPU(int, cpu_state); | 
|  | 35 |  | 
| Paul Mundt | 173a44d | 2008-08-06 18:02:48 +0900 | [diff] [blame] | 36 | void smp_message_recv(unsigned int msg); | 
| Rusty Russell | 320ab2b | 2008-12-13 21:20:26 +1030 | [diff] [blame] | 37 | void smp_timer_broadcast(const struct cpumask *mask); | 
| Paul Mundt | 6f52707 | 2008-08-06 18:21:03 +0900 | [diff] [blame] | 38 |  | 
| Paul Mundt | 8c24594 | 2008-08-06 18:37:07 +0900 | [diff] [blame] | 39 | void local_timer_interrupt(void); | 
|  | 40 | void local_timer_setup(unsigned int cpu); | 
| Paul Mundt | 763142d | 2010-04-26 19:08:55 +0900 | [diff] [blame] | 41 | void local_timer_stop(unsigned int cpu); | 
| Paul Mundt | 8c24594 | 2008-08-06 18:37:07 +0900 | [diff] [blame] | 42 |  | 
| Paul Mundt | 6f52707 | 2008-08-06 18:21:03 +0900 | [diff] [blame] | 43 | void arch_send_call_function_single_ipi(int cpu); | 
| Paul Mundt | 763142d | 2010-04-26 19:08:55 +0900 | [diff] [blame] | 44 | void arch_send_call_function_ipi_mask(const struct cpumask *mask); | 
|  | 45 |  | 
|  | 46 | void native_play_dead(void); | 
|  | 47 | void native_cpu_die(unsigned int cpu); | 
|  | 48 | int native_cpu_disable(unsigned int cpu); | 
|  | 49 |  | 
|  | 50 | #ifdef CONFIG_HOTPLUG_CPU | 
|  | 51 | void play_dead_common(void); | 
|  | 52 | extern int __cpu_disable(void); | 
|  | 53 |  | 
|  | 54 | static 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 Mundt | aba1030 | 2007-09-21 18:32:32 +0900 | [diff] [blame] | 61 |  | 
| Paul Mundt | 3366e35 | 2010-03-30 12:38:01 +0900 | [diff] [blame] | 62 | static 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 Mundt | aba1030 | 2007-09-21 18:32:32 +0900 | [diff] [blame] | 72 | #else | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 |  | 
| Paul Mundt | 027e56e | 2007-06-20 18:23:49 +0900 | [diff] [blame] | 74 | #define hard_smp_processor_id()	(0) | 
|  | 75 |  | 
| Paul Mundt | aba1030 | 2007-09-21 18:32:32 +0900 | [diff] [blame] | 76 | #endif /* CONFIG_SMP */ | 
|  | 77 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | #endif /* __ASM_SH_SMP_H */ |