<p dir="ltr">Hi,</p>
<p dir="ltr">Please review the changes. I will work on the suggestions and make the required modifications. </p>
<p dir="ltr">Thanks.</p>
<div class="gmail_quote">On 9 Jul 2015 19:24,  <<a href="mailto:krohini1593@gmail.com">krohini1593@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Rohini Kulkarni <<a href="mailto:krohini1593@gmail.com">krohini1593@gmail.com</a>><br>
<br>
---<br>
 c/src/lib/libbsp/arm/raspberrypi/Makefile.am       |    1 +<br>
 c/src/lib/libbsp/arm/raspberrypi/include/bsp.h     |   14 ++++----<br>
 .../libbsp/arm/raspberrypi/startup/bspstarthooks.c |    8 ++---<br>
 .../libbsp/arm/raspberrypi/startup/bspstartmmu.c   |   34 ++++++++++++++++++++<br>
 c/src/lib/libbsp/arm/shared/mminit.c               |   20 ++++++++----<br>
 c/src/lib/libbsp/shared/include/mm.h               |    6 +++-<br>
 6 files changed, 65 insertions(+), 18 deletions(-)<br>
 create mode 100644 c/src/lib/libbsp/arm/raspberrypi/startup/bspstartmmu.c<br>
<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
index d59263c..74545d6 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/Makefile.am<br>
@@ -131,6 +131,7 @@ libbsp_a_CPPFLAGS += -I$(srcdir)/../../../libcpu/arm/shared/include<br>
<br>
 # Start hooks<br>
 libbsp_a_SOURCES += startup/bspstarthooks.c<br>
+libbsp_a_SOURCES += startup/bspstartmmu.c<br>
<br>
 # LIBMM<br>
 libbsp_a_SOURCES += startup/mm_config_table.c<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h b/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h<br>
index c05a410..410d9ab 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/include/bsp.h<br>
@@ -33,12 +33,6 @@ extern "C" {<br>
<br>
 #define BSP_FEATURE_IRQ_EXTENSION<br>
<br>
-#ifdef __cplusplus<br>
-}<br>
-#endif /* __cplusplus */<br>
-<br>
-#endif /* LIBBSP_ARM_RASPBERRYPI_BSP_H */<br>
-<br>
 /**<br>
  * @defgroup arm_raspberrypi Raspberry Pi Support<br>
  *<br>
@@ -47,3 +41,11 @@ extern "C" {<br>
  * @brief Raspberry Pi support package<br>
  *<br>
  */<br>
+<br>
+void raspberrypi_setup_mmu_and_cache(void);<br>
+<br>
+#ifdef __cplusplus<br>
+}<br>
+#endif /* __cplusplus */<br>
+<br>
+#endif /* LIBBSP_ARM_RASPBERRYPI_BSP_H */<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c<br>
index 047c8ad..107649f 100644<br>
--- a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstarthooks.c<br>
@@ -26,15 +26,15 @@<br>
 #include <bsp/start.h><br>
 #include <bsp/raspberrypi.h><br>
 #include <bsp/mm.h><br>
+#include <bsp.h><br>
<br>
 void BSP_START_TEXT_SECTION bsp_start_hook_0(void)<br>
-{<br>
+{<br>
 }<br>
<br>
-<br>
 void BSP_START_TEXT_SECTION bsp_start_hook_1(void)<br>
 {<br>
   bsp_start_copy_sections();<br>
-  bsp_memory_management_initialize();<br>
+  raspberrypi_setup_mmu_and_cache();<br>
   bsp_start_clear_bss();<br>
-}<br>
+}<br>
\ No newline at end of file<br>
diff --git a/c/src/lib/libbsp/arm/raspberrypi/startup/bspstartmmu.c b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstartmmu.c<br>
new file mode 100644<br>
index 0000000..3741070<br>
--- /dev/null<br>
+++ b/c/src/lib/libbsp/arm/raspberrypi/startup/bspstartmmu.c<br>
@@ -0,0 +1,34 @@<br>
+#define ARM_CP15_TEXT_SECTION BSP_START_TEXT_SECTION<br>
+<br>
+#include <bsp/start.h><br>
+#include <bsp/arm-cp15-start.h><br>
+#include <bsp/linker-symbols.h><br>
+#include <libcpu/arm-cp15.h><br>
+#include <bsp/mm.h><br>
+#include <bsp.h><br>
+<br>
+void raspberrypi_setup_mmu_and_cache(void)<br>
+{<br>
+  uint32_t bsp_initial_mmu_ctrl_set;<br>
+  uint32_t bsp_initial_mmu_ctrl_clear;<br>
+  uint32_t domain_set;<br>
+<br>
+#if (BSP_IS_RPI2 == 1)<br>
+  /* Enable SMP in auxiliary control */<br>
+  uint32_t actlr = arm_cp15_get_auxiliary_control();<br>
+  actlr |= ARM_CORTEX_A9_ACTL_SMP;<br>
+  arm_cp15_set_auxiliary_control(actlr);<br>
+  bsp_initial_mmu_ctrl_clear = ARM_CP15_CTRL_A;<br>
+  bsp_initial_mmu_ctrl_set = ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_Z;<br>
+#else<br>
+  bsp_initial_mmu_ctrl_clear = 0;<br>
+  bsp_initial_mmu_ctrl_set = ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_S | ARM_CP15_CTRL_XP;<br>
+#endif<br>
+  domain_set = ARM_MMU_DEFAULT_CLIENT_DOMAIN;<br>
+<br>
+  bsp_memory_management_initialize(<br>
+    bsp_initial_mmu_ctrl_set,<br>
+    bsp_initial_mmu_ctrl_clear,<br>
+    domain_set<br>
+  );<br>
+}<br>
\ No newline at end of file<br>
diff --git a/c/src/lib/libbsp/arm/shared/mminit.c b/c/src/lib/libbsp/arm/shared/mminit.c<br>
index acfbfc0..b477482 100644<br>
--- a/c/src/lib/libbsp/arm/shared/mminit.c<br>
+++ b/c/src/lib/libbsp/arm/shared/mminit.c<br>
@@ -11,19 +11,25 @@<br>
 #include <bsp/start.h><br>
 #include <bsp/arm-cp15-start.h><br>
 #include <bsp/linker-symbols.h><br>
+#include <libcpu/arm-cp15.h><br>
 #include <bsp/mm.h><br>
<br>
-BSP_START_TEXT_SECTION void bsp_memory_management_initialize(void)<br>
-{<br>
-  uint32_t ctrl = arm_cp15_get_control();<br>
-<br>
-  ctrl |= ARM_CP15_CTRL_AFE | ARM_CP15_CTRL_S | ARM_CP15_CTRL_XP;<br>
<br>
+BSP_START_TEXT_SECTION void bsp_memory_management_initialize(<br>
+  uint32_t bsp_initial_mmu_ctrl_set,<br>
+  uint32_t bsp_initial_mmu_ctrl_clear,<br>
+  uint32_t domain_set<br>
+)<br>
+{<br>
+  uint32_t ctrl = arm_cp15_start_setup_mmu_and_cache(<br>
+    bsp_initial_mmu_ctrl_clear,<br>
+    bsp_initial_mmu_ctrl_set  );<br>
+<br>
   arm_cp15_start_setup_translation_table_and_enable_mmu_and_cache(<br>
     ctrl,<br>
     (uint32_t *) bsp_translation_table_base,<br>
-    ARM_MMU_DEFAULT_CLIENT_DOMAIN,<br>
+    domain_set,<br>
     &arm_cp15_start_mmu_config_table[0],<br>
     arm_cp15_start_mmu_config_table_size<br>
   );<br>
-}<br>
+}<br>
\ No newline at end of file<br>
diff --git a/c/src/lib/libbsp/shared/include/mm.h b/c/src/lib/libbsp/shared/include/mm.h<br>
index 2152f68..49ee472 100644<br>
--- a/c/src/lib/libbsp/shared/include/mm.h<br>
+++ b/c/src/lib/libbsp/shared/include/mm.h<br>
@@ -33,7 +33,11 @@ extern "C" {<br>
  *  @brief MM Support Package<br>
  */<br>
<br>
-void bsp_memory_management_initialize(void);<br>
+void bsp_memory_management_initialize(<br>
+  uint32_t bsp_initial_mmu_ctrl_set,<br>
+  uint32_t bsp_initial_mmu_ctrl_clear,<br>
+  uint32_t domain_set<br>
+);<br>
<br>
 #ifdef __cplusplus<br>
 }<br>
<font color="#888888">--<br>
1.7.9.5<br>
<br>
</font></blockquote></div>