From 6ca4f6af8ae91d52f5836805f05a7b9b77a2feac Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 17 Feb 2014 14:56:51 +0100 Subject: score: Add and use Collect SMP implementation specific parts in the header file. --- cpukit/sapi/src/exinit.c | 12 +-- cpukit/score/Makefile.am | 1 + cpukit/score/include/rtems/score/percpu.h | 7 -- cpukit/score/include/rtems/score/smp.h | 66 +--------------- cpukit/score/include/rtems/score/smpimpl.h | 123 +++++++++++++++++++++++++++++ cpukit/score/preinstall.am | 4 + cpukit/score/src/interr.c | 2 +- cpukit/score/src/smp.c | 2 +- 8 files changed, 134 insertions(+), 83 deletions(-) create mode 100644 cpukit/score/include/rtems/score/smpimpl.h diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index e8b009ba60..d265455afd 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -59,11 +60,6 @@ #include #endif -#if defined(RTEMS_SMP) - #include - #include -#endif - Objects_Information *_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ]; void rtems_initialize_data_structures(void) @@ -150,9 +146,7 @@ void rtems_initialize_data_structures(void) _POSIX_API_Initialize(); #endif - #if defined(RTEMS_SMP) - _SMP_Handler_initialize(); - #endif + _SMP_Handler_initialize(); _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); @@ -216,9 +210,7 @@ void rtems_initialize_start_multitasking(void) { _System_state_Set( SYSTEM_STATE_UP ); -#if defined(RTEMS_SMP) _SMP_Request_other_cores_to_perform_first_context_switch(); -#endif _Thread_Start_multitasking(); diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am index 482e78de12..b247af6950 100644 --- a/cpukit/score/Makefile.am +++ b/cpukit/score/Makefile.am @@ -61,6 +61,7 @@ include_rtems_score_HEADERS += include/rtems/score/schedulersmpimpl.h include_rtems_score_HEADERS += include/rtems/score/smp.h include_rtems_score_HEADERS += include/rtems/score/smpbarrier.h include_rtems_score_HEADERS += include/rtems/score/smplock.h +include_rtems_score_HEADERS += include/rtems/score/smpimpl.h include_rtems_score_HEADERS += include/rtems/score/stack.h include_rtems_score_HEADERS += include/rtems/score/stackimpl.h include_rtems_score_HEADERS += include/rtems/score/states.h diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index 8acd867fcb..4c46b50425 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -306,13 +306,6 @@ static inline void _Per_CPU_Send_interrupt( const Per_CPU_Control *per_cpu ) _CPU_SMP_Send_interrupt( _Per_CPU_Get_index( per_cpu ) ); } -/** - * @brief Initialize SMP Handler - * - * This method initialize the SMP Handler. - */ -void _SMP_Handler_initialize(void); - /** * @brief Allocate and Initialize Per CPU Structures * diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h index 3c60baaed2..521cd7b21e 100644 --- a/cpukit/score/include/rtems/score/smp.h +++ b/cpukit/score/include/rtems/score/smp.h @@ -34,20 +34,6 @@ extern "C" { * @{ */ -/** - * @brief SMP message to request a processor shutdown. - * - * @see _SMP_Send_message(). - */ -#define SMP_MESSAGE_SHUTDOWN UINT32_C(0x1) - -/** - * @brief SMP fatal codes. - */ -typedef enum { - SMP_FATAL_SHUTDOWN -} SMP_Fatal_code; - #if defined( RTEMS_SMP ) SCORE_EXTERN uint32_t _SMP_Processor_count; @@ -59,56 +45,6 @@ typedef enum { #define _SMP_Get_processor_count() UINT32_C(1) #endif -#if defined( RTEMS_SMP ) - -/** - * @brief Sends a SMP message to a processor. - * - * The target processor may be the sending processor. - * - * @param[in] cpu The target processor of the message. - * @param[in] message The message. - */ -void _SMP_Send_message( uint32_t cpu, uint32_t message ); - -/** - * @brief Request of others CPUs. - * - * This method is invoked by RTEMS when it needs to make a request - * of the other CPUs. It should be implemented using some type of - * interprocessor interrupt. CPUs not including the originating - * CPU should receive the message. - * - * @param [in] message is message to send - */ -void _SMP_Broadcast_message( - uint32_t message -); - -/** - * @brief Request other cores to perform first context switch. - * - * Send message to other cores requesting them to perform - * their first context switch operation. - */ -void _SMP_Request_other_cores_to_perform_first_context_switch(void); - -#endif /* defined( RTEMS_SMP ) */ - -/** - * @brief Request other cores to shutdown. - * - * Send message to other cores requesting them to shutdown. - */ -#if defined( RTEMS_SMP ) - void _SMP_Request_other_cores_to_shutdown( void ); -#else - #define _SMP_Request_other_cores_to_shutdown() \ - do { } while ( 0 ) -#endif - -/** @} */ - #if defined( RTEMS_SMP ) RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t _SMP_Get_current_processor( void ) @@ -119,6 +55,8 @@ void _SMP_Request_other_cores_to_perform_first_context_switch(void); #define _SMP_Get_current_processor() UINT32_C(0) #endif +/** @} */ + #ifdef __cplusplus } #endif diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h new file mode 100644 index 0000000000..59f2b10b67 --- /dev/null +++ b/cpukit/score/include/rtems/score/smpimpl.h @@ -0,0 +1,123 @@ +/** + * @file + * + * @ingroup ScoreSMPImpl + * + * @brief SuperCore SMP Implementation + */ + +/* + * COPYRIGHT (c) 1989-2011. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + */ + +#ifndef _RTEMS_SCORE_SMPIMPL_H +#define _RTEMS_SCORE_SMPIMPL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup ScoreSMP SMP Support + * + * @ingroup Score + * + * This defines the interface of the SuperCore SMP support. + * + * @{ + */ + +/** + * @brief SMP message to request a processor shutdown. + * + * @see _SMP_Send_message(). + */ +#define SMP_MESSAGE_SHUTDOWN UINT32_C(0x1) + +/** + * @brief SMP fatal codes. + */ +typedef enum { + SMP_FATAL_SHUTDOWN +} SMP_Fatal_code; + +/** + * @brief Initialize SMP Handler + * + * This method initialize the SMP Handler. + */ +#if defined( RTEMS_SMP ) + void _SMP_Handler_initialize( void ); +#else + #define _SMP_Handler_initialize() \ + do { } while ( 0 ) +#endif + +#if defined( RTEMS_SMP ) + +/** + * @brief Sends a SMP message to a processor. + * + * The target processor may be the sending processor. + * + * @param[in] cpu The target processor of the message. + * @param[in] message The message. + */ +void _SMP_Send_message( uint32_t cpu, uint32_t message ); + +/** + * @brief Request of others CPUs. + * + * This method is invoked by RTEMS when it needs to make a request + * of the other CPUs. It should be implemented using some type of + * interprocessor interrupt. CPUs not including the originating + * CPU should receive the message. + * + * @param [in] message is message to send + */ +void _SMP_Broadcast_message( + uint32_t message +); + +#endif /* defined( RTEMS_SMP ) */ + +/** + * @brief Request other cores to perform first context switch. + * + * Send message to other cores requesting them to perform + * their first context switch operation. + */ +#if defined( RTEMS_SMP ) + void _SMP_Request_other_cores_to_perform_first_context_switch( void ); +#else + #define _SMP_Request_other_cores_to_perform_first_context_switch() \ + do { } while ( 0 ) +#endif + +/** + * @brief Request other cores to shutdown. + * + * Send message to other cores requesting them to shutdown. + */ +#if defined( RTEMS_SMP ) + void _SMP_Request_other_cores_to_shutdown( void ); +#else + #define _SMP_Request_other_cores_to_shutdown() \ + do { } while ( 0 ) +#endif + +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am index ceefbe7e6e..c9d0ab9ff4 100644 --- a/cpukit/score/preinstall.am +++ b/cpukit/score/preinstall.am @@ -227,6 +227,10 @@ $(PROJECT_INCLUDE)/rtems/score/smplock.h: include/rtems/score/smplock.h $(PROJEC $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/smplock.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/smplock.h +$(PROJECT_INCLUDE)/rtems/score/smpimpl.h: include/rtems/score/smpimpl.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/smpimpl.h +PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/smpimpl.h + $(PROJECT_INCLUDE)/rtems/score/stack.h: include/rtems/score/stack.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/stack.h PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/stack.h diff --git a/cpukit/score/src/interr.c b/cpukit/score/src/interr.c index bb15e0cbe4..3836f527cb 100644 --- a/cpukit/score/src/interr.c +++ b/cpukit/score/src/interr.c @@ -20,7 +20,7 @@ #include #include -#include +#include #include #include diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index f3aa25f011..6c2f78b2eb 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -19,10 +19,10 @@ #endif #include +#include #include #include #include -#include #include #include -- cgit v1.2.3