_SMP_Start_multitasking_on_secondary_processor()

Pass current processor control as first parameter to make dependency
more explicit.
This commit is contained in:
Sebastian Huber
2018-07-24 11:18:27 +02:00
parent 4678d1a8b0
commit 406dd62c99
7 changed files with 28 additions and 17 deletions

View File

@@ -109,7 +109,7 @@ arm_a9mpcore_start_on_secondary_processor(void)
ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M; ctrl |= ARM_CP15_CTRL_I | ARM_CP15_CTRL_C | ARM_CP15_CTRL_M;
arm_cp15_set_control(ctrl); 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 BSP_START_TEXT_SECTION static inline void

View File

@@ -77,5 +77,5 @@ void rpi_start_rtems_on_secondary_processor(void)
ctrl &= ~ARM_CP15_CTRL_V; ctrl &= ~ARM_CP15_CTRL_V;
arm_cp15_set_control(ctrl); arm_cp15_set_control(ctrl);
_SMP_Start_multitasking_on_secondary_processor(); _SMP_Start_multitasking_on_secondary_processor(_Per_CPU_Get());
} }

View File

@@ -794,7 +794,7 @@ static void secondary_cpu_initialize(void)
enable_sse(); enable_sse();
#endif #endif
_SMP_Start_multitasking_on_secondary_processor(); _SMP_Start_multitasking_on_secondary_processor( _Per_CPU_Get() );
} }
uint32_t _CPU_SMP_Initialize( void ) uint32_t _CPU_SMP_Initialize( void )

View File

@@ -53,7 +53,7 @@ void qoriq_start_thread(Per_CPU_Control *cpu_self)
bsp_interrupt_facility_initialize(); bsp_interrupt_facility_initialize();
_SMP_Start_multitasking_on_secondary_processor(); _SMP_Start_multitasking_on_secondary_processor(cpu_self);
} }
#endif #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); cpu_index_self = _Per_CPU_Get_index(cpu_self);
start_thread_if_necessary(cpu_index_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 #ifndef QORIQ_IS_HYPERVISOR_GUEST

View File

@@ -52,7 +52,7 @@ void bsp_start_on_secondary_processor(Per_CPU_Control *cpu_self)
cpu_index_self = _Per_CPU_Get_index(cpu_self); cpu_index_self = _Per_CPU_Get_index(cpu_self);
LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq; 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 ) uint32_t _CPU_SMP_Initialize( void )

View File

@@ -134,9 +134,12 @@ extern Processor_mask _SMP_Online_processors;
* uses _Thread_Start_multitasking() instead. * uses _Thread_Start_multitasking() instead.
* *
* This function does not return to the caller. * This function does not return to the caller.
*
* @param[in] cpu_self The current processor control.
*/ */
void _SMP_Start_multitasking_on_secondary_processor( void ) void _SMP_Start_multitasking_on_secondary_processor(
RTEMS_NO_RETURN; Per_CPU_Control *cpu_self
) RTEMS_NO_RETURN;
typedef void ( *SMP_Test_message_handler )( Per_CPU_Control *cpu_self ); typedef void ( *SMP_Test_message_handler )( Per_CPU_Control *cpu_self );

View File

@@ -145,14 +145,19 @@ void _SMP_Handler_initialize( void )
void _SMP_Request_start_multitasking( void ) void _SMP_Request_start_multitasking( void )
{ {
Per_CPU_Control *self_cpu = _Per_CPU_Get(); Per_CPU_Control *cpu_self;
uint32_t cpu_count = _SMP_Get_processor_count(); uint32_t cpu_count;
uint32_t cpu_index; uint32_t cpu_index;
_Per_CPU_State_change( self_cpu, PER_CPU_STATE_READY_TO_START_MULTITASKING ); cpu_self = _Per_CPU_Get();
_Per_CPU_State_change( cpu_self, PER_CPU_STATE_READY_TO_START_MULTITASKING );
cpu_count = _SMP_Get_processor_count();
for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { 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 ) ) { if ( _Per_CPU_Is_processor_online( cpu ) ) {
_Per_CPU_State_change( cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING ); _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 ); 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;
uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu );
cpu_index_self = _Per_CPU_Get_index( cpu_self );
if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) { if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
_SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR ); _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 ); _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(); _Thread_Start_multitasking();
} }