forked from Imagelibrary/rtems
smp: Add and use _SMP_Should_start_processor()
This commit is contained in:
@@ -57,7 +57,6 @@
|
|||||||
#include <bsp/smp-imps.h>
|
#include <bsp/smp-imps.h>
|
||||||
#include <bsp/irq.h>
|
#include <bsp/irq.h>
|
||||||
#include <rtems/score/smpimpl.h>
|
#include <rtems/score/smpimpl.h>
|
||||||
#include <rtems/score/schedulerimpl.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXXXX The following absolutely must be defined!!!
|
* XXXXX The following absolutely must be defined!!!
|
||||||
@@ -387,10 +386,7 @@ imps_read_config_table(unsigned start, int count)
|
|||||||
switch (*((unsigned char *)start)) {
|
switch (*((unsigned char *)start)) {
|
||||||
case IMPS_BCT_PROCESSOR:
|
case IMPS_BCT_PROCESSOR:
|
||||||
if ( imps_num_cpus < rtems_configuration_get_maximum_processors() ) {
|
if ( imps_num_cpus < rtems_configuration_get_maximum_processors() ) {
|
||||||
const Scheduler_Assignment *assignment =
|
if (_SMP_Should_start_processor((uint32_t) imps_num_cpus)) {
|
||||||
_Scheduler_Get_assignment((uint32_t) imps_num_cpus);
|
|
||||||
|
|
||||||
if (_Scheduler_Should_start_processor(assignment)) {
|
|
||||||
add_processor((imps_processor *)start);
|
add_processor((imps_processor *)start);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include <bsp/bootcard.h>
|
#include <bsp/bootcard.h>
|
||||||
#include <rtems/bspIo.h>
|
#include <rtems/bspIo.h>
|
||||||
#include <rtems/score/smpimpl.h>
|
#include <rtems/score/smpimpl.h>
|
||||||
#include <rtems/score/schedulerimpl.h>
|
|
||||||
|
|
||||||
void bsp_fatal_extension(
|
void bsp_fatal_extension(
|
||||||
rtems_fatal_source source,
|
rtems_fatal_source source,
|
||||||
@@ -55,10 +54,7 @@ void bsp_fatal_extension(
|
|||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < cpu_count; ++i) {
|
for (i = 0; i < cpu_count; ++i) {
|
||||||
const Scheduler_Assignment *assignment = _Scheduler_Get_assignment( i );
|
if ( (i != self_cpu) && _SMP_Should_start_processor( i ) ) {
|
||||||
|
|
||||||
if ( (i != self_cpu) &&
|
|
||||||
_Scheduler_Should_start_processor( assignment ) ) {
|
|
||||||
halt_mask |= UINT32_C(1) << i;
|
halt_mask |= UINT32_C(1) << i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,6 +170,17 @@ static inline void _SMP_Inter_processor_interrupt_handler( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns true, if the processor with the specified index should be
|
||||||
|
* started.
|
||||||
|
*
|
||||||
|
* @param[in] cpu_index The processor index.
|
||||||
|
*
|
||||||
|
* @retval true The processor should be started.
|
||||||
|
* @retval false Otherwise.
|
||||||
|
*/
|
||||||
|
bool _SMP_Should_start_processor( uint32_t cpu_index );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends a SMP message to a processor.
|
* @brief Sends a SMP message to a processor.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -118,18 +118,24 @@ void _SMP_Request_start_multitasking( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _SMP_Should_start_processor( uint32_t cpu_index )
|
||||||
|
{
|
||||||
|
const Scheduler_Assignment *assignment =
|
||||||
|
_Scheduler_Get_assignment( cpu_index );
|
||||||
|
|
||||||
|
return _Scheduler_Should_start_processor( assignment );
|
||||||
|
}
|
||||||
|
|
||||||
void _SMP_Start_multitasking_on_secondary_processor( void )
|
void _SMP_Start_multitasking_on_secondary_processor( void )
|
||||||
{
|
{
|
||||||
Per_CPU_Control *self_cpu = _Per_CPU_Get();
|
Per_CPU_Control *self_cpu = _Per_CPU_Get();
|
||||||
uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu );
|
uint32_t cpu_index_self = _Per_CPU_Get_index( self_cpu );
|
||||||
const Scheduler_Assignment *assignment =
|
|
||||||
_Scheduler_Get_assignment( cpu_index_self );
|
|
||||||
|
|
||||||
if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
|
if ( cpu_index_self >= rtems_configuration_get_maximum_processors() ) {
|
||||||
_SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR );
|
_SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !_Scheduler_Should_start_processor( assignment ) ) {
|
if ( !_SMP_Should_start_processor( cpu_index_self ) ) {
|
||||||
_SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR );
|
_SMP_Fatal( SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user