From 3380ee8194ec35506b88257f369e88d1d26350f1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 22 Apr 2014 07:46:53 +0200 Subject: score: Use common names for per-CPU variables Use "cpu" for an arbitrary Per_CPU_Control variable. Use "cpu_self" for the Per_CPU_Control of the current processor. Use "cpu_index" for an arbitrary processor index. Use "cpu_index_self" for the processor index of the current processor. Use "cpu_count" for the processor count obtained via _SMP_Get_processor_count(). Use "cpu_max" for the processor maximum obtained by rtems_configuration_get_maximum_processors(). --- cpukit/score/src/smp.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'cpukit/score/src/smp.c') diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c index 6df72070ec..f03a4c05e4 100644 --- a/cpukit/score/src/smp.c +++ b/cpukit/score/src/smp.c @@ -41,17 +41,17 @@ static void _SMP_Check_scheduler_configuration( void ) static void _SMP_Start_processors( uint32_t cpu_count ) { - uint32_t cpu_self = _SMP_Get_current_processor(); + uint32_t cpu_index_self = _SMP_Get_current_processor(); uint32_t cpu_index; for ( cpu_index = 0 ; cpu_index < cpu_count; ++cpu_index ) { const Scheduler_Assignment *assignment = _Scheduler_Get_assignment( cpu_index ); - Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu_index ); + Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); bool started; - if ( cpu_index != cpu_self ) { + if ( cpu_index != cpu_index_self ) { if ( _Scheduler_Should_start_processor( assignment ) ) { started = _CPU_SMP_Start_processor( cpu_index ); @@ -69,7 +69,7 @@ static void _SMP_Start_processors( uint32_t cpu_count ) } } - per_cpu->started = started; + cpu->started = started; if ( started ) { ++assignment->scheduler->context->processor_count; @@ -86,9 +86,9 @@ void _SMP_Handler_initialize( void ) uint32_t cpu_index; for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) { - Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu_index ); + Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); - _SMP_ticket_lock_Initialize( &per_cpu->Lock, "per-CPU" ); + _SMP_ticket_lock_Initialize( &cpu->Lock, "per-CPU" ); } /* @@ -116,15 +116,15 @@ void _SMP_Handler_initialize( void ) void _SMP_Request_start_multitasking( void ) { Per_CPU_Control *self_cpu = _Per_CPU_Get(); - uint32_t ncpus = _SMP_Get_processor_count(); - uint32_t cpu; + uint32_t cpu_count = _SMP_Get_processor_count(); + uint32_t cpu_index; _Per_CPU_State_change( self_cpu, PER_CPU_STATE_READY_TO_START_MULTITASKING ); - for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { - Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); + for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { + Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); - _Per_CPU_State_change( per_cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING ); + _Per_CPU_State_change( cpu, PER_CPU_STATE_REQUEST_START_MULTITASKING ); } } @@ -156,29 +156,29 @@ void _SMP_Request_shutdown( void ) _Giant_Drop( self_cpu ); } -void _SMP_Send_message( uint32_t cpu, uint32_t message ) +void _SMP_Send_message( uint32_t cpu_index, uint32_t message ) { - Per_CPU_Control *per_cpu = _Per_CPU_Get_by_index( cpu ); + Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index ); ISR_Level level; - _Per_CPU_ISR_disable_and_acquire( per_cpu, level ); - per_cpu->message |= message; - _Per_CPU_Release_and_ISR_enable( per_cpu, level ); + _Per_CPU_ISR_disable_and_acquire( cpu, level ); + cpu->message |= message; + _Per_CPU_Release_and_ISR_enable( cpu, level ); - _CPU_SMP_Send_interrupt( cpu ); + _CPU_SMP_Send_interrupt( cpu_index ); } void _SMP_Broadcast_message( uint32_t message ) { - uint32_t self = _SMP_Get_current_processor(); - uint32_t ncpus = _SMP_Get_processor_count(); - uint32_t cpu; + uint32_t cpu_count = _SMP_Get_processor_count(); + uint32_t cpu_index_self = _SMP_Get_current_processor(); + uint32_t cpu_index; _Assert( _Debug_Is_thread_dispatching_allowed() ); - for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { - if ( cpu != self ) { - _SMP_Send_message( cpu, message ); + for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) { + if ( cpu_index != cpu_index_self ) { + _SMP_Send_message( cpu_index, message ); } } } -- cgit v1.2.3