Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/mips/lib/iomap_copy.c
26424 views
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
*/
16
void __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
}
29
EXPORT_SYMBOL_GPL(__ioread64_copy);
30
31