16 #include <linux/module.h>
17 #include <asm/processor.h>
18 #include <arch/spr_def.h>
28 while ((my_ticket = __insn_tns((
void *)&lock->next_ticket)) & 1)
29 delay_backoff(iterations++);
35 while ((delta = my_ticket - lock->current_ticket) != 0)
47 int my_ticket = __insn_tns((
void *)&lock->next_ticket);
49 if (my_ticket == lock->current_ticket) {
56 if (!(my_ticket & 1)) {
58 lock->next_ticket = my_ticket;
69 delay_backoff(iterations++);
81 #define WR_NEXT_SHIFT _WR_NEXT_SHIFT
82 #define WR_CURR_SHIFT _WR_CURR_SHIFT
83 #define WR_WIDTH _WR_WIDTH
84 #define WR_MASK ((1 << WR_WIDTH) - 1)
90 #define RD_COUNT_SHIFT _RD_COUNT_SHIFT
91 #define RD_COUNT_WIDTH _RD_COUNT_WIDTH
92 #define RD_COUNT_MASK ((1 << RD_COUNT_WIDTH) - 1)
108 val = __insn_tns((
int *)&rwlock->
lock);
135 delay_backoff(iterations++);
146 val = __insn_tns((
int *)&rwlock->
lock);
147 if (
likely((val & 1) == 0)) {
153 delay_backoff(iterations++);
189 delay_backoff(iterations++);
190 val = __insn_tns((
int *)&rwlock->
lock);
212 while ((val = rwlock->
lock) & 1)
243 val = __insn_tns((
int *)&rwlock->
lock);
251 val = __insn_tns((
int *)&rwlock->
lock);
254 val = __insn_addb(val, mask);
256 val = __insn_mz(eq & mask, val);