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>
16 static inline unsigned long arch_local_save_flags(void)
19 asm volatile("rsr %0,"__stringify(PS
) : "=a" (flags
));
23 static inline unsigned long arch_local_irq_save(void)
26 asm volatile("rsil %0, "__stringify(LOCKLEVEL
)
27 : "=a" (flags
) :: "memory");
31 static inline void arch_local_irq_disable(void)
33 arch_local_irq_save();
36 static inline void arch_local_irq_enable(void)
39 asm volatile("rsil %0, 0" : "=a" (flags
) :: "memory");
42 static inline void arch_local_irq_restore(unsigned long flags
)
44 asm volatile("wsr %0, "__stringify(PS
)" ; rsync"
45 :: "a" (flags
) : "memory");
48 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
50 return (flags
& 0xf) != 0;
53 static inline bool arch_irqs_disabled(void)
55 return arch_irqs_disabled_flags(arch_local_save_flags());
58 #endif /* _XTENSA_IRQFLAGS_H */