summaryrefslogtreecommitdiff
path: root/arch/c6x/include/uapi/asm/swab.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-13 11:19:00 +0900
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-13 11:19:00 +0900
commitff69497ad754b0fa9d5935df644890f208f31558 (patch)
tree6a7b51f507093363f37eb817bdee3d28465c0f9d /arch/c6x/include/uapi/asm/swab.h
parent6c536a17fa049d0fb690c1a947b97dbfd304a916 (diff)
parentfbdd63d76c5ad6ae56a7bd1acebabefafc6aadf0 (diff)
downloadlwn-ff69497ad754b0fa9d5935df644890f208f31558.tar.gz
lwn-ff69497ad754b0fa9d5935df644890f208f31558.zip
Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming
Pull C6X UAPI disintegration from Mark Salter: - scripted UAPI disintegration by David Howells. * tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming: UAPI: (Scripted) Disintegrate arch/c6x/include/asm
Diffstat (limited to 'arch/c6x/include/uapi/asm/swab.h')
-rw-r--r--arch/c6x/include/uapi/asm/swab.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/arch/c6x/include/uapi/asm/swab.h b/arch/c6x/include/uapi/asm/swab.h
new file mode 100644
index 000000000000..fd4bb0520e5e
--- /dev/null
+++ b/arch/c6x/include/uapi/asm/swab.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2011 Texas Instruments Incorporated
+ * Author: Mark Salter <msalter@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef _ASM_C6X_SWAB_H
+#define _ASM_C6X_SWAB_H
+
+static inline __attribute_const__ __u16 __c6x_swab16(__u16 val)
+{
+ asm("swap4 .l1 %0,%0\n" : "+a"(val));
+ return val;
+}
+
+static inline __attribute_const__ __u32 __c6x_swab32(__u32 val)
+{
+ asm("swap4 .l1 %0,%0\n"
+ "swap2 .l1 %0,%0\n"
+ : "+a"(val));
+ return val;
+}
+
+static inline __attribute_const__ __u64 __c6x_swab64(__u64 val)
+{
+ asm(" swap2 .s1 %p0,%P0\n"
+ "|| swap2 .l1 %P0,%p0\n"
+ " swap4 .l1 %p0,%p0\n"
+ " swap4 .l1 %P0,%P0\n"
+ : "+a"(val));
+ return val;
+}
+
+static inline __attribute_const__ __u32 __c6x_swahw32(__u32 val)
+{
+ asm("swap2 .l1 %0,%0\n" : "+a"(val));
+ return val;
+}
+
+static inline __attribute_const__ __u32 __c6x_swahb32(__u32 val)
+{
+ asm("swap4 .l1 %0,%0\n" : "+a"(val));
+ return val;
+}
+
+#define __arch_swab16 __c6x_swab16
+#define __arch_swab32 __c6x_swab32
+#define __arch_swab64 __c6x_swab64
+#define __arch_swahw32 __c6x_swahw32
+#define __arch_swahb32 __c6x_swahb32
+
+#endif /* _ASM_C6X_SWAB_H */