Merge tag 'v3.3.7' into 3.3/master
[zen-stable.git] / arch / xtensa / include / asm / irqflags.h
blobdae9a8bdcb1725ce6a38db642fdc777403d354e1
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>
16 static inline unsigned long arch_local_save_flags(void)
18 unsigned long flags;
19 asm volatile("rsr %0,"__stringify(PS) : "=a" (flags));
20 return flags;
23 static inline unsigned long arch_local_irq_save(void)
25 unsigned long flags;
26 asm volatile("rsil %0, "__stringify(LOCKLEVEL)
27 : "=a" (flags) :: "memory");
28 return flags;
31 static inline void arch_local_irq_disable(void)
33 arch_local_irq_save();
36 static inline void arch_local_irq_enable(void)
38 unsigned long flags;
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 */