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")
60 * Save the current interrupt enable state & disable IRQs
62 #define arch_local_irq_save arch_local_irq_save
63 static inline unsigned long arch_local_irq_save(void)
65 unsigned long flags
, temp
;
68 " mrs %0, cpsr @ arch_local_irq_save\n"
71 : "=r" (flags
), "=r" (temp
)
80 #define arch_local_irq_enable arch_local_irq_enable
81 static inline void arch_local_irq_enable(void)
85 " mrs %0, cpsr @ arch_local_irq_enable\n"
96 #define arch_local_irq_disable arch_local_irq_disable
97 static inline void arch_local_irq_disable(void)
101 " mrs %0, cpsr @ arch_local_irq_disable\n"
102 " orr %0, %0, #128\n"
112 #define local_fiq_enable() \
114 unsigned long temp; \
115 __asm__ __volatile__( \
116 "mrs %0, cpsr @ stf\n" \
117 " bic %0, %0, #64\n" \
127 #define local_fiq_disable() \
129 unsigned long temp; \
130 __asm__ __volatile__( \
131 "mrs %0, cpsr @ clf\n" \
132 " orr %0, %0, #64\n" \
142 * Save the current interrupt enable state.
144 #define arch_local_save_flags arch_local_save_flags
145 static inline unsigned long arch_local_save_flags(void)
149 " mrs %0, " IRQMASK_REG_NAME_R
" @ local_save_flags"
150 : "=r" (flags
) : : "memory", "cc");
155 * restore saved IRQ & FIQ state
157 #define arch_local_irq_restore arch_local_irq_restore
158 static inline void arch_local_irq_restore(unsigned long flags
)
161 " msr " IRQMASK_REG_NAME_W
", %0 @ local_irq_restore"
167 #define arch_irqs_disabled_flags arch_irqs_disabled_flags
168 static inline int arch_irqs_disabled_flags(unsigned long flags
)
170 return flags
& IRQMASK_I_BIT
;
173 #include <asm-generic/irqflags.h>
175 #endif /* ifdef __KERNEL__ */
176 #endif /* ifndef __ASM_ARM_IRQFLAGS_H */