Linux 2.6.35-rc2
[linux/fpc-iii.git] / arch / microblaze / include / asm / irqflags.h
blob2c38c6d801769be469348fa80f4ef3283aab44e2
1 /*
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
6 * for more details.
7 */
9 #ifndef _ASM_MICROBLAZE_IRQFLAGS_H
10 #define _ASM_MICROBLAZE_IRQFLAGS_H
12 #include <linux/irqflags.h>
13 #include <asm/registers.h>
15 # if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
17 # define raw_local_irq_save(flags) \
18 do { \
19 asm volatile (" msrclr %0, %1; \
20 nop;" \
21 : "=r"(flags) \
22 : "i"(MSR_IE) \
23 : "memory"); \
24 } while (0)
26 # define raw_local_irq_disable() \
27 do { \
28 asm volatile (" msrclr r0, %0; \
29 nop;" \
30 : \
31 : "i"(MSR_IE) \
32 : "memory"); \
33 } while (0)
35 # define raw_local_irq_enable() \
36 do { \
37 asm volatile (" msrset r0, %0; \
38 nop;" \
39 : \
40 : "i"(MSR_IE) \
41 : "memory"); \
42 } while (0)
44 # else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */
46 # define raw_local_irq_save(flags) \
47 do { \
48 register unsigned tmp; \
49 asm volatile (" mfs %0, rmsr; \
50 nop; \
51 andi %1, %0, %2; \
52 mts rmsr, %1; \
53 nop;" \
54 : "=r"(flags), "=r" (tmp) \
55 : "i"(~MSR_IE) \
56 : "memory"); \
57 } while (0)
59 # define raw_local_irq_disable() \
60 do { \
61 register unsigned tmp; \
62 asm volatile (" mfs %0, rmsr; \
63 nop; \
64 andi %0, %0, %1; \
65 mts rmsr, %0; \
66 nop;" \
67 : "=r"(tmp) \
68 : "i"(~MSR_IE) \
69 : "memory"); \
70 } while (0)
72 # define raw_local_irq_enable() \
73 do { \
74 register unsigned tmp; \
75 asm volatile (" mfs %0, rmsr; \
76 nop; \
77 ori %0, %0, %1; \
78 mts rmsr, %0; \
79 nop;" \
80 : "=r"(tmp) \
81 : "i"(MSR_IE) \
82 : "memory"); \
83 } while (0)
85 # endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
87 #define raw_local_irq_restore(flags) \
88 do { \
89 asm volatile (" mts rmsr, %0; \
90 nop;" \
91 : \
92 : "r"(flags) \
93 : "memory"); \
94 } while (0)
96 static inline unsigned long get_msr(void)
98 unsigned long flags;
99 asm volatile (" mfs %0, rmsr; \
100 nop;" \
101 : "=r"(flags) \
103 : "memory"); \
104 return flags;
107 #define raw_local_save_flags(flags) ((flags) = get_msr())
108 #define raw_irqs_disabled() ((get_msr() & MSR_IE) == 0)
109 #define raw_irqs_disabled_flags(flags) ((flags & MSR_IE) == 0)
111 #endif /* _ASM_MICROBLAZE_IRQFLAGS_H */