Linux Audio

Check our new training course

Linux BSP development engineering services

Need help to port Linux and bootloaders to your hardware?
Loading...
v6.2
 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);
v4.17
 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 */
29void __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}
42EXPORT_SYMBOL_GPL(__ioread64_copy);