51533b615e
New CRIS sub architecture named v32. From: Dave Jones <davej@redhat.com> Fix swapped kmalloc args Signed-off-by: Mikael Starvik <starvik@axis.com> Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
36 lines
895 B
C
36 lines
895 B
C
#ifndef __ASM_CRIS_ARCH_ATOMIC__
|
|
#define __ASM_CRIS_ARCH_ATOMIC__
|
|
|
|
#include <asm/system.h>
|
|
|
|
extern void cris_spin_unlock(void *l, int val);
|
|
extern void cris_spin_lock(void *l);
|
|
extern int cris_spin_trylock(void* l);
|
|
|
|
#ifndef CONFIG_SMP
|
|
#define cris_atomic_save(addr, flags) local_irq_save(flags);
|
|
#define cris_atomic_restore(addr, flags) local_irq_restore(flags);
|
|
#else
|
|
|
|
extern spinlock_t cris_atomic_locks[];
|
|
#define LOCK_COUNT 128
|
|
#define HASH_ADDR(a) (((int)a) & 127)
|
|
|
|
#define cris_atomic_save(addr, flags) \
|
|
local_irq_save(flags); \
|
|
cris_spin_lock((void*)&cris_atomic_locks[HASH_ADDR(addr)].lock);
|
|
|
|
#define cris_atomic_restore(addr, flags) \
|
|
{ \
|
|
spinlock_t *lock = (void*)&cris_atomic_locks[HASH_ADDR(addr)]; \
|
|
__asm__ volatile ("move.d %1,%0" \
|
|
: "=m" (lock->lock) \
|
|
: "r" (1) \
|
|
: "memory"); \
|
|
local_irq_restore(flags); \
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|