[rtems commit] bsps: Add RTEMS_SYSINIT_BSP_EARLY

Sebastian Huber sebh at rtems.org
Tue Feb 4 06:03:21 UTC 2020


Module:    rtems
Branch:    master
Commit:    34a7a12f48b62f959029172d5e8ffbd2a73739d2
Changeset: http://git.rtems.org/rtems/commit/?id=34a7a12f48b62f959029172d5e8ffbd2a73739d2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 12 16:02:19 2019 +0100

bsps: Add RTEMS_SYSINIT_BSP_EARLY

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 1ddb457..4e0f007 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;
@@ -366,6 +360,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() */
+}
+
+RTEMS_SYSINIT_ITEM(
   BSP_vme_config,
   RTEMS_SYSINIT_BSP_PRE_DRIVERS,
   RTEMS_SYSINIT_ORDER_MIDDLE
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index 810db21..c28d5d2 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;
@@ -368,6 +362,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() */
+}
+
+RTEMS_SYSINIT_ITEM(
   BSP_vme_config,
   RTEMS_SYSINIT_BSP_PRE_DRIVERS,
   RTEMS_SYSINIT_ORDER_MIDDLE
diff --git a/bsps/powerpc/mvme3100/start/bspstart.c b/bsps/powerpc/mvme3100/start/bspstart.c
index 527247a..f20a40f 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 06a12d8..90fc8cf 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 2ee7a54..8873ffe 100644
--- a/bsps/powerpc/shared/start/bspgetworkarea.c
+++ b/bsps/powerpc/shared/start/bspgetworkarea.c
@@ -9,20 +9,10 @@
 
 #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 9f5cfb6..a5aa328 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



More information about the vc mailing list