Commit | Line | Data |
---|---|---|
c27cfeff GC |
1 | #ifndef _ASM_X86_SMP_H_ |
2 | #define _ASM_X86_SMP_H_ | |
3 | #ifndef __ASSEMBLY__ | |
53ebef49 | 4 | #include <linux/cpumask.h> |
93b016f8 | 5 | #include <linux/init.h> |
7e1efc0c | 6 | #include <asm/percpu.h> |
53ebef49 | 7 | |
b23dab08 GC |
8 | /* |
9 | * We need the APIC definitions automatically as part of 'smp.h' | |
10 | */ | |
11 | #ifdef CONFIG_X86_LOCAL_APIC | |
12 | # include <asm/mpspec.h> | |
13 | # include <asm/apic.h> | |
14 | # ifdef CONFIG_X86_IO_APIC | |
15 | # include <asm/io_apic.h> | |
16 | # endif | |
17 | #endif | |
18 | #include <asm/pda.h> | |
19 | #include <asm/thread_info.h> | |
20 | ||
53ebef49 GC |
21 | extern cpumask_t cpu_callout_map; |
22 | ||
23 | extern int smp_num_siblings; | |
24 | extern unsigned int num_processors; | |
cb3c8b90 | 25 | extern cpumask_t cpu_initialized; |
c27cfeff | 26 | |
7e1efc0c GOC |
27 | extern u16 x86_cpu_to_apicid_init[]; |
28 | extern u16 x86_bios_cpu_apicid_init[]; | |
29 | extern void *x86_cpu_to_apicid_early_ptr; | |
30 | extern void *x86_bios_cpu_apicid_early_ptr; | |
31 | ||
32 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | |
33 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | |
34 | DECLARE_PER_CPU(u16, cpu_llc_id); | |
35 | DECLARE_PER_CPU(u16, x86_cpu_to_apicid); | |
36 | DECLARE_PER_CPU(u16, x86_bios_cpu_apicid); | |
37 | ||
42068829 GC |
38 | /* |
39 | * Trampoline 80x86 program as an array. | |
40 | */ | |
41 | extern const unsigned char trampoline_data []; | |
42 | extern const unsigned char trampoline_end []; | |
91718e8d | 43 | extern unsigned char *trampoline_base; |
42068829 | 44 | |
9d97d0da GOC |
45 | /* Static state in head.S used to set up a CPU */ |
46 | extern struct { | |
47 | void *sp; | |
48 | unsigned short ss; | |
49 | } stack_start; | |
50 | ||
cb3c8b90 GOC |
51 | extern unsigned long init_rsp; |
52 | extern unsigned long initial_code; | |
9d97d0da | 53 | |
16694024 GC |
54 | struct smp_ops { |
55 | void (*smp_prepare_boot_cpu)(void); | |
56 | void (*smp_prepare_cpus)(unsigned max_cpus); | |
57 | int (*cpu_up)(unsigned cpu); | |
58 | void (*smp_cpus_done)(unsigned max_cpus); | |
59 | ||
60 | void (*smp_send_stop)(void); | |
61 | void (*smp_send_reschedule)(int cpu); | |
62 | int (*smp_call_function_mask)(cpumask_t mask, | |
63 | void (*func)(void *info), void *info, | |
64 | int wait); | |
65 | }; | |
66 | ||
14522076 GC |
67 | /* Globals due to paravirt */ |
68 | extern void set_cpu_sibling_map(int cpu); | |
69 | ||
c76cb368 | 70 | #ifdef CONFIG_SMP |
d0173aea GOC |
71 | #ifndef CONFIG_PARAVIRT |
72 | #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0) | |
73 | #endif | |
c76cb368 | 74 | extern struct smp_ops smp_ops; |
8678969e | 75 | |
377d6984 GC |
76 | static inline void smp_send_stop(void) |
77 | { | |
78 | smp_ops.smp_send_stop(); | |
79 | } | |
80 | ||
1e3fac83 GC |
81 | static inline void smp_prepare_boot_cpu(void) |
82 | { | |
83 | smp_ops.smp_prepare_boot_cpu(); | |
84 | } | |
85 | ||
7557da67 GC |
86 | static inline void smp_prepare_cpus(unsigned int max_cpus) |
87 | { | |
88 | smp_ops.smp_prepare_cpus(max_cpus); | |
89 | } | |
90 | ||
c5597649 GC |
91 | static inline void smp_cpus_done(unsigned int max_cpus) |
92 | { | |
93 | smp_ops.smp_cpus_done(max_cpus); | |
94 | } | |
95 | ||
71d19549 GC |
96 | static inline int __cpu_up(unsigned int cpu) |
97 | { | |
98 | return smp_ops.cpu_up(cpu); | |
99 | } | |
100 | ||
8678969e GC |
101 | static inline void smp_send_reschedule(int cpu) |
102 | { | |
103 | smp_ops.smp_send_reschedule(cpu); | |
104 | } | |
64b1a21e GC |
105 | |
106 | static inline int smp_call_function_mask(cpumask_t mask, | |
107 | void (*func) (void *info), void *info, | |
108 | int wait) | |
109 | { | |
110 | return smp_ops.smp_call_function_mask(mask, func, info, wait); | |
111 | } | |
71d19549 | 112 | |
1e3fac83 | 113 | void native_smp_prepare_boot_cpu(void); |
7557da67 | 114 | void native_smp_prepare_cpus(unsigned int max_cpus); |
c5597649 | 115 | void native_smp_cpus_done(unsigned int max_cpus); |
71d19549 | 116 | int native_cpu_up(unsigned int cpunum); |
93b016f8 | 117 | |
69c18c15 GC |
118 | extern int __cpu_disable(void); |
119 | extern void __cpu_die(unsigned int cpu); | |
120 | ||
93b016f8 | 121 | extern unsigned disabled_cpus; |
68a1c3f8 | 122 | extern void prefill_possible_map(void); |
91718e8d GC |
123 | |
124 | #define SMP_TRAMPOLINE_BASE 0x6000 | |
125 | extern unsigned long setup_trampoline(void); | |
1d89a7f0 GOC |
126 | |
127 | void smp_store_cpu_info(int id); | |
c70dcb74 GOC |
128 | #define cpu_physical_id(cpu) per_cpu(x86_cpu_to_apicid, cpu) |
129 | #else | |
130 | #define cpu_physical_id(cpu) boot_cpu_physical_apicid | |
c76cb368 | 131 | #endif |
16694024 | 132 | |
96a388de TG |
133 | #ifdef CONFIG_X86_32 |
134 | # include "smp_32.h" | |
135 | #else | |
136 | # include "smp_64.h" | |
137 | #endif | |
c27cfeff | 138 | |
1b000843 GC |
139 | #ifdef CONFIG_X86_LOCAL_APIC |
140 | ||
141 | static inline int logical_smp_processor_id(void) | |
142 | { | |
143 | /* we don't want to mark this access volatile - bad code generation */ | |
144 | return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR)); | |
145 | } | |
146 | ||
147 | # ifdef APIC_DEFINITION | |
148 | extern int hard_smp_processor_id(void); | |
149 | # else | |
150 | # include <mach_apicdef.h> | |
151 | static inline int hard_smp_processor_id(void) | |
152 | { | |
153 | /* we don't want to mark this access volatile - bad code generation */ | |
154 | return GET_APIC_ID(*(u32 *)(APIC_BASE + APIC_ID)); | |
155 | } | |
156 | # endif /* APIC_DEFINITION */ | |
157 | ||
158 | #else /* CONFIG_X86_LOCAL_APIC */ | |
159 | ||
160 | # ifndef CONFIG_SMP | |
161 | # define hard_smp_processor_id() 0 | |
162 | # endif | |
163 | ||
164 | #endif /* CONFIG_X86_LOCAL_APIC */ | |
165 | ||
1dbb4726 GC |
166 | #ifdef CONFIG_HOTPLUG_CPU |
167 | extern void cpu_exit_clear(void); | |
168 | extern void cpu_uninit(void); | |
169 | extern void remove_siblinginfo(int cpu); | |
170 | #endif | |
171 | ||
639acb16 GC |
172 | extern void smp_alloc_memory(void); |
173 | extern void lock_ipi_call_lock(void); | |
174 | extern void unlock_ipi_call_lock(void); | |
c27cfeff GC |
175 | #endif /* __ASSEMBLY__ */ |
176 | #endif |