summaryrefslogtreecommitdiff
path: root/libcpu
diff options
context:
space:
mode:
Diffstat (limited to 'libcpu')
-rw-r--r--libcpu/Kconfig8
-rw-r--r--libcpu/aarch64/Kconfig4
-rw-r--r--libcpu/aarch64/common/cpuport.h32
-rw-r--r--libcpu/aarch64/common/mmu.c25
4 files changed, 41 insertions, 28 deletions
diff --git a/libcpu/Kconfig b/libcpu/Kconfig
index 9636ce5599..1b21511200 100644
--- a/libcpu/Kconfig
+++ b/libcpu/Kconfig
@@ -1,5 +1,3 @@
-menu "RT-Thread Architecture"
-
config ARCH_CPU_64BIT
bool
@@ -239,6 +237,6 @@ config ARCH_CPU_STACK_GROWS_UPWARD
bool
default n
-source "$RTT_DIR/libcpu/aarch64/Kconfig"
-
-endmenu
+if ARCH_ARMV8 && ARCH_CPU_64BIT
+ source "$RTT_DIR/libcpu/aarch64/Kconfig"
+endif
diff --git a/libcpu/aarch64/Kconfig b/libcpu/aarch64/Kconfig
index 4bb9f1ffe7..ac280832b4 100644
--- a/libcpu/aarch64/Kconfig
+++ b/libcpu/aarch64/Kconfig
@@ -1,4 +1,4 @@
-if ARCH_ARMV8 && ARCH_CPU_64BIT
+menu "AArch64 Architecture Configuration"
config ARCH_TEXT_OFFSET
hex "Text offset"
@@ -16,4 +16,4 @@ config ARCH_HAVE_EFFICIENT_UNALIGNED_ACCESS
bool
default y
-endif
+endmenu
diff --git a/libcpu/aarch64/common/cpuport.h b/libcpu/aarch64/common/cpuport.h
index 12719c4531..2fe6afb2b9 100644
--- a/libcpu/aarch64/common/cpuport.h
+++ b/libcpu/aarch64/common/cpuport.h
@@ -23,30 +23,20 @@ typedef union {
} rt_hw_spinlock_t;
#endif
-rt_inline void rt_hw_isb(void)
-{
- __asm__ volatile ("isb":::"memory");
-}
+#define rt_hw_barrier(cmd, ...) \
+ __asm__ volatile (RT_STRINGIFY(cmd) " "RT_STRINGIFY(__VA_ARGS__):::"memory")
-rt_inline void rt_hw_dmb(void)
-{
- __asm__ volatile ("dmb ish":::"memory");
-}
+#define rt_hw_isb() rt_hw_barrier(isb)
+#define rt_hw_dmb() rt_hw_barrier(dmb, ish)
+#define rt_hw_wmb() rt_hw_barrier(dmb, ishst)
+#define rt_hw_rmb() rt_hw_barrier(dmb, ishld)
+#define rt_hw_dsb() rt_hw_barrier(dsb, ish)
-rt_inline void rt_hw_wmb(void)
-{
- __asm__ volatile ("dmb ishst":::"memory");
-}
+#define rt_hw_wfi() rt_hw_barrier(wfi)
+#define rt_hw_wfe() rt_hw_barrier(wfe)
+#define rt_hw_sev() rt_hw_barrier(sev)
-rt_inline void rt_hw_rmb(void)
-{
- __asm__ volatile ("dmb ishld":::"memory");
-}
-
-rt_inline void rt_hw_dsb(void)
-{
- __asm__ volatile ("dsb ish":::"memory");
-}
+#define rt_hw_cpu_relax() rt_hw_barrier(yield)
void _thread_start(void);
#endif /*CPUPORT_H__*/
diff --git a/libcpu/aarch64/common/mmu.c b/libcpu/aarch64/common/mmu.c
index 88df1f89ff..cd38d74ef3 100644
--- a/libcpu/aarch64/common/mmu.c
+++ b/libcpu/aarch64/common/mmu.c
@@ -590,6 +590,31 @@ static int _map_single_page_2M(unsigned long *lv0_tbl, unsigned long va,
return 0;
}
+void *rt_ioremap_early(void *paddr, size_t size)
+{
+ size_t count;
+ static void *tbl = RT_NULL;
+
+ if (!size)
+ {
+ return RT_NULL;
+ }
+
+ if (!tbl)
+ {
+ tbl = rt_hw_mmu_tbl_get();
+ }
+
+ count = (size + ARCH_SECTION_MASK) >> ARCH_SECTION_SHIFT;
+
+ while (count --> 0)
+ {
+ _map_single_page_2M(tbl, (unsigned long)paddr, (unsigned long)paddr, MMU_MAP_K_DEVICE);
+ }
+
+ return paddr;
+}
+
static int _init_map_2M(unsigned long *lv0_tbl, unsigned long va,
unsigned long pa, unsigned long count,
unsigned long attr)