x86: unify setup_trampoline
[pandora-kernel.git] / include / asm-x86 / smp.h
1 #ifndef _ASM_X86_SMP_H_
2 #define _ASM_X86_SMP_H_
3 #ifndef __ASSEMBLY__
4 #include <linux/cpumask.h>
5 #include <linux/init.h>
6
7 extern cpumask_t cpu_callout_map;
8
9 extern int smp_num_siblings;
10 extern unsigned int num_processors;
11
12 /*
13  * Trampoline 80x86 program as an array.
14  */
15 extern const unsigned char trampoline_data [];
16 extern const unsigned char trampoline_end  [];
17 extern unsigned char *trampoline_base;
18
19 struct smp_ops {
20         void (*smp_prepare_boot_cpu)(void);
21         void (*smp_prepare_cpus)(unsigned max_cpus);
22         int (*cpu_up)(unsigned cpu);
23         void (*smp_cpus_done)(unsigned max_cpus);
24
25         void (*smp_send_stop)(void);
26         void (*smp_send_reschedule)(int cpu);
27         int (*smp_call_function_mask)(cpumask_t mask,
28                                       void (*func)(void *info), void *info,
29                                       int wait);
30 };
31
32 /* Globals due to paravirt */
33 extern void set_cpu_sibling_map(int cpu);
34
35 #ifdef CONFIG_SMP
36 extern struct smp_ops smp_ops;
37
38 static inline void smp_send_stop(void)
39 {
40         smp_ops.smp_send_stop();
41 }
42
43 static inline void smp_prepare_boot_cpu(void)
44 {
45         smp_ops.smp_prepare_boot_cpu();
46 }
47
48 static inline void smp_prepare_cpus(unsigned int max_cpus)
49 {
50         smp_ops.smp_prepare_cpus(max_cpus);
51 }
52
53 static inline void smp_cpus_done(unsigned int max_cpus)
54 {
55         smp_ops.smp_cpus_done(max_cpus);
56 }
57
58 static inline int __cpu_up(unsigned int cpu)
59 {
60         return smp_ops.cpu_up(cpu);
61 }
62
63 static inline void smp_send_reschedule(int cpu)
64 {
65         smp_ops.smp_send_reschedule(cpu);
66 }
67
68 static inline int smp_call_function_mask(cpumask_t mask,
69                                          void (*func) (void *info), void *info,
70                                          int wait)
71 {
72         return smp_ops.smp_call_function_mask(mask, func, info, wait);
73 }
74
75 void native_smp_prepare_boot_cpu(void);
76 void native_smp_prepare_cpus(unsigned int max_cpus);
77 void native_smp_cpus_done(unsigned int max_cpus);
78 int native_cpu_up(unsigned int cpunum);
79
80 extern int __cpu_disable(void);
81 extern void __cpu_die(unsigned int cpu);
82
83 extern unsigned disabled_cpus;
84 extern void prefill_possible_map(void);
85
86 #define SMP_TRAMPOLINE_BASE 0x6000
87 extern unsigned long setup_trampoline(void);
88 #endif
89
90 #ifdef CONFIG_X86_32
91 # include "smp_32.h"
92 #else
93 # include "smp_64.h"
94 #endif
95
96 #ifdef CONFIG_HOTPLUG_CPU
97 extern void cpu_exit_clear(void);
98 extern void cpu_uninit(void);
99 extern void remove_siblinginfo(int cpu);
100 #endif
101
102 extern void smp_alloc_memory(void);
103 extern void lock_ipi_call_lock(void);
104 extern void unlock_ipi_call_lock(void);
105 #endif /* __ASSEMBLY__ */
106 #endif