2 * include/asm-s390/irqflags.h
4 * Copyright (C) IBM Corp. 2006
5 * Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
8 #ifndef __ASM_IRQFLAGS_H
9 #define __ASM_IRQFLAGS_H
13 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
15 /* store then or system mask. */
16 #define __raw_local_irq_stosm(__or) \
18 unsigned long __mask; \
21 : "=Q" (__mask) : "i" (__or) : "memory"); \
25 /* store then and system mask. */
26 #define __raw_local_irq_stnsm(__and) \
28 unsigned long __mask; \
31 : "=Q" (__mask) : "i" (__and) : "memory"); \
35 /* set system mask. */
36 #define __raw_local_irq_ssm(__mask) \
38 asm volatile("ssm %0" : : "Q" (__mask) : "memory"); \
43 /* store then or system mask. */
44 #define __raw_local_irq_stosm(__or) \
46 unsigned long __mask; \
50 : "a" (&__mask), "i" (__or) : "memory"); \
54 /* store then and system mask. */
55 #define __raw_local_irq_stnsm(__and) \
57 unsigned long __mask; \
61 : "a" (&__mask), "i" (__and) : "memory"); \
65 /* set system mask. */
66 #define __raw_local_irq_ssm(__mask) \
70 : : "a" (&__mask), "m" (__mask) : "memory"); \
75 /* interrupt control.. */
76 static inline unsigned long raw_local_irq_enable(void)
78 return __raw_local_irq_stosm(0x03);
81 static inline unsigned long raw_local_irq_disable(void)
83 return __raw_local_irq_stnsm(0xfc);
86 #define raw_local_save_flags(x) \
88 typecheck(unsigned long, x); \
89 (x) = __raw_local_irq_stosm(0x00); \
92 static inline void raw_local_irq_restore(unsigned long flags)
94 __raw_local_irq_ssm(flags);
97 static inline int raw_irqs_disabled_flags(unsigned long flags)
99 return !(flags & (3UL << (BITS_PER_LONG - 8)));
102 /* For spinlocks etc */
103 #define raw_local_irq_save(x) ((x) = raw_local_irq_disable())
105 #endif /* __KERNEL__ */
106 #endif /* __ASM_IRQFLAGS_H */