1 #ifndef __ASM_ARM_IRQFLAGS_H
2 #define __ASM_ARM_IRQFLAGS_H
6 #include <asm/ptrace.h>
9 * CPU interrupt mask handling.
12 #define IRQMASK_REG_NAME_R "primask"
13 #define IRQMASK_REG_NAME_W "primask"
14 #define IRQMASK_I_BIT 1
16 #define IRQMASK_REG_NAME_R "cpsr"
17 #define IRQMASK_REG_NAME_W "cpsr_c"
18 #define IRQMASK_I_BIT PSR_I_BIT
21 #if __LINUX_ARM_ARCH__ >= 6
23 #define arch_local_irq_save arch_local_irq_save
24 static inline unsigned long arch_local_irq_save(void)
29 " mrs %0, " IRQMASK_REG_NAME_R
" @ arch_local_irq_save\n"
31 : "=r" (flags
) : : "memory", "cc");
35 #define arch_local_irq_enable arch_local_irq_enable
36 static inline void arch_local_irq_enable(void)
39 " cpsie i @ arch_local_irq_enable"
45 #define arch_local_irq_disable arch_local_irq_disable
46 static inline void arch_local_irq_disable(void)
49 " cpsid i @ arch_local_irq_disable"
55 #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
56 #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
58 #ifndef CONFIG_CPU_V7M
59 #define local_abt_enable() __asm__("cpsie a @ __sta" : : : "memory", "cc")
60 #define local_abt_disable() __asm__("cpsid a @ __cla" : : : "memory", "cc")
62 #define local_abt_enable() do { } while (0)
63 #define local_abt_disable() do { } while (0)
68 * Save the current interrupt enable state & disable IRQs
70 #define arch_local_irq_save arch_local_irq_save
71 static inline unsigned long arch_local_irq_save(void)
73 unsigned long flags
, temp
;
76 " mrs %0, cpsr @ arch_local_irq_save\n"
79 : "=r" (flags
), "=r" (temp
)
88 #define arch_local_irq_enable arch_local_irq_enable
89 static inline void arch_local_irq_enable(void)
93 " mrs %0, cpsr @ arch_local_irq_enable\n"
104 #define arch_local_irq_disable arch_local_irq_disable
105 static inline void arch_local_irq_disable(void)
109 " mrs %0, cpsr @ arch_local_irq_disable\n"
110 " orr %0, %0, #128\n"
120 #define local_fiq_enable() \
122 unsigned long temp; \
123 __asm__ __volatile__( \
124 "mrs %0, cpsr @ stf\n" \
125 " bic %0, %0, #64\n" \
135 #define local_fiq_disable() \
137 unsigned long temp; \
138 __asm__ __volatile__( \
139 "mrs %0, cpsr @ clf\n" \
140 " orr %0, %0, #64\n" \
147 #define local_abt_enable() do { } while (0)
148 #define local_abt_disable() do { } while (0)
152 * Save the current interrupt enable state.
154 #define arch_local_save_flags arch_local_save_flags
155 static inline unsigned long arch_local_save_flags(void)
159 " mrs %0, " IRQMASK_REG_NAME_R
" @ local_save_flags"
160 : "=r" (flags
) : : "memory", "cc");
165 * restore saved IRQ & FIQ state
167 #define arch_local_irq_restore arch_local_irq_restore
168 static inline void arch_local_irq_restore(unsigned long flags
)
171 " msr " IRQMASK_REG_NAME_W
", %0 @ local_irq_restore"
177 #define arch_irqs_disabled_flags arch_irqs_disabled_flags
178 static inline int arch_irqs_disabled_flags(unsigned long flags
)
180 return flags
& IRQMASK_I_BIT
;
183 #include <asm-generic/irqflags.h>
185 #endif /* ifdef __KERNEL__ */
186 #endif /* ifndef __ASM_ARM_IRQFLAGS_H */