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 __raw_local_irq_stosm(__or) \
14 unsigned long __mask; \
17 : "=Q" (__mask) : "i" (__or) : "memory"); \
21 /* store then and system mask. */
22 #define __raw_local_irq_stnsm(__and) \
24 unsigned long __mask; \
27 : "=Q" (__mask) : "i" (__and) : "memory"); \
31 /* set system mask. */
32 #define __raw_local_irq_ssm(__mask) \
34 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \
37 /* interrupt control.. */
38 static inline unsigned long raw_local_irq_enable(void)
40 return __raw_local_irq_stosm(0x03);
43 static inline unsigned long raw_local_irq_disable(void)
45 return __raw_local_irq_stnsm(0xfc);
48 #define raw_local_save_flags(x) \
50 typecheck(unsigned long, x); \
51 (x) = __raw_local_irq_stosm(0x00); \
54 static inline void raw_local_irq_restore(unsigned long flags)
56 __raw_local_irq_ssm(flags);
59 static inline int raw_irqs_disabled_flags(unsigned long flags)
61 return !(flags & (3UL << (BITS_PER_LONG - 8)));
64 /* For spinlocks etc */
65 #define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
67 #endif /* __ASM_IRQFLAGS_H */