mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-27 22:25:18 +07:00

MIPS MMIO macros for byteswapping from/to hardware endianness are a bit tricky because they use cpu_to_le{16,32,64}() in both directions. This generates a lot of questions from sparse as __le{16,32,64} types are 'restricted' and direct cast is forbidden in order to prevent messing up the byteorder. As MMIO ops are used in almost every single driver, this leads to console flooding and complicates bug hunting. We could fix it in a more proper way, i.e. separate from device / to device byteswap macros and expand __BUILD_MEMORY_*(), but this seems redundant and will produce code duplication. Instead, just expand the existing *ioswab*() macros with forced typecasting to stop floods. Signed-off-by: Alexander Lobakin <alobakin@pm.me> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
27 lines
863 B
C
27 lines
863 B
C
/*
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
* for more details.
|
|
*
|
|
* Copyright (C) 2003 Ladislav Michl
|
|
* Copyright (C) 2004 Ralf Baechle
|
|
*/
|
|
#ifndef __ASM_MACH_IP32_MANGLE_PORT_H
|
|
#define __ASM_MACH_IP32_MANGLE_PORT_H
|
|
|
|
#define __swizzle_addr_b(port) ((port) ^ 3)
|
|
#define __swizzle_addr_w(port) ((port) ^ 2)
|
|
#define __swizzle_addr_l(port) (port)
|
|
#define __swizzle_addr_q(port) (port)
|
|
|
|
# define ioswabb(a, x) (x)
|
|
# define __mem_ioswabb(a, x) (x)
|
|
# define ioswabw(a, x) (x)
|
|
# define __mem_ioswabw(a, x) ((__force u16)cpu_to_le16(x))
|
|
# define ioswabl(a, x) (x)
|
|
# define __mem_ioswabl(a, x) ((__force u32)cpu_to_le32(x))
|
|
# define ioswabq(a, x) (x)
|
|
# define __mem_ioswabq(a, x) ((__force u64)cpu_to_le64(x))
|
|
|
|
#endif /* __ASM_MACH_IP32_MANGLE_PORT_H */
|