xref: /OK3568_Linux_fs/u-boot/arch/mips/include/asm/mach-generic/mangle-port.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2003, 2004 Ralf Baechle
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun #ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
7*4882a593Smuzhiyun #define __ASM_MACH_GENERIC_MANGLE_PORT_H
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #define __swizzle_addr_b(port)	(port)
10*4882a593Smuzhiyun #define __swizzle_addr_w(port)	(port)
11*4882a593Smuzhiyun #define __swizzle_addr_l(port)	(port)
12*4882a593Smuzhiyun #define __swizzle_addr_q(port)	(port)
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /*
15*4882a593Smuzhiyun  * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
16*4882a593Smuzhiyun  * less sane hardware forces software to fiddle with this...
17*4882a593Smuzhiyun  *
18*4882a593Smuzhiyun  * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
19*4882a593Smuzhiyun  * you can't have the numerical value of data and byte addresses within
20*4882a593Smuzhiyun  * multibyte quantities both preserved at the same time.  Hence two
21*4882a593Smuzhiyun  * variations of functions: non-prefixed ones that preserve the value
22*4882a593Smuzhiyun  * and prefixed ones that preserve byte addresses.  The latters are
23*4882a593Smuzhiyun  * typically used for moving raw data between a peripheral and memory (cf.
24*4882a593Smuzhiyun  * string I/O functions), hence the "__mem_" prefix.
25*4882a593Smuzhiyun  */
26*4882a593Smuzhiyun #if defined(CONFIG_SWAP_IO_SPACE)
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun # define ioswabb(a, x)		(x)
29*4882a593Smuzhiyun # define __mem_ioswabb(a, x)	(x)
30*4882a593Smuzhiyun # define ioswabw(a, x)		le16_to_cpu(x)
31*4882a593Smuzhiyun # define __mem_ioswabw(a, x)	(x)
32*4882a593Smuzhiyun # define ioswabl(a, x)		le32_to_cpu(x)
33*4882a593Smuzhiyun # define __mem_ioswabl(a, x)	(x)
34*4882a593Smuzhiyun # define ioswabq(a, x)		le64_to_cpu(x)
35*4882a593Smuzhiyun # define __mem_ioswabq(a, x)	(x)
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #else
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun # define ioswabb(a, x)		(x)
40*4882a593Smuzhiyun # define __mem_ioswabb(a, x)	(x)
41*4882a593Smuzhiyun # define ioswabw(a, x)		(x)
42*4882a593Smuzhiyun # define __mem_ioswabw(a, x)	cpu_to_le16(x)
43*4882a593Smuzhiyun # define ioswabl(a, x)		(x)
44*4882a593Smuzhiyun # define __mem_ioswabl(a, x)	cpu_to_le32(x)
45*4882a593Smuzhiyun # define ioswabq(a, x)		(x)
46*4882a593Smuzhiyun # define __mem_ioswabq(a, x)	cpu_to_le32(x)
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun #endif
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */
51