aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include/asm/octeon/cvmx-spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/include/asm/octeon/cvmx-spinlock.h')
-rw-r--r--arch/mips/include/asm/octeon/cvmx-spinlock.h78
1 files changed, 39 insertions, 39 deletions
diff --git a/arch/mips/include/asm/octeon/cvmx-spinlock.h b/arch/mips/include/asm/octeon/cvmx-spinlock.h
index a672abb1bc4f..4f09cff8b8c0 100644
--- a/arch/mips/include/asm/octeon/cvmx-spinlock.h
+++ b/arch/mips/include/asm/octeon/cvmx-spinlock.h
@@ -26,7 +26,7 @@
26 ***********************license end**************************************/ 26 ***********************license end**************************************/
27 27
28/** 28/**
29 * Implementation of spinlocks for Octeon CVMX. Although similar in 29 * Implementation of spinlocks for Octeon CVMX. Although similar in
30 * function to Linux kernel spinlocks, they are not compatible. 30 * function to Linux kernel spinlocks, they are not compatible.
31 * Octeon CVMX spinlocks are only used to synchronize with the boot 31 * Octeon CVMX spinlocks are only used to synchronize with the boot
32 * monitor and other non-Linux programs running in the system. 32 * monitor and other non-Linux programs running in the system.
@@ -50,8 +50,8 @@ typedef struct {
50} cvmx_spinlock_t; 50} cvmx_spinlock_t;
51 51
52/* note - macros not expanded in inline ASM, so values hardcoded */ 52/* note - macros not expanded in inline ASM, so values hardcoded */
53#define CVMX_SPINLOCK_UNLOCKED_VAL 0 53#define CVMX_SPINLOCK_UNLOCKED_VAL 0
54#define CVMX_SPINLOCK_LOCKED_VAL 1 54#define CVMX_SPINLOCK_LOCKED_VAL 1
55 55
56#define CVMX_SPINLOCK_UNLOCKED_INITIALIZER {CVMX_SPINLOCK_UNLOCKED_VAL} 56#define CVMX_SPINLOCK_UNLOCKED_INITIALIZER {CVMX_SPINLOCK_UNLOCKED_VAL}
57 57
@@ -96,7 +96,7 @@ static inline void cvmx_spinlock_unlock(cvmx_spinlock_t *lock)
96 * @lock: pointer to lock structure 96 * @lock: pointer to lock structure
97 * 97 *
98 * Returns 0: lock successfully taken 98 * Returns 0: lock successfully taken
99 * 1: lock not taken, held by someone else 99 * 1: lock not taken, held by someone else
100 * These return values match the Linux semantics. 100 * These return values match the Linux semantics.
101 */ 101 */
102 102
@@ -104,16 +104,16 @@ static inline unsigned int cvmx_spinlock_trylock(cvmx_spinlock_t *lock)
104{ 104{
105 unsigned int tmp; 105 unsigned int tmp;
106 106
107 __asm__ __volatile__(".set noreorder \n" 107 __asm__ __volatile__(".set noreorder \n"
108 "1: ll %[tmp], %[val] \n" 108 "1: ll %[tmp], %[val] \n"
109 /* if lock held, fail immediately */ 109 /* if lock held, fail immediately */
110 " bnez %[tmp], 2f \n" 110 " bnez %[tmp], 2f \n"
111 " li %[tmp], 1 \n" 111 " li %[tmp], 1 \n"
112 " sc %[tmp], %[val] \n" 112 " sc %[tmp], %[val] \n"
113 " beqz %[tmp], 1b \n" 113 " beqz %[tmp], 1b \n"
114 " li %[tmp], 0 \n" 114 " li %[tmp], 0 \n"
115 "2: \n" 115 "2: \n"
116 ".set reorder \n" : 116 ".set reorder \n" :
117 [val] "+m"(lock->value), [tmp] "=&r"(tmp) 117 [val] "+m"(lock->value), [tmp] "=&r"(tmp)
118 : : "memory"); 118 : : "memory");
119 119
@@ -129,14 +129,14 @@ static inline void cvmx_spinlock_lock(cvmx_spinlock_t *lock)
129{ 129{
130 unsigned int tmp; 130 unsigned int tmp;
131 131
132 __asm__ __volatile__(".set noreorder \n" 132 __asm__ __volatile__(".set noreorder \n"
133 "1: ll %[tmp], %[val] \n" 133 "1: ll %[tmp], %[val] \n"
134 " bnez %[tmp], 1b \n" 134 " bnez %[tmp], 1b \n"
135 " li %[tmp], 1 \n" 135 " li %[tmp], 1 \n"
136 " sc %[tmp], %[val] \n" 136 " sc %[tmp], %[val] \n"
137 " beqz %[tmp], 1b \n" 137 " beqz %[tmp], 1b \n"
138 " nop \n" 138 " nop \n"
139 ".set reorder \n" : 139 ".set reorder \n" :
140 [val] "+m"(lock->value), [tmp] "=&r"(tmp) 140 [val] "+m"(lock->value), [tmp] "=&r"(tmp)
141 : : "memory"); 141 : : "memory");
142 142
@@ -163,17 +163,17 @@ static inline void cvmx_spinlock_bit_lock(uint32_t *word)
163 unsigned int tmp; 163 unsigned int tmp;
164 unsigned int sav; 164 unsigned int sav;
165 165
166 __asm__ __volatile__(".set noreorder \n" 166 __asm__ __volatile__(".set noreorder \n"
167 ".set noat \n" 167 ".set noat \n"
168 "1: ll %[tmp], %[val] \n" 168 "1: ll %[tmp], %[val] \n"
169 " bbit1 %[tmp], 31, 1b \n" 169 " bbit1 %[tmp], 31, 1b \n"
170 " li $at, 1 \n" 170 " li $at, 1 \n"
171 " ins %[tmp], $at, 31, 1 \n" 171 " ins %[tmp], $at, 31, 1 \n"
172 " sc %[tmp], %[val] \n" 172 " sc %[tmp], %[val] \n"
173 " beqz %[tmp], 1b \n" 173 " beqz %[tmp], 1b \n"
174 " nop \n" 174 " nop \n"
175 ".set at \n" 175 ".set at \n"
176 ".set reorder \n" : 176 ".set reorder \n" :
177 [val] "+m"(*word), [tmp] "=&r"(tmp), [sav] "=&r"(sav) 177 [val] "+m"(*word), [tmp] "=&r"(tmp), [sav] "=&r"(sav)
178 : : "memory"); 178 : : "memory");
179 179
@@ -187,7 +187,7 @@ static inline void cvmx_spinlock_bit_lock(uint32_t *word)
187 * 187 *
188 * @word: word to lock bit 31 of 188 * @word: word to lock bit 31 of
189 * Returns 0: lock successfully taken 189 * Returns 0: lock successfully taken
190 * 1: lock not taken, held by someone else 190 * 1: lock not taken, held by someone else
191 * These return values match the Linux semantics. 191 * These return values match the Linux semantics.
192 */ 192 */
193static inline unsigned int cvmx_spinlock_bit_trylock(uint32_t *word) 193static inline unsigned int cvmx_spinlock_bit_trylock(uint32_t *word)
@@ -198,15 +198,15 @@ static inline unsigned int cvmx_spinlock_bit_trylock(uint32_t *word)
198 ".set noat\n" 198 ".set noat\n"
199 "1: ll %[tmp], %[val] \n" 199 "1: ll %[tmp], %[val] \n"
200 /* if lock held, fail immediately */ 200 /* if lock held, fail immediately */
201 " bbit1 %[tmp], 31, 2f \n" 201 " bbit1 %[tmp], 31, 2f \n"
202 " li $at, 1 \n" 202 " li $at, 1 \n"
203 " ins %[tmp], $at, 31, 1 \n" 203 " ins %[tmp], $at, 31, 1 \n"
204 " sc %[tmp], %[val] \n" 204 " sc %[tmp], %[val] \n"
205 " beqz %[tmp], 1b \n" 205 " beqz %[tmp], 1b \n"
206 " li %[tmp], 0 \n" 206 " li %[tmp], 0 \n"
207 "2: \n" 207 "2: \n"
208 ".set at \n" 208 ".set at \n"
209 ".set reorder \n" : 209 ".set reorder \n" :
210 [val] "+m"(*word), [tmp] "=&r"(tmp) 210 [val] "+m"(*word), [tmp] "=&r"(tmp)
211 : : "memory"); 211 : : "memory");
212 212