[PATCH 4/7] bsps: Add RTEMS_SYSINIT_BSP_EARLY

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Dec 16 12:42:09 UTC 2019


Add new BSP system initialization step for work to be performed before
the work areas are initialized.

Update #3838.
---
 bsps/powerpc/beatnik/start/bspstart.c          | 19 ++++++++++++-------
 bsps/powerpc/motorola_powerpc/start/bspstart.c | 19 ++++++++++++-------
 bsps/powerpc/mvme3100/start/bspstart.c         | 19 ++++++++++++-------
 bsps/powerpc/mvme5500/start/bspstart.c         | 13 ++++++++++++-
 bsps/powerpc/shared/start/bspgetworkarea.c     | 16 ----------------
 cpukit/include/rtems/sysinit.h                 |  1 +
 6 files changed, 49 insertions(+), 38 deletions(-)

diff --git a/bsps/powerpc/beatnik/start/bspstart.c b/bsps/powerpc/beatnik/start/bspstart.c
index 1ddb457e05..4e0f007d41 100644
--- a/bsps/powerpc/beatnik/start/bspstart.c
+++ b/bsps/powerpc/beatnik/start/bspstart.c
@@ -166,13 +166,7 @@ uint32_t _CPU_Counter_frequency(void)
   return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
 }
 
-/*
- *  bsp_start
- *
- *  This routine does the bulk of the system initialization.
- */
-
-void bsp_start( void )
+static void bsp_early( void )
 {
   unsigned char  *stack;
   char           *chpt;
@@ -365,6 +359,17 @@ void bsp_start( void )
 #endif
 }
 
+RTEMS_SYSINIT_ITEM(
+  bsp_early,
+  RTEMS_SYSINIT_BSP_EARLY,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+void bsp_start( void )
+{
+  /* Initialization was done by bsp_early() */
+}
+
 RTEMS_SYSINIT_ITEM(
   BSP_vme_config,
   RTEMS_SYSINIT_BSP_PRE_DRIVERS,
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index 810db21dce..c28d5d21b5 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -124,13 +124,7 @@ uint32_t _CPU_Counter_frequency(void)
   return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
 }
 
-/*
- *  bsp_start
- *
- *  This routine does the bulk of the system initialization.
- */
-
-void bsp_start( void )
+static void bsp_early( void )
 {
 #if !defined(mvme2100)
   unsigned l2cr;
@@ -367,6 +361,17 @@ void bsp_start( void )
 #endif
 }
 
+RTEMS_SYSINIT_ITEM(
+  bsp_early,
+  RTEMS_SYSINIT_BSP_EARLY,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+void bsp_start( void )
+{
+  /* Initialization was done by bsp_early() */
+}
+
 RTEMS_SYSINIT_ITEM(
   BSP_vme_config,
   RTEMS_SYSINIT_BSP_PRE_DRIVERS,
diff --git a/bsps/powerpc/mvme3100/start/bspstart.c b/bsps/powerpc/mvme3100/start/bspstart.c
index 527247af1b..f20a40fed1 100644
--- a/bsps/powerpc/mvme3100/start/bspstart.c
+++ b/bsps/powerpc/mvme3100/start/bspstart.c
@@ -197,17 +197,11 @@ uint32_t _CPU_Counter_frequency(void)
   return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
 }
 
-/*
- *  bsp_start
- *
- *  This routine does the bulk of the system initialization.
- */
-
 #include <libcpu/spr.h>
 
 SPR_RW(HID1)
 
-void bsp_start( void )
+static void bsp_early( void )
 {
   unsigned char       *stack;
   char                *chpt;
@@ -412,6 +406,17 @@ VpdBufRec          vpdData [] = {
 #endif
 }
 
+RTEMS_SYSINIT_ITEM(
+  bsp_early,
+  RTEMS_SYSINIT_BSP_EARLY,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+void bsp_start( void )
+{
+  /* Initialization was done by bsp_early() */
+}
+
 static void mvme3100_i2c_initialize(void)
 {
   BSP_i2c_initialize();
diff --git a/bsps/powerpc/mvme5500/start/bspstart.c b/bsps/powerpc/mvme5500/start/bspstart.c
index 06a12d815f..90fc8cf961 100644
--- a/bsps/powerpc/mvme5500/start/bspstart.c
+++ b/bsps/powerpc/mvme5500/start/bspstart.c
@@ -173,7 +173,7 @@ uint32_t _CPU_Counter_frequency(void)
   return BSP_bus_frequency / (BSP_time_base_divisor / 1000);
 }
 
-void bsp_start( void )
+static void bsp_early( void )
 {
 #ifdef CONF_VPD
   int i;
@@ -329,6 +329,17 @@ void bsp_start( void )
 
 }
 
+RTEMS_SYSINIT_ITEM(
+  bsp_early,
+  RTEMS_SYSINIT_BSP_EARLY,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+void bsp_start( void )
+{
+  /* Initialization was done by bsp_early() */
+}
+
 unsigned char ReadConfVPD_buff(int offset)
 {
   return(ConfVPD_buff[offset]);
diff --git a/bsps/powerpc/shared/start/bspgetworkarea.c b/bsps/powerpc/shared/start/bspgetworkarea.c
index 2ee7a54410..8873ffe574 100644
--- a/bsps/powerpc/shared/start/bspgetworkarea.c
+++ b/bsps/powerpc/shared/start/bspgetworkarea.c
@@ -9,19 +9,9 @@
 
 #include <libcpu/powerpc-utility.h>
 
-#include <rtems/sysinit.h>
-
 LINKER_SYMBOL(__rtems_end)
 
 void bsp_work_area_initialize(void)
-{
-  /*
-   * Cannot do work area initialization before bsp_start(), since BSP_mem_size
-   * and MMU is not set up.
-   */
-}
-
-static void bsp_work_area_initialize_later(void)
 {
   uintptr_t work_size;
   uintptr_t work_area;
@@ -31,9 +21,3 @@ static void bsp_work_area_initialize_later(void)
 
   bsp_work_area_initialize_default((void *) work_area, work_size);
 }
-
-RTEMS_SYSINIT_ITEM(
-  bsp_work_area_initialize_later,
-  RTEMS_SYSINIT_BSP_START,
-  RTEMS_SYSINIT_ORDER_LAST
-);
diff --git a/cpukit/include/rtems/sysinit.h b/cpukit/include/rtems/sysinit.h
index b349a70051..ae599fd845 100644
--- a/cpukit/include/rtems/sysinit.h
+++ b/cpukit/include/rtems/sysinit.h
@@ -27,6 +27,7 @@ extern "C" {
  * order values to form a proper integer literal.
  */
 #define RTEMS_SYSINIT_RECORD                     000100
+#define RTEMS_SYSINIT_BSP_EARLY                  000140
 #define RTEMS_SYSINIT_BSP_WORK_AREAS             000200
 #define RTEMS_SYSINIT_BSP_START                  000300
 #define RTEMS_SYSINIT_CPU_COUNTER                000400
-- 
2.16.4



More information about the devel mailing list