summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-04-11 08:54:29 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-04-11 09:19:12 +0200
commitad87de4a67d8ce7e75d0b844efc03b98c3ecda1a (patch)
tree107f99285b1d0744f0c6e59bf9014b21085a01d6 /cpukit/score
parentscore: Rename _SMP_Processor_count (diff)
downloadrtems-ad87de4a67d8ce7e75d0b844efc03b98c3ecda1a.tar.bz2
score: Rename _SMP_Get_processor_count()
Rename _SMP_Get_processor_count() in _SMP_Get_processor_maximum() to be in line with the API level rtems_scheduler_get_processor_maximum(). Update #3732.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/src/coretodset.c6
-rw-r--r--cpukit/score/src/schedulerdefaultpinunpin.c2
-rw-r--r--cpukit/score/src/smp.c53
-rw-r--r--cpukit/score/src/smpmulticastaction.c2
-rw-r--r--cpukit/score/src/threadcreateidle.c5
5 files changed, 39 insertions, 29 deletions
diff --git a/cpukit/score/src/coretodset.c b/cpukit/score/src/coretodset.c
index f348596213..b021a58dc6 100644
--- a/cpukit/score/src/coretodset.c
+++ b/cpukit/score/src/coretodset.c
@@ -29,7 +29,7 @@ void _TOD_Set(
{
struct bintime tod_as_bintime;
uint64_t tod_as_ticks;
- uint32_t cpu_count;
+ uint32_t cpu_max;
uint32_t cpu_index;
_Assert( _TOD_Is_owner() );
@@ -38,9 +38,9 @@ void _TOD_Set(
_Timecounter_Set_clock( &tod_as_bintime, lock_context );
tod_as_ticks = _Watchdog_Ticks_from_timespec( tod );
- cpu_count = _SMP_Get_processor_count();
+ cpu_max = _SMP_Get_processor_maximum();
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
Per_CPU_Control *cpu;
Watchdog_Header *header;
ISR_lock_Context lock_context;
diff --git a/cpukit/score/src/schedulerdefaultpinunpin.c b/cpukit/score/src/schedulerdefaultpinunpin.c
index 5fc9cca026..6df685a371 100644
--- a/cpukit/score/src/schedulerdefaultpinunpin.c
+++ b/cpukit/score/src/schedulerdefaultpinunpin.c
@@ -26,7 +26,7 @@ void _Scheduler_default_Pin_or_unpin(
(void) node;
(void) cpu;
- if ( _SMP_Get_processor_count() > 1 ) {
+ if ( _SMP_Get_processor_maximum() > 1 ) {
_Terminate(
RTEMS_FATAL_SOURCE_SMP,
SMP_FATAL_SCHEDULER_PIN_OR_UNPIN_NOT_SUPPORTED
diff --git a/cpukit/score/src/smp.c b/cpukit/score/src/smp.c
index 3d35154817..780b33c740 100644
--- a/cpukit/score/src/smp.c
+++ b/cpukit/score/src/smp.c
@@ -53,14 +53,14 @@ static bool _Scheduler_Should_start_processor(
return assignment->scheduler != NULL;
}
-static void _SMP_Start_processors( uint32_t cpu_count )
+static void _SMP_Start_processors( uint32_t cpu_max )
{
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 ) {
+ for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) {
const Scheduler_Assignment *assignment;
Per_CPU_Control *cpu;
bool started;
@@ -107,11 +107,13 @@ static void _SMP_Start_processors( uint32_t cpu_count )
void _SMP_Handler_initialize( void )
{
- uint32_t cpu_max = rtems_configuration_get_maximum_processors();
- uint32_t cpu_count;
+ uint32_t cpu_config_max;
+ uint32_t cpu_max;
uint32_t cpu_index;
- for ( cpu_index = 0 ; cpu_index < cpu_max; ++cpu_index ) {
+ cpu_config_max = rtems_configuration_get_maximum_processors();
+
+ for ( cpu_index = 0 ; cpu_index < cpu_config_max; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
_ISR_lock_Initialize( &cpu->Watchdog.Lock, "Watchdog" );
@@ -124,11 +126,11 @@ void _SMP_Handler_initialize( void )
* Discover and initialize the secondary cores in an SMP system.
*/
- cpu_count = _CPU_SMP_Initialize();
- cpu_count = cpu_count < cpu_max ? cpu_count : cpu_max;
- _SMP_Processor_maximum = cpu_count;
+ cpu_max = _CPU_SMP_Initialize();
+ cpu_max = cpu_max < cpu_config_max ? cpu_max : cpu_config_max;
+ _SMP_Processor_maximum = cpu_max;
- for ( cpu_index = cpu_count ; cpu_index < cpu_max; ++cpu_index ) {
+ for ( cpu_index = cpu_max ; cpu_index < cpu_config_max; ++cpu_index ) {
const Scheduler_Assignment *assignment;
assignment = _Scheduler_Get_initial_assignment( cpu_index );
@@ -138,23 +140,23 @@ void _SMP_Handler_initialize( void )
}
}
- _SMP_Start_processors( cpu_count );
+ _SMP_Start_processors( cpu_max );
- _CPU_SMP_Finalize_initialization( cpu_count );
+ _CPU_SMP_Finalize_initialization( cpu_max );
}
void _SMP_Request_start_multitasking( void )
{
Per_CPU_Control *cpu_self;
- uint32_t cpu_count;
+ uint32_t cpu_max;
uint32_t cpu_index;
cpu_self = _Per_CPU_Get();
_Per_CPU_State_change( cpu_self, PER_CPU_STATE_READY_TO_START_MULTITASKING );
- cpu_count = _SMP_Get_processor_count();
+ cpu_max = _SMP_Get_processor_maximum();
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
Per_CPU_Control *cpu;
cpu = _Per_CPU_Get_by_index( cpu_index );
@@ -215,13 +217,15 @@ void _SMP_Send_message( uint32_t cpu_index, unsigned long message )
void _SMP_Send_message_broadcast( unsigned long message )
{
- uint32_t cpu_count = _SMP_Get_processor_count();
- uint32_t cpu_index_self = _SMP_Get_current_processor();
+ uint32_t cpu_max;
+ uint32_t cpu_index_self;
uint32_t cpu_index;
_Assert( _Debug_Is_thread_dispatching_allowed() );
+ cpu_max = _SMP_Get_processor_maximum();
+ cpu_index_self = _SMP_Get_current_processor();
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
if (
cpu_index != cpu_index_self
&& _Processor_mask_Is_set( &_SMP_Online_processors, cpu_index )
@@ -236,10 +240,12 @@ void _SMP_Send_message_multicast(
unsigned long message
)
{
- uint32_t cpu_count = _SMP_Get_processor_count();
+ uint32_t cpu_max;
uint32_t cpu_index;
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ cpu_max = _SMP_Get_processor_maximum();
+
+ for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
if ( _Processor_mask_Is_set( targets, cpu_index ) ) {
_SMP_Send_message( cpu_index, message );
}
@@ -251,11 +257,14 @@ bool _SMP_Before_multitasking_action_broadcast(
void *arg
)
{
- bool done = true;
- uint32_t cpu_count = _SMP_Get_processor_count();
+ bool done;
+ uint32_t cpu_max;
uint32_t cpu_index;
- for ( cpu_index = 0 ; done && cpu_index < cpu_count ; ++cpu_index ) {
+ done = true;
+ cpu_max = _SMP_Get_processor_maximum();
+
+ for ( cpu_index = 0 ; done && cpu_index < cpu_max ; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
if (
diff --git a/cpukit/score/src/smpmulticastaction.c b/cpukit/score/src/smpmulticastaction.c
index df03c79fa1..0cf675f795 100644
--- a/cpukit/score/src/smpmulticastaction.c
+++ b/cpukit/score/src/smpmulticastaction.c
@@ -110,7 +110,7 @@ void _SMP_Multicast_action(
} else {
_Processor_mask_Zero( &targets );
- for ( i = 0; i < _SMP_Get_processor_count(); ++i ) {
+ for ( i = 0; i < _SMP_Get_processor_maximum(); ++i ) {
if ( CPU_ISSET_S( i, setsize, cpus ) ) {
_Processor_mask_Set( &targets, i );
}
diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c
index eaf5d50389..65199f0f7d 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -85,12 +85,13 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu )
void _Thread_Create_idle( void )
{
- uint32_t cpu_count = _SMP_Get_processor_count();
+ uint32_t cpu_max;
uint32_t cpu_index;
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
+ cpu_max = _SMP_Get_processor_maximum();
- for ( cpu_index = 0 ; cpu_index < cpu_count ; ++cpu_index ) {
+ for ( cpu_index = 0 ; cpu_index < cpu_max ; ++cpu_index ) {
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
if ( _Per_CPU_Is_processor_online( cpu ) ) {