[rtems commit] smp: Add and use _SMP_Should_start_processor()

Sebastian Huber sebh at rtems.org
Fri Jan 9 13:09:38 UTC 2015


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Dec 23 08:28:24 2014 +0100

smp: Add and use _SMP_Should_start_processor()

---

 c/src/lib/libbsp/i386/shared/smp/smp-imps.c     |  6 +-----
 c/src/lib/libbsp/sparc/leon3/startup/bspclean.c |  6 +-----
 cpukit/score/include/rtems/score/smpimpl.h      | 11 +++++++++++
 cpukit/score/src/smp.c                          | 12 +++++++++---
 4 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index fdbf915..158a45d 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -57,7 +57,6 @@
 #include <bsp/smp-imps.h>
 #include <bsp/irq.h>
 #include <rtems/score/smpimpl.h>
-#include <rtems/score/schedulerimpl.h>
 
 /*
  *  XXXXX  The following absolutely must be defined!!!
@@ -387,10 +386,7 @@ imps_read_config_table(unsigned start, int count)
     switch (*((unsigned char *)start)) {
     case IMPS_BCT_PROCESSOR:
       if ( imps_num_cpus < rtems_configuration_get_maximum_processors() ) {
-        const Scheduler_Assignment *assignment =
-          _Scheduler_Get_assignment((uint32_t) imps_num_cpus);
-
-        if (_Scheduler_Should_start_processor(assignment)) {
+        if (_SMP_Should_start_processor((uint32_t) imps_num_cpus)) {
           add_processor((imps_processor *)start);
         }
       } else
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspclean.c b/c/src/lib/libbsp/sparc/leon3/startup/bspclean.c
index 0d7d855..cfe049b 100644
--- a/c/src/lib/libbsp/sparc/leon3/startup/bspclean.c
+++ b/c/src/lib/libbsp/sparc/leon3/startup/bspclean.c
@@ -23,7 +23,6 @@
 #include <bsp/bootcard.h>
 #include <rtems/bspIo.h>
 #include <rtems/score/smpimpl.h>
-#include <rtems/score/schedulerimpl.h>
 
 void bsp_fatal_extension(
   rtems_fatal_source source,
@@ -55,10 +54,7 @@ void bsp_fatal_extension(
       uint32_t i;
 
       for (i = 0; i < cpu_count; ++i) {
-        const Scheduler_Assignment *assignment = _Scheduler_Get_assignment( i );
-
-        if ( (i != self_cpu) &&
-            _Scheduler_Should_start_processor( assignment ) ) {
+        if ( (i != self_cpu) && _SMP_Should_start_processor( i ) ) {
           halt_mask |= UINT32_C(1) << i;
         }
       }
diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h
index dca8a6b..98e109c 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -171,6 +171,17 @@ static inline void _SMP_Inter_processor_interrupt_handler( void )
 }
 
 /**
+ *  @brief Returns true, if the processor with the specified index should be
+ *  started.
+ *
+ *  @param[in] cpu_index The processor index.
+ *
+ *  @retval true The processor should be started.
+ *  @retval false Otherwise.
+ */
+bool _SMP_Should_start_processor( uint32_t cpu_index );
+
+/**
  *  @brief Sends a SMP message to a processor.
  *
  *  The target processor may be the sending processor.
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 09246e3..ae10f82 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -118,18 +118,24 @@ void _SMP_Request_start_multitasking( void )
   }
 }
 
+bool _SMP_Should_start_processor( uint32_t cpu_index )
+{
+  const Scheduler_Assignment *assignment =
+    _Scheduler_Get_assignment( cpu_index );
+
+  return _Scheduler_Should_start_processor( assignment );
+}
+
 void _SMP_Start_multitasking_on_secondary_processor( void )
 {
   Per_CPU_Control *self_cpu = _Per_CPU_Get();
   uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu );
-  const Scheduler_Assignment *assignment =
-    _Scheduler_Get_assignment( cpu_index_self );
 
   if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
     _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR );
   }
 
-  if ( !_Scheduler_Should_start_processor( assignment ) ) {
+  if ( !_SMP_Should_start_processor( cpu_index_self ) ) {
     _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR );
   }
 




More information about the vc mailing list