diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-08-07 12:55:03 +0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-08-07 12:55:03 +0400 |
commit | 4fb8af10d0fd09372d52966b76922b9e82bbc950 (patch) | |
tree | d240e4d40357583e3f3eb228dccf20122a5b31ed /arch/sparc/include/asm/byteorder.h | |
parent | f44f82e8a20b98558486eb14497b2f71c78fa325 (diff) | |
parent | 64a99d2a8c3ed5c4e39f3ae1cc682aa8fd3977fc (diff) | |
download | linux-4fb8af10d0fd09372d52966b76922b9e82bbc950.tar.xz |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-fixes
Diffstat (limited to 'arch/sparc/include/asm/byteorder.h')
-rw-r--r-- | arch/sparc/include/asm/byteorder.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h new file mode 100644 index 000000000000..bcd83aa351c5 --- /dev/null +++ b/arch/sparc/include/asm/byteorder.h @@ -0,0 +1,57 @@ +#ifndef _SPARC_BYTEORDER_H +#define _SPARC_BYTEORDER_H + +#include <asm/types.h> +#include <asm/asi.h> + +#ifdef __GNUC__ + +#ifdef CONFIG_SPARC32 +#define __SWAB_64_THRU_32__ +#endif + +#ifdef CONFIG_SPARC64 + +static inline __u16 ___arch__swab16p(const __u16 *addr) +{ + __u16 ret; + + __asm__ __volatile__ ("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +static inline __u32 ___arch__swab32p(const __u32 *addr) +{ + __u32 ret; + + __asm__ __volatile__ ("lduwa [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +static inline __u64 ___arch__swab64p(const __u64 *addr) +{ + __u64 ret; + + __asm__ __volatile__ ("ldxa [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +#define __arch__swab16p(x) ___arch__swab16p(x) +#define __arch__swab32p(x) ___arch__swab32p(x) +#define __arch__swab64p(x) ___arch__swab64p(x) + +#endif /* CONFIG_SPARC64 */ + +#define __BYTEORDER_HAS_U64__ + +#endif + +#include <linux/byteorder/big_endian.h> + +#endif /* _SPARC_BYTEORDER_H */ |