1df9ee292SDavid Howells #ifndef __ALPHA_IRQFLAGS_H 2df9ee292SDavid Howells #define __ALPHA_IRQFLAGS_H 3df9ee292SDavid Howells 4*ec221208SDavid Howells #include <asm/pal.h> 5df9ee292SDavid Howells 6df9ee292SDavid Howells #define IPL_MIN 0 7df9ee292SDavid Howells #define IPL_SW0 1 8df9ee292SDavid Howells #define IPL_SW1 2 9df9ee292SDavid Howells #define IPL_DEV0 3 10df9ee292SDavid Howells #define IPL_DEV1 4 11df9ee292SDavid Howells #define IPL_TIMER 5 12df9ee292SDavid Howells #define IPL_PERF 6 13df9ee292SDavid Howells #define IPL_POWERFAIL 6 14df9ee292SDavid Howells #define IPL_MCHECK 7 15df9ee292SDavid Howells #define IPL_MAX 7 16df9ee292SDavid Howells 17df9ee292SDavid Howells #ifdef CONFIG_ALPHA_BROKEN_IRQ_MASK 18df9ee292SDavid Howells #undef IPL_MIN 19df9ee292SDavid Howells #define IPL_MIN __min_ipl 20df9ee292SDavid Howells extern int __min_ipl; 21df9ee292SDavid Howells #endif 22df9ee292SDavid Howells 23df9ee292SDavid Howells #define getipl() (rdps() & 7) 24df9ee292SDavid Howells #define setipl(ipl) ((void) swpipl(ipl)) 25df9ee292SDavid Howells 26df9ee292SDavid Howells static inline unsigned long arch_local_save_flags(void) 27df9ee292SDavid Howells { 28df9ee292SDavid Howells return rdps(); 29df9ee292SDavid Howells } 30df9ee292SDavid Howells 31df9ee292SDavid Howells static inline void arch_local_irq_disable(void) 32df9ee292SDavid Howells { 33df9ee292SDavid Howells setipl(IPL_MAX); 34df9ee292SDavid Howells barrier(); 35df9ee292SDavid Howells } 36df9ee292SDavid Howells 37df9ee292SDavid Howells static inline unsigned long arch_local_irq_save(void) 38df9ee292SDavid Howells { 39df9ee292SDavid Howells unsigned long flags = swpipl(IPL_MAX); 40df9ee292SDavid Howells barrier(); 41df9ee292SDavid Howells return flags; 42df9ee292SDavid Howells } 43df9ee292SDavid Howells 44df9ee292SDavid Howells static inline void arch_local_irq_enable(void) 45df9ee292SDavid Howells { 46df9ee292SDavid Howells barrier(); 47df9ee292SDavid Howells setipl(IPL_MIN); 48df9ee292SDavid Howells } 49df9ee292SDavid Howells 50df9ee292SDavid Howells static inline void arch_local_irq_restore(unsigned long flags) 51df9ee292SDavid Howells { 52df9ee292SDavid Howells barrier(); 53df9ee292SDavid Howells setipl(flags); 54df9ee292SDavid Howells barrier(); 55df9ee292SDavid Howells } 56df9ee292SDavid Howells 57df9ee292SDavid Howells static inline bool arch_irqs_disabled_flags(unsigned long flags) 58df9ee292SDavid Howells { 59df9ee292SDavid Howells return flags == IPL_MAX; 60df9ee292SDavid Howells } 61df9ee292SDavid Howells 62df9ee292SDavid Howells static inline bool arch_irqs_disabled(void) 63df9ee292SDavid Howells { 64df9ee292SDavid Howells return arch_irqs_disabled_flags(getipl()); 65df9ee292SDavid Howells } 66df9ee292SDavid Howells 67df9ee292SDavid Howells #endif /* __ALPHA_IRQFLAGS_H */ 68