diff options
Diffstat (limited to 'include/asm-arm/system.h')
-rw-r--r-- | include/asm-arm/system.h | 137 |
1 files changed, 9 insertions, 128 deletions
diff --git a/include/asm-arm/system.h b/include/asm-arm/system.h index 0947cbf9b69a..f05fbe31576c 100644 --- a/include/asm-arm/system.h +++ b/include/asm-arm/system.h | |||
@@ -46,6 +46,7 @@ | |||
46 | #define CPUID_TCM 2 | 46 | #define CPUID_TCM 2 |
47 | #define CPUID_TLBTYPE 3 | 47 | #define CPUID_TLBTYPE 3 |
48 | 48 | ||
49 | #ifdef CONFIG_CPU_CP15 | ||
49 | #define read_cpuid(reg) \ | 50 | #define read_cpuid(reg) \ |
50 | ({ \ | 51 | ({ \ |
51 | unsigned int __val; \ | 52 | unsigned int __val; \ |
@@ -55,6 +56,9 @@ | |||
55 | : "cc"); \ | 56 | : "cc"); \ |
56 | __val; \ | 57 | __val; \ |
57 | }) | 58 | }) |
59 | #else | ||
60 | #define read_cpuid(reg) (processor_id) | ||
61 | #endif | ||
58 | 62 | ||
59 | /* | 63 | /* |
60 | * This is used to ensure the compiler did actually allocate the register we | 64 | * This is used to ensure the compiler did actually allocate the register we |
@@ -207,130 +211,7 @@ static inline void sched_cacheflush(void) | |||
207 | { | 211 | { |
208 | } | 212 | } |
209 | 213 | ||
210 | /* | 214 | #include <linux/irqflags.h> |
211 | * CPU interrupt mask handling. | ||
212 | */ | ||
213 | #if __LINUX_ARM_ARCH__ >= 6 | ||
214 | |||
215 | #define local_irq_save(x) \ | ||
216 | ({ \ | ||
217 | __asm__ __volatile__( \ | ||
218 | "mrs %0, cpsr @ local_irq_save\n" \ | ||
219 | "cpsid i" \ | ||
220 | : "=r" (x) : : "memory", "cc"); \ | ||
221 | }) | ||
222 | |||
223 | #define local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc") | ||
224 | #define local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc") | ||
225 | #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc") | ||
226 | #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc") | ||
227 | |||
228 | #else | ||
229 | |||
230 | /* | ||
231 | * Save the current interrupt enable state & disable IRQs | ||
232 | */ | ||
233 | #define local_irq_save(x) \ | ||
234 | ({ \ | ||
235 | unsigned long temp; \ | ||
236 | (void) (&temp == &x); \ | ||
237 | __asm__ __volatile__( \ | ||
238 | "mrs %0, cpsr @ local_irq_save\n" \ | ||
239 | " orr %1, %0, #128\n" \ | ||
240 | " msr cpsr_c, %1" \ | ||
241 | : "=r" (x), "=r" (temp) \ | ||
242 | : \ | ||
243 | : "memory", "cc"); \ | ||
244 | }) | ||
245 | |||
246 | /* | ||
247 | * Enable IRQs | ||
248 | */ | ||
249 | #define local_irq_enable() \ | ||
250 | ({ \ | ||
251 | unsigned long temp; \ | ||
252 | __asm__ __volatile__( \ | ||
253 | "mrs %0, cpsr @ local_irq_enable\n" \ | ||
254 | " bic %0, %0, #128\n" \ | ||
255 | " msr cpsr_c, %0" \ | ||
256 | : "=r" (temp) \ | ||
257 | : \ | ||
258 | : "memory", "cc"); \ | ||
259 | }) | ||
260 | |||
261 | /* | ||
262 | * Disable IRQs | ||
263 | */ | ||
264 | #define local_irq_disable() \ | ||
265 | ({ \ | ||
266 | unsigned long temp; \ | ||
267 | __asm__ __volatile__( \ | ||
268 | "mrs %0, cpsr @ local_irq_disable\n" \ | ||
269 | " orr %0, %0, #128\n" \ | ||
270 | " msr cpsr_c, %0" \ | ||
271 | : "=r" (temp) \ | ||
272 | : \ | ||
273 | : "memory", "cc"); \ | ||
274 | }) | ||
275 | |||
276 | /* | ||
277 | * Enable FIQs | ||
278 | */ | ||
279 | #define local_fiq_enable() \ | ||
280 | ({ \ | ||
281 | unsigned long temp; \ | ||
282 | __asm__ __volatile__( \ | ||
283 | "mrs %0, cpsr @ stf\n" \ | ||
284 | " bic %0, %0, #64\n" \ | ||
285 | " msr cpsr_c, %0" \ | ||
286 | : "=r" (temp) \ | ||
287 | : \ | ||
288 | : "memory", "cc"); \ | ||
289 | }) | ||
290 | |||
291 | /* | ||
292 | * Disable FIQs | ||
293 | */ | ||
294 | #define local_fiq_disable() \ | ||
295 | ({ \ | ||
296 | unsigned long temp; \ | ||
297 | __asm__ __volatile__( \ | ||
298 | "mrs %0, cpsr @ clf\n" \ | ||
299 | " orr %0, %0, #64\n" \ | ||
300 | " msr cpsr_c, %0" \ | ||
301 | : "=r" (temp) \ | ||
302 | : \ | ||
303 | : "memory", "cc"); \ | ||
304 | }) | ||
305 | |||
306 | #endif | ||
307 | |||
308 | /* | ||
309 | * Save the current interrupt enable state. | ||
310 | */ | ||
311 | #define local_save_flags(x) \ | ||
312 | ({ \ | ||
313 | __asm__ __volatile__( \ | ||
314 | "mrs %0, cpsr @ local_save_flags" \ | ||
315 | : "=r" (x) : : "memory", "cc"); \ | ||
316 | }) | ||
317 | |||
318 | /* | ||
319 | * restore saved IRQ & FIQ state | ||
320 | */ | ||
321 | #define local_irq_restore(x) \ | ||
322 | __asm__ __volatile__( \ | ||
323 | "msr cpsr_c, %0 @ local_irq_restore\n" \ | ||
324 | : \ | ||
325 | : "r" (x) \ | ||
326 | : "memory", "cc") | ||
327 | |||
328 | #define irqs_disabled() \ | ||
329 | ({ \ | ||
330 | unsigned long flags; \ | ||
331 | local_save_flags(flags); \ | ||
332 | (int)(flags & PSR_I_BIT); \ | ||
333 | }) | ||
334 | 215 | ||
335 | #ifdef CONFIG_SMP | 216 | #ifdef CONFIG_SMP |
336 | 217 | ||
@@ -405,17 +286,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size | |||
405 | #error SMP is not supported on this platform | 286 | #error SMP is not supported on this platform |
406 | #endif | 287 | #endif |
407 | case 1: | 288 | case 1: |
408 | local_irq_save(flags); | 289 | raw_local_irq_save(flags); |
409 | ret = *(volatile unsigned char *)ptr; | 290 | ret = *(volatile unsigned char *)ptr; |
410 | *(volatile unsigned char *)ptr = x; | 291 | *(volatile unsigned char *)ptr = x; |
411 | local_irq_restore(flags); | 292 | raw_local_irq_restore(flags); |
412 | break; | 293 | break; |
413 | 294 | ||
414 | case 4: | 295 | case 4: |
415 | local_irq_save(flags); | 296 | raw_local_irq_save(flags); |
416 | ret = *(volatile unsigned long *)ptr; | 297 | ret = *(volatile unsigned long *)ptr; |
417 | *(volatile unsigned long *)ptr = x; | 298 | *(volatile unsigned long *)ptr = x; |
418 | local_irq_restore(flags); | 299 | raw_local_irq_restore(flags); |
419 | break; | 300 | break; |
420 | #else | 301 | #else |
421 | case 1: | 302 | case 1: |