score: Add and use <rtems/score/smpimpl.h>

Collect SMP implementation specific parts in the
<rtems/score/smpimpl.h> header file.
This commit is contained in:
Sebastian Huber
2014-02-17 14:56:51 +01:00
parent f8ff2a011c
commit 6ca4f6af8a
8 changed files with 134 additions and 83 deletions

View File

@@ -45,6 +45,7 @@
#include <rtems/score/isr.h>
#include <rtems/score/priority.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/smpimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/todimpl.h>
#include <rtems/score/userextimpl.h>
@@ -59,11 +60,6 @@
#include <rtems/posix/posixapi.h>
#endif
#if defined(RTEMS_SMP)
#include <rtems/score/smp.h>
#include <rtems/score/percpu.h>
#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();

View File

@@ -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

View File

@@ -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
*

View File

@@ -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

View File

@@ -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 <rtems/score/smp.h>
#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 */

View File

@@ -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

View File

@@ -20,7 +20,7 @@
#include <rtems/score/interr.h>
#include <rtems/score/isrlevel.h>
#include <rtems/score/smp.h>
#include <rtems/score/smpimpl.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/userextimpl.h>

View File

@@ -19,10 +19,10 @@
#endif
#include <rtems/bspsmp.h>
#include <rtems/score/smpimpl.h>
#include <rtems/score/assert.h>
#include <rtems/score/threaddispatch.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/smp.h>
#include <rtems/config.h>
#include <rtems/fatal.h>