Skip to content

Commit 0110fea

Browse files
Julian Vetterarndb
authored andcommitted
arm64: Use new fallback IO memcpy/memset
Use the new fallback memcpy_{from,to}io and memset_io functions from lib/iomem_copy.c on the arm64 processor architecture. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Reviewed-by: Yann Sionneau <ysionneau@kalrayinc.com> Signed-off-by: Julian Vetter <jvetter@kalrayinc.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent b660d0a commit 0110fea

2 files changed

Lines changed: 0 additions & 98 deletions

File tree

arch/arm64/include/asm/io.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -128,17 +128,6 @@ static __always_inline u64 __raw_readq(const volatile void __iomem *addr)
128128
#define IO_SPACE_LIMIT (PCI_IO_SIZE - 1)
129129
#define PCI_IOBASE ((void __iomem *)PCI_IO_START)
130130

131-
/*
132-
* String version of I/O memory access operations.
133-
*/
134-
extern void __memcpy_fromio(void *, const volatile void __iomem *, size_t);
135-
extern void __memcpy_toio(volatile void __iomem *, const void *, size_t);
136-
extern void __memset_io(volatile void __iomem *, int, size_t);
137-
138-
#define memset_io(c,v,l) __memset_io((c),(v),(l))
139-
#define memcpy_fromio(a,c,l) __memcpy_fromio((a),(c),(l))
140-
#define memcpy_toio(c,a,l) __memcpy_toio((c),(a),(l))
141-
142131
/*
143132
* The ARM64 iowrite implementation is intended to support drivers that want to
144133
* use write combining. For instance PCI drivers using write combining with a 64

arch/arm64/kernel/io.c

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,6 @@
99
#include <linux/types.h>
1010
#include <linux/io.h>
1111

12-
/*
13-
* Copy data from IO memory space to "real" memory space.
14-
*/
15-
void __memcpy_fromio(void *to, const volatile void __iomem *from, size_t count)
16-
{
17-
while (count && !IS_ALIGNED((unsigned long)from, 8)) {
18-
*(u8 *)to = __raw_readb(from);
19-
from++;
20-
to++;
21-
count--;
22-
}
23-
24-
while (count >= 8) {
25-
*(u64 *)to = __raw_readq(from);
26-
from += 8;
27-
to += 8;
28-
count -= 8;
29-
}
30-
31-
while (count) {
32-
*(u8 *)to = __raw_readb(from);
33-
from++;
34-
to++;
35-
count--;
36-
}
37-
}
38-
EXPORT_SYMBOL(__memcpy_fromio);
39-
4012
/*
4113
* This generates a memcpy that works on a from/to address which is aligned to
4214
* bits. Count is in terms of the number of bits sized quantities to copy. It
@@ -78,62 +50,3 @@ void __iowrite32_copy_full(void __iomem *to, const void *from, size_t count)
7850
dgh();
7951
}
8052
EXPORT_SYMBOL(__iowrite32_copy_full);
81-
82-
/*
83-
* Copy data from "real" memory space to IO memory space.
84-
*/
85-
void __memcpy_toio(volatile void __iomem *to, const void *from, size_t count)
86-
{
87-
while (count && !IS_ALIGNED((unsigned long)to, 8)) {
88-
__raw_writeb(*(u8 *)from, to);
89-
from++;
90-
to++;
91-
count--;
92-
}
93-
94-
while (count >= 8) {
95-
__raw_writeq(*(u64 *)from, to);
96-
from += 8;
97-
to += 8;
98-
count -= 8;
99-
}
100-
101-
while (count) {
102-
__raw_writeb(*(u8 *)from, to);
103-
from++;
104-
to++;
105-
count--;
106-
}
107-
}
108-
EXPORT_SYMBOL(__memcpy_toio);
109-
110-
/*
111-
* "memset" on IO memory space.
112-
*/
113-
void __memset_io(volatile void __iomem *dst, int c, size_t count)
114-
{
115-
u64 qc = (u8)c;
116-
117-
qc |= qc << 8;
118-
qc |= qc << 16;
119-
qc |= qc << 32;
120-
121-
while (count && !IS_ALIGNED((unsigned long)dst, 8)) {
122-
__raw_writeb(c, dst);
123-
dst++;
124-
count--;
125-
}
126-
127-
while (count >= 8) {
128-
__raw_writeq(qc, dst);
129-
dst += 8;
130-
count -= 8;
131-
}
132-
133-
while (count) {
134-
__raw_writeb(c, dst);
135-
dst++;
136-
count--;
137-
}
138-
}
139-
EXPORT_SYMBOL(__memset_io);

0 commit comments

Comments
 (0)