[PATCH 2/3] shared MMU initialization for ARM BSPs
Hesham AL-Matary
heshamelmatary at gmail.com
Mon Sep 16 16:17:37 UTC 2013
The newly added ORed flag: ARM_CP15_CTRL_XP is vital to get RaspberryPi
MMU working properly and to share the container function between various
ARM BSPs. The new ORed flags do not affect the current BSPs that make use
of arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache function.
The rest is of the patch targets MMU initialization for ARM architectures,
desgined to be shared. Later patches make use of shared mminit implementation.
---
c/src/lib/libbsp/arm/shared/mminit.c | 27 +++++++++++++++++++++++++++
c/src/lib/libbsp/shared/include/mm.h | 31 +++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+)
create mode 100644 c/src/lib/libbsp/arm/shared/mminit.c
create mode 100644 c/src/lib/libbsp/shared/include/mm.h
diff --git a/c/src/lib/libbsp/arm/shared/mminit.c b/c/src/lib/libbsp/arm/shared/mminit.c
new file mode 100644
index 0000000..c3d9f16
--- /dev/null
+++ b/c/src/lib/libbsp/arm/shared/mminit.c
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013 Hesham AL-Matary.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+#include <bsp/arm-cp15-start.h>
+#include <bsp/linker-symbols.h>
+#include <bsp/mm.h>
+#include <bsp/start.h>
+
+extern const arm_cp15_start_section_config bsp_mm_config_table[];
+extern const size_t bsp_mm_config_table_size;
+
+BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)
+{
+ uint32_t ctrl = arm_cp15_get_control();
+
+ arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
+ ctrl,
+ (uint32_t *) bsp_translation_table_base,
+ ARM_MMU_DEFAULT_CLIENT_DOMAIN,
+ &bsp_mm_config_table[0],
+ bsp_mm_config_table_size
+ );
+}
diff --git a/c/src/lib/libbsp/shared/include/mm.h b/c/src/lib/libbsp/shared/include/mm.h
new file mode 100644
index 0000000..476c288
--- /dev/null
+++ b/c/src/lib/libbsp/shared/include/mm.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013 Hesham AL-Matary.
+ * Copyright (c) 2013 Gedare Bloom.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#ifndef __LIBBSP_MM_H
+#define __LIBBSP_MM_H
+
+#include <stdint.h>
+#include <stdlib.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void bsp_memory_management_initialize(void);
+
+void bsp_memory_management_set_attributes(
+ uintptr_t base,
+ size_t size,
+ uint32_t attr
+);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--
1.8.3.1
More information about the devel
mailing list