aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lib/iomap_copy.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/lib/iomap_copy.c')
-rw-r--r--arch/mips/lib/iomap_copy.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/mips/lib/iomap_copy.c b/arch/mips/lib/iomap_copy.c
new file mode 100644
index 000000000..157500a09
--- /dev/null
+++ b/arch/mips/lib/iomap_copy.c
@@ -0,0 +1,29 @@
1// SPDX-License-Identifier: GPL-2.0-only
2
3#include <linux/export.h>
4#include <linux/io.h>
5
6/**
7 * __ioread64_copy - copy data from MMIO space, in 64-bit units
8 * @to: destination (must be 64-bit aligned)
9 * @from: source, in MMIO space (must be 64-bit aligned)
10 * @count: number of 64-bit quantities to copy
11 *
12 * Copy data from MMIO space to kernel space, in units of 32 or 64 bits at a
13 * time. Order of access is not guaranteed, nor is a memory barrier
14 * performed afterwards.
15 */
16void __ioread64_copy(void *to, const void __iomem *from, size_t count)
17{
18#ifdef CONFIG_64BIT
19 u64 *dst = to;
20 const u64 __iomem *src = from;
21 const u64 __iomem *end = src + count;
22
23 while (src < end)
24 *dst++ = __raw_readq(src++);
25#else
26 __ioread32_copy(to, from, count * 2);
27#endif
28}
29EXPORT_SYMBOL_GPL(__ioread64_copy);