[PATCH] add a proper prototype for setup_arch()
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / include / asm-mips / byteorder.h
blobaefc02f16fd84319c3cdd46ced02e60569edc8e5
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
6 * Copyright (C) 1996, 99, 2003 by Ralf Baechle
7 */
8 #ifndef _ASM_BYTEORDER_H
9 #define _ASM_BYTEORDER_H
11 #include <linux/config.h>
12 #include <linux/compiler.h>
13 #include <asm/types.h>
15 #ifdef __GNUC__
17 #ifdef CONFIG_CPU_MIPSR2
19 static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
21 __asm__(
22 " wsbh %0, %1 \n"
23 : "=r" (x)
24 : "r" (x));
26 return x;
28 #define __arch__swab16(x) ___arch__swab16(x)
30 static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
32 __asm__(
33 " wsbh %0, %1 \n"
34 " rotr %0, %0, 16 \n"
35 : "=r" (x)
36 : "r" (x));
38 return x;
40 #define __arch__swab32(x) ___arch__swab32(x)
42 #ifdef CONFIG_CPU_MIPS64_R2
44 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x)
46 __asm__(
47 " dsbh %0, %1 \n"
48 " dshd %0, %0 \n"
49 " drotr %0, %0, 32 \n"
50 : "=r" (x)
51 : "r" (x));
53 return x;
56 #define __arch__swab64(x) ___arch__swab64(x)
58 #endif /* CONFIG_CPU_MIPS64_R2 */
60 #endif /* CONFIG_CPU_MIPSR2 */
62 #if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
63 # define __BYTEORDER_HAS_U64__
64 # define __SWAB_64_THRU_32__
65 #endif
67 #endif /* __GNUC__ */
69 #if defined (__MIPSEB__)
70 # include <linux/byteorder/big_endian.h>
71 #elif defined (__MIPSEL__)
72 # include <linux/byteorder/little_endian.h>
73 #else
74 # error "MIPS, but neither __MIPSEB__, nor __MIPSEL__???"
75 #endif
77 #endif /* _ASM_BYTEORDER_H */