mangle-port.h 1.6 KB

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