diff options
Diffstat (limited to 'include/asm-mips/byteorder.h')
-rw-r--r-- | include/asm-mips/byteorder.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/asm-mips/byteorder.h b/include/asm-mips/byteorder.h index d1fe9e5c62e4..584f8128fffd 100644 --- a/include/asm-mips/byteorder.h +++ b/include/asm-mips/byteorder.h | |||
@@ -8,10 +8,39 @@ | |||
8 | #ifndef _ASM_BYTEORDER_H | 8 | #ifndef _ASM_BYTEORDER_H |
9 | #define _ASM_BYTEORDER_H | 9 | #define _ASM_BYTEORDER_H |
10 | 10 | ||
11 | #include <linux/config.h> | ||
12 | #include <linux/compiler.h> | ||
11 | #include <asm/types.h> | 13 | #include <asm/types.h> |
12 | 14 | ||
13 | #ifdef __GNUC__ | 15 | #ifdef __GNUC__ |
14 | 16 | ||
17 | #ifdef CONFIG_CPU_MIPSR2 | ||
18 | |||
19 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) | ||
20 | { | ||
21 | __asm__( | ||
22 | " wsbh %0, %1 \n" | ||
23 | : "=r" (x) | ||
24 | : "r" (x)); | ||
25 | |||
26 | return x; | ||
27 | } | ||
28 | #define __arch__swab16(x) ___arch__swab16(x) | ||
29 | |||
30 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) | ||
31 | { | ||
32 | __asm__( | ||
33 | " wsbh %0, %1 \n" | ||
34 | " rotr %0, %0, 16 \n" | ||
35 | : "=r" (x) | ||
36 | : "r" (x)); | ||
37 | |||
38 | return x; | ||
39 | } | ||
40 | #define __arch__swab32(x) ___arch__swab32(x) | ||
41 | |||
42 | #endif /* CONFIG_CPU_MIPSR2 */ | ||
43 | |||
15 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | 44 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) |
16 | # define __BYTEORDER_HAS_U64__ | 45 | # define __BYTEORDER_HAS_U64__ |
17 | # define __SWAB_64_THRU_32__ | 46 | # define __SWAB_64_THRU_32__ |