diff options
Diffstat (limited to 'arch/powerpc/include/asm/bitops.h')
-rw-r--r-- | arch/powerpc/include/asm/bitops.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h index 59abc620f8e8..73eb794d6163 100644 --- a/arch/powerpc/include/asm/bitops.h +++ b/arch/powerpc/include/asm/bitops.h | |||
@@ -154,6 +154,34 @@ static __inline__ int test_and_change_bit(unsigned long nr, | |||
154 | return test_and_change_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0; | 154 | return test_and_change_bits(BIT_MASK(nr), addr + BIT_WORD(nr)) != 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | #ifdef CONFIG_PPC64 | ||
158 | static __inline__ unsigned long clear_bit_unlock_return_word(int nr, | ||
159 | volatile unsigned long *addr) | ||
160 | { | ||
161 | unsigned long old, t; | ||
162 | unsigned long *p = (unsigned long *)addr + BIT_WORD(nr); | ||
163 | unsigned long mask = BIT_MASK(nr); | ||
164 | |||
165 | __asm__ __volatile__ ( | ||
166 | PPC_RELEASE_BARRIER | ||
167 | "1:" PPC_LLARX(%0,0,%3,0) "\n" | ||
168 | "andc %1,%0,%2\n" | ||
169 | PPC405_ERR77(0,%3) | ||
170 | PPC_STLCX "%1,0,%3\n" | ||
171 | "bne- 1b\n" | ||
172 | : "=&r" (old), "=&r" (t) | ||
173 | : "r" (mask), "r" (p) | ||
174 | : "cc", "memory"); | ||
175 | |||
176 | return old; | ||
177 | } | ||
178 | |||
179 | /* This is a special function for mm/filemap.c */ | ||
180 | #define clear_bit_unlock_is_negative_byte(nr, addr) \ | ||
181 | (clear_bit_unlock_return_word(nr, addr) & BIT_MASK(PG_waiters)) | ||
182 | |||
183 | #endif /* CONFIG_PPC64 */ | ||
184 | |||
157 | #include <asm-generic/bitops/non-atomic.h> | 185 | #include <asm-generic/bitops/non-atomic.h> |
158 | 186 | ||
159 | static __inline__ void __clear_bit_unlock(int nr, volatile unsigned long *addr) | 187 | static __inline__ void __clear_bit_unlock(int nr, volatile unsigned long *addr) |