diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-06-14 14:00:38 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2013-07-17 13:09:49 +0200 |
commit | 39e51758c86754cef5ba4521c0c36578521f73d0 (patch) | |
tree | a87255c5c0592b876106da50b939dedd471b7d5a /cpukit/score/include | |
parent | smp: Delete RTEMS_BSP_SMP_CONTEXT_SWITCH_NECESSARY (diff) | |
download | rtems-39e51758c86754cef5ba4521c0c36578521f73d0.tar.bz2 |
smp: Add and use _CPU_SMP_Get_current_processor()
Add and use _SMP_Get_current_processor() and
rtems_smp_get_current_processor().
Delete bsp_smp_interrupt_cpu().
Change type of current processor index from int to uint32_t to match
_SMP_Processor_count type.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r-- | cpukit/score/include/rtems/bspsmp.h | 25 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/percpu.h | 23 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/smp.h | 12 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/threaddispatch.h | 4 |
4 files changed, 22 insertions, 42 deletions
diff --git a/cpukit/score/include/rtems/bspsmp.h b/cpukit/score/include/rtems/bspsmp.h index b712c4fe95..57f5a7a458 100644 --- a/cpukit/score/include/rtems/bspsmp.h +++ b/cpukit/score/include/rtems/bspsmp.h @@ -70,16 +70,6 @@ extern "C" { uint32_t bsp_smp_initialize( uint32_t configured_cpu_count ); /** - * @brief Obtain current CPU index. - * - * This method is invoked by RTEMS when it needs to know the index - * of the CPU it is executing on. - * - * @retval This method returns the current CPU index. - */ -int bsp_smp_processor_id(void) RTEMS_COMPILER_PURE_ATTRIBUTE; - -/** * @brief Generate an interprocessor broadcast interrupt. * * This method is invoked when RTEMS wants to let all of the other @@ -106,19 +96,6 @@ void bsp_smp_interrupt_cpu( ); /** - * @brief Obtain CPU core number. - * - * This method is invoked by RTEMS when it needs to know which core - * number it is executing on. This is used when it needs to perform - * some action or bookkeeping and needs to distinguish itself from - * the other cores. For example, it may need to realize it needs to - * preempt a thread on another node. - * - * @retval This method returns the Id of the current CPU core. - */ -int bsp_smp_processor_id( void ); - -/** * @brief Performs high-level initialization of a secondary processor and runs * the application threads. * @@ -156,8 +133,6 @@ void rtems_smp_process_interrupt(void); } #endif -#else - #define bsp_smp_processor_id() 0 #endif /**@}*/ diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index bb565d92c0..383202c328 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -25,12 +25,7 @@ #include <rtems/score/isrlevel.h> #include <rtems/score/timestamp.h> #include <rtems/score/smplock.h> - - /* - * NOTE: This file MUST be included on non-smp systems as well - * in order to define bsp_smp_processor_id. - */ - #include <rtems/bspsmp.h> + #include <rtems/score/smp.h> #endif /** @@ -277,23 +272,23 @@ void _Per_CPU_Wait_for_state( #endif /* - * On a non SMP system, the bsp_smp_processor_id is defined to 0. + * On a non SMP system, the _SMP_Get_current_processor() is defined to 0. * Thus when built for non-SMP, there should be no performance penalty. */ #define _Thread_Heir \ - _Per_CPU_Information[bsp_smp_processor_id()].heir + _Per_CPU_Information[_SMP_Get_current_processor()].heir #define _Thread_Executing \ - _Per_CPU_Information[bsp_smp_processor_id()].executing + _Per_CPU_Information[_SMP_Get_current_processor()].executing #define _ISR_Nest_level \ - _Per_CPU_Information[bsp_smp_processor_id()].isr_nest_level + _Per_CPU_Information[_SMP_Get_current_processor()].isr_nest_level #define _CPU_Interrupt_stack_low \ - _Per_CPU_Information[bsp_smp_processor_id()].interrupt_stack_low + _Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_low #define _CPU_Interrupt_stack_high \ - _Per_CPU_Information[bsp_smp_processor_id()].interrupt_stack_high + _Per_CPU_Information[_SMP_Get_current_processor()].interrupt_stack_high #define _Thread_Dispatch_necessary \ - _Per_CPU_Information[bsp_smp_processor_id()].dispatch_necessary + _Per_CPU_Information[_SMP_Get_current_processor()].dispatch_necessary #define _Thread_Time_of_last_context_switch \ - _Per_CPU_Information[bsp_smp_processor_id()].time_of_last_context_switch + _Per_CPU_Information[_SMP_Get_current_processor()].time_of_last_context_switch #endif /* ASM */ diff --git a/cpukit/score/include/rtems/score/smp.h b/cpukit/score/include/rtems/score/smp.h index a01515673f..fedf9ab6d7 100644 --- a/cpukit/score/include/rtems/score/smp.h +++ b/cpukit/score/include/rtems/score/smp.h @@ -71,7 +71,7 @@ extern "C" { * @param[in] cpu The target processor of the message. * @param[in] message The message. */ -void _SMP_Send_message( int cpu, uint32_t message ); +void _SMP_Send_message( uint32_t cpu, uint32_t message ); /** * @brief Request of others CPUs. @@ -116,6 +116,16 @@ void _SMP_Request_other_cores_to_shutdown(void); /** @} */ +#if defined( RTEMS_SMP ) + RTEMS_COMPILER_PURE_ATTRIBUTE static inline uint32_t + _SMP_Get_current_processor( void ) + { + return _CPU_SMP_Get_current_processor(); + } +#else + #define _SMP_Get_current_processor() ( ( uint32_t ) 0 ) +#endif + #ifdef __cplusplus } #endif diff --git a/cpukit/score/include/rtems/score/threaddispatch.h b/cpukit/score/include/rtems/score/threaddispatch.h index e3065da590..7e7afb9161 100644 --- a/cpukit/score/include/rtems/score/threaddispatch.h +++ b/cpukit/score/include/rtems/score/threaddispatch.h @@ -62,8 +62,8 @@ RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled(void) #if defined(RTEMS_SMP) typedef struct { SMP_lock_Control lock; - int owner_cpu; - int nest_level; + uint32_t owner_cpu; + uint32_t nest_level; } Thread_Dispatch_disable_level_lock_control; /** |