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

[Minios-devel] [PATCH v2 35/47] arm32: gic: move REG_WRITE32/REG_READ32 to a separate header



Move REG_WRITE32/REG_READ32 to:
      include/arm/arm32/io.h

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

diff --git a/arch/arm/gic.c b/arch/arm/gic.c
index 687f242..ad8c350 100644
--- a/arch/arm/gic.c
+++ b/arch/arm/gic.c
@@ -5,6 +5,10 @@
 #include <mini-os/console.h>
 #include <libfdt.h>
 
+#if defined(__arm__)
+#include <mini-os/arm32/io.h>
+#endif
+
 //#define VGIC_DEBUG
 #ifdef VGIC_DEBUG
 #define DEBUG(_f, _a...) \
@@ -41,20 +45,6 @@ static struct gic gic;
 
 #define REG(addr) ((uint32_t *)(addr))
 
-static inline uint32_t REG_READ32(volatile uint32_t *addr)
-{
-    uint32_t value;
-    __asm__ __volatile__("ldr %0, [%1]":"=&r"(value):"r"(addr));
-    rmb();
-    return value;
-}
-
-static inline void REG_WRITE32(volatile uint32_t *addr, unsigned int value)
-{
-    __asm__ __volatile__("str %0, [%1]"::"r"(value), "r"(addr));
-    wmb();
-}
-
 static void gic_set_priority(struct gic *gic, int irq_number, unsigned char 
priority)
 {
     uint32_t value;
diff --git a/include/arm/arm32/io.h b/include/arm/arm32/io.h
new file mode 100644
index 0000000..5f71e17
--- /dev/null
+++ b/include/arm/arm32/io.h
@@ -0,0 +1,18 @@
+#ifndef __ARM32_IO_H__
+#define __ARM32_IO_H__
+
+static inline uint32_t REG_READ32(volatile uint32_t *addr)
+{
+    uint32_t value;
+    __asm__ __volatile__("ldr %0, [%1]":"=&r"(value):"r"(addr));
+    rmb();
+    return value;
+}
+
+static inline void REG_WRITE32(volatile uint32_t *addr, unsigned int value)
+{
+    __asm__ __volatile__("str %0, [%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®.