]>
Commit | Line | Data |
---|---|---|
1f194a4c | 1 | /* |
428aecf6 HC |
2 | * Copyright IBM Corp. 2006,2010 |
3 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> | |
1f194a4c HC |
4 | */ |
5 | ||
6 | #ifndef __ASM_IRQFLAGS_H | |
7 | #define __ASM_IRQFLAGS_H | |
8 | ||
428aecf6 | 9 | #include <linux/types.h> |
1f194a4c | 10 | |
df9ee292 DH |
11 | /* store then OR system mask. */ |
12 | #define __arch_local_irq_stosm(__or) \ | |
94c12cc7 MS |
13 | ({ \ |
14 | unsigned long __mask; \ | |
15 | asm volatile( \ | |
16 | " stosm %0,%1" \ | |
17 | : "=Q" (__mask) : "i" (__or) : "memory"); \ | |
18 | __mask; \ | |
19 | }) | |
20 | ||
df9ee292 DH |
21 | /* store then AND system mask. */ |
22 | #define __arch_local_irq_stnsm(__and) \ | |
94c12cc7 MS |
23 | ({ \ |
24 | unsigned long __mask; \ | |
25 | asm volatile( \ | |
26 | " stnsm %0,%1" \ | |
27 | : "=Q" (__mask) : "i" (__and) : "memory"); \ | |
28 | __mask; \ | |
29 | }) | |
30 | ||
31 | /* set system mask. */ | |
f433c4ae | 32 | static inline notrace void __arch_local_irq_ssm(unsigned long flags) |
df9ee292 DH |
33 | { |
34 | asm volatile("ssm %0" : : "Q" (flags) : "memory"); | |
35 | } | |
94c12cc7 | 36 | |
f433c4ae | 37 | static inline notrace unsigned long arch_local_save_flags(void) |
94c12cc7 | 38 | { |
df9ee292 | 39 | return __arch_local_irq_stosm(0x00); |
94c12cc7 | 40 | } |
63f4f9e1 | 41 | |
f433c4ae | 42 | static inline notrace unsigned long arch_local_irq_save(void) |
94c12cc7 | 43 | { |
df9ee292 | 44 | return __arch_local_irq_stnsm(0xfc); |
94c12cc7 MS |
45 | } |
46 | ||
f433c4ae | 47 | static inline notrace void arch_local_irq_disable(void) |
df9ee292 DH |
48 | { |
49 | arch_local_irq_save(); | |
50 | } | |
1f194a4c | 51 | |
f433c4ae | 52 | static inline notrace void arch_local_irq_enable(void) |
94c12cc7 | 53 | { |
df9ee292 | 54 | __arch_local_irq_stosm(0x03); |
94c12cc7 | 55 | } |
1f194a4c | 56 | |
f433c4ae | 57 | static inline notrace void arch_local_irq_restore(unsigned long flags) |
df9ee292 DH |
58 | { |
59 | __arch_local_irq_ssm(flags); | |
60 | } | |
61 | ||
f433c4ae | 62 | static inline notrace bool arch_irqs_disabled_flags(unsigned long flags) |
1f194a4c | 63 | { |
94c12cc7 | 64 | return !(flags & (3UL << (BITS_PER_LONG - 8))); |
1f194a4c HC |
65 | } |
66 | ||
f433c4ae | 67 | static inline notrace bool arch_irqs_disabled(void) |
df9ee292 DH |
68 | { |
69 | return arch_irqs_disabled_flags(arch_local_save_flags()); | |
70 | } | |
1f194a4c | 71 | |
1f194a4c | 72 | #endif /* __ASM_IRQFLAGS_H */ |