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.
This commit is contained in:
Sebastian Huber
2019-04-11 09:19:12 +02:00
parent cfcd6dc98c
commit ad87de4a67
13 changed files with 60 additions and 48 deletions
+1 -1
View File
@@ -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;
+9 -9
View File
@@ -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);
+4 -2
View File
@@ -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 );
+2 -2
View File
@@ -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 ) ); \
+2 -2
View File
@@ -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 )
+1 -1
View File
@@ -21,5 +21,5 @@
uint32_t rtems_scheduler_get_processor_maximum(void)
{
return _SMP_Get_processor_count();
return _SMP_Get_processor_maximum();
}
+1 -1
View File
@@ -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;
}
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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
+31 -22
View File
@@ -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 (
+1 -1
View File
@@ -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 );
}
+3 -2
View File
@@ -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 ) ) {
+1 -1
View File
@@ -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) +