forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -36,7 +36,8 @@ static const char *const fatal_source_text[] = {
|
|||||||
"RTEMS_FATAL_SOURCE_BSP",
|
"RTEMS_FATAL_SOURCE_BSP",
|
||||||
"RTEMS_FATAL_SOURCE_ASSERT",
|
"RTEMS_FATAL_SOURCE_ASSERT",
|
||||||
"RTEMS_FATAL_SOURCE_STACK_CHECKER",
|
"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 )
|
const char *rtems_fatal_source_text( rtems_fatal_source source )
|
||||||
|
|||||||
@@ -103,6 +103,13 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
RTEMS_FATAL_SOURCE_EXCEPTION,
|
RTEMS_FATAL_SOURCE_EXCEPTION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Fatal source of SMP domain.
|
||||||
|
*
|
||||||
|
* @see SMP_Fatal_code.
|
||||||
|
*/
|
||||||
|
RTEMS_FATAL_SOURCE_SMP,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The last available fatal source.
|
* @brief The last available fatal source.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -43,6 +43,13 @@ extern "C" {
|
|||||||
|
|
||||||
#if !defined( ASM )
|
#if !defined( ASM )
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SMP fatal codes.
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
SMP_FATAL_SHUTDOWN
|
||||||
|
} SMP_Fatal_code;
|
||||||
|
|
||||||
#if defined( RTEMS_SMP )
|
#if defined( RTEMS_SMP )
|
||||||
SCORE_EXTERN uint32_t _SMP_Processor_count;
|
SCORE_EXTERN uint32_t _SMP_Processor_count;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
#include <rtems/score/threadimpl.h>
|
#include <rtems/score/threadimpl.h>
|
||||||
#include <rtems/score/smp.h>
|
#include <rtems/score/smp.h>
|
||||||
#include <rtems/config.h>
|
#include <rtems/config.h>
|
||||||
|
#include <rtems/fatal.h>
|
||||||
|
|
||||||
#if defined(RTEMS_DEBUG)
|
#if defined(RTEMS_DEBUG)
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
@@ -75,13 +76,9 @@ void rtems_smp_process_interrupt( void )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( ( message & RTEMS_BSP_SMP_SHUTDOWN ) != 0 ) {
|
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 );
|
_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 */
|
/* does not continue past here */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ static void test_fatal_source_text(void)
|
|||||||
puts( text );
|
puts( text );
|
||||||
} while ( text != text_last );
|
} 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)
|
static void test_status_text(void)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ RTEMS_FATAL_SOURCE_BSP
|
|||||||
RTEMS_FATAL_SOURCE_ASSERT
|
RTEMS_FATAL_SOURCE_ASSERT
|
||||||
RTEMS_FATAL_SOURCE_STACK_CHECKER
|
RTEMS_FATAL_SOURCE_STACK_CHECKER
|
||||||
RTEMS_FATAL_SOURCE_EXCEPTION
|
RTEMS_FATAL_SOURCE_EXCEPTION
|
||||||
|
RTEMS_FATAL_SOURCE_SMP
|
||||||
?
|
?
|
||||||
?
|
?
|
||||||
RTEMS_SUCCESSFUL
|
RTEMS_SUCCESSFUL
|
||||||
|
|||||||
Reference in New Issue
Block a user