Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 
0003 #include <linux/export.h>
0004 #include <linux/io.h>
0005 
0006 /**
0007  * __ioread64_copy - copy data from MMIO space, in 64-bit units
0008  * @to: destination (must be 64-bit aligned)
0009  * @from: source, in MMIO space (must be 64-bit aligned)
0010  * @count: number of 64-bit quantities to copy
0011  *
0012  * Copy data from MMIO space to kernel space, in units of 32 or 64 bits at a
0013  * time.  Order of access is not guaranteed, nor is a memory barrier
0014  * performed afterwards.
0015  */
0016 void __ioread64_copy(void *to, const void __iomem *from, size_t count)
0017 {
0018 #ifdef CONFIG_64BIT
0019     u64 *dst = to;
0020     const u64 __iomem *src = from;
0021     const u64 __iomem *end = src + count;
0022 
0023     while (src < end)
0024         *dst++ = __raw_readq(src++);
0025 #else
0026     __ioread32_copy(to, from, count * 2);
0027 #endif
0028 }
0029 EXPORT_SYMBOL_GPL(__ioread64_copy);