[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] xen/arm: Add helpers ioreadl/iowritel



commit 11eedee7ccbc8c49b4035d342ffd3524ba0684a5
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Fri May 10 17:24:33 2013 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Mon May 13 11:59:57 2013 +0100

    xen/arm: Add helpers ioreadl/iowritel
    
    Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 xen/include/asm-arm/arm32/io.h |   46 ++++++++++++++++++++++++++++++++++++++++
 xen/include/asm-arm/arm64/io.h |   38 +++++++++++++++++++++++++++++++++
 xen/include/asm-arm/mm.h       |    8 +++++++
 3 files changed, 92 insertions(+), 0 deletions(-)

diff --git a/xen/include/asm-arm/arm32/io.h b/xen/include/asm-arm/arm32/io.h
new file mode 100644
index 0000000..ec7e0ff
--- /dev/null
+++ b/xen/include/asm-arm/arm32/io.h
@@ -0,0 +1,46 @@
+/*
+ *  Based on linux arch/arm/include/asm/io.h
+ *
+ *  Copyright (C) 1996-2000 Russell King
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Modifications:
+ *  16-Sep-1996        RMK     Inlined the inx/outx functions & optimised for 
both
+ *                     constant addresses and variable addresses.
+ *  04-Dec-1997        RMK     Moved a lot of this stuff to the new 
architecture
+ *                     specific IO header files.
+ *  27-Mar-1999        PJB     Second parameter of memcpy_toio is const..
+ *  04-Apr-1999        PJB     Added check_signature.
+ *  12-Dec-1999        RMK     More cleanups
+ *  18-Jun-2000 RMK    Removed virt_to_* and friends definitions
+ *  05-Oct-2004 BJD     Moved memory string functions to use void __iomem
+ */
+#ifndef _ARM_ARM32_IO_H
+#define _ARM_ARM32_IO_H
+
+#include <asm/system.h>
+
+static inline uint32_t ioreadl(const volatile void __iomem *addr)
+{
+    uint32_t val;
+
+    asm volatile("ldr %1, %0"
+                 : "+Qo" (*(volatile uint32_t __force *)addr),
+                   "=r" (val));
+    dsb();
+
+    return val;
+}
+
+static inline void iowritel(const volatile void __iomem *addr, uint32_t val)
+{
+    dsb();
+    asm volatile("str %1, %0"
+                 : "+Qo" (*(volatile uint32_t __force *)addr)
+                 : "r" (val));
+}
+
+#endif /* _ARM_ARM32_IO_H */
diff --git a/xen/include/asm-arm/arm64/io.h b/xen/include/asm-arm/arm64/io.h
new file mode 100644
index 0000000..ec041cd
--- /dev/null
+++ b/xen/include/asm-arm/arm64/io.h
@@ -0,0 +1,38 @@
+/*
+ * Based on linux arch/arm64/include/asm/io.h
+ *
+ * Copyright (C) 1996-2000 Russell King
+ * Copyright (C) 2012 ARM Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef _ARM_ARM64_IO_H
+#define _ARM_ARM64_IO_H
+
+static inline uint32_t ioreadl(const volatile void __iomem *addr)
+{
+    uint32_t val;
+
+    asm volatile("ldr %w0, [%1]" : "=r" (val) : "r" (addr));
+    dsb();
+
+    return val;
+}
+
+static inline void iowritel(const volatile void __iomem *addr, uint32_t val)
+{
+    dsb();
+    asm volatile("str %w0, [%1]" : : "r" (val), "r" (addr));
+}
+
+#endif /* _ARM_ARM64_IO_H */
diff --git a/xen/include/asm-arm/mm.h b/xen/include/asm-arm/mm.h
index 63e1069..5e7c5a3 100644
--- a/xen/include/asm-arm/mm.h
+++ b/xen/include/asm-arm/mm.h
@@ -6,6 +6,14 @@
 #include <asm/page.h>
 #include <public/xen.h>
 
+#if defined(CONFIG_ARM_32)
+# include <asm/arm32/io.h>
+#elif defined(CONFIG_ARM_64)
+# include <asm/arm64/io.h>
+#else
+# error "unknown ARM variant"
+#endif
+
 /* Align Xen to a 2 MiB boundary. */
 #define XEN_PADDR_ALIGN (1 << 21)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.