diff options
-rw-r--r-- | include/asm-xtensa/byteorder.h | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/include/asm-xtensa/byteorder.h b/include/asm-xtensa/byteorder.h index 765edf17a9a4..07d10ad364d1 100644 --- a/include/asm-xtensa/byteorder.h +++ b/include/asm-xtensa/byteorder.h | |||
@@ -14,7 +14,17 @@ | |||
14 | #include <asm/types.h> | 14 | #include <asm/types.h> |
15 | #include <linux/compiler.h> | 15 | #include <linux/compiler.h> |
16 | 16 | ||
17 | static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) | 17 | #ifdef __XTENSA_EL__ |
18 | # define __LITTLE_ENDIAN | ||
19 | #elif defined(__XTENSA_EB__) | ||
20 | # define __BIG_ENDIAN | ||
21 | #else | ||
22 | # error processor byte order undefined! | ||
23 | #endif | ||
24 | |||
25 | #define __SWAB_64_THRU_32__ | ||
26 | |||
27 | static inline __attribute_const__ __u32 __arch_swab32(__u32 x) | ||
18 | { | 28 | { |
19 | __u32 res; | 29 | __u32 res; |
20 | /* instruction sequence from Xtensa ISA release 2/2000 */ | 30 | /* instruction sequence from Xtensa ISA release 2/2000 */ |
@@ -28,8 +38,9 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) | |||
28 | ); | 38 | ); |
29 | return res; | 39 | return res; |
30 | } | 40 | } |
41 | #define __arch_swab32 __arch_swab32 | ||
31 | 42 | ||
32 | static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) | 43 | static inline __attribute_const__ __u16 __arch_swab16(__u16 x) |
33 | { | 44 | { |
34 | /* Given that 'short' values are signed (i.e., can be negative), | 45 | /* Given that 'short' values are signed (i.e., can be negative), |
35 | * we cannot assume that the upper 16-bits of the register are | 46 | * we cannot assume that the upper 16-bits of the register are |
@@ -62,21 +73,8 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) | |||
62 | 73 | ||
63 | return res; | 74 | return res; |
64 | } | 75 | } |
76 | #define __arch_swab16 __arch_swab16 | ||
65 | 77 | ||
66 | #define __arch__swab32(x) ___arch__swab32(x) | 78 | #include <linux/byteorder.h> |
67 | #define __arch__swab16(x) ___arch__swab16(x) | ||
68 | |||
69 | #if !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
70 | # define __BYTEORDER_HAS_U64__ | ||
71 | # define __SWAB_64_THRU_32__ | ||
72 | #endif | ||
73 | |||
74 | #ifdef __XTENSA_EL__ | ||
75 | # include <linux/byteorder/little_endian.h> | ||
76 | #elif defined(__XTENSA_EB__) | ||
77 | # include <linux/byteorder/big_endian.h> | ||
78 | #else | ||
79 | # error processor byte order undefined! | ||
80 | #endif | ||
81 | 79 | ||
82 | #endif /* _XTENSA_BYTEORDER_H */ | 80 | #endif /* _XTENSA_BYTEORDER_H */ |