Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * include/asm/irqflags.h
0004  *
0005  * IRQ flags handling
0006  *
0007  * This file gets included from lowlevel asm headers too, to provide
0008  * wrapped versions of the local_irq_*() APIs, based on the
0009  * arch_local_irq_*() functions from the lowlevel headers.
0010  */
0011 #ifndef _ASM_IRQFLAGS_H
0012 #define _ASM_IRQFLAGS_H
0013 
0014 #ifndef __ASSEMBLY__
0015 
0016 #include <linux/types.h>
0017 #include <asm/psr.h>
0018 
0019 void arch_local_irq_restore(unsigned long);
0020 unsigned long arch_local_irq_save(void);
0021 void arch_local_irq_enable(void);
0022 
0023 static inline notrace unsigned long arch_local_save_flags(void)
0024 {
0025     unsigned long flags;
0026 
0027     asm volatile("rd        %%psr, %0" : "=r" (flags));
0028     return flags;
0029 }
0030 
0031 static inline notrace void arch_local_irq_disable(void)
0032 {
0033     arch_local_irq_save();
0034 }
0035 
0036 static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
0037 {
0038     return (flags & PSR_PIL) != 0;
0039 }
0040 
0041 static inline notrace bool arch_irqs_disabled(void)
0042 {
0043     return arch_irqs_disabled_flags(arch_local_save_flags());
0044 }
0045 
0046 #endif /* (__ASSEMBLY__) */
0047 
0048 #endif /* !(_ASM_IRQFLAGS_H) */