diff options
Diffstat (limited to 'include/asm-mips/hazards.h')
-rw-r--r-- | include/asm-mips/hazards.h | 58 |
1 files changed, 47 insertions, 11 deletions
diff --git a/include/asm-mips/hazards.h b/include/asm-mips/hazards.h index f524eaccd5f1..7517189e469f 100644 --- a/include/asm-mips/hazards.h +++ b/include/asm-mips/hazards.h | |||
@@ -74,7 +74,8 @@ | |||
74 | #define irq_disable_hazard | 74 | #define irq_disable_hazard |
75 | _ehb | 75 | _ehb |
76 | 76 | ||
77 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) | 77 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \ |
78 | defined(CONFIG_CPU_SB1) | ||
78 | 79 | ||
79 | /* | 80 | /* |
80 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. | 81 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. |
@@ -107,6 +108,7 @@ __asm__( | |||
107 | " .endm \n\t"); | 108 | " .endm \n\t"); |
108 | 109 | ||
109 | #ifdef CONFIG_CPU_RM9000 | 110 | #ifdef CONFIG_CPU_RM9000 |
111 | |||
110 | /* | 112 | /* |
111 | * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent | 113 | * RM9000 hazards. When the JTLB is updated by tlbwi or tlbwr, a subsequent |
112 | * use of the JTLB for instructions should not occur for 4 cpu cycles and use | 114 | * use of the JTLB for instructions should not occur for 4 cpu cycles and use |
@@ -124,6 +126,9 @@ __asm__( | |||
124 | ".set\tmips32\n\t" \ | 126 | ".set\tmips32\n\t" \ |
125 | "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \ | 127 | "_ssnop; _ssnop; _ssnop; _ssnop\n\t" \ |
126 | ".set\tmips0") | 128 | ".set\tmips0") |
129 | |||
130 | #define back_to_back_c0_hazard() do { } while (0) | ||
131 | |||
127 | #else | 132 | #else |
128 | 133 | ||
129 | /* | 134 | /* |
@@ -144,15 +149,13 @@ __asm__( | |||
144 | #endif | 149 | #endif |
145 | 150 | ||
146 | /* | 151 | /* |
147 | * mtc0->mfc0 hazard | 152 | * Interrupt enable/disable hazards |
148 | * The 24K has a 2 cycle mtc0/mfc0 execution hazard. | 153 | * Some processors have hazards when modifying |
149 | * It is a MIPS32R2 processor so ehb will clear the hazard. | 154 | * the status register to change the interrupt state |
150 | */ | 155 | */ |
151 | 156 | ||
152 | #ifdef CONFIG_CPU_MIPSR2 | 157 | #ifdef CONFIG_CPU_MIPSR2 |
153 | /* | 158 | |
154 | * Use a macro for ehb unless explicit support for MIPSR2 is enabled | ||
155 | */ | ||
156 | __asm__( | 159 | __asm__( |
157 | " .macro\tirq_enable_hazard \n\t" | 160 | " .macro\tirq_enable_hazard \n\t" |
158 | " _ehb \n\t" | 161 | " _ehb \n\t" |
@@ -160,17 +163,26 @@ __asm__( | |||
160 | " \n\t" | 163 | " \n\t" |
161 | " .macro\tirq_disable_hazard \n\t" | 164 | " .macro\tirq_disable_hazard \n\t" |
162 | " _ehb \n\t" | 165 | " _ehb \n\t" |
166 | " .endm \n\t" | ||
167 | " \n\t" | ||
168 | " .macro\tback_to_back_c0_hazard \n\t" | ||
169 | " _ehb \n\t" | ||
163 | " .endm"); | 170 | " .endm"); |
164 | 171 | ||
165 | #define irq_enable_hazard() \ | 172 | #define irq_enable_hazard() \ |
166 | __asm__ __volatile__( \ | 173 | __asm__ __volatile__( \ |
167 | "_ehb\t\t\t\t# irq_enable_hazard") | 174 | "irq_enable_hazard") |
168 | 175 | ||
169 | #define irq_disable_hazard() \ | 176 | #define irq_disable_hazard() \ |
170 | __asm__ __volatile__( \ | 177 | __asm__ __volatile__( \ |
171 | "_ehb\t\t\t\t# irq_disable_hazard") | 178 | "irq_disable_hazard") |
179 | |||
180 | #define back_to_back_c0_hazard() \ | ||
181 | __asm__ __volatile__( \ | ||
182 | "back_to_back_c0_hazard") | ||
172 | 183 | ||
173 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) | 184 | #elif defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_RM9000) || \ |
185 | defined(CONFIG_CPU_SB1) | ||
174 | 186 | ||
175 | /* | 187 | /* |
176 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. | 188 | * R10000 rocks - all hazards handled in hardware, so this becomes a nobrainer. |
@@ -186,6 +198,8 @@ __asm__( | |||
186 | #define irq_enable_hazard() do { } while (0) | 198 | #define irq_enable_hazard() do { } while (0) |
187 | #define irq_disable_hazard() do { } while (0) | 199 | #define irq_disable_hazard() do { } while (0) |
188 | 200 | ||
201 | #define back_to_back_c0_hazard() do { } while (0) | ||
202 | |||
189 | #else | 203 | #else |
190 | 204 | ||
191 | /* | 205 | /* |
@@ -208,10 +222,32 @@ __asm__( | |||
208 | #define irq_enable_hazard() do { } while (0) | 222 | #define irq_enable_hazard() do { } while (0) |
209 | #define irq_disable_hazard() \ | 223 | #define irq_disable_hazard() \ |
210 | __asm__ __volatile__( \ | 224 | __asm__ __volatile__( \ |
211 | "_ssnop; _ssnop; _ssnop;\t\t# irq_disable_hazard") | 225 | "irq_disable_hazard") |
226 | |||
227 | #define back_to_back_c0_hazard() \ | ||
228 | __asm__ __volatile__( \ | ||
229 | " .set noreorder \n" \ | ||
230 | " nop; nop; nop \n" \ | ||
231 | " .set reorder \n") | ||
212 | 232 | ||
213 | #endif | 233 | #endif |
214 | 234 | ||
235 | #ifdef CONFIG_CPU_MIPSR2 | ||
236 | #define instruction_hazard() \ | ||
237 | do { \ | ||
238 | __label__ __next; \ | ||
239 | __asm__ __volatile__( \ | ||
240 | " jr.hb %0 \n" \ | ||
241 | : \ | ||
242 | : "r" (&&__next)); \ | ||
243 | __next: \ | ||
244 | ; \ | ||
245 | } while (0) | ||
246 | |||
247 | #else | ||
248 | #define instruction_hazard() do { } while (0) | ||
249 | #endif | ||
250 | |||
215 | #endif /* __ASSEMBLY__ */ | 251 | #endif /* __ASSEMBLY__ */ |
216 | 252 | ||
217 | #endif /* _ASM_HAZARDS_H */ | 253 | #endif /* _ASM_HAZARDS_H */ |