1 /* SPDX-License-Identifier: GPL-2.0 */
3 * include/asm/irqflags.h
7 * This file gets included from lowlevel asm headers too, to provide
8 * wrapped versions of the local_irq_*() APIs, based on the
9 * arch_local_irq_*() functions from the lowlevel headers.
11 #ifndef _ASM_IRQFLAGS_H
12 #define _ASM_IRQFLAGS_H
18 static inline notrace
unsigned long arch_local_save_flags(void)
30 static inline notrace
void arch_local_irq_restore(unsigned long flags
)
40 static inline notrace
void arch_local_irq_disable(void)
45 : "i" (PIL_NORMAL_MAX
)
50 static inline notrace
void arch_local_irq_enable(void)
60 static inline notrace
int arch_irqs_disabled_flags(unsigned long flags
)
65 static inline notrace
int arch_irqs_disabled(void)
67 return arch_irqs_disabled_flags(arch_local_save_flags());
70 static inline notrace
unsigned long arch_local_irq_save(void)
72 unsigned long flags
, tmp
;
74 /* Disable interrupts to PIL_NORMAL_MAX unless we already
75 * are using PIL_NMI, in which case PIL_NMI is retained.
77 * The only values we ever program into the %pil are 0,
78 * PIL_NORMAL_MAX and PIL_NMI.
80 * Since PIL_NMI is the largest %pil value and all bits are
81 * set in it (0xf), it doesn't matter what PIL_NORMAL_MAX
88 : "=r" (flags
), "=r" (tmp
)
89 : "i" (PIL_NORMAL_MAX
)
96 #endif /* (__ASSEMBLY__) */
98 #endif /* !(_ASM_IRQFLAGS_H) */