diff options
Diffstat (limited to 'arch/x86/include/asm/apic.h')
-rw-r--r-- | arch/x86/include/asm/apic.h | 74 |
1 files changed, 68 insertions, 6 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index ab1d51a8855..fba49f66228 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -33,7 +33,13 @@ | |||
33 | } while (0) | 33 | } while (0) |
34 | 34 | ||
35 | 35 | ||
36 | #if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_32) | ||
36 | extern void generic_apic_probe(void); | 37 | extern void generic_apic_probe(void); |
38 | #else | ||
39 | static inline void generic_apic_probe(void) | ||
40 | { | ||
41 | } | ||
42 | #endif | ||
37 | 43 | ||
38 | #ifdef CONFIG_X86_LOCAL_APIC | 44 | #ifdef CONFIG_X86_LOCAL_APIC |
39 | 45 | ||
@@ -41,6 +47,21 @@ extern unsigned int apic_verbosity; | |||
41 | extern int local_apic_timer_c2_ok; | 47 | extern int local_apic_timer_c2_ok; |
42 | 48 | ||
43 | extern int disable_apic; | 49 | extern int disable_apic; |
50 | |||
51 | #ifdef CONFIG_SMP | ||
52 | extern void __inquire_remote_apic(int apicid); | ||
53 | #else /* CONFIG_SMP */ | ||
54 | static inline void __inquire_remote_apic(int apicid) | ||
55 | { | ||
56 | } | ||
57 | #endif /* CONFIG_SMP */ | ||
58 | |||
59 | static inline void default_inquire_remote_apic(int apicid) | ||
60 | { | ||
61 | if (apic_verbosity >= APIC_DEBUG) | ||
62 | __inquire_remote_apic(apicid); | ||
63 | } | ||
64 | |||
44 | /* | 65 | /* |
45 | * Basic functions accessing APICs. | 66 | * Basic functions accessing APICs. |
46 | */ | 67 | */ |
@@ -124,12 +145,35 @@ struct apic_ops { | |||
124 | 145 | ||
125 | extern struct apic_ops *apic_ops; | 146 | extern struct apic_ops *apic_ops; |
126 | 147 | ||
127 | #define apic_read (apic_ops->read) | 148 | static inline u32 apic_read(u32 reg) |
128 | #define apic_write (apic_ops->write) | 149 | { |
129 | #define apic_icr_read (apic_ops->icr_read) | 150 | return apic_ops->read(reg); |
130 | #define apic_icr_write (apic_ops->icr_write) | 151 | } |
131 | #define apic_wait_icr_idle (apic_ops->wait_icr_idle) | 152 | |
132 | #define safe_apic_wait_icr_idle (apic_ops->safe_wait_icr_idle) | 153 | static inline void apic_write(u32 reg, u32 val) |
154 | { | ||
155 | apic_ops->write(reg, val); | ||
156 | } | ||
157 | |||
158 | static inline u64 apic_icr_read(void) | ||
159 | { | ||
160 | return apic_ops->icr_read(); | ||
161 | } | ||
162 | |||
163 | static inline void apic_icr_write(u32 low, u32 high) | ||
164 | { | ||
165 | apic_ops->icr_write(low, high); | ||
166 | } | ||
167 | |||
168 | static inline void apic_wait_icr_idle(void) | ||
169 | { | ||
170 | apic_ops->wait_icr_idle(); | ||
171 | } | ||
172 | |||
173 | static inline u32 safe_apic_wait_icr_idle(void) | ||
174 | { | ||
175 | return apic_ops->safe_wait_icr_idle(); | ||
176 | } | ||
133 | 177 | ||
134 | extern int get_physical_broadcast(void); | 178 | extern int get_physical_broadcast(void); |
135 | 179 | ||
@@ -196,4 +240,22 @@ static inline void disable_local_APIC(void) { } | |||
196 | 240 | ||
197 | #endif /* !CONFIG_X86_LOCAL_APIC */ | 241 | #endif /* !CONFIG_X86_LOCAL_APIC */ |
198 | 242 | ||
243 | #ifdef CONFIG_X86_64 | ||
244 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) | ||
245 | #else | ||
246 | |||
247 | #ifdef CONFIG_X86_LOCAL_APIC | ||
248 | static inline unsigned default_get_apic_id(unsigned long x) | ||
249 | { | ||
250 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
251 | |||
252 | if (APIC_XAPIC(ver)) | ||
253 | return (x >> 24) & 0xFF; | ||
254 | else | ||
255 | return (x >> 24) & 0x0F; | ||
256 | } | ||
257 | #endif | ||
258 | |||
259 | #endif | ||
260 | |||
199 | #endif /* _ASM_X86_APIC_H */ | 261 | #endif /* _ASM_X86_APIC_H */ |