s390: introduce asm/swab.h
authorHarvey Harrison <harvey.harrison@gmail.com>
Tue, 6 Jan 2009 22:56:24 +0000 (14:56 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 7 Jan 2009 02:10:27 +0000 (18:10 -0800)
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/s390/include/asm/Kbuild
arch/s390/include/asm/byteorder.h
arch/s390/include/asm/swab.h [new file with mode: 0644]

index 63a23415fba6b2ed4a80d68630f8b240eba9e64b..f2af4167bd5f527700c221363f4ee9273ac2fe3e 100644 (file)
@@ -13,3 +13,4 @@ unifdef-y += cmb.h
 unifdef-y += debug.h
 unifdef-y += chpid.h
 unifdef-y += schid.h
+unifdef-y += swab.h
index 8bcf277c84680a14e9403c4f113ebf7627016cf3..b95a2b2933fb9407cea20e8ab22da3aa05d3e18a 100644 (file)
@@ -1,95 +1,7 @@
 #ifndef _S390_BYTEORDER_H
 #define _S390_BYTEORDER_H
 
-/*
- *  include/asm-s390/byteorder.h
- *
- *  S390 version
- *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
- *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
- */
-
-#include <asm/types.h>
-
-#define __BIG_ENDIAN
-
-#ifndef __s390x__
-# define __SWAB_64_THRU_32__
-#endif
-
-#ifdef __s390x__
-static inline __u64 __arch_swab64p(const __u64 *x)
-{
-       __u64 result;
-
-       asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
-       return result;
-}
-#define __arch_swab64p __arch_swab64p
-
-static inline __u64 __arch_swab64(__u64 x)
-{
-       __u64 result;
-
-       asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
-       return result;
-}
-#define __arch_swab64 __arch_swab64
-
-static inline void __arch_swab64s(__u64 *x)
-{
-       *x = __arch_swab64p(x);
-}
-#define __arch_swab64s __arch_swab64s
-#endif /* __s390x__ */
-
-static inline __u32 __arch_swab32p(const __u32 *x)
-{
-       __u32 result;
-       
-       asm volatile(
-#ifndef __s390x__
-               "       icm     %0,8,3(%1)\n"
-               "       icm     %0,4,2(%1)\n"
-               "       icm     %0,2,1(%1)\n"
-               "       ic      %0,0(%1)"
-               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
-#else /* __s390x__ */
-               "       lrv     %0,%1"
-               : "=d" (result) : "m" (*x));
-#endif /* __s390x__ */
-       return result;
-}
-#define __arch_swab32p __arch_swab32p
-
-#ifdef __s390x__
-static inline __u32 __arch_swab32(__u32 x)
-{
-       __u32 result;
-       
-       asm volatile("lrvr  %0,%1" : "=d" (result) : "d" (x));
-       return result;
-}
-#define __arch_swab32 __arch_swab32
-#endif /* __s390x__ */
-
-static inline __u16 __arch_swab16p(const __u16 *x)
-{
-       __u16 result;
-       
-       asm volatile(
-#ifndef __s390x__
-               "       icm     %0,2,1(%1)\n"
-               "       ic      %0,0(%1)\n"
-               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
-#else /* __s390x__ */
-               "       lrvh    %0,%1"
-               : "=d" (result) : "m" (*x));
-#endif /* __s390x__ */
-       return result;
-}
-#define __arch_swab16p __arch_swab16p
-
-#include <linux/byteorder.h>
+#include <asm/swab.h>
+#include <linux/byteorder/big_endian.h>
 
 #endif /* _S390_BYTEORDER_H */
diff --git a/arch/s390/include/asm/swab.h b/arch/s390/include/asm/swab.h
new file mode 100644 (file)
index 0000000..bd9321a
--- /dev/null
@@ -0,0 +1,91 @@
+#ifndef _S390_SWAB_H
+#define _S390_SWAB_H
+
+/*
+ *  include/asm-s390/swab.h
+ *
+ *  S390 version
+ *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
+ */
+
+#include <asm/types.h>
+
+#ifndef __s390x__
+# define __SWAB_64_THRU_32__
+#endif
+
+#ifdef __s390x__
+static inline __u64 __arch_swab64p(const __u64 *x)
+{
+       __u64 result;
+
+       asm volatile("lrvg %0,%1" : "=d" (result) : "m" (*x));
+       return result;
+}
+#define __arch_swab64p __arch_swab64p
+
+static inline __u64 __arch_swab64(__u64 x)
+{
+       __u64 result;
+
+       asm volatile("lrvgr %0,%1" : "=d" (result) : "d" (x));
+       return result;
+}
+#define __arch_swab64 __arch_swab64
+
+static inline void __arch_swab64s(__u64 *x)
+{
+       *x = __arch_swab64p(x);
+}
+#define __arch_swab64s __arch_swab64s
+#endif /* __s390x__ */
+
+static inline __u32 __arch_swab32p(const __u32 *x)
+{
+       __u32 result;
+       
+       asm volatile(
+#ifndef __s390x__
+               "       icm     %0,8,3(%1)\n"
+               "       icm     %0,4,2(%1)\n"
+               "       icm     %0,2,1(%1)\n"
+               "       ic      %0,0(%1)"
+               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
+#else /* __s390x__ */
+               "       lrv     %0,%1"
+               : "=d" (result) : "m" (*x));
+#endif /* __s390x__ */
+       return result;
+}
+#define __arch_swab32p __arch_swab32p
+
+#ifdef __s390x__
+static inline __u32 __arch_swab32(__u32 x)
+{
+       __u32 result;
+       
+       asm volatile("lrvr  %0,%1" : "=d" (result) : "d" (x));
+       return result;
+}
+#define __arch_swab32 __arch_swab32
+#endif /* __s390x__ */
+
+static inline __u16 __arch_swab16p(const __u16 *x)
+{
+       __u16 result;
+       
+       asm volatile(
+#ifndef __s390x__
+               "       icm     %0,2,1(%1)\n"
+               "       ic      %0,0(%1)\n"
+               : "=&d" (result) : "a" (x), "m" (*x) : "cc");
+#else /* __s390x__ */
+               "       lrvh    %0,%1"
+               : "=d" (result) : "m" (*x));
+#endif /* __s390x__ */
+       return result;
+}
+#define __arch_swab16p __arch_swab16p
+
+#endif /* _S390_SWAB_H */