diff options
Diffstat (limited to 'lib/iomap_copy.c')
-rw-r--r-- | lib/iomap_copy.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/iomap_copy.c b/lib/iomap_copy.c index 4527e751b5e0..b8f1d6cbb200 100644 --- a/lib/iomap_copy.c +++ b/lib/iomap_copy.c | |||
@@ -42,6 +42,27 @@ void __attribute__((weak)) __iowrite32_copy(void __iomem *to, | |||
42 | EXPORT_SYMBOL_GPL(__iowrite32_copy); | 42 | EXPORT_SYMBOL_GPL(__iowrite32_copy); |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * __ioread32_copy - copy data from MMIO space, in 32-bit units | ||
46 | * @to: destination (must be 32-bit aligned) | ||
47 | * @from: source, in MMIO space (must be 32-bit aligned) | ||
48 | * @count: number of 32-bit quantities to copy | ||
49 | * | ||
50 | * Copy data from MMIO space to kernel space, in units of 32 bits at a | ||
51 | * time. Order of access is not guaranteed, nor is a memory barrier | ||
52 | * performed afterwards. | ||
53 | */ | ||
54 | void __ioread32_copy(void *to, const void __iomem *from, size_t count) | ||
55 | { | ||
56 | u32 *dst = to; | ||
57 | const u32 __iomem *src = from; | ||
58 | const u32 __iomem *end = src + count; | ||
59 | |||
60 | while (src < end) | ||
61 | *dst++ = __raw_readl(src++); | ||
62 | } | ||
63 | EXPORT_SYMBOL_GPL(__ioread32_copy); | ||
64 | |||
65 | /** | ||
45 | * __iowrite64_copy - copy data to MMIO space, in 64-bit or 32-bit units | 66 | * __iowrite64_copy - copy data to MMIO space, in 64-bit or 32-bit units |
46 | * @to: destination, in MMIO space (must be 64-bit aligned) | 67 | * @to: destination, in MMIO space (must be 64-bit aligned) |
47 | * @from: source (must be 64-bit aligned) | 68 | * @from: source (must be 64-bit aligned) |