[rtems commit] Optional CPU Set Handler initialization

Sebastian Huber sebh at rtems.org
Wed Feb 3 09:34:23 UTC 2016


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Dec 10 15:30:41 2015 +0100

Optional CPU Set Handler initialization

Update #2408.

---

 cpukit/sapi/src/exinit.c                      |  3 ---
 cpukit/score/include/rtems/score/cpusetimpl.h | 12 ------------
 cpukit/score/include/rtems/sysinit.h          |  1 +
 cpukit/score/src/cpuset.c                     |  9 ++++++++-
 doc/user/init.t                               |  4 ++++
 testsuites/sptests/spsysinit01/init.c         | 13 +++++++++++++
 6 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index dd5e2c9..edd8a5c 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -37,7 +37,6 @@
 #include <rtems/score/apiext.h>
 #include <rtems/score/apimutex.h>
 #include <rtems/score/copyrt.h>
-#include <rtems/score/cpusetimpl.h>
 #include <rtems/score/heap.h>
 #include <rtems/score/interr.h>
 #include <rtems/score/isr.h>
@@ -130,8 +129,6 @@ static void rtems_initialize_data_structures(void)
 
   _SMP_Handler_initialize();
 
-  _CPU_set_Handler_initialization();
-
 /* MANAGERS */
 
   _POSIX_API_Initialize();
diff --git a/cpukit/score/include/rtems/score/cpusetimpl.h b/cpukit/score/include/rtems/score/cpusetimpl.h
index 226c3a1..f9a0f0f 100644
--- a/cpukit/score/include/rtems/score/cpusetimpl.h
+++ b/cpukit/score/include/rtems/score/cpusetimpl.h
@@ -123,18 +123,6 @@ static inline void _CPU_set_Set(
 }
 #endif
 
-/**
- * @brief Initialize the CPU Set Handler
- *
- * This routine validates a cpuset sets at least one valid cpu and that
- * it does not set any invalid cpus.
- */
-#if __RTEMS_HAVE_SYS_CPUSET_H__ && defined( RTEMS_SMP )
-void _CPU_set_Handler_initialization(void);
-#else
-#define _CPU_set_Handler_initialization()  do { } while ( 0 )
-#endif
-
 /**@}*/
 
 #ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 8f18764..39e551f 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -30,6 +30,7 @@ extern "C" {
 #define RTEMS_SYSINIT_BSP_START                  000200
 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS         000300
 #define RTEMS_SYSINIT_DATA_STRUCTURES            000301
+#define RTEMS_SYSINIT_CPU_SET                    00030d
 #define RTEMS_SYSINIT_USER_EXTENSIONS            000320
 #define RTEMS_SYSINIT_CLASSIC_TASKS              000340
 #define RTEMS_SYSINIT_CLASSIC_TIMER              000341
diff --git a/cpukit/score/src/cpuset.c b/cpukit/score/src/cpuset.c
index ca355c9..deb9e43 100644
--- a/cpukit/score/src/cpuset.c
+++ b/cpukit/score/src/cpuset.c
@@ -21,6 +21,7 @@
 
 #ifdef __RTEMS_HAVE_SYS_CPUSET_H__
 #include <sys/cpuset.h>
+#include <rtems/sysinit.h>
 #include <rtems/score/cpusetimpl.h>
 #include <rtems/score/assert.h>
 #include <rtems/score/percpu.h>
@@ -30,7 +31,7 @@ static CPU_set_Control cpuset_default;
 /*
  * _CPU_set_Handler_initialization
  */
-void _CPU_set_Handler_initialization()
+static void _CPU_set_Handler_initialization()
 {
   uint32_t cpu_count;
   uint32_t cpu_index;
@@ -50,6 +51,12 @@ void _CPU_set_Handler_initialization()
     CPU_SET_S( (int) cpu_index, cpuset_default.setsize, cpuset_default.set );
 }
 
+RTEMS_SYSINIT_ITEM(
+  _CPU_set_Handler_initialization,
+  RTEMS_SYSINIT_CPU_SET,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
 /**
  * _CPU_set_Is_valid
  *
diff --git a/doc/user/init.t b/doc/user/init.t
index a373b4a..ecbfa14 100644
--- a/doc/user/init.t
+++ b/doc/user/init.t
@@ -172,6 +172,10 @@ Multiprocessor Communications Interface (MPCI) Table.
 Initializes the @ref{User Extensions Manager} in case it is used by the
 application.
 
+ at item RTEMS_SYSINIT_CPU_SET
+Initializes the global CPU set on SMP configurations in case the application
+uses this information.
+
 @item RTEMS_SYSINIT_BSP_LIBC
 Depending on the application configuration the IO library and root filesystem
 is initialized.  This step is mandatory.
diff --git a/testsuites/sptests/spsysinit01/init.c b/testsuites/sptests/spsysinit01/init.c
index 042c600..916ae6c 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -65,6 +65,8 @@ typedef enum {
   INITIAL_EXTENSIONS_POST,
   DATA_STRUCTURES_PRE,
   DATA_STRUCTURES_POST,
+  CPU_SET_PRE,
+  CPU_SET_POST,
   USER_EXTENSIONS_PRE,
   USER_EXTENSIONS_POST,
   CLASSIC_TASKS_PRE,
@@ -206,6 +208,17 @@ LAST(RTEMS_SYSINIT_DATA_STRUCTURES)
   next_step(DATA_STRUCTURES_POST);
 }
 
+FIRST(RTEMS_SYSINIT_CPU_SET)
+{
+  /* There is nothing to do in case RTEMS_SMP is not defined */
+  next_step(CPU_SET_PRE);
+}
+
+LAST(RTEMS_SYSINIT_CPU_SET)
+{
+  next_step(CPU_SET_POST);
+}
+
 FIRST(RTEMS_SYSINIT_USER_EXTENSIONS)
 {
   assert(_Extension_Information.maximum == 0);



More information about the vc mailing list