diff options
Diffstat (limited to 'arch/arm/include/asm/irqflags.h')
-rw-r--r-- | arch/arm/include/asm/irqflags.h | 145 |
1 files changed, 84 insertions, 61 deletions
diff --git a/arch/arm/include/asm/irqflags.h b/arch/arm/include/asm/irqflags.h index 6d09974e6646..1e6cca55c750 100644 --- a/arch/arm/include/asm/irqflags.h +++ b/arch/arm/include/asm/irqflags.h | |||
@@ -10,66 +10,85 @@ | |||
10 | */ | 10 | */ |
11 | #if __LINUX_ARM_ARCH__ >= 6 | 11 | #if __LINUX_ARM_ARCH__ >= 6 |
12 | 12 | ||
13 | #define raw_local_irq_save(x) \ | 13 | static inline unsigned long arch_local_irq_save(void) |
14 | ({ \ | 14 | { |
15 | __asm__ __volatile__( \ | 15 | unsigned long flags; |
16 | "mrs %0, cpsr @ local_irq_save\n" \ | 16 | |
17 | "cpsid i" \ | 17 | asm volatile( |
18 | : "=r" (x) : : "memory", "cc"); \ | 18 | " mrs %0, cpsr @ arch_local_irq_save\n" |
19 | }) | 19 | " cpsid i" |
20 | : "=r" (flags) : : "memory", "cc"); | ||
21 | return flags; | ||
22 | } | ||
23 | |||
24 | static inline void arch_local_irq_enable(void) | ||
25 | { | ||
26 | asm volatile( | ||
27 | " cpsie i @ arch_local_irq_enable" | ||
28 | : | ||
29 | : | ||
30 | : "memory", "cc"); | ||
31 | } | ||
32 | |||
33 | static inline void arch_local_irq_disable(void) | ||
34 | { | ||
35 | asm volatile( | ||
36 | " cpsid i @ arch_local_irq_disable" | ||
37 | : | ||
38 | : | ||
39 | : "memory", "cc"); | ||
40 | } | ||
20 | 41 | ||
21 | #define raw_local_irq_enable() __asm__("cpsie i @ __sti" : : : "memory", "cc") | ||
22 | #define raw_local_irq_disable() __asm__("cpsid i @ __cli" : : : "memory", "cc") | ||
23 | #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc") | 42 | #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc") |
24 | #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc") | 43 | #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc") |
25 | |||
26 | #else | 44 | #else |
27 | 45 | ||
28 | /* | 46 | /* |
29 | * Save the current interrupt enable state & disable IRQs | 47 | * Save the current interrupt enable state & disable IRQs |
30 | */ | 48 | */ |
31 | #define raw_local_irq_save(x) \ | 49 | static inline unsigned long arch_local_irq_save(void) |
32 | ({ \ | 50 | { |
33 | unsigned long temp; \ | 51 | unsigned long flags, temp; |
34 | (void) (&temp == &x); \ | 52 | |
35 | __asm__ __volatile__( \ | 53 | asm volatile( |
36 | "mrs %0, cpsr @ local_irq_save\n" \ | 54 | " mrs %0, cpsr @ arch_local_irq_save\n" |
37 | " orr %1, %0, #128\n" \ | 55 | " orr %1, %0, #128\n" |
38 | " msr cpsr_c, %1" \ | 56 | " msr cpsr_c, %1" |
39 | : "=r" (x), "=r" (temp) \ | 57 | : "=r" (flags), "=r" (temp) |
40 | : \ | 58 | : |
41 | : "memory", "cc"); \ | 59 | : "memory", "cc"); |
42 | }) | 60 | return flags; |
43 | 61 | } | |
62 | |||
44 | /* | 63 | /* |
45 | * Enable IRQs | 64 | * Enable IRQs |
46 | */ | 65 | */ |
47 | #define raw_local_irq_enable() \ | 66 | static inline void arch_local_irq_enable(void) |
48 | ({ \ | 67 | { |
49 | unsigned long temp; \ | 68 | unsigned long temp; |
50 | __asm__ __volatile__( \ | 69 | asm volatile( |
51 | "mrs %0, cpsr @ local_irq_enable\n" \ | 70 | " mrs %0, cpsr @ arch_local_irq_enable\n" |
52 | " bic %0, %0, #128\n" \ | 71 | " bic %0, %0, #128\n" |
53 | " msr cpsr_c, %0" \ | 72 | " msr cpsr_c, %0" |
54 | : "=r" (temp) \ | 73 | : "=r" (temp) |
55 | : \ | 74 | : |
56 | : "memory", "cc"); \ | 75 | : "memory", "cc"); |
57 | }) | 76 | } |
58 | 77 | ||
59 | /* | 78 | /* |
60 | * Disable IRQs | 79 | * Disable IRQs |
61 | */ | 80 | */ |
62 | #define raw_local_irq_disable() \ | 81 | static inline void arch_local_irq_disable(void) |
63 | ({ \ | 82 | { |
64 | unsigned long temp; \ | 83 | unsigned long temp; |
65 | __asm__ __volatile__( \ | 84 | asm volatile( |
66 | "mrs %0, cpsr @ local_irq_disable\n" \ | 85 | " mrs %0, cpsr @ arch_local_irq_disable\n" |
67 | " orr %0, %0, #128\n" \ | 86 | " orr %0, %0, #128\n" |
68 | " msr cpsr_c, %0" \ | 87 | " msr cpsr_c, %0" |
69 | : "=r" (temp) \ | 88 | : "=r" (temp) |
70 | : \ | 89 | : |
71 | : "memory", "cc"); \ | 90 | : "memory", "cc"); |
72 | }) | 91 | } |
73 | 92 | ||
74 | /* | 93 | /* |
75 | * Enable FIQs | 94 | * Enable FIQs |
@@ -106,27 +125,31 @@ | |||
106 | /* | 125 | /* |
107 | * Save the current interrupt enable state. | 126 | * Save the current interrupt enable state. |
108 | */ | 127 | */ |
109 | #define raw_local_save_flags(x) \ | 128 | static inline unsigned long arch_local_save_flags(void) |
110 | ({ \ | 129 | { |
111 | __asm__ __volatile__( \ | 130 | unsigned long flags; |
112 | "mrs %0, cpsr @ local_save_flags" \ | 131 | asm volatile( |
113 | : "=r" (x) : : "memory", "cc"); \ | 132 | " mrs %0, cpsr @ local_save_flags" |
114 | }) | 133 | : "=r" (flags) : : "memory", "cc"); |
134 | return flags; | ||
135 | } | ||
115 | 136 | ||
116 | /* | 137 | /* |
117 | * restore saved IRQ & FIQ state | 138 | * restore saved IRQ & FIQ state |
118 | */ | 139 | */ |
119 | #define raw_local_irq_restore(x) \ | 140 | static inline void arch_local_irq_restore(unsigned long flags) |
120 | __asm__ __volatile__( \ | 141 | { |
121 | "msr cpsr_c, %0 @ local_irq_restore\n" \ | 142 | asm volatile( |
122 | : \ | 143 | " msr cpsr_c, %0 @ local_irq_restore" |
123 | : "r" (x) \ | 144 | : |
124 | : "memory", "cc") | 145 | : "r" (flags) |
146 | : "memory", "cc"); | ||
147 | } | ||
125 | 148 | ||
126 | #define raw_irqs_disabled_flags(flags) \ | 149 | static inline int arch_irqs_disabled_flags(unsigned long flags) |
127 | ({ \ | 150 | { |
128 | (int)((flags) & PSR_I_BIT); \ | 151 | return flags & PSR_I_BIT; |
129 | }) | 152 | } |
130 | 153 | ||
131 | #endif | 154 | #endif |
132 | #endif | 155 | #endif |