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

[Minios-devel] [PATCH v2 36/47] arm64: gic: implement the REG_WRITE32/REG_READ32



Implement the REG_WRITE32/REG_READ32 for arm64.

Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
 arch/arm/gic.c         |  2 ++
 include/arm/arm64/io.h | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+)
 create mode 100644 include/arm/arm64/io.h

diff --git a/arch/arm/gic.c b/arch/arm/gic.c
index ad8c350..102504f 100644
--- a/arch/arm/gic.c
+++ b/arch/arm/gic.c
@@ -7,6 +7,8 @@
 
 #if defined(__arm__)
 #include <mini-os/arm32/io.h>
+#else
+#include <mini-os/arm64/io.h>
 #endif
 
 //#define VGIC_DEBUG
diff --git a/include/arm/arm64/io.h b/include/arm/arm64/io.h
new file mode 100644
index 0000000..f4c087c
--- /dev/null
+++ b/include/arm/arm64/io.h
@@ -0,0 +1,18 @@
+#ifndef __ARM64_IO_H__
+#define __ARM64_IO_H__
+
+static inline uint32_t REG_READ32(volatile uint32_t *addr)
+{
+    uint32_t value;
+
+    __asm__ __volatile__("ldr %w0, [%1]":"=&r"(value):"r"(addr));
+    rmb();
+    return value;
+}
+
+static inline void REG_WRITE32(volatile uint32_t *addr, unsigned int value)
+{
+    __asm__ __volatile__("str %w0, [%1]"::"r" (value), "r"(addr));
+    wmb();
+}
+#endif
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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