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