2 * Copyright IBM Corp. 2006,2010
3 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
6 #ifndef __ASM_IRQFLAGS_H
7 #define __ASM_IRQFLAGS_H
9 #include <linux/types.h>
11 /* store then OR system mask. */
12 #define __arch_local_irq_stosm(__or) \
14 unsigned long __mask; \
17 : "=Q" (__mask) : "i" (__or) : "memory"); \
21 /* store then AND system mask. */
22 #define __arch_local_irq_stnsm(__and) \
24 unsigned long __mask; \
27 : "=Q" (__mask) : "i" (__and) : "memory"); \
31 /* set system mask. */
32 static inline void __arch_local_irq_ssm(unsigned long flags
)
34 asm volatile("ssm %0" : : "Q" (flags
) : "memory");
37 static inline unsigned long arch_local_save_flags(void)
39 return __arch_local_irq_stosm(0x00);
42 static inline unsigned long arch_local_irq_save(void)
44 return __arch_local_irq_stnsm(0xfc);
47 static inline void arch_local_irq_disable(void)
49 arch_local_irq_save();
52 static inline void arch_local_irq_enable(void)
54 __arch_local_irq_stosm(0x03);
57 static inline void arch_local_irq_restore(unsigned long flags
)
59 __arch_local_irq_ssm(flags
);
62 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
64 return !(flags
& (3UL << (BITS_PER_LONG
- 8)));
67 static inline bool arch_irqs_disabled(void)
69 return arch_irqs_disabled_flags(arch_local_save_flags());
72 #endif /* __ASM_IRQFLAGS_H */