1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/export.h>
4 #include <linux/types.h>
8 * Copy data from IO memory space to "real" memory space.
10 void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
12 while (count && !IS_ALIGNED((unsigned long)from, 4)) {
13 *(u8 *)to = __raw_readb(from);
20 *(u32 *)to = __raw_readl(from);
27 *(u8 *)to = __raw_readb(from);
33 EXPORT_SYMBOL(__memcpy_fromio);
36 * Copy data from "real" memory space to IO memory space.
38 void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
40 while (count && !IS_ALIGNED((unsigned long)to, 4)) {
41 __raw_writeb(*(u8 *)from, to);
48 __raw_writel(*(u32 *)from, to);
55 __raw_writeb(*(u8 *)from, to);
61 EXPORT_SYMBOL(__memcpy_toio);
64 * "memset" on IO memory space.
66 void __memset_io(volatile void __iomem *dst, int c, size_t count)
73 while (count && !IS_ALIGNED((unsigned long)dst, 4)) {
80 __raw_writel(qc, dst);
91 EXPORT_SYMBOL(__memset_io);