Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ALPHA_IRQFLAGS_H
0003 #define __ALPHA_IRQFLAGS_H
0004 
0005 #include <asm/pal.h>
0006 
0007 #define IPL_MIN     0
0008 #define IPL_SW0     1
0009 #define IPL_SW1     2
0010 #define IPL_DEV0    3
0011 #define IPL_DEV1    4
0012 #define IPL_TIMER   5
0013 #define IPL_PERF    6
0014 #define IPL_POWERFAIL   6
0015 #define IPL_MCHECK  7
0016 #define IPL_MAX     7
0017 
0018 #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK
0019 #undef IPL_MIN
0020 #define IPL_MIN     __min_ipl
0021 extern int __min_ipl;
0022 #endif
0023 
0024 #define getipl()        (rdps() & 7)
0025 #define setipl(ipl)     ((void) swpipl(ipl))
0026 
0027 static inline unsigned long arch_local_save_flags(void)
0028 {
0029     return rdps();
0030 }
0031 
0032 static inline void arch_local_irq_disable(void)
0033 {
0034     setipl(IPL_MAX);
0035     barrier();
0036 }
0037 
0038 static inline unsigned long arch_local_irq_save(void)
0039 {
0040     unsigned long flags = swpipl(IPL_MAX);
0041     barrier();
0042     return flags;
0043 }
0044 
0045 static inline void arch_local_irq_enable(void)
0046 {
0047     barrier();
0048     setipl(IPL_MIN);
0049 }
0050 
0051 static inline void arch_local_irq_restore(unsigned long flags)
0052 {
0053     barrier();
0054     setipl(flags);
0055     barrier();
0056 }
0057 
0058 static inline bool arch_irqs_disabled_flags(unsigned long flags)
0059 {
0060     return flags == IPL_MAX;
0061 }
0062 
0063 static inline bool arch_irqs_disabled(void)
0064 {
0065     return arch_irqs_disabled_flags(getipl());
0066 }
0067 
0068 #endif /* __ALPHA_IRQFLAGS_H */