162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci * 362306a36Sopenharmony_ci * SH version cribbed from the MIPS copy: 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2003, 2004 Ralf Baechle 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci#ifndef __MACH_COMMON_MANGLE_PORT_H 862306a36Sopenharmony_ci#define __MACH_COMMON_MANGLE_PORT_H 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci/* 1162306a36Sopenharmony_ci * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware; 1262306a36Sopenharmony_ci * less sane hardware forces software to fiddle with this... 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * Regardless, if the host bus endianness mismatches that of PCI/ISA, then 1562306a36Sopenharmony_ci * you can't have the numerical value of data and byte addresses within 1662306a36Sopenharmony_ci * multibyte quantities both preserved at the same time. Hence two 1762306a36Sopenharmony_ci * variations of functions: non-prefixed ones that preserve the value 1862306a36Sopenharmony_ci * and prefixed ones that preserve byte addresses. The latters are 1962306a36Sopenharmony_ci * typically used for moving raw data between a peripheral and memory (cf. 2062306a36Sopenharmony_ci * string I/O functions), hence the "__mem_" prefix. 2162306a36Sopenharmony_ci */ 2262306a36Sopenharmony_ci#if defined(CONFIG_SWAP_IO_SPACE) 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci# define ioswabb(x) (x) 2562306a36Sopenharmony_ci# define __mem_ioswabb(x) (x) 2662306a36Sopenharmony_ci# define ioswabw(x) le16_to_cpu(x) 2762306a36Sopenharmony_ci# define __mem_ioswabw(x) (x) 2862306a36Sopenharmony_ci# define ioswabl(x) le32_to_cpu(x) 2962306a36Sopenharmony_ci# define __mem_ioswabl(x) (x) 3062306a36Sopenharmony_ci# define ioswabq(x) le64_to_cpu(x) 3162306a36Sopenharmony_ci# define __mem_ioswabq(x) (x) 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#else 3462306a36Sopenharmony_ci 3562306a36Sopenharmony_ci# define ioswabb(x) (x) 3662306a36Sopenharmony_ci# define __mem_ioswabb(x) (x) 3762306a36Sopenharmony_ci# define ioswabw(x) (x) 3862306a36Sopenharmony_ci# define __mem_ioswabw(x) cpu_to_le16(x) 3962306a36Sopenharmony_ci# define ioswabl(x) (x) 4062306a36Sopenharmony_ci# define __mem_ioswabl(x) cpu_to_le32(x) 4162306a36Sopenharmony_ci# define ioswabq(x) (x) 4262306a36Sopenharmony_ci# define __mem_ioswabq(x) cpu_to_le32(x) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#endif 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci#endif /* __MACH_COMMON_MANGLE_PORT_H */ 47