[PATCH 1 of 20] Introduce __memcpy_toio32

From: Bryan O'Sullivan
Date: Wed Dec 28 2005 - 19:38:18 EST


This routine is an arch-independent building block for memcpy_toio32.
It copies data to a memory-mapped I/O region, using 32-bit accesses.
This style of access is required by some devices.

Signed-off-by: Bryan O'Sullivan <bos@xxxxxxxxxxxxx>

diff -r a56fd6a8895d -r ef833f6712e7 include/asm-generic/iomap.h
--- a/include/asm-generic/iomap.h Wed Dec 28 14:19:42 2005 -0800
+++ b/include/asm-generic/iomap.h Wed Dec 28 14:19:42 2005 -0800
@@ -56,6 +56,15 @@
extern void fastcall iowrite16_rep(void __iomem *port, const void *buf, unsigned long count);
extern void fastcall iowrite32_rep(void __iomem *port, const void *buf, unsigned long count);

+/*
+ * __memcpy_toio32 - copy data to MMIO space, in 32-bit units
+ *
+ * @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 fastcall __memcpy_toio32(void __iomem *to, const void *from, size_t count);
+
/* Create a virtual mapping cookie for an IO port range */
extern void __iomem *ioport_map(unsigned long port, unsigned int nr);
extern void ioport_unmap(void __iomem *);
diff -r a56fd6a8895d -r ef833f6712e7 lib/iomap.c
--- a/lib/iomap.c Wed Dec 28 14:19:42 2005 -0800
+++ b/lib/iomap.c Wed Dec 28 14:19:42 2005 -0800
@@ -187,6 +187,17 @@
EXPORT_SYMBOL(iowrite16_rep);
EXPORT_SYMBOL(iowrite32_rep);

+void fastcall __memcpy_toio32(void __iomem *d, const void *s, size_t count)
+{
+ u32 __iomem *dst = d;
+ const u32 *src = s;
+ size_t i;
+
+ for (i = 0; i < count; i++)
+ __raw_writel(*src++, dst++);
+ wmb();
+}
+
/* Create a virtual mapping cookie for an IO port range */
void __iomem *ioport_map(unsigned long port, unsigned int nr)
{
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/