diff options
Diffstat (limited to 'arch/mn10300/include/asm/system.h')
-rw-r--r-- | arch/mn10300/include/asm/system.h | 109 |
1 files changed, 1 insertions, 108 deletions
diff --git a/arch/mn10300/include/asm/system.h b/arch/mn10300/include/asm/system.h index 3636c054dcd5..9f7c7e17c01e 100644 --- a/arch/mn10300/include/asm/system.h +++ b/arch/mn10300/include/asm/system.h | |||
@@ -17,6 +17,7 @@ | |||
17 | #ifndef __ASSEMBLY__ | 17 | #ifndef __ASSEMBLY__ |
18 | 18 | ||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/irqflags.h> | ||
20 | 21 | ||
21 | struct task_struct; | 22 | struct task_struct; |
22 | struct thread_struct; | 23 | struct thread_struct; |
@@ -81,114 +82,6 @@ do { \ | |||
81 | 82 | ||
82 | /*****************************************************************************/ | 83 | /*****************************************************************************/ |
83 | /* | 84 | /* |
84 | * interrupt control | ||
85 | * - "disabled": run in IM1/2 | ||
86 | * - level 0 - GDB stub | ||
87 | * - level 1 - virtual serial DMA (if present) | ||
88 | * - level 5 - normal interrupt priority | ||
89 | * - level 6 - timer interrupt | ||
90 | * - "enabled": run in IM7 | ||
91 | */ | ||
92 | #ifdef CONFIG_MN10300_TTYSM | ||
93 | #define MN10300_CLI_LEVEL EPSW_IM_2 | ||
94 | #else | ||
95 | #define MN10300_CLI_LEVEL EPSW_IM_1 | ||
96 | #endif | ||
97 | |||
98 | #define local_save_flags(x) \ | ||
99 | do { \ | ||
100 | typecheck(unsigned long, x); \ | ||
101 | asm volatile( \ | ||
102 | " mov epsw,%0 \n" \ | ||
103 | : "=d"(x) \ | ||
104 | ); \ | ||
105 | } while (0) | ||
106 | |||
107 | #define local_irq_disable() \ | ||
108 | do { \ | ||
109 | asm volatile( \ | ||
110 | " and %0,epsw \n" \ | ||
111 | " or %1,epsw \n" \ | ||
112 | " nop \n" \ | ||
113 | " nop \n" \ | ||
114 | " nop \n" \ | ||
115 | : \ | ||
116 | : "i"(~EPSW_IM), "i"(EPSW_IE | MN10300_CLI_LEVEL) \ | ||
117 | ); \ | ||
118 | } while (0) | ||
119 | |||
120 | #define local_irq_save(x) \ | ||
121 | do { \ | ||
122 | local_save_flags(x); \ | ||
123 | local_irq_disable(); \ | ||
124 | } while (0) | ||
125 | |||
126 | /* | ||
127 | * we make sure local_irq_enable() doesn't cause priority inversion | ||
128 | */ | ||
129 | #ifndef __ASSEMBLY__ | ||
130 | |||
131 | extern unsigned long __mn10300_irq_enabled_epsw; | ||
132 | |||
133 | #endif | ||
134 | |||
135 | #define local_irq_enable() \ | ||
136 | do { \ | ||
137 | unsigned long tmp; \ | ||
138 | \ | ||
139 | asm volatile( \ | ||
140 | " mov epsw,%0 \n" \ | ||
141 | " and %1,%0 \n" \ | ||
142 | " or %2,%0 \n" \ | ||
143 | " mov %0,epsw \n" \ | ||
144 | : "=&d"(tmp) \ | ||
145 | : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw) \ | ||
146 | : "cc" \ | ||
147 | ); \ | ||
148 | } while (0) | ||
149 | |||
150 | #define local_irq_restore(x) \ | ||
151 | do { \ | ||
152 | typecheck(unsigned long, x); \ | ||
153 | asm volatile( \ | ||
154 | " mov %0,epsw \n" \ | ||
155 | " nop \n" \ | ||
156 | " nop \n" \ | ||
157 | " nop \n" \ | ||
158 | : \ | ||
159 | : "d"(x) \ | ||
160 | : "memory", "cc" \ | ||
161 | ); \ | ||
162 | } while (0) | ||
163 | |||
164 | #define irqs_disabled() \ | ||
165 | ({ \ | ||
166 | unsigned long flags; \ | ||
167 | local_save_flags(flags); \ | ||
168 | (flags & EPSW_IM) <= MN10300_CLI_LEVEL; \ | ||
169 | }) | ||
170 | |||
171 | /* hook to save power by halting the CPU | ||
172 | * - called from the idle loop | ||
173 | * - must reenable interrupts (which takes three instruction cycles to complete) | ||
174 | */ | ||
175 | #define safe_halt() \ | ||
176 | do { \ | ||
177 | asm volatile(" or %0,epsw \n" \ | ||
178 | " nop \n" \ | ||
179 | " nop \n" \ | ||
180 | " bset %2,(%1) \n" \ | ||
181 | : \ | ||
182 | : "i"(EPSW_IE|EPSW_IM), "n"(&CPUM), "i"(CPUM_SLEEP)\ | ||
183 | : "cc" \ | ||
184 | ); \ | ||
185 | } while (0) | ||
186 | |||
187 | #define STI or EPSW_IE|EPSW_IM,epsw | ||
188 | #define CLI and ~EPSW_IM,epsw; or EPSW_IE|MN10300_CLI_LEVEL,epsw; nop; nop; nop | ||
189 | |||
190 | /*****************************************************************************/ | ||
191 | /* | ||
192 | * MN10300 doesn't actually have an exchange instruction | 85 | * MN10300 doesn't actually have an exchange instruction |
193 | */ | 86 | */ |
194 | #ifndef __ASSEMBLY__ | 87 | #ifndef __ASSEMBLY__ |