1384740dcSRalf Baechle /* 2384740dcSRalf Baechle * This file is subject to the terms and conditions of the GNU General Public 3384740dcSRalf Baechle * License. See the file "COPYING" in the main directory of this archive 4384740dcSRalf Baechle * for more details. 5384740dcSRalf Baechle * 6384740dcSRalf Baechle * Copyright (C) 2003, 2004 Ralf Baechle 7384740dcSRalf Baechle */ 8384740dcSRalf Baechle #ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H 9384740dcSRalf Baechle #define __ASM_MACH_GENERIC_MANGLE_PORT_H 10384740dcSRalf Baechle 11384740dcSRalf Baechle #define __swizzle_addr_b(port) (port) 12384740dcSRalf Baechle #define __swizzle_addr_w(port) (port) 13384740dcSRalf Baechle #define __swizzle_addr_l(port) (port) 14384740dcSRalf Baechle #define __swizzle_addr_q(port) (port) 15384740dcSRalf Baechle 16384740dcSRalf Baechle /* 17384740dcSRalf Baechle * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware; 18384740dcSRalf Baechle * less sane hardware forces software to fiddle with this... 19384740dcSRalf Baechle * 20384740dcSRalf Baechle * Regardless, if the host bus endianness mismatches that of PCI/ISA, then 21384740dcSRalf Baechle * you can't have the numerical value of data and byte addresses within 22384740dcSRalf Baechle * multibyte quantities both preserved at the same time. Hence two 23384740dcSRalf Baechle * variations of functions: non-prefixed ones that preserve the value 24384740dcSRalf Baechle * and prefixed ones that preserve byte addresses. The latters are 25384740dcSRalf Baechle * typically used for moving raw data between a peripheral and memory (cf. 26384740dcSRalf Baechle * string I/O functions), hence the "__mem_" prefix. 27384740dcSRalf Baechle */ 28384740dcSRalf Baechle #if defined(CONFIG_SWAP_IO_SPACE) 29384740dcSRalf Baechle 30384740dcSRalf Baechle # define ioswabb(a, x) (x) 31384740dcSRalf Baechle # define __mem_ioswabb(a, x) (x) 32*7b5f9694SAlexander Lobakin # define ioswabw(a, x) le16_to_cpu((__force __le16)(x)) 33384740dcSRalf Baechle # define __mem_ioswabw(a, x) (x) 34*7b5f9694SAlexander Lobakin # define ioswabl(a, x) le32_to_cpu((__force __le32)(x)) 35384740dcSRalf Baechle # define __mem_ioswabl(a, x) (x) 36*7b5f9694SAlexander Lobakin # define ioswabq(a, x) le64_to_cpu((__force __le64)(x)) 37384740dcSRalf Baechle # define __mem_ioswabq(a, x) (x) 38384740dcSRalf Baechle 39384740dcSRalf Baechle #else 40384740dcSRalf Baechle 41384740dcSRalf Baechle # define ioswabb(a, x) (x) 42384740dcSRalf Baechle # define __mem_ioswabb(a, x) (x) 43384740dcSRalf Baechle # define ioswabw(a, x) (x) 44*7b5f9694SAlexander Lobakin # define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x)) 45384740dcSRalf Baechle # define ioswabl(a, x) (x) 46*7b5f9694SAlexander Lobakin # define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x)) 47384740dcSRalf Baechle # define ioswabq(a, x) (x) 48*7b5f9694SAlexander Lobakin # define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x)) 49384740dcSRalf Baechle 50384740dcSRalf Baechle #endif 51384740dcSRalf Baechle 52384740dcSRalf Baechle #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */ 53