diff options
Diffstat (limited to 'arch/x86/include/asm/apic.h')
-rw-r--r-- | arch/x86/include/asm/apic.h | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 465b309af254..efc3b22d896e 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -106,7 +106,14 @@ extern u32 native_safe_apic_wait_icr_idle(void); | |||
106 | extern void native_apic_icr_write(u32 low, u32 id); | 106 | extern void native_apic_icr_write(u32 low, u32 id); |
107 | extern u64 native_apic_icr_read(void); | 107 | extern u64 native_apic_icr_read(void); |
108 | 108 | ||
109 | extern int x2apic_mode; | 109 | static inline bool apic_is_x2apic_enabled(void) |
110 | { | ||
111 | u64 msr; | ||
112 | |||
113 | if (rdmsrl_safe(MSR_IA32_APICBASE, &msr)) | ||
114 | return false; | ||
115 | return msr & X2APIC_ENABLE; | ||
116 | } | ||
110 | 117 | ||
111 | #ifdef CONFIG_X86_X2APIC | 118 | #ifdef CONFIG_X86_X2APIC |
112 | /* | 119 | /* |
@@ -169,48 +176,23 @@ static inline u64 native_x2apic_icr_read(void) | |||
169 | return val; | 176 | return val; |
170 | } | 177 | } |
171 | 178 | ||
179 | extern int x2apic_mode; | ||
172 | extern int x2apic_phys; | 180 | extern int x2apic_phys; |
173 | extern int x2apic_preenabled; | 181 | extern void __init check_x2apic(void); |
174 | extern void check_x2apic(void); | 182 | extern void x2apic_setup(void); |
175 | extern void enable_x2apic(void); | ||
176 | static inline int x2apic_enabled(void) | 183 | static inline int x2apic_enabled(void) |
177 | { | 184 | { |
178 | u64 msr; | 185 | return cpu_has_x2apic && apic_is_x2apic_enabled(); |
179 | |||
180 | if (!cpu_has_x2apic) | ||
181 | return 0; | ||
182 | |||
183 | rdmsrl(MSR_IA32_APICBASE, msr); | ||
184 | if (msr & X2APIC_ENABLE) | ||
185 | return 1; | ||
186 | return 0; | ||
187 | } | 186 | } |
188 | 187 | ||
189 | #define x2apic_supported() (cpu_has_x2apic) | 188 | #define x2apic_supported() (cpu_has_x2apic) |
190 | static inline void x2apic_force_phys(void) | ||
191 | { | ||
192 | x2apic_phys = 1; | ||
193 | } | ||
194 | #else | 189 | #else |
195 | static inline void disable_x2apic(void) | 190 | static inline void check_x2apic(void) { } |
196 | { | 191 | static inline void x2apic_setup(void) { } |
197 | } | 192 | static inline int x2apic_enabled(void) { return 0; } |
198 | static inline void check_x2apic(void) | ||
199 | { | ||
200 | } | ||
201 | static inline void enable_x2apic(void) | ||
202 | { | ||
203 | } | ||
204 | static inline int x2apic_enabled(void) | ||
205 | { | ||
206 | return 0; | ||
207 | } | ||
208 | static inline void x2apic_force_phys(void) | ||
209 | { | ||
210 | } | ||
211 | 193 | ||
212 | #define x2apic_preenabled 0 | 194 | #define x2apic_mode (0) |
213 | #define x2apic_supported() 0 | 195 | #define x2apic_supported() (0) |
214 | #endif | 196 | #endif |
215 | 197 | ||
216 | extern void enable_IR_x2apic(void); | 198 | extern void enable_IR_x2apic(void); |
@@ -219,7 +201,6 @@ extern int get_physical_broadcast(void); | |||
219 | 201 | ||
220 | extern int lapic_get_maxlvt(void); | 202 | extern int lapic_get_maxlvt(void); |
221 | extern void clear_local_APIC(void); | 203 | extern void clear_local_APIC(void); |
222 | extern void connect_bsp_APIC(void); | ||
223 | extern void disconnect_bsp_APIC(int virt_wire_setup); | 204 | extern void disconnect_bsp_APIC(int virt_wire_setup); |
224 | extern void disable_local_APIC(void); | 205 | extern void disable_local_APIC(void); |
225 | extern void lapic_shutdown(void); | 206 | extern void lapic_shutdown(void); |
@@ -227,14 +208,23 @@ extern int verify_local_APIC(void); | |||
227 | extern void sync_Arb_IDs(void); | 208 | extern void sync_Arb_IDs(void); |
228 | extern void init_bsp_APIC(void); | 209 | extern void init_bsp_APIC(void); |
229 | extern void setup_local_APIC(void); | 210 | extern void setup_local_APIC(void); |
230 | extern void end_local_APIC_setup(void); | ||
231 | extern void bsp_end_local_APIC_setup(void); | ||
232 | extern void init_apic_mappings(void); | 211 | extern void init_apic_mappings(void); |
233 | void register_lapic_address(unsigned long address); | 212 | void register_lapic_address(unsigned long address); |
234 | extern void setup_boot_APIC_clock(void); | 213 | extern void setup_boot_APIC_clock(void); |
235 | extern void setup_secondary_APIC_clock(void); | 214 | extern void setup_secondary_APIC_clock(void); |
236 | extern int APIC_init_uniprocessor(void); | 215 | extern int APIC_init_uniprocessor(void); |
216 | |||
217 | #ifdef CONFIG_X86_64 | ||
218 | static inline int apic_force_enable(unsigned long addr) | ||
219 | { | ||
220 | return -1; | ||
221 | } | ||
222 | #else | ||
237 | extern int apic_force_enable(unsigned long addr); | 223 | extern int apic_force_enable(unsigned long addr); |
224 | #endif | ||
225 | |||
226 | extern int apic_bsp_setup(bool upmode); | ||
227 | extern void apic_ap_setup(void); | ||
238 | 228 | ||
239 | /* | 229 | /* |
240 | * On 32bit this is mach-xxx local | 230 | * On 32bit this is mach-xxx local |