1 /* 2 * This file is free software; you can redistribute it and/or modify 3 * it under the terms of version 2 of the GNU General Public License 4 * as published by the Free Software Foundation. 5 * 6 * This program is distributed in the hope that it will be useful, 7 * but WITHOUT ANY WARRANTY; without even the implied warranty of 8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 9 * GNU General Public License for more details. 10 * 11 * You should have received a copy of the GNU General Public License 12 * along with this program; if not, write to the Free Software Foundation, 13 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. 14 */ 15 16 #include <linux/export.h> 17 #include <linux/io.h> 18 19 /** 20 * __ioread64_copy - copy data from MMIO space, in 64-bit units 21 * @to: destination (must be 64-bit aligned) 22 * @from: source, in MMIO space (must be 64-bit aligned) 23 * @count: number of 64-bit quantities to copy 24 * 25 * Copy data from MMIO space to kernel space, in units of 32 or 64 bits at a 26 * time. Order of access is not guaranteed, nor is a memory barrier 27 * performed afterwards. 28 */ 29 void __ioread64_copy(void *to, const void __iomem *from, size_t count) 30 { 31 #ifdef CONFIG_64BIT 32 u64 *dst = to; 33 const u64 __iomem *src = from; 34 const u64 __iomem *end = src + count; 35 36 while (src < end) 37 *dst++ = __raw_readq(src++); 38 #else 39 __ioread32_copy(to, from, count * 2); 40 #endif 41 } 42 EXPORT_SYMBOL_GPL(__ioread64_copy); 43