1a439fe51SSam Ravnborg /* 2a439fe51SSam Ravnborg * include/asm/irqflags.h 3a439fe51SSam Ravnborg * 4a439fe51SSam Ravnborg * IRQ flags handling 5a439fe51SSam Ravnborg * 6a439fe51SSam Ravnborg * This file gets included from lowlevel asm headers too, to provide 7a439fe51SSam Ravnborg * wrapped versions of the local_irq_*() APIs, based on the 8df9ee292SDavid Howells * arch_local_irq_*() functions from the lowlevel headers. 9a439fe51SSam Ravnborg */ 10a439fe51SSam Ravnborg #ifndef _ASM_IRQFLAGS_H 11a439fe51SSam Ravnborg #define _ASM_IRQFLAGS_H 12a439fe51SSam Ravnborg 13a439fe51SSam Ravnborg #ifndef __ASSEMBLY__ 14a439fe51SSam Ravnborg 15df9ee292SDavid Howells #include <linux/types.h> 16*d550bbd4SDavid Howells #include <asm/psr.h> 17a439fe51SSam Ravnborg 18df9ee292SDavid Howells extern void arch_local_irq_restore(unsigned long); 19df9ee292SDavid Howells extern unsigned long arch_local_irq_save(void); 20df9ee292SDavid Howells extern void arch_local_irq_enable(void); 21df9ee292SDavid Howells 2218d85bc5SSteven Rostedt static inline notrace unsigned long arch_local_save_flags(void) 23a439fe51SSam Ravnborg { 24df9ee292SDavid Howells unsigned long flags; 25a439fe51SSam Ravnborg 26df9ee292SDavid Howells asm volatile("rd %%psr, %0" : "=r" (flags)); 27df9ee292SDavid Howells return flags; 28a439fe51SSam Ravnborg } 29a439fe51SSam Ravnborg 3018d85bc5SSteven Rostedt static inline notrace void arch_local_irq_disable(void) 31a439fe51SSam Ravnborg { 32df9ee292SDavid Howells arch_local_irq_save(); 33df9ee292SDavid Howells } 34df9ee292SDavid Howells 3518d85bc5SSteven Rostedt static inline notrace bool arch_irqs_disabled_flags(unsigned long flags) 36df9ee292SDavid Howells { 37df9ee292SDavid Howells return (flags & PSR_PIL) != 0; 38df9ee292SDavid Howells } 39df9ee292SDavid Howells 4018d85bc5SSteven Rostedt static inline notrace bool arch_irqs_disabled(void) 41df9ee292SDavid Howells { 42df9ee292SDavid Howells return arch_irqs_disabled_flags(arch_local_save_flags()); 43a439fe51SSam Ravnborg } 44a439fe51SSam Ravnborg 45a439fe51SSam Ravnborg #endif /* (__ASSEMBLY__) */ 46a439fe51SSam Ravnborg 47a439fe51SSam Ravnborg #endif /* !(_ASM_IRQFLAGS_H) */ 48