WIP FPC-III support
[linux/fpc-iii.git] / arch / alpha / include / asm / irqflags.h
blob9f25d4e0d37eac738fa38d4bd501bce89f268185
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ALPHA_IRQFLAGS_H
3 #define __ALPHA_IRQFLAGS_H
5 #include <asm/pal.h>
7 #define IPL_MIN 0
8 #define IPL_SW0 1
9 #define IPL_SW1 2
10 #define IPL_DEV0 3
11 #define IPL_DEV1 4
12 #define IPL_TIMER 5
13 #define IPL_PERF 6
14 #define IPL_POWERFAIL 6
15 #define IPL_MCHECK 7
16 #define IPL_MAX 7
18 #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
19 #undef IPL_MIN
20 #define IPL_MIN __min_ipl
21 extern int __min_ipl;
22 #endif
24 #define getipl() (rdps() & 7)
25 #define setipl(ipl) ((void) swpipl(ipl))
27 static inline unsigned long arch_local_save_flags(void)
29 return rdps();
32 static inline void arch_local_irq_disable(void)
34 setipl(IPL_MAX);
35 barrier();
38 static inline unsigned long arch_local_irq_save(void)
40 unsigned long flags = swpipl(IPL_MAX);
41 barrier();
42 return flags;
45 static inline void arch_local_irq_enable(void)
47 barrier();
48 setipl(IPL_MIN);
51 static inline void arch_local_irq_restore(unsigned long flags)
53 barrier();
54 setipl(flags);
55 barrier();
58 static inline bool arch_irqs_disabled_flags(unsigned long flags)
60 return flags == IPL_MAX;
63 static inline bool arch_irqs_disabled(void)
65 return arch_irqs_disabled_flags(getipl());
68 #endif /* __ALPHA_IRQFLAGS_H */