[PATCH 08/10] score: Rename _Scheduler_Assignments

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Nov 8 08:59:42 UTC 2016


Rename _Scheduler_Assignments into _Scheduler_Initial_assignments to
make it clear that they may not reflect the run-time scheduler
assignment.

Update #2797.
---
 cpukit/sapi/include/confdefs.h                   |  6 ++--
 cpukit/score/include/rtems/score/scheduler.h     |  2 +-
 cpukit/score/include/rtems/score/schedulerimpl.h | 23 -------------
 cpukit/score/src/smp.c                           | 44 +++++++++++++++++++-----
 4 files changed, 39 insertions(+), 36 deletions(-)

diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 3eac92c..be817bb 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1019,7 +1019,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
   #if defined(RTEMS_SMP)
     const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT;
 
-    const Scheduler_Assignment _Scheduler_Assignments[] = {
+    const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
       #if defined(CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS)
         CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
       #else
@@ -1128,8 +1128,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
 
     RTEMS_STATIC_ASSERT(
       CONFIGURE_SMP_MAXIMUM_PROCESSORS
-        == RTEMS_ARRAY_SIZE( _Scheduler_Assignments ),
-      _Scheduler_Assignments
+        == RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
+      _Scheduler_Initial_assignments
     );
   #endif
 #endif
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 873dabc..2e2f5f4 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -327,7 +327,7 @@ extern const Scheduler_Control _Scheduler_Table[];
    *
    * @see _Scheduler_Table and rtems_configuration_get_maximum_processors().
    */
-  extern const Scheduler_Assignment _Scheduler_Assignments[];
+  extern const Scheduler_Assignment _Scheduler_Initial_assignments[];
 #endif
 
 /**
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index de9af50..62a8e94 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -638,29 +638,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
   ( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
 }
 
-#if defined(RTEMS_SMP)
-RTEMS_INLINE_ROUTINE const Scheduler_Assignment *_Scheduler_Get_assignment(
-  uint32_t cpu_index
-)
-{
-  return &_Scheduler_Assignments[ cpu_index ];
-}
-
-RTEMS_INLINE_ROUTINE bool _Scheduler_Is_mandatory_processor(
-  const Scheduler_Assignment *assignment
-)
-{
-  return (assignment->attributes & SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) != 0;
-}
-
-RTEMS_INLINE_ROUTINE bool _Scheduler_Should_start_processor(
-  const Scheduler_Assignment *assignment
-)
-{
-  return assignment->scheduler != NULL;
-}
-#endif /* defined(RTEMS_SMP) */
-
 RTEMS_INLINE_ROUTINE bool _Scheduler_Has_processor_ownership(
   const Scheduler_Control *scheduler,
   uint32_t                 cpu_index
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index c880d7e..ab9c7a6 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -32,16 +32,41 @@ Processor_mask _SMP_Online_processors;
 
 uint32_t _SMP_Processor_count;
 
+static const Scheduler_Assignment *_Scheduler_Get_initial_assignment(
+  uint32_t cpu_index
+)
+{
+  return &_Scheduler_Initial_assignments[ cpu_index ];
+}
+
+static bool _Scheduler_Is_mandatory_processor(
+  const Scheduler_Assignment *assignment
+)
+{
+  return (assignment->attributes & SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) != 0;
+}
+
+static bool _Scheduler_Should_start_processor(
+  const Scheduler_Assignment *assignment
+)
+{
+  return assignment->scheduler != NULL;
+}
+
 static void _SMP_Start_processors( uint32_t cpu_count )
 {
-  uint32_t cpu_index_self = _SMP_Get_current_processor();
+  uint32_t cpu_index_self;
   uint32_t cpu_index;
 
+  cpu_index_self = _SMP_Get_current_processor();
+
   for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) {
-    const Scheduler_Assignment *assignment =
-      _Scheduler_Get_assignment( cpu_index );
-    Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
-    bool started;
+    const Scheduler_Assignment *assignment;
+    Per_CPU_Control            *cpu;
+    bool                        started;
+
+    assignment = _Scheduler_Get_initial_assignment( cpu_index );
+    cpu = _Per_CPU_Get_by_index( cpu_index );
 
     if ( cpu_index != cpu_index_self ) {
       if ( _Scheduler_Should_start_processor( assignment ) ) {
@@ -105,8 +130,9 @@ void _SMP_Handler_initialize( void )
   _SMP_Processor_count = cpu_count;
 
   for ( cpu_index = cpu_count ; cpu_index < cpu_max; ++cpu_index ) {
-    const Scheduler_Assignment *assignment =
-      _Scheduler_Get_assignment( cpu_index );
+    const Scheduler_Assignment *assignment;
+
+    assignment = _Scheduler_Get_initial_assignment( cpu_index );
 
     if ( _Scheduler_Is_mandatory_processor( assignment ) ) {
       _SMP_Fatal( SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT );
@@ -137,9 +163,9 @@ void _SMP_Request_start_multitasking( void )
 
 bool _SMP_Should_start_processor( uint32_t cpu_index )
 {
-  const Scheduler_Assignment *assignment =
-    _Scheduler_Get_assignment( cpu_index );
+  const Scheduler_Assignment *assignment;
 
+  assignment = _Scheduler_Get_initial_assignment( cpu_index );
   return _Scheduler_Should_start_processor( assignment );
 }
 
-- 
1.8.4.5




More information about the devel mailing list