From e6107854b2511decef8c209cde14c4826a33ff01 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 7 Nov 2016 08:06:48 +0100 Subject: score: Rename _Scheduler_Assignments Rename _Scheduler_Assignments into _Scheduler_Initial_assignments to make it clear that they may not reflect the run-time scheduler assignment. Update #2797. --- cpukit/score/src/smp.c | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'cpukit/score/src/smp.c') diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index c880d7eb5d..ab9c7a6115 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -32,16 +32,41 @@ Processor_mask _SMP_Online_processors; uint32_t _SMP_Processor_count; +static const Scheduler_Assignment *_Scheduler_Get_initial_assignment( + uint32_t cpu_index +) +{ + return &_Scheduler_Initial_assignments[ cpu_index ]; +} + +static bool _Scheduler_Is_mandatory_processor( + const Scheduler_Assignment *assignment +) +{ + return (assignment->attributes & SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) != 0; +} + +static bool _Scheduler_Should_start_processor( + const Scheduler_Assignment *assignment +) +{ + return assignment->scheduler != NULL; +} + static void _SMP_Start_processors( uint32_t cpu_count ) { - uint32_t cpu_index_self = _SMP_Get_current_processor(); + uint32_t cpu_index_self; uint32_t cpu_index; + cpu_index_self = _SMP_Get_current_processor(); + for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) { - const Scheduler_Assignment *assignment = - _Scheduler_Get_assignment( cpu_index ); - Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); - bool started; + const Scheduler_Assignment *assignment; + Per_CPU_Control *cpu; + bool started; + + assignment = _Scheduler_Get_initial_assignment( cpu_index ); + cpu = _Per_CPU_Get_by_index( cpu_index ); if ( cpu_index != cpu_index_self ) { if ( _Scheduler_Should_start_processor( assignment ) ) { @@ -105,8 +130,9 @@ void _SMP_Handler_initialize( void ) _SMP_Processor_count = cpu_count; for ( cpu_index = cpu_count ; cpu_index < cpu_max; ++cpu_index ) { - const Scheduler_Assignment *assignment = - _Scheduler_Get_assignment( cpu_index ); + const Scheduler_Assignment *assignment; + + assignment = _Scheduler_Get_initial_assignment( cpu_index ); if ( _Scheduler_Is_mandatory_processor( assignment ) ) { _SMP_Fatal( SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT ); @@ -137,9 +163,9 @@ void _SMP_Request_start_multitasking( void ) bool _SMP_Should_start_processor( uint32_t cpu_index ) { - const Scheduler_Assignment *assignment = - _Scheduler_Get_assignment( cpu_index ); + const Scheduler_Assignment *assignment; + assignment = _Scheduler_Get_initial_assignment( cpu_index ); return _Scheduler_Should_start_processor( assignment ); } -- cgit v1.2.3