Merge branch 'akpm'
[linux-2.6/next.git] / arch / xtensa / include / asm / irqflags.h
blob6015371be49e27281463556512d8318047a474a1
1 /*
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
6 * for more details.
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 */
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)
19 unsigned long flags;
20 asm volatile("rsr %0,"__stringify(PS) : "=a" (flags));
21 return flags;
24 static inline unsigned long arch_local_irq_save(void)
26 unsigned long flags;
27 asm volatile("rsil %0, "__stringify(LOCKLEVEL)
28 : "=a" (flags) :: "memory");
29 return flags;
32 static inline void arch_local_irq_disable(void)
34 arch_local_irq_save();
37 static inline void arch_local_irq_enable(void)
39 unsigned long flags;
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 */