diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-10-30 22:45:07 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-12-04 17:43:14 -0500 |
commit | 0004a9dfeaa709a7f853487aba19932c9b1a87c8 (patch) | |
tree | e9f1f4b1ca897e57f46778cef283617ba83fc855 /include/asm-mips/bitops.h | |
parent | 08f57f7ffe5819e537301b1f1109fa4fc670bfff (diff) |
[MIPS] Cleanup memory barriers for weakly ordered systems.
Also the R4000 / R4600 LL/SC instructions imply a sync so no explicit sync
needed.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips/bitops.h')
-rw-r--r-- | include/asm-mips/bitops.h | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index b9007411b60f..06445de1324b 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (c) 1994 - 1997, 1999, 2000 Ralf Baechle (ralf@gnu.org) | 6 | * Copyright (c) 1994 - 1997, 1999, 2000, 06 Ralf Baechle (ralf@linux-mips.org) |
7 | * Copyright (c) 1999, 2000 Silicon Graphics, Inc. | 7 | * Copyright (c) 1999, 2000 Silicon Graphics, Inc. |
8 | */ | 8 | */ |
9 | #ifndef _ASM_BITOPS_H | 9 | #ifndef _ASM_BITOPS_H |
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/compiler.h> | 12 | #include <linux/compiler.h> |
13 | #include <linux/irqflags.h> | 13 | #include <linux/irqflags.h> |
14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
15 | #include <asm/barrier.h> | ||
15 | #include <asm/bug.h> | 16 | #include <asm/bug.h> |
16 | #include <asm/byteorder.h> /* sigh ... */ | 17 | #include <asm/byteorder.h> /* sigh ... */ |
17 | #include <asm/cpu-features.h> | 18 | #include <asm/cpu-features.h> |
@@ -204,9 +205,6 @@ static inline int test_and_set_bit(unsigned long nr, | |||
204 | " " __SC "%2, %1 \n" | 205 | " " __SC "%2, %1 \n" |
205 | " beqzl %2, 1b \n" | 206 | " beqzl %2, 1b \n" |
206 | " and %2, %0, %3 \n" | 207 | " and %2, %0, %3 \n" |
207 | #ifdef CONFIG_SMP | ||
208 | " sync \n" | ||
209 | #endif | ||
210 | " .set mips0 \n" | 208 | " .set mips0 \n" |
211 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 209 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
212 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 210 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -226,9 +224,6 @@ static inline int test_and_set_bit(unsigned long nr, | |||
226 | " " __SC "%2, %1 \n" | 224 | " " __SC "%2, %1 \n" |
227 | " beqz %2, 1b \n" | 225 | " beqz %2, 1b \n" |
228 | " and %2, %0, %3 \n" | 226 | " and %2, %0, %3 \n" |
229 | #ifdef CONFIG_SMP | ||
230 | " sync \n" | ||
231 | #endif | ||
232 | " .set pop \n" | 227 | " .set pop \n" |
233 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 228 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
234 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 229 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -250,6 +245,8 @@ static inline int test_and_set_bit(unsigned long nr, | |||
250 | 245 | ||
251 | return retval; | 246 | return retval; |
252 | } | 247 | } |
248 | |||
249 | smp_mb(); | ||
253 | } | 250 | } |
254 | 251 | ||
255 | /* | 252 | /* |
@@ -275,9 +272,6 @@ static inline int test_and_clear_bit(unsigned long nr, | |||
275 | " " __SC "%2, %1 \n" | 272 | " " __SC "%2, %1 \n" |
276 | " beqzl %2, 1b \n" | 273 | " beqzl %2, 1b \n" |
277 | " and %2, %0, %3 \n" | 274 | " and %2, %0, %3 \n" |
278 | #ifdef CONFIG_SMP | ||
279 | " sync \n" | ||
280 | #endif | ||
281 | " .set mips0 \n" | 275 | " .set mips0 \n" |
282 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 276 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
283 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 277 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -298,9 +292,6 @@ static inline int test_and_clear_bit(unsigned long nr, | |||
298 | " " __SC "%2, %1 \n" | 292 | " " __SC "%2, %1 \n" |
299 | " beqz %2, 1b \n" | 293 | " beqz %2, 1b \n" |
300 | " and %2, %0, %3 \n" | 294 | " and %2, %0, %3 \n" |
301 | #ifdef CONFIG_SMP | ||
302 | " sync \n" | ||
303 | #endif | ||
304 | " .set pop \n" | 295 | " .set pop \n" |
305 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 296 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
306 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 297 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -322,6 +313,8 @@ static inline int test_and_clear_bit(unsigned long nr, | |||
322 | 313 | ||
323 | return retval; | 314 | return retval; |
324 | } | 315 | } |
316 | |||
317 | smp_mb(); | ||
325 | } | 318 | } |
326 | 319 | ||
327 | /* | 320 | /* |
@@ -346,9 +339,6 @@ static inline int test_and_change_bit(unsigned long nr, | |||
346 | " " __SC "%2, %1 \n" | 339 | " " __SC "%2, %1 \n" |
347 | " beqzl %2, 1b \n" | 340 | " beqzl %2, 1b \n" |
348 | " and %2, %0, %3 \n" | 341 | " and %2, %0, %3 \n" |
349 | #ifdef CONFIG_SMP | ||
350 | " sync \n" | ||
351 | #endif | ||
352 | " .set mips0 \n" | 342 | " .set mips0 \n" |
353 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 343 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
354 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 344 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -368,9 +358,6 @@ static inline int test_and_change_bit(unsigned long nr, | |||
368 | " " __SC "\t%2, %1 \n" | 358 | " " __SC "\t%2, %1 \n" |
369 | " beqz %2, 1b \n" | 359 | " beqz %2, 1b \n" |
370 | " and %2, %0, %3 \n" | 360 | " and %2, %0, %3 \n" |
371 | #ifdef CONFIG_SMP | ||
372 | " sync \n" | ||
373 | #endif | ||
374 | " .set pop \n" | 361 | " .set pop \n" |
375 | : "=&r" (temp), "=m" (*m), "=&r" (res) | 362 | : "=&r" (temp), "=m" (*m), "=&r" (res) |
376 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) | 363 | : "r" (1UL << (nr & SZLONG_MASK)), "m" (*m) |
@@ -391,6 +378,8 @@ static inline int test_and_change_bit(unsigned long nr, | |||
391 | 378 | ||
392 | return retval; | 379 | return retval; |
393 | } | 380 | } |
381 | |||
382 | smp_mb(); | ||
394 | } | 383 | } |
395 | 384 | ||
396 | #include <asm-generic/bitops/non-atomic.h> | 385 | #include <asm-generic/bitops/non-atomic.h> |