1 #ifndef _ASM_M32R_SPINLOCK_H
2 #define _ASM_M32R_SPINLOCK_H
12 #include <linux/compiler.h>
28 #define arch_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0)
29 #define arch_spin_lock_flags(lock, flags) arch_spin_lock(lock)
30 #define arch_spin_unlock_wait(x) \
31 do { cpu_relax(); } while (arch_spin_is_locked(x))
43 unsigned long tmp1, tmp2;
54 "# arch_spin_trylock \n\t"
57 "clrpsw #0x40 -> nop; \n\t"
60 "unlock %1, @%3; \n\t"
62 :
"=&r" (oldval),
"=&r" (tmp1),
"=&r" (tmp2)
65 #ifdef CONFIG_CHIP_M32700_TS1
75 unsigned long tmp0,
tmp1;
88 "# arch_spin_lock \n\t"
92 "clrpsw #0x40 -> nop; \n\t"
96 "unlock %0, @%2; \n\t"
106 :
"=&r" (tmp0),
"=&r" (tmp1)
109 #ifdef CONFIG_CHIP_M32700_TS1
144 #define arch_read_can_lock(x) ((int)(x)->lock > 0)
150 #define arch_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS)
154 unsigned long tmp0,
tmp1;
172 "clrpsw #0x40 -> nop; \n\t"
176 "unlock %0, @%2; \n\t"
182 "clrpsw #0x40 -> nop; \n\t"
186 "unlock %0, @%2; \n\t"
194 :
"=&r" (tmp0),
"=&r" (tmp1)
197 #ifdef CONFIG_CHIP_M32700_TS1
205 unsigned long tmp0,
tmp1, tmp2;
225 "clrpsw #0x40 -> nop; \n\t"
229 "unlock %0, @%3; \n\t"
235 "clrpsw #0x40 -> nop; \n\t"
239 "unlock %0, @%3; \n\t"
244 "beq %0, %1, 1b; \n\t"
247 :
"=&r" (tmp0),
"=&r" (tmp1),
"=&r" (tmp2)
250 #ifdef CONFIG_CHIP_M32700_TS1
258 unsigned long tmp0,
tmp1;
263 "clrpsw #0x40 -> nop; \n\t"
267 "unlock %0, @%2; \n\t"
269 :
"=&r" (tmp0),
"=&r" (tmp1)
272 #ifdef CONFIG_CHIP_M32700_TS1
280 unsigned long tmp0,
tmp1, tmp2;
283 "# write_unlock \n\t"
287 "clrpsw #0x40 -> nop; \n\t"
291 "unlock %0, @%3; \n\t"
293 :
"=&r" (tmp0),
"=&r" (tmp1),
"=&r" (tmp2)
296 #ifdef CONFIG_CHIP_M32700_TS1
320 #define arch_read_lock_flags(lock, flags) arch_read_lock(lock)
321 #define arch_write_lock_flags(lock, flags) arch_write_lock(lock)
323 #define arch_spin_relax(lock) cpu_relax()
324 #define arch_read_relax(lock) cpu_relax()
325 #define arch_write_relax(lock) cpu_relax()