summaryrefslogtreecommitdiffstats
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
parentcfcd6dc98cad1dd677ac60ad80e7ef3aa39b926b (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.
-rw-r--r--bsps/powerpc/qoriq/start/bsprestart.c2
-rw-r--r--bsps/riscv/riscv/irq/irq.c18
-rw-r--r--bsps/shared/dev/clock/clockimpl.h6
-rw-r--r--cpukit/include/rtems/score/percpu.h4
-rw-r--r--cpukit/include/rtems/score/smp.h4
-rw-r--r--cpukit/rtems/src/getprocessorcount.c2
-rw-r--r--cpukit/rtems/src/scheduleridentbyprocessor.c2
-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
-rw-r--r--testsuites/sptests/spsize/size.c2
13 files changed, 60 insertions, 48 deletions
diff --git a/bsps/powerpc/qoriq/start/bsprestart.c b/bsps/powerpc/qoriq/start/bsprestart.c
index 3118afd46b..3dc9d6ffce 100644
--- a/bsps/powerpc/qoriq/start/bsprestart.c
+++ b/bsps/powerpc/qoriq/start/bsprestart.c
@@ -67,7 +67,7 @@ static void restart_interrupt(void *arg)
(void) level;
_SMP_barrier_State_initialize(&bs);
- _SMP_barrier_Wait(&restart_barrier, &bs, _SMP_Get_processor_count());
+ _SMP_barrier_Wait(&restart_barrier, &bs, _SMP_Get_processor_maximum());
cpu_self_index = rtems_scheduler_get_processor();
thread_index = cpu_self_index % QORIQ_THREAD_COUNT;
diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 3c35a379a4..ffd9bbe61f 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -247,12 +247,12 @@ void bsp_interrupt_vector_enable(rtems_vector_number vector)
if (enable != NULL) {
enable[group] |= bit;
} else {
+ uint32_t cpu_max;
uint32_t cpu_index;
- uint32_t cpu_count;
- 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);
@@ -289,12 +289,12 @@ void bsp_interrupt_vector_disable(rtems_vector_number vector)
if (enable != NULL) {
enable[group] &= ~bit;
} else {
+ uint32_t cpu_max;
uint32_t cpu_index;
- uint32_t cpu_count;
- 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);
@@ -357,12 +357,12 @@ void bsp_interrupt_get_affinity(
enable = riscv_plic_irq_to_cpu[interrupt_index - 1];
if (enable != NULL) {
+ uint32_t cpu_max;
uint32_t cpu_index;
- uint32_t cpu_count;
- 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);
diff --git a/bsps/shared/dev/clock/clockimpl.h b/bsps/shared/dev/clock/clockimpl.h
index 7913cde28c..f5eb4dcd1d 100644
--- a/bsps/shared/dev/clock/clockimpl.h
+++ b/bsps/shared/dev/clock/clockimpl.h
@@ -79,10 +79,12 @@ static void Clock_driver_timecounter_tick( void )
#if defined(CLOCK_DRIVER_USE_DUMMY_TIMECOUNTER)
rtems_clock_tick();
#elif defined(RTEMS_SMP) && defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
- 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 ) {
Per_CPU_Control *cpu;
cpu = _Per_CPU_Get_by_index( cpu_index );
diff --git a/cpukit/include/rtems/score/percpu.h b/cpukit/include/rtems/score/percpu.h
index 26ae8c68d0..4ffefae292 100644
--- a/cpukit/include/rtems/score/percpu.h
+++ b/cpukit/include/rtems/score/percpu.h
@@ -597,7 +597,7 @@ extern Per_CPU_Control_envelope _Per_CPU_Information[] CPU_STRUCTURE_ALIGNMENT;
#if defined( RTEMS_SMP )
#define _Per_CPU_Acquire_all( isr_cookie ) \
do { \
- uint32_t ncpus = _SMP_Get_processor_count(); \
+ uint32_t ncpus = _SMP_Get_processor_maximum(); \
uint32_t cpu; \
_ISR_Local_disable( isr_cookie ); \
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { \
@@ -612,7 +612,7 @@ extern Per_CPU_Control_envelope _Per_CPU_Information[] CPU_STRUCTURE_ALIGNMENT;
#if defined( RTEMS_SMP )
#define _Per_CPU_Release_all( isr_cookie ) \
do { \
- uint32_t ncpus = _SMP_Get_processor_count(); \
+ uint32_t ncpus = _SMP_Get_processor_maximum(); \
uint32_t cpu; \
for ( cpu = 0 ; cpu < ncpus ; ++cpu ) { \
_Per_CPU_Release( _Per_CPU_Get_by_index( cpu ) ); \
diff --git a/cpukit/include/rtems/score/smp.h b/cpukit/include/rtems/score/smp.h
index a960097948..94b7566f0e 100644
--- a/cpukit/include/rtems/score/smp.h
+++ b/cpukit/include/rtems/score/smp.h
@@ -37,12 +37,12 @@ extern "C" {
#if defined( RTEMS_SMP )
extern uint32_t _SMP_Processor_maximum;
- static inline uint32_t _SMP_Get_processor_count( void )
+ static inline uint32_t _SMP_Get_processor_maximum( void )
{
return _SMP_Processor_maximum;
}
#else
- #define _SMP_Get_processor_count() UINT32_C(1)
+ #define _SMP_Get_processor_maximum() UINT32_C(1)
#endif
#if defined( RTEMS_SMP )
diff --git a/cpukit/rtems/src/getprocessorcount.c b/cpukit/rtems/src/getprocessorcount.c
index 40ab5ef9d9..68de749225 100644
--- a/cpukit/rtems/src/getprocessorcount.c
+++ b/cpukit/rtems/src/getprocessorcount.c
@@ -21,5 +21,5 @@
uint32_t rtems_scheduler_get_processor_maximum(void)
{
- return _SMP_Get_processor_count();
+ return _SMP_Get_processor_maximum();
}
diff --git a/cpukit/rtems/src/scheduleridentbyprocessor.c b/cpukit/rtems/src/scheduleridentbyprocessor.c
index 2bc64d77d3..f862c1bc32 100644
--- a/cpukit/rtems/src/scheduleridentbyprocessor.c
+++ b/cpukit/rtems/src/scheduleridentbyprocessor.c
@@ -31,7 +31,7 @@ rtems_status_code rtems_scheduler_ident_by_processor(
return RTEMS_INVALID_ADDRESS;
}
- if ( cpu_index >= _SMP_Get_processor_count() ) {
+ if ( cpu_index >= _SMP_Get_processor_maximum() ) {
return RTEMS_INVALID_NAME;
}
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 ) ) {
diff --git a/testsuites/sptests/spsize/size.c b/testsuites/sptests/spsize/size.c
index ac674d89ad..1369cd7072 100644
--- a/testsuites/sptests/spsize/size.c
+++ b/testsuites/sptests/spsize/size.c
@@ -322,7 +322,7 @@ uninitialized =
/*partmp.h*/ 0 +
#endif
-/*percpu.h*/ (_SMP_Get_processor_count() * sizeof(Per_CPU_Control)) +
+/*percpu.h*/ (_SMP_Get_processor_maximum() * sizeof(Per_CPU_Control)) +
/*ratemonimpl.h*/ (sizeof _Rate_monotonic_Information) +