Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2003, 2004 Ralf Baechle
0007  */
0008 #ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
0009 #define __ASM_MACH_GENERIC_MANGLE_PORT_H
0010 
0011 #define __swizzle_addr_b(port)  (port)
0012 #define __swizzle_addr_w(port)  (port)
0013 #define __swizzle_addr_l(port)  (port)
0014 #define __swizzle_addr_q(port)  (port)
0015 
0016 /*
0017  * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
0018  * less sane hardware forces software to fiddle with this...
0019  *
0020  * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
0021  * you can't have the numerical value of data and byte addresses within
0022  * multibyte quantities both preserved at the same time.  Hence two
0023  * variations of functions: non-prefixed ones that preserve the value
0024  * and prefixed ones that preserve byte addresses.  The latters are
0025  * typically used for moving raw data between a peripheral and memory (cf.
0026  * string I/O functions), hence the "__mem_" prefix.
0027  */
0028 #if defined(CONFIG_SWAP_IO_SPACE)
0029 
0030 # define ioswabb(a, x)      (x)
0031 # define __mem_ioswabb(a, x)    (x)
0032 # define ioswabw(a, x)      le16_to_cpu((__force __le16)(x))
0033 # define __mem_ioswabw(a, x)    (x)
0034 # define ioswabl(a, x)      le32_to_cpu((__force __le32)(x))
0035 # define __mem_ioswabl(a, x)    (x)
0036 # define ioswabq(a, x)      le64_to_cpu((__force __le64)(x))
0037 # define __mem_ioswabq(a, x)    (x)
0038 
0039 #else
0040 
0041 # define ioswabb(a, x)      (x)
0042 # define __mem_ioswabb(a, x)    (x)
0043 # define ioswabw(a, x)      (x)
0044 # define __mem_ioswabw(a, x)    ((__force u16)cpu_to_le16(x))
0045 # define ioswabl(a, x)      (x)
0046 # define __mem_ioswabl(a, x)    ((__force u32)cpu_to_le32(x))
0047 # define ioswabq(a, x)      (x)
0048 # define __mem_ioswabq(a, x)    ((__force u64)cpu_to_le64(x))
0049 
0050 #endif
0051 
0052 #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */