aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc
diff options
context:
space:
mode:
authorHarvey Harrison <harvey.harrison@gmail.com>2008-12-01 22:28:17 -0500
committerKyle McMartin <kyle@mcmartin.ca>2009-01-05 13:15:24 -0500
commitd2e6675fffe435989e51c084600581ca58048c13 (patch)
tree70e4433036fe877996288b903583ace3c7d35239 /arch/parisc
parentdf8e5bc6b7b61c8b2aeaf58b6afd762d20a651dd (diff)
parisc: use the new byteorder headers
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com> Cc: Matthew Wilcox <willy@debian.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Diffstat (limited to 'arch/parisc')
-rw-r--r--arch/parisc/include/asm/byteorder.h37
1 files changed, 12 insertions, 25 deletions
diff --git a/arch/parisc/include/asm/byteorder.h b/arch/parisc/include/asm/byteorder.h
index db148313de5d..83095c5bb379 100644
--- a/arch/parisc/include/asm/byteorder.h
+++ b/arch/parisc/include/asm/byteorder.h
@@ -4,9 +4,10 @@
4#include <asm/types.h> 4#include <asm/types.h>
5#include <linux/compiler.h> 5#include <linux/compiler.h>
6 6
7#ifdef __GNUC__ 7#define __BIG_ENDIAN
8#define __SWAB_64_THRU_32__
8 9
9static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) 10static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
10{ 11{
11 __asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */ 12 __asm__("dep %0, 15, 8, %0\n\t" /* deposit 00ab -> 0bab */
12 "shd %%r0, %0, 8, %0" /* shift 000000ab -> 00ba */ 13 "shd %%r0, %0, 8, %0" /* shift 000000ab -> 00ba */
@@ -14,8 +15,9 @@ static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
14 : "0" (x)); 15 : "0" (x));
15 return x; 16 return x;
16} 17}
18#define __arch_swab16 __arch_swab16
17 19
18static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x) 20static inline __attribute_const__ __u32 __arch_swab24(__u32 x)
19{ 21{
20 __asm__("shd %0, %0, 8, %0\n\t" /* shift xabcxabc -> cxab */ 22 __asm__("shd %0, %0, 8, %0\n\t" /* shift xabcxabc -> cxab */
21 "dep %0, 15, 8, %0\n\t" /* deposit cxab -> cbab */ 23 "dep %0, 15, 8, %0\n\t" /* deposit cxab -> cbab */
@@ -25,7 +27,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab24(__u32 x)
25 return x; 27 return x;
26} 28}
27 29
28static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) 30static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
29{ 31{
30 unsigned int temp; 32 unsigned int temp;
31 __asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */ 33 __asm__("shd %0, %0, 16, %1\n\t" /* shift abcdabcd -> cdab */
@@ -35,7 +37,7 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
35 : "0" (x)); 37 : "0" (x));
36 return x; 38 return x;
37} 39}
38 40#define __arch_swab32 __arch_swab32
39 41
40#if BITS_PER_LONG > 32 42#if BITS_PER_LONG > 32
41/* 43/*
@@ -48,7 +50,8 @@ static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
48** HSHR 67452301 -> *6*4*2*0 into %0 50** HSHR 67452301 -> *6*4*2*0 into %0
49** OR %0 | %1 -> 76543210 into %0 (all done!) 51** OR %0 | %1 -> 76543210 into %0 (all done!)
50*/ 52*/
51static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) { 53static inline __attribute_const__ __u64 __arch_swab64(__u64 x)
54{
52 __u64 temp; 55 __u64 temp;
53 __asm__("permh,3210 %0, %0\n\t" 56 __asm__("permh,3210 %0, %0\n\t"
54 "hshl %0, 8, %1\n\t" 57 "hshl %0, 8, %1\n\t"
@@ -58,25 +61,9 @@ static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) {
58 : "0" (x)); 61 : "0" (x));
59 return x; 62 return x;
60} 63}
61#define __arch__swab64(x) ___arch__swab64(x) 64#define __arch_swab64 __arch_swab64
62#define __BYTEORDER_HAS_U64__ 65#endif /* BITS_PER_LONG > 32 */
63#elif !defined(__STRICT_ANSI__)
64static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
65{
66 __u32 t1 = ___arch__swab32((__u32) x);
67 __u32 t2 = ___arch__swab32((__u32) (x >> 32));
68 return (((__u64) t1 << 32) | t2);
69}
70#define __arch__swab64(x) ___arch__swab64(x)
71#define __BYTEORDER_HAS_U64__
72#endif
73
74#define __arch__swab16(x) ___arch__swab16(x)
75#define __arch__swab24(x) ___arch__swab24(x)
76#define __arch__swab32(x) ___arch__swab32(x)
77
78#endif /* __GNUC__ */
79 66
80#include <linux/byteorder/big_endian.h> 67#include <linux/byteorder.h>
81 68
82#endif /* _PARISC_BYTEORDER_H */ 69#endif /* _PARISC_BYTEORDER_H */