mangle-port.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2003, 2004 Ralf Baechle
  7. */
  8. #ifndef __ASM_MACH_GENERIC_MANGLE_PORT_H
  9. #define __ASM_MACH_GENERIC_MANGLE_PORT_H
  10. #define __swizzle_addr_b(port) (port)
  11. #define __swizzle_addr_w(port) (port)
  12. #define __swizzle_addr_l(port) (port)
  13. #define __swizzle_addr_q(port) (port)
  14. /*
  15. * Sane hardware offers swapping of PCI/ISA I/O space accesses in hardware;
  16. * less sane hardware forces software to fiddle with this...
  17. *
  18. * Regardless, if the host bus endianness mismatches that of PCI/ISA, then
  19. * you can't have the numerical value of data and byte addresses within
  20. * multibyte quantities both preserved at the same time. Hence two
  21. * variations of functions: non-prefixed ones that preserve the value
  22. * and prefixed ones that preserve byte addresses. The latters are
  23. * typically used for moving raw data between a peripheral and memory (cf.
  24. * string I/O functions), hence the "__mem_" prefix.
  25. */
  26. #if defined(CONFIG_SWAP_IO_SPACE)
  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. #else
  36. # define ioswabb(a, x) (x)
  37. # define __mem_ioswabb(a, x) (x)
  38. # define ioswabw(a, x) (x)
  39. # define __mem_ioswabw(a, x) cpu_to_le16(x)
  40. # define ioswabl(a, x) (x)
  41. # define __mem_ioswabl(a, x) cpu_to_le32(x)
  42. # define ioswabq(a, x) (x)
  43. # define __mem_ioswabq(a, x) cpu_to_le32(x)
  44. #endif
  45. #endif /* __ASM_MACH_GENERIC_MANGLE_PORT_H */