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