]>
Commit | Line | Data |
---|---|---|
1f194a4c | 1 | /* |
a53c8fab | 2 | * Copyright IBM Corp. 2006, 2010 |
428aecf6 | 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 | |
204ee2c5 CB |
11 | #define ARCH_IRQ_ENABLED (3UL << (BITS_PER_LONG - 8)) |
12 | ||
df9ee292 DH |
13 | /* store then OR system mask. */ |
14 | #define __arch_local_irq_stosm(__or) \ | |
94c12cc7 MS |
15 | ({ \ |
16 | unsigned long __mask; \ | |
17 | asm volatile( \ | |
18 | " stosm %0,%1" \ | |
19 | : "=Q" (__mask) : "i" (__or) : "memory"); \ | |
20 | __mask; \ | |
21 | }) | |
22 | ||
df9ee292 DH |
23 | /* store then AND system mask. */ |
24 | #define __arch_local_irq_stnsm(__and) \ | |
94c12cc7 MS |
25 | ({ \ |
26 | unsigned long __mask; \ | |
27 | asm volatile( \ | |
28 | " stnsm %0,%1" \ | |
29 | : "=Q" (__mask) : "i" (__and) : "memory"); \ | |
30 | __mask; \ | |
31 | }) | |
32 | ||
33 | /* set system mask. */ | |
f433c4ae | 34 | static inline notrace void __arch_local_irq_ssm(unsigned long flags) |
df9ee292 DH |
35 | { |
36 | asm volatile("ssm %0" : : "Q" (flags) : "memory"); | |
37 | } | |
94c12cc7 | 38 | |
f433c4ae | 39 | static inline notrace unsigned long arch_local_save_flags(void) |
94c12cc7 | 40 | { |
81fc77fb | 41 | return __arch_local_irq_stnsm(0xff); |
94c12cc7 | 42 | } |
63f4f9e1 | 43 | |
f433c4ae | 44 | static inline notrace unsigned long arch_local_irq_save(void) |
94c12cc7 | 45 | { |
df9ee292 | 46 | return __arch_local_irq_stnsm(0xfc); |
94c12cc7 MS |
47 | } |
48 | ||
f433c4ae | 49 | static inline notrace void arch_local_irq_disable(void) |
df9ee292 DH |
50 | { |
51 | arch_local_irq_save(); | |
52 | } | |
1f194a4c | 53 | |
f433c4ae | 54 | static inline notrace void arch_local_irq_enable(void) |
94c12cc7 | 55 | { |
df9ee292 | 56 | __arch_local_irq_stosm(0x03); |
94c12cc7 | 57 | } |
1f194a4c | 58 | |
204ee2c5 | 59 | /* This only restores external and I/O interrupt state */ |
f433c4ae | 60 | static inline notrace void arch_local_irq_restore(unsigned long flags) |
df9ee292 | 61 | { |
204ee2c5 CB |
62 | /* only disabled->disabled and disabled->enabled is valid */ |
63 | if (flags & ARCH_IRQ_ENABLED) | |
64 | arch_local_irq_enable(); | |
df9ee292 DH |
65 | } |
66 | ||
f433c4ae | 67 | static inline notrace bool arch_irqs_disabled_flags(unsigned long flags) |
1f194a4c | 68 | { |
204ee2c5 | 69 | return !(flags & ARCH_IRQ_ENABLED); |
1f194a4c HC |
70 | } |
71 | ||
f433c4ae | 72 | static inline notrace bool arch_irqs_disabled(void) |
df9ee292 DH |
73 | { |
74 | return arch_irqs_disabled_flags(arch_local_save_flags()); | |
75 | } | |
1f194a4c | 76 | |
1f194a4c | 77 | #endif /* __ASM_IRQFLAGS_H */ |