mangle-port.h 1.5 KB

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