diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-24 11:18:27 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-25 10:07:42 +0200 |
commit | 406dd62c9927af547987ad1326d4b7512c320ff9 (patch) | |
tree | f0c1bbd131f56720195da5bad29f9e20fbea96e8 | |
parent | bsps: bsp_start_on_secondary_processor() (diff) | |
download | rtems-406dd62c9927af547987ad1326d4b7512c320ff9.tar.bz2 |
_SMP_Start_multitasking_on_secondary_processor()
Pass current processor control as first parameter to make dependency
more explicit.
-rw-r--r-- | bsps/arm/include/bsp/arm-a9mpcore-start.h | 2 | ||||
-rw-r--r-- | bsps/arm/raspberrypi/start/bspsmp_init.c | 2 | ||||
-rw-r--r-- | bsps/i386/pc386/start/smp-imps.c | 2 | ||||
-rw-r--r-- | bsps/powerpc/qoriq/start/bspsmp.c | 4 | ||||
-rw-r--r-- | bsps/sparc/leon3/start/bspsmp.c | 2 | ||||
-rw-r--r-- | cpukit/include/rtems/score/smpimpl.h | 7 | ||||
-rw-r--r-- | cpukit/score/src/smp.c | 26 |
7 files changed, 28 insertions, 17 deletions
diff --git a/bsps/arm/include/bsp/arm-a9mpcore-start.h b/bsps/arm/include/bsp/arm-a9mpcore-start.h index dd1e1247de..5648dc0daf 100644 --- a/bsps/arm/include/bsp/arm-a9mpcore-start.h +++ b/bsps/arm/include/bsp/arm-a9mpcore-start.h @@ -109,7 +109,7 @@ arm_a9mpcore_start_on_secondary_processor(void) ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M; arm_cp15_set_control(ctrl); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(_Per_CPU_Get()); } BSP_START_TEXT_SECTION static inline void diff --git a/bsps/arm/raspberrypi/start/bspsmp_init.c b/bsps/arm/raspberrypi/start/bspsmp_init.c index 8c8cd74712..a8c79e9f7c 100644 --- a/bsps/arm/raspberrypi/start/bspsmp_init.c +++ b/bsps/arm/raspberrypi/start/bspsmp_init.c @@ -77,5 +77,5 @@ void rpi_start_rtems_on_secondary_processor(void) ctrl &= ~ARM_CP15_CTRL_V; arm_cp15_set_control(ctrl); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(_Per_CPU_Get()); } diff --git a/bsps/i386/pc386/start/smp-imps.c b/bsps/i386/pc386/start/smp-imps.c index 405f7f0a92..d8b2dd3edc 100644 --- a/bsps/i386/pc386/start/smp-imps.c +++ b/bsps/i386/pc386/start/smp-imps.c @@ -794,7 +794,7 @@ static void secondary_cpu_initialize(void) enable_sse(); #endif - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor( _Per_CPU_Get() ); } uint32_t _CPU_SMP_Initialize( void ) diff --git a/bsps/powerpc/qoriq/start/bspsmp.c b/bsps/powerpc/qoriq/start/bspsmp.c index 2b95f943dd..57a61e0776 100644 --- a/bsps/powerpc/qoriq/start/bspsmp.c +++ b/bsps/powerpc/qoriq/start/bspsmp.c @@ -53,7 +53,7 @@ void qoriq_start_thread(Per_CPU_Control *cpu_self) bsp_interrupt_facility_initialize(); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(cpu_self); } #endif @@ -93,7 +93,7 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self) cpu_index_self = _Per_CPU_Get_index(cpu_self); start_thread_if_necessary(cpu_index_self); - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(cpu_self); } #ifndef QORIQ_IS_HYPERVISOR_GUEST diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c index 5b939fc765..caf0200a3c 100644 --- a/bsps/sparc/leon3/start/bspsmp.c +++ b/bsps/sparc/leon3/start/bspsmp.c @@ -52,7 +52,7 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self) cpu_index_self = _Per_CPU_Get_index(cpu_self); LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq; - _SMP_Start_multitasking_on_secondary_processor(); + _SMP_Start_multitasking_on_secondary_processor(cpu_self); } uint32_t _CPU_SMP_Initialize( void ) diff --git a/cpukit/include/rtems/score/smpimpl.h b/cpukit/include/rtems/score/smpimpl.h index fd92f655c7..762b3e5fc1 100644 --- a/cpukit/include/rtems/score/smpimpl.h +++ b/cpukit/include/rtems/score/smpimpl.h @@ -134,9 +134,12 @@ extern Processor_mask _SMP_Online_processors; * uses _Thread_Start_multitasking() instead. * * This function does not return to the caller. + * + * @param[in] cpu_self The current processor control. */ -void _SMP_Start_multitasking_on_secondary_processor( void ) - RTEMS_NO_RETURN; +void _SMP_Start_multitasking_on_secondary_processor( + Per_CPU_Control *cpu_self +) RTEMS_NO_RETURN; typedef void ( *SMP_Test_message_handler )( Per_CPU_Control *cpu_self ); diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 1a29e37d15..1c7eb6d947 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -145,14 +145,19 @@ void _SMP_Handler_initialize( void ) void _SMP_Request_start_multitasking( void ) { - Per_CPU_Control *self_cpu = _Per_CPU_Get(); - uint32_t cpu_count = _SMP_Get_processor_count(); - uint32_t cpu_index; + Per_CPU_Control *cpu_self; + uint32_t cpu_count; + uint32_t cpu_index; + + cpu_self = _Per_CPU_Get(); + _Per_CPU_State_change( cpu_self, PER_CPU_STATE_READY_TO_START_MULTITASKING ); - _Per_CPU_State_change( self_cpu, PER_CPU_STATE_READY_TO_START_MULTITASKING ); + cpu_count = _SMP_Get_processor_count(); for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { - Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); + Per_CPU_Control *cpu; + + cpu = _Per_CPU_Get_by_index( cpu_index ); if ( _Per_CPU_Is_processor_online( cpu ) ) { _Per_CPU_State_change( cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING ); @@ -168,10 +173,13 @@ bool _SMP_Should_start_processor( uint32_t cpu_index ) return _Scheduler_Should_start_processor( assignment ); } -void _SMP_Start_multitasking_on_secondary_processor( void ) +void _SMP_Start_multitasking_on_secondary_processor( + Per_CPU_Control *cpu_self +) { - Per_CPU_Control *self_cpu = _Per_CPU_Get(); - uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu ); + uint32_t cpu_index_self; + + cpu_index_self = _Per_CPU_Get_index( cpu_self ); if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) { _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR ); @@ -181,7 +189,7 @@ void _SMP_Start_multitasking_on_secondary_processor( void ) _SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR ); } - _Per_CPU_State_change( self_cpu, PER_CPU_STATE_READY_TO_START_MULTITASKING ); + _Per_CPU_State_change( cpu_self, PER_CPU_STATE_READY_TO_START_MULTITASKING ); _Thread_Start_multitasking(); } |