[PATCH 10/17] score: Add RTEMS_FATAL_SOURCE_SMP

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Feb 17 15:51:35 UTC 2014


Use rtems_fatal() instead of _CPU_Fatal_halt() to shutdown processors in
SMP configurations since this allows intervention of BSP or application
specific fatal extensions.
---
 cpukit/score/include/rtems/score/interr.h |    7 +++++++
 cpukit/score/include/rtems/score/smp.h    |    7 +++++++
 cpukit/score/src/smp.c                    |    7 ++-----
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 6b495d2..9fbd140 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -104,6 +104,13 @@ typedef enum {
   RTEMS_FATAL_SOURCE_EXCEPTION,
 
   /**
+   * @brief Fatal source of SMP domain.
+   *
+   * @see SMP_Fatal_code.
+   */
+  RTEMS_FATAL_SOURCE_SMP,
+
+  /**
    * @brief The last available fatal source.
    *
    * This enum value ensures that the enum type needs at least 32-bits for
diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h
index b97cced..88e3ec8 100644
--- a/cpukit/score/include/rtems/score/smp.h
+++ b/cpukit/score/include/rtems/score/smp.h
@@ -43,6 +43,13 @@ extern "C" {
 
 #if !defined( ASM )
 
+/**
+ * @brief SMP fatal codes.
+ */
+typedef enum {
+  SMP_FATAL_SHUTDOWN
+} SMP_Fatal_code;
+
 #if defined( RTEMS_SMP )
   SCORE_EXTERN uint32_t _SMP_Processor_count;
 
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 50ebc13..994bfea 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -23,6 +23,7 @@
 #include <rtems/score/threadimpl.h>
 #include <rtems/score/smp.h>
 #include <rtems/config.h>
+#include <rtems/fatal.h>
 
 #if defined(RTEMS_DEBUG)
   #include <rtems/bspIo.h>
@@ -75,13 +76,9 @@ void rtems_smp_process_interrupt( void )
     #endif
 
     if ( ( message & RTEMS_BSP_SMP_SHUTDOWN ) != 0 ) {
-      _ISR_Disable_without_giant( level );
-
-      _Thread_Dispatch_set_disable_level( 0 );
-
       _Per_CPU_Change_state( self_cpu, PER_CPU_STATE_SHUTDOWN );
 
-      _CPU_Fatal_halt( _Per_CPU_Get_index( self_cpu ) );
+      rtems_fatal( RTEMS_FATAL_SOURCE_SMP, SMP_FATAL_SHUTDOWN );
       /* does not continue past here */
     }
   }
-- 
1.7.7




More information about the devel mailing list