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