From 9eec2f33e983d466f7677bc0769eafbc448f7cf6 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Feb 2014 13:46:11 +0100 Subject: score: Add RTEMS_FATAL_SOURCE_SMP 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/sapi/src/fatalsrctext.c | 3 ++- cpukit/score/include/rtems/score/interr.h | 7 +++++++ cpukit/score/include/rtems/score/smp.h | 7 +++++++ cpukit/score/src/smp.c | 7 ++----- testsuites/sptests/spinternalerror02/init.c | 2 +- testsuites/sptests/spinternalerror02/spinternalerror02.scn | 1 + 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/cpukit/sapi/src/fatalsrctext.c b/cpukit/sapi/src/fatalsrctext.c index 7f7bccc195..f2116ece35 100644 --- a/cpukit/sapi/src/fatalsrctext.c +++ b/cpukit/sapi/src/fatalsrctext.c @@ -36,7 +36,8 @@ static const char *const fatal_source_text[] = { "RTEMS_FATAL_SOURCE_BSP", "RTEMS_FATAL_SOURCE_ASSERT", "RTEMS_FATAL_SOURCE_STACK_CHECKER", - "RTEMS_FATAL_SOURCE_EXCEPTION" + "RTEMS_FATAL_SOURCE_EXCEPTION", + "RTEMS_FATAL_SOURCE_SMP" }; const char *rtems_fatal_source_text( rtems_fatal_source source ) diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index 4ad52c9fb0..197f648245 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -103,6 +103,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. * diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h index b97cceda36..88e3ec8b9e 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 50ebc132a8..994bfea922 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -23,6 +23,7 @@ #include #include #include +#include #if defined(RTEMS_DEBUG) #include @@ -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 */ } } diff --git a/testsuites/sptests/spinternalerror02/init.c b/testsuites/sptests/spinternalerror02/init.c index 0d07fabe79..01865da74b 100644 --- a/testsuites/sptests/spinternalerror02/init.c +++ b/testsuites/sptests/spinternalerror02/init.c @@ -49,7 +49,7 @@ static void test_fatal_source_text(void) puts( text ); } while ( text != text_last ); - rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_EXCEPTION ); + rtems_test_assert( source - 3 == RTEMS_FATAL_SOURCE_SMP ); } static void test_status_text(void) diff --git a/testsuites/sptests/spinternalerror02/spinternalerror02.scn b/testsuites/sptests/spinternalerror02/spinternalerror02.scn index dc2ef6f171..89f571e93d 100644 --- a/testsuites/sptests/spinternalerror02/spinternalerror02.scn +++ b/testsuites/sptests/spinternalerror02/spinternalerror02.scn @@ -36,6 +36,7 @@ RTEMS_FATAL_SOURCE_BSP RTEMS_FATAL_SOURCE_ASSERT RTEMS_FATAL_SOURCE_STACK_CHECKER RTEMS_FATAL_SOURCE_EXCEPTION +RTEMS_FATAL_SOURCE_SMP ? ? RTEMS_SUCCESSFUL -- cgit v1.2.3