[PATCH 3/4] Code refactor realview-pbx-a9 BSP MMU initialization

Rohini Kulkarni krohini1593 at gmail.com
Thu Aug 13 21:44:23 UTC 2015


---
 c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am   |    4 +++
 .../arm/realview-pbx-a9/startup/bspstarthooks.c    |   27 ++++++++++----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
index 2cc7aa0..606f510 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
@@ -28,6 +28,7 @@ nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
 
 include_bsp_HEADERS =
 include_bsp_HEADERS += ../../shared/include/utility.h
+include_bsp_HEADERS += ../../../libbsp/shared/include/mm.h
 include_bsp_HEADERS += ../../shared/include/irq-generic.h
 include_bsp_HEADERS += ../../shared/include/irq-info.h
 include_bsp_HEADERS += ../../shared/include/stackalloc.h
@@ -131,6 +132,9 @@ libbsp_a_CPPFLAGS += -I$(srcdir)/../../../libcpu/arm/shared/include
 # Start hooks
 libbsp_a_SOURCES += startup/bspstarthooks.c
 
+# LIBMM
+libbsp_a_SOURCES += ../shared/mminit.c
+
 # Framebuffer
 libbsp_a_SOURCES += ../shared/arm-pl111-fb.c
 libbsp_a_SOURCES += startup/fb-config.c
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c
index ab766e8..74391b5 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/startup/bspstarthooks.c
@@ -15,12 +15,13 @@
 #define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION
 
 #include <bsp.h>
+#include <bsp/mm.h>
 #include <bsp/start.h>
 #include <bsp/arm-cp15-start.h>
 #include <bsp/arm-a9mpcore-start.h>
 
-BSP_START_DATA_SECTION static const arm_cp15_start_section_config
-rvpbxa9_mmu_config_table[] = {
+BSP_START_DATA_SECTION const arm_cp15_start_section_config
+arm_cp15_start_mmu_config_table[] = {
   ARMV7_CP15_START_DEFAULT_SECTIONS,
   {
     .begin = 0x10000000U,
@@ -37,19 +38,17 @@ rvpbxa9_mmu_config_table[] = {
   }
 };
 
+const size_t arm_cp15_start_mmu_config_table_size =
+  RTEMS_ARRAY_SIZE(arm_cp15_start_mmu_config_table);
+
 BSP_START_TEXT_SECTION static void setup_mmu_and_cache(void)
 {
-  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(
-    ARM_CP15_CTRL_A,
-    ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z
-  );
-
-  arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(
-    ctrl,
-    (uint32_t *) bsp_translation_table_base,
-    ARM_MMU_DEFAULT_CLIENT_DOMAIN,
-    &rvpbxa9_mmu_config_table[0],
-    RTEMS_ARRAY_SIZE(rvpbxa9_mmu_config_table)
+  uint32_t bsp_initial_mmu_ctrl_set = ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z;
+  uint32_t bsp_initial_mmu_ctrl_clear = ARM_CP15_CTRL_A;
+  
+  bsp_memory_management_initialize(
+    bsp_initial_mmu_ctrl_set,
+    bsp_initial_mmu_ctrl_clear
   );
 }
 
@@ -78,4 +77,4 @@ BSP_START_TEXT_SECTION void bsp_start_hook_1(void)
   bsp_start_copy_sections();
   setup_mmu_and_cache();
   bsp_start_clear_bss();
-}
+}
\ No newline at end of file
-- 
1.7.9.5




More information about the devel mailing list