]> git.ipfire.org Git - thirdparty/kernel/linux.git/blame - arch/sparc/include/asm/irqflags_32.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[thirdparty/kernel/linux.git] / arch / sparc / include / asm / irqflags_32.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
f5e706ad 2/*
a439fe51 3 * include/asm/irqflags.h
f5e706ad
SR
4 *
5 * IRQ flags handling
6 *
7 * This file gets included from lowlevel asm headers too, to provide
8 * wrapped versions of the local_irq_*() APIs, based on the
df9ee292 9 * arch_local_irq_*() functions from the lowlevel headers.
f5e706ad
SR
10 */
11#ifndef _ASM_IRQFLAGS_H
12#define _ASM_IRQFLAGS_H
13
14#ifndef __ASSEMBLY__
15
df9ee292 16#include <linux/types.h>
d550bbd4 17#include <asm/psr.h>
f5e706ad 18
f05a6865
SR
19void arch_local_irq_restore(unsigned long);
20unsigned long arch_local_irq_save(void);
21void arch_local_irq_enable(void);
df9ee292 22
18d85bc5 23static inline notrace unsigned long arch_local_save_flags(void)
f5e706ad 24{
df9ee292
DH
25 unsigned long flags;
26
27 asm volatile("rd %%psr, %0" : "=r" (flags));
28 return flags;
29}
f5e706ad 30
18d85bc5 31static inline notrace void arch_local_irq_disable(void)
df9ee292
DH
32{
33 arch_local_irq_save();
f5e706ad
SR
34}
35
18d85bc5 36static inline notrace bool arch_irqs_disabled_flags(unsigned long flags)
df9ee292
DH
37{
38 return (flags & PSR_PIL) != 0;
39}
f5e706ad 40
18d85bc5 41static inline notrace bool arch_irqs_disabled(void)
f5e706ad 42{
df9ee292 43 return arch_irqs_disabled_flags(arch_local_save_flags());
f5e706ad
SR
44}
45
46#endif /* (__ASSEMBLY__) */
47
48#endif /* !(_ASM_IRQFLAGS_H) */