aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/include
diff options
context:
space:
mode:
authorPaul Martin <paul.martin@codethink.co.uk>2015-03-30 12:00:58 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-04-01 11:22:14 -0400
commitf1e770cf51fc0567b7d2b1d242b5ab8d23399d09 (patch)
tree58603eba4700c568c755117f74287c3e6cd8bccf /arch/mips/include
parentb0abf36ffdc2b7efbb74e02b9dad99b40e85ec3b (diff)
MIPS: Octeon: Reverse the order of register accesses to the FAU
64 bit access is unaffected but for 32 bit access, swap high and low words. Similarly for 16 bit access, reverse the order of the four possible words, and for 8 bit access reverse the order of byte accesses. Signed-off-by: Paul Martin <paul.martin@codethink.co.uk> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9630/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/include')
-rw-r--r--arch/mips/include/asm/octeon/cvmx-fau.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/mips/include/asm/octeon/cvmx-fau.h b/arch/mips/include/asm/octeon/cvmx-fau.h
index ef98f7fc102f..dafeae300c97 100644
--- a/arch/mips/include/asm/octeon/cvmx-fau.h
+++ b/arch/mips/include/asm/octeon/cvmx-fau.h
@@ -105,6 +105,16 @@ typedef union {
105 } s; 105 } s;
106} cvmx_fau_async_tagwait_result_t; 106} cvmx_fau_async_tagwait_result_t;
107 107
108#ifdef __BIG_ENDIAN_BITFIELD
109#define SWIZZLE_8 0
110#define SWIZZLE_16 0
111#define SWIZZLE_32 0
112#else
113#define SWIZZLE_8 0x7
114#define SWIZZLE_16 0x6
115#define SWIZZLE_32 0x4
116#endif
117
108/** 118/**
109 * Builds a store I/O address for writing to the FAU 119 * Builds a store I/O address for writing to the FAU
110 * 120 *
@@ -175,6 +185,7 @@ static inline int64_t cvmx_fau_fetch_and_add64(cvmx_fau_reg_64_t reg,
175static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg, 185static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg,
176 int32_t value) 186 int32_t value)
177{ 187{
188 reg ^= SWIZZLE_32;
178 return cvmx_read64_int32(__cvmx_fau_atomic_address(0, reg, value)); 189 return cvmx_read64_int32(__cvmx_fau_atomic_address(0, reg, value));
179} 190}
180 191
@@ -189,6 +200,7 @@ static inline int32_t cvmx_fau_fetch_and_add32(cvmx_fau_reg_32_t reg,
189static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg, 200static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg,
190 int16_t value) 201 int16_t value)
191{ 202{
203 reg ^= SWIZZLE_16;
192 return cvmx_read64_int16(__cvmx_fau_atomic_address(0, reg, value)); 204 return cvmx_read64_int16(__cvmx_fau_atomic_address(0, reg, value));
193} 205}
194 206
@@ -201,6 +213,7 @@ static inline int16_t cvmx_fau_fetch_and_add16(cvmx_fau_reg_16_t reg,
201 */ 213 */
202static inline int8_t cvmx_fau_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value) 214static inline int8_t cvmx_fau_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
203{ 215{
216 reg ^= SWIZZLE_8;
204 return cvmx_read64_int8(__cvmx_fau_atomic_address(0, reg, value)); 217 return cvmx_read64_int8(__cvmx_fau_atomic_address(0, reg, value));
205} 218}
206 219
@@ -247,6 +260,7 @@ cvmx_fau_tagwait_fetch_and_add32(cvmx_fau_reg_32_t reg, int32_t value)
247 uint64_t i32; 260 uint64_t i32;
248 cvmx_fau_tagwait32_t t; 261 cvmx_fau_tagwait32_t t;
249 } result; 262 } result;
263 reg ^= SWIZZLE_32;
250 result.i32 = 264 result.i32 =
251 cvmx_read64_int32(__cvmx_fau_atomic_address(1, reg, value)); 265 cvmx_read64_int32(__cvmx_fau_atomic_address(1, reg, value));
252 return result.t; 266 return result.t;
@@ -270,6 +284,7 @@ cvmx_fau_tagwait_fetch_and_add16(cvmx_fau_reg_16_t reg, int16_t value)
270 uint64_t i16; 284 uint64_t i16;
271 cvmx_fau_tagwait16_t t; 285 cvmx_fau_tagwait16_t t;
272 } result; 286 } result;
287 reg ^= SWIZZLE_16;
273 result.i16 = 288 result.i16 =
274 cvmx_read64_int16(__cvmx_fau_atomic_address(1, reg, value)); 289 cvmx_read64_int16(__cvmx_fau_atomic_address(1, reg, value));
275 return result.t; 290 return result.t;
@@ -292,6 +307,7 @@ cvmx_fau_tagwait_fetch_and_add8(cvmx_fau_reg_8_t reg, int8_t value)
292 uint64_t i8; 307 uint64_t i8;
293 cvmx_fau_tagwait8_t t; 308 cvmx_fau_tagwait8_t t;
294 } result; 309 } result;
310 reg ^= SWIZZLE_8;
295 result.i8 = cvmx_read64_int8(__cvmx_fau_atomic_address(1, reg, value)); 311 result.i8 = cvmx_read64_int8(__cvmx_fau_atomic_address(1, reg, value));
296 return result.t; 312 return result.t;
297} 313}
@@ -521,6 +537,7 @@ static inline void cvmx_fau_atomic_add64(cvmx_fau_reg_64_t reg, int64_t value)
521 */ 537 */
522static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value) 538static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value)
523{ 539{
540 reg ^= SWIZZLE_32;
524 cvmx_write64_int32(__cvmx_fau_store_address(0, reg), value); 541 cvmx_write64_int32(__cvmx_fau_store_address(0, reg), value);
525} 542}
526 543
@@ -533,6 +550,7 @@ static inline void cvmx_fau_atomic_add32(cvmx_fau_reg_32_t reg, int32_t value)
533 */ 550 */
534static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value) 551static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value)
535{ 552{
553 reg ^= SWIZZLE_16;
536 cvmx_write64_int16(__cvmx_fau_store_address(0, reg), value); 554 cvmx_write64_int16(__cvmx_fau_store_address(0, reg), value);
537} 555}
538 556
@@ -544,6 +562,7 @@ static inline void cvmx_fau_atomic_add16(cvmx_fau_reg_16_t reg, int16_t value)
544 */ 562 */
545static inline void cvmx_fau_atomic_add8(cvmx_fau_reg_8_t reg, int8_t value) 563static inline void cvmx_fau_atomic_add8(cvmx_fau_reg_8_t reg, int8_t value)
546{ 564{
565 reg ^= SWIZZLE_8;
547 cvmx_write64_int8(__cvmx_fau_store_address(0, reg), value); 566 cvmx_write64_int8(__cvmx_fau_store_address(0, reg), value);
548} 567}
549 568
@@ -568,6 +587,7 @@ static inline void cvmx_fau_atomic_write64(cvmx_fau_reg_64_t reg, int64_t value)
568 */ 587 */
569static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value) 588static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value)
570{ 589{
590 reg ^= SWIZZLE_32;
571 cvmx_write64_int32(__cvmx_fau_store_address(1, reg), value); 591 cvmx_write64_int32(__cvmx_fau_store_address(1, reg), value);
572} 592}
573 593
@@ -580,6 +600,7 @@ static inline void cvmx_fau_atomic_write32(cvmx_fau_reg_32_t reg, int32_t value)
580 */ 600 */
581static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value) 601static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value)
582{ 602{
603 reg ^= SWIZZLE_16;
583 cvmx_write64_int16(__cvmx_fau_store_address(1, reg), value); 604 cvmx_write64_int16(__cvmx_fau_store_address(1, reg), value);
584} 605}
585 606
@@ -591,6 +612,7 @@ static inline void cvmx_fau_atomic_write16(cvmx_fau_reg_16_t reg, int16_t value)
591 */ 612 */
592static inline void cvmx_fau_atomic_write8(cvmx_fau_reg_8_t reg, int8_t value) 613static inline void cvmx_fau_atomic_write8(cvmx_fau_reg_8_t reg, int8_t value)
593{ 614{
615 reg ^= SWIZZLE_8;
594 cvmx_write64_int8(__cvmx_fau_store_address(1, reg), value); 616 cvmx_write64_int8(__cvmx_fau_store_address(1, reg), value);
595} 617}
596 618