diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-08-29 16:40:27 -0400 |
commit | c1b054d03f5b31c33eaa0b267c629b118eaf3790 (patch) | |
tree | 9333907ca767be24fcb3667877242976c3e3c8dd /include/asm-cris/arch-v32/atomic.h | |
parent | 559fb51ba7e66fe298b8355fabde1275b7def35f (diff) | |
parent | bf4e70e54cf31dcca48d279c7f7e71328eebe749 (diff) |
Merge /spare/repo/linux-2.6/
Diffstat (limited to 'include/asm-cris/arch-v32/atomic.h')
-rw-r--r-- | include/asm-cris/arch-v32/atomic.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/asm-cris/arch-v32/atomic.h b/include/asm-cris/arch-v32/atomic.h new file mode 100644 index 000000000000..bbfb7a5ae315 --- /dev/null +++ b/include/asm-cris/arch-v32/atomic.h | |||
@@ -0,0 +1,36 @@ | |||
1 | #ifndef __ASM_CRIS_ARCH_ATOMIC__ | ||
2 | #define __ASM_CRIS_ARCH_ATOMIC__ | ||
3 | |||
4 | #include <asm/system.h> | ||
5 | |||
6 | extern void cris_spin_unlock(void *l, int val); | ||
7 | extern void cris_spin_lock(void *l); | ||
8 | extern int cris_spin_trylock(void* l); | ||
9 | |||
10 | #ifndef CONFIG_SMP | ||
11 | #define cris_atomic_save(addr, flags) local_irq_save(flags); | ||
12 | #define cris_atomic_restore(addr, flags) local_irq_restore(flags); | ||
13 | #else | ||
14 | |||
15 | extern spinlock_t cris_atomic_locks[]; | ||
16 | #define LOCK_COUNT 128 | ||
17 | #define HASH_ADDR(a) (((int)a) & 127) | ||
18 | |||
19 | #define cris_atomic_save(addr, flags) \ | ||
20 | local_irq_save(flags); \ | ||
21 | cris_spin_lock((void*)&cris_atomic_locks[HASH_ADDR(addr)].lock); | ||
22 | |||
23 | #define cris_atomic_restore(addr, flags) \ | ||
24 | { \ | ||
25 | spinlock_t *lock = (void*)&cris_atomic_locks[HASH_ADDR(addr)]; \ | ||
26 | __asm__ volatile ("move.d %1,%0" \ | ||
27 | : "=m" (lock->lock) \ | ||
28 | : "r" (1) \ | ||
29 | : "memory"); \ | ||
30 | local_irq_restore(flags); \ | ||
31 | } | ||
32 | |||
33 | #endif | ||
34 | |||
35 | #endif | ||
36 | |||