kmap.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _KMAP_H
  3. #define _KMAP_H
  4. #ifdef CONFIG_MMU
  5. #define ARCH_HAS_IOREMAP_WT
  6. /* Values for nocacheflag and cmode */
  7. #define IOMAP_FULL_CACHING 0
  8. #define IOMAP_NOCACHE_SER 1
  9. #define IOMAP_NOCACHE_NONSER 2
  10. #define IOMAP_WRITETHROUGH 3
  11. /*
  12. * These functions exported by arch/m68k/mm/kmap.c.
  13. * Only needed on MMU enabled systems.
  14. */
  15. extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size,
  16. int cacheflag);
  17. #define iounmap iounmap
  18. extern void iounmap(void __iomem *addr);
  19. extern void __iounmap(void *addr, unsigned long size);
  20. #define ioremap ioremap
  21. static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size)
  22. {
  23. return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  24. }
  25. #define ioremap_nocache ioremap_nocache
  26. static inline void __iomem *ioremap_nocache(unsigned long physaddr,
  27. unsigned long size)
  28. {
  29. return __ioremap(physaddr, size, IOMAP_NOCACHE_SER);
  30. }
  31. #define ioremap_uc ioremap_nocache
  32. #define ioremap_wt ioremap_wt
  33. static inline void __iomem *ioremap_wt(unsigned long physaddr,
  34. unsigned long size)
  35. {
  36. return __ioremap(physaddr, size, IOMAP_WRITETHROUGH);
  37. }
  38. #define ioremap_fullcache ioremap_fullcache
  39. static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
  40. unsigned long size)
  41. {
  42. return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
  43. }
  44. #define memset_io memset_io
  45. static inline void memset_io(volatile void __iomem *addr, unsigned char val,
  46. int count)
  47. {
  48. __builtin_memset((void __force *) addr, val, count);
  49. }
  50. #define memcpy_fromio memcpy_fromio
  51. static inline void memcpy_fromio(void *dst, const volatile void __iomem *src,
  52. int count)
  53. {
  54. __builtin_memcpy(dst, (void __force *) src, count);
  55. }
  56. #define memcpy_toio memcpy_toio
  57. static inline void memcpy_toio(volatile void __iomem *dst, const void *src,
  58. int count)
  59. {
  60. __builtin_memcpy((void __force *) dst, src, count);
  61. }
  62. #endif /* CONFIG_MMU */
  63. #define ioport_map ioport_map
  64. static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
  65. {
  66. return (void __iomem *) port;
  67. }
  68. #define ioport_unmap ioport_unmap
  69. static inline void ioport_unmap(void __iomem *p)
  70. {
  71. }
  72. #endif /* _KMAP_H */