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.
This commit is contained in:
Sebastian Huber
2016-11-07 08:06:48 +01:00
parent 68ef65bd5e
commit e6107854b2
4 changed files with 39 additions and 36 deletions

View File

@@ -1019,7 +1019,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#if defined(RTEMS_SMP)
const size_t _Scheduler_Count = CONFIGURE_SCHEDULER_COUNT;
const Scheduler_Assignment _Scheduler_Assignments[] = {
const Scheduler_Assignment _Scheduler_Initial_assignments[] = {
#if defined(CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS)
CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
#else
@@ -1128,8 +1128,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
RTEMS_STATIC_ASSERT(
CONFIGURE_SMP_MAXIMUM_PROCESSORS
== RTEMS_ARRAY_SIZE( _Scheduler_Assignments ),
_Scheduler_Assignments
== RTEMS_ARRAY_SIZE( _Scheduler_Initial_assignments ),
_Scheduler_Initial_assignments
);
#endif
#endif

View File

@@ -327,7 +327,7 @@ extern const Scheduler_Control _Scheduler_Table[];
*
* @see _Scheduler_Table and rtems_configuration_get_maximum_processors().
*/
extern const Scheduler_Assignment _Scheduler_Assignments[];
extern const Scheduler_Assignment _Scheduler_Initial_assignments[];
#endif
/**

View File

@@ -638,29 +638,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Start_idle(
( *scheduler->Operations.start_idle )( scheduler, the_thread, cpu );
}
#if defined(RTEMS_SMP)
RTEMS_INLINE_ROUTINE const Scheduler_Assignment *_Scheduler_Get_assignment(
uint32_t cpu_index
)
{
return &_Scheduler_Assignments[ cpu_index ];
}
RTEMS_INLINE_ROUTINE bool _Scheduler_Is_mandatory_processor(
const Scheduler_Assignment *assignment
)
{
return (assignment->attributes & SCHEDULER_ASSIGN_PROCESSOR_MANDATORY) != 0;
}
RTEMS_INLINE_ROUTINE bool _Scheduler_Should_start_processor(
const Scheduler_Assignment *assignment
)
{
return assignment->scheduler != NULL;
}
#endif /* defined(RTEMS_SMP) */
RTEMS_INLINE_ROUTINE bool _Scheduler_Has_processor_ownership(
const Scheduler_Control *scheduler,
uint32_t cpu_index

View File

@@ -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 );
}