2 * Copyright (C) 2006 Atmark Techno, Inc.
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
9 #ifndef _ASM_MICROBLAZE_IRQFLAGS_H
10 #define _ASM_MICROBLAZE_IRQFLAGS_H
12 #include <linux/types.h>
13 #include <asm/registers.h>
15 #if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
17 static inline unsigned long arch_local_irq_save(void)
20 asm volatile(" msrclr %0, %1 \n"
28 static inline void arch_local_irq_disable(void)
30 /* this uses r0 without declaring it - is that correct? */
31 asm volatile(" msrclr r0, %0 \n"
38 static inline void arch_local_irq_enable(void)
40 /* this uses r0 without declaring it - is that correct? */
41 asm volatile(" msrset r0, %0 \n"
48 #else /* !CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
50 static inline unsigned long arch_local_irq_save(void)
52 unsigned long flags
, tmp
;
53 asm volatile (" mfs %0, rmsr \n"
58 : "=r"(flags
), "=r"(tmp
)
64 static inline void arch_local_irq_disable(void)
67 asm volatile(" mfs %0, rmsr \n"
77 static inline void arch_local_irq_enable(void)
80 asm volatile(" mfs %0, rmsr \n"
90 #endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
92 static inline unsigned long arch_local_save_flags(void)
95 asm volatile(" mfs %0, rmsr \n"
103 static inline void arch_local_irq_restore(unsigned long flags
)
105 asm volatile(" mts rmsr, %0 \n"
112 static inline bool arch_irqs_disabled_flags(unsigned long flags
)
114 return (flags
& MSR_IE
) == 0;
117 static inline bool arch_irqs_disabled(void)
119 return arch_irqs_disabled_flags(arch_local_save_flags());
122 #endif /* _ASM_MICROBLAZE_IRQFLAGS_H */