[PATCH 4/4] Code refactor xilinx-zynq BSP MMU initialization

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


---
 c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am       |    4 +++
 .../libbsp/arm/xilinx-zynq/startup/bspstartmmu.c   |   27 ++++++++++----------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am b/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
index df4aa15..f7b23bd 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/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
@@ -133,6 +134,9 @@ libbsp_a_CPPFLAGS += -I$(srcdir)/../shared/arm-l2c-310
 # Start hooks
 libbsp_a_SOURCES += startup/bspstarthooks.c startup/bspstartmmu.c
 
+# LIBMM
+libbsp_a_SOURCES += ../shared/mminit.c
+
 ###############################################################################
 #                  Special Rules                                              #
 ###############################################################################
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstartmmu.c b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstartmmu.c
index c7a1089..e33e18b 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstartmmu.c
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/startup/bspstartmmu.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
-zynq_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 = 0xe0000000U,
@@ -39,17 +40,15 @@ zynq_mmu_config_table[] = {
 BSP_START_TEXT_SECTION void zynq_setup_mmu_and_cache(void) __attribute__ ((weak));
 
 BSP_START_TEXT_SECTION void zynq_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,
-    &zynq_mmu_config_table[0],
-    RTEMS_ARRAY_SIZE(zynq_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
   );
 }
+
+const size_t arm_cp15_start_mmu_config_table_size =
+  RTEMS_ARRAY_SIZE(arm_cp15_start_mmu_config_table);
\ No newline at end of file
-- 
1.7.9.5




More information about the devel mailing list