2 * Xtensa IRQ flags handling functions
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
11 #ifndef _XTENSA_IRQFLAGS_H
12 #define _XTENSA_IRQFLAGS_H
14 #include <linux/types.h>
15 #include <asm/processor.h>
17 static inline unsigned long arch_local_save_flags(void)
20 asm volatile("rsr %0,"__stringify(PS
) : "=a" (flags
));
24 static inline unsigned long arch_local_irq_save(void)
27 asm volatile("rsil %0, "__stringify(LOCKLEVEL
)
28 : "=a" (flags
) :: "memory");
32 static inline void arch_local_irq_disable(void)
34 arch_local_irq_save();
37 static inline void arch_local_irq_enable(void)
40 asm volatile("rsil %0, 0" : "=a" (flags
) :: "memory");
43 static inline void arch_local_irq_restore(unsigned long flags
)
45 asm volatile("wsr %0, "__stringify(PS
)" ; rsync"
46 :: "a" (flags
) : "memory");
49 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
51 return (flags
& 0xf) != 0;
54 static inline bool arch_irqs_disabled(void)
56 return arch_irqs_disabled_flags(arch_local_save_flags());
59 #endif /* _XTENSA_IRQFLAGS_H */