ARM: rockchip: fix broken build
[linux/fpc-iii.git] / arch / arm / include / asm / irqflags.h
blob43908146a5cf05c473967d603247a792f73b5663
1 #ifndef __ASM_ARM_IRQFLAGS_H
2 #define __ASM_ARM_IRQFLAGS_H
4 #ifdef __KERNEL__
6 #include <asm/ptrace.h>
8 /*
9 * CPU interrupt mask handling.
11 #ifdef CONFIG_CPU_V7M
12 #define IRQMASK_REG_NAME_R "primask"
13 #define IRQMASK_REG_NAME_W "primask"
14 #define IRQMASK_I_BIT 1
15 #else
16 #define IRQMASK_REG_NAME_R "cpsr"
17 #define IRQMASK_REG_NAME_W "cpsr_c"
18 #define IRQMASK_I_BIT PSR_I_BIT
19 #endif
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)
26 unsigned long flags;
28 asm volatile(
29 " mrs %0, " IRQMASK_REG_NAME_R " @ arch_local_irq_save\n"
30 " cpsid i"
31 : "=r" (flags) : : "memory", "cc");
32 return flags;
35 #define arch_local_irq_enable arch_local_irq_enable
36 static inline void arch_local_irq_enable(void)
38 asm volatile(
39 " cpsie i @ arch_local_irq_enable"
42 : "memory", "cc");
45 #define arch_local_irq_disable arch_local_irq_disable
46 static inline void arch_local_irq_disable(void)
48 asm volatile(
49 " cpsid i @ arch_local_irq_disable"
52 : "memory", "cc");
55 #define local_fiq_enable() __asm__("cpsie f @ __stf" : : : "memory", "cc")
56 #define local_fiq_disable() __asm__("cpsid f @ __clf" : : : "memory", "cc")
57 #else
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;
67 asm volatile(
68 " mrs %0, cpsr @ arch_local_irq_save\n"
69 " orr %1, %0, #128\n"
70 " msr cpsr_c, %1"
71 : "=r" (flags), "=r" (temp)
73 : "memory", "cc");
74 return flags;
78 * Enable IRQs
80 #define arch_local_irq_enable arch_local_irq_enable
81 static inline void arch_local_irq_enable(void)
83 unsigned long temp;
84 asm volatile(
85 " mrs %0, cpsr @ arch_local_irq_enable\n"
86 " bic %0, %0, #128\n"
87 " msr cpsr_c, %0"
88 : "=r" (temp)
90 : "memory", "cc");
94 * Disable IRQs
96 #define arch_local_irq_disable arch_local_irq_disable
97 static inline void arch_local_irq_disable(void)
99 unsigned long temp;
100 asm volatile(
101 " mrs %0, cpsr @ arch_local_irq_disable\n"
102 " orr %0, %0, #128\n"
103 " msr cpsr_c, %0"
104 : "=r" (temp)
106 : "memory", "cc");
110 * Enable FIQs
112 #define local_fiq_enable() \
113 ({ \
114 unsigned long temp; \
115 __asm__ __volatile__( \
116 "mrs %0, cpsr @ stf\n" \
117 " bic %0, %0, #64\n" \
118 " msr cpsr_c, %0" \
119 : "=r" (temp) \
121 : "memory", "cc"); \
125 * Disable FIQs
127 #define local_fiq_disable() \
128 ({ \
129 unsigned long temp; \
130 __asm__ __volatile__( \
131 "mrs %0, cpsr @ clf\n" \
132 " orr %0, %0, #64\n" \
133 " msr cpsr_c, %0" \
134 : "=r" (temp) \
136 : "memory", "cc"); \
139 #endif
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)
147 unsigned long flags;
148 asm volatile(
149 " mrs %0, " IRQMASK_REG_NAME_R " @ local_save_flags"
150 : "=r" (flags) : : "memory", "cc");
151 return flags;
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)
160 asm volatile(
161 " msr " IRQMASK_REG_NAME_W ", %0 @ local_irq_restore"
163 : "r" (flags)
164 : "memory", "cc");
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 */