On Tue, 2006-01-10 at 08:07 -0800, Bryan O'Sullivan wrote:
> The only problem with this is that it's an unusual approach, so I don't
> have any obvious examples to copy.
It was easy to hack up a quick patch to try the idea out.
This single-arch patch is for review purposes only; I compile-tested it
on i386, and it has no obvious problems at compile- or link-time.
If it looks OK, I have a complete patch set that affects all arches.
The parts that affect arch/*/lib/Makefile and include/asm-*/io.h are
essentially identical in all cases.
<b
diff -r 48616306e7bd include/asm-generic/raw_memcpy_toio32.h
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/include/asm-generic/raw_memcpy_toio32.h Tue Jan 10 08:44:30 2006 -0800
@@ -0,0 +1,16 @@
+#ifndef _ASM_GENERIC_RAW_MEMCPYTOIO32_H
+#define _ASM_GENERIC_RAW_MEMCPYTOIO32_H
+
+/*
+ * __raw_memcpy_toio32 - copy data to MMIO space, in 32-bit units
+ *
+ * Order of access is not guaranteed, nor is a memory barrier performed
+ * afterwards. This is an arch-independent generic implementation.
+ *
+ * @to: destination, in MMIO space (must be 32-bit aligned)
+ * @from: source (must be 32-bit aligned)
+ * @count: number of 32-bit quantities to copy
+ */
+void __raw_memcpy_toio32(void __iomem *to, const void *from, size_t count);
+
+#endif // _ASM_GENERIC_RAW_MEMCPYTOIO32_H
--- /dev/null Thu Jan 1 00:00:00 1970 +0000
+++ b/lib/raw_memcpy_toio32.c Tue Jan 10 08:44:30 2006 -0800
@@ -0,0 +1,13 @@
+#include <linux/types.h>
+#include <asm/io.h>
+#include <asm-generic/raw_memcpy_toio32.h>
+
+void __raw_memcpy_toio32(void __iomem *to, const void *from, size_t count)
+{
+ u32 __iomem *dst = to;
+ const u32 *src = from;
+ size_t i;
+
+ for (i = 0; i < count; i++)
+ __raw_writel(*src++, dst++);
+}
--- a/arch/i386/lib/Makefile Tue Jan 10 08:44:35 2006 -0800
+++ b/arch/i386/lib/Makefile Tue Jan 10 08:44:44 2006 -0800
@@ -5,5 +5,6 @@
lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \
bitops.o
+lib-y += ../../../lib/raw_memcpy_toio32.o
lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
--- a/include/asm-i386/io.h Tue Jan 10 08:44:35 2006 -0800
+++ b/include/asm-i386/io.h Tue Jan 10 08:44:44 2006 -0800
@@ -203,6 +203,8 @@
{
__memcpy((void __force *) dst, src, count);
}
+
+#include <asm-generic/raw_memcpy_toio32.h>
/*
* ISA space is 'always mapped' on a typical x86 system, no need to
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]