diff options
author | Yinghai Lu <yinghai@kernel.org> | 2009-02-17 02:02:14 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 06:22:20 -0500 |
commit | c1eeb2de41d7015678bdd412b48a5f071b84e29a (patch) | |
tree | 6af99f46f557f9e854e882deac52d23b2fadb5a2 /arch/x86/include/asm/apic.h | |
parent | 06cd9a7dc8a58186060a91b6ddc031057435fd34 (diff) |
x86: fold apic_ops into genapic
Impact: cleanup
make it simpler, don't need have one extra struct.
v2: fix the sgi_uv build
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/apic.h')
-rw-r--r-- | arch/x86/include/asm/apic.h | 97 |
1 files changed, 31 insertions, 66 deletions
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index dc1db99cd40e..4f56e053d347 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h | |||
@@ -92,6 +92,12 @@ static inline u32 native_apic_mem_read(u32 reg) | |||
92 | return *((volatile u32 *)(APIC_BASE + reg)); | 92 | return *((volatile u32 *)(APIC_BASE + reg)); |
93 | } | 93 | } |
94 | 94 | ||
95 | extern void native_apic_wait_icr_idle(void); | ||
96 | extern u32 native_safe_apic_wait_icr_idle(void); | ||
97 | extern void native_apic_icr_write(u32 low, u32 id); | ||
98 | extern u64 native_apic_icr_read(void); | ||
99 | |||
100 | #ifdef CONFIG_X86_X2APIC | ||
95 | static inline void native_apic_msr_write(u32 reg, u32 v) | 101 | static inline void native_apic_msr_write(u32 reg, u32 v) |
96 | { | 102 | { |
97 | if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR || | 103 | if (reg == APIC_DFR || reg == APIC_ID || reg == APIC_LDR || |
@@ -112,7 +118,31 @@ static inline u32 native_apic_msr_read(u32 reg) | |||
112 | return low; | 118 | return low; |
113 | } | 119 | } |
114 | 120 | ||
115 | #ifdef CONFIG_X86_X2APIC | 121 | static inline void native_x2apic_wait_icr_idle(void) |
122 | { | ||
123 | /* no need to wait for icr idle in x2apic */ | ||
124 | return; | ||
125 | } | ||
126 | |||
127 | static inline u32 native_safe_x2apic_wait_icr_idle(void) | ||
128 | { | ||
129 | /* no need to wait for icr idle in x2apic */ | ||
130 | return 0; | ||
131 | } | ||
132 | |||
133 | static inline void native_x2apic_icr_write(u32 low, u32 id) | ||
134 | { | ||
135 | wrmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), ((__u64) id) << 32 | low); | ||
136 | } | ||
137 | |||
138 | static inline u64 native_x2apic_icr_read(void) | ||
139 | { | ||
140 | unsigned long val; | ||
141 | |||
142 | rdmsrl(APIC_BASE_MSR + (APIC_ICR >> 4), val); | ||
143 | return val; | ||
144 | } | ||
145 | |||
116 | extern int x2apic; | 146 | extern int x2apic; |
117 | extern void check_x2apic(void); | 147 | extern void check_x2apic(void); |
118 | extern void enable_x2apic(void); | 148 | extern void enable_x2apic(void); |
@@ -146,47 +176,6 @@ static inline int x2apic_enabled(void) | |||
146 | } | 176 | } |
147 | #endif | 177 | #endif |
148 | 178 | ||
149 | struct apic_ops { | ||
150 | u32 (*read)(u32 reg); | ||
151 | void (*write)(u32 reg, u32 v); | ||
152 | u64 (*icr_read)(void); | ||
153 | void (*icr_write)(u32 low, u32 high); | ||
154 | void (*wait_icr_idle)(void); | ||
155 | u32 (*safe_wait_icr_idle)(void); | ||
156 | }; | ||
157 | |||
158 | extern struct apic_ops *apic_ops; | ||
159 | |||
160 | static inline u32 apic_read(u32 reg) | ||
161 | { | ||
162 | return apic_ops->read(reg); | ||
163 | } | ||
164 | |||
165 | static inline void apic_write(u32 reg, u32 val) | ||
166 | { | ||
167 | apic_ops->write(reg, val); | ||
168 | } | ||
169 | |||
170 | static inline u64 apic_icr_read(void) | ||
171 | { | ||
172 | return apic_ops->icr_read(); | ||
173 | } | ||
174 | |||
175 | static inline void apic_icr_write(u32 low, u32 high) | ||
176 | { | ||
177 | apic_ops->icr_write(low, high); | ||
178 | } | ||
179 | |||
180 | static inline void apic_wait_icr_idle(void) | ||
181 | { | ||
182 | apic_ops->wait_icr_idle(); | ||
183 | } | ||
184 | |||
185 | static inline u32 safe_apic_wait_icr_idle(void) | ||
186 | { | ||
187 | return apic_ops->safe_wait_icr_idle(); | ||
188 | } | ||
189 | |||
190 | extern int get_physical_broadcast(void); | 179 | extern int get_physical_broadcast(void); |
191 | 180 | ||
192 | #ifdef CONFIG_X86_X2APIC | 181 | #ifdef CONFIG_X86_X2APIC |
@@ -197,18 +186,6 @@ static inline void ack_x2APIC_irq(void) | |||
197 | } | 186 | } |
198 | #endif | 187 | #endif |
199 | 188 | ||
200 | |||
201 | static inline void ack_APIC_irq(void) | ||
202 | { | ||
203 | /* | ||
204 | * ack_APIC_irq() actually gets compiled as a single instruction | ||
205 | * ... yummie. | ||
206 | */ | ||
207 | |||
208 | /* Docs say use 0 for future compatibility */ | ||
209 | apic_write(APIC_EOI, 0); | ||
210 | } | ||
211 | |||
212 | extern int lapic_get_maxlvt(void); | 189 | extern int lapic_get_maxlvt(void); |
213 | extern void clear_local_APIC(void); | 190 | extern void clear_local_APIC(void); |
214 | extern void connect_bsp_APIC(void); | 191 | extern void connect_bsp_APIC(void); |
@@ -256,18 +233,6 @@ static inline void disable_local_APIC(void) { } | |||
256 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) | 233 | #define SET_APIC_ID(x) (apic->set_apic_id(x)) |
257 | #else | 234 | #else |
258 | 235 | ||
259 | #ifdef CONFIG_X86_LOCAL_APIC | ||
260 | static inline unsigned default_get_apic_id(unsigned long x) | ||
261 | { | ||
262 | unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR)); | ||
263 | |||
264 | if (APIC_XAPIC(ver)) | ||
265 | return (x >> 24) & 0xFF; | ||
266 | else | ||
267 | return (x >> 24) & 0x0F; | ||
268 | } | ||
269 | #endif | ||
270 | |||
271 | #endif | 236 | #endif |
272 | 237 | ||
273 | #endif /* _ASM_X86_APIC_H */ | 238 | #endif /* _ASM_X86_APIC_H */ |