forked from Imagelibrary/rtems
score: Remove _SMP_Before_multitasking_action()
Use _SMP_Multicast_action() instead.
This commit is contained in:
@@ -102,11 +102,13 @@ typedef struct {
|
|||||||
|
|
||||||
static void a9mpcore_clock_secondary_action(void *arg)
|
static void a9mpcore_clock_secondary_action(void *arg)
|
||||||
{
|
{
|
||||||
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
if (!_Per_CPU_Is_boot_processor(_Per_CPU_Get())) {
|
||||||
a9mpcore_clock_init_data *init_data = arg;
|
volatile a9mpcore_gt *gt = A9MPCORE_GT;
|
||||||
|
a9mpcore_clock_init_data *init_data = arg;
|
||||||
|
|
||||||
a9mpcore_clock_gt_init(gt, init_data->cmpval, init_data->interval);
|
a9mpcore_clock_gt_init(gt, init_data->cmpval, init_data->interval);
|
||||||
bsp_interrupt_vector_enable(A9MPCORE_IRQ_GT);
|
bsp_interrupt_vector_enable(A9MPCORE_IRQ_GT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -122,10 +124,7 @@ static void a9mpcore_clock_secondary_initialization(
|
|||||||
.interval = interval
|
.interval = interval
|
||||||
};
|
};
|
||||||
|
|
||||||
_SMP_Before_multitasking_action_broadcast(
|
_SMP_Multicast_action(NULL, a9mpcore_clock_secondary_action, &init_data);
|
||||||
a9mpcore_clock_secondary_action,
|
|
||||||
&init_data
|
|
||||||
);
|
|
||||||
|
|
||||||
if (cmpval - a9mpcore_clock_get_counter(gt) >= interval) {
|
if (cmpval - a9mpcore_clock_get_counter(gt) >= interval) {
|
||||||
bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_SMP_INIT);
|
bsp_fatal(BSP_ARM_A9MPCORE_FATAL_CLOCK_SMP_INIT);
|
||||||
|
|||||||
@@ -122,21 +122,20 @@ static void arm_gt_clock_gt_init(uint64_t cval)
|
|||||||
#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
|
#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
|
||||||
static void arm_gt_clock_secondary_action(void *arg)
|
static void arm_gt_clock_secondary_action(void *arg)
|
||||||
{
|
{
|
||||||
uint64_t *cval;
|
if (!_Per_CPU_Is_boot_processor(_Per_CPU_Get())) {
|
||||||
|
uint64_t *cval;
|
||||||
|
|
||||||
cval = arg;
|
cval = arg;
|
||||||
arm_gt_clock_gt_init(*cval);
|
arm_gt_clock_gt_init(*cval);
|
||||||
bsp_interrupt_vector_enable(arm_gt_clock_instance.irq);
|
bsp_interrupt_vector_enable(arm_gt_clock_instance.irq);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void arm_gt_clock_secondary_initialization(uint64_t cval)
|
static void arm_gt_clock_secondary_initialization(uint64_t cval)
|
||||||
{
|
{
|
||||||
#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
|
#if defined(RTEMS_SMP) && !defined(CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR)
|
||||||
_SMP_Before_multitasking_action_broadcast(
|
_SMP_Multicast_action(NULL, arm_gt_clock_secondary_action, &cval);
|
||||||
arm_gt_clock_secondary_action,
|
|
||||||
&cval
|
|
||||||
);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -488,14 +488,6 @@ typedef struct Per_CPU_Control {
|
|||||||
*/
|
*/
|
||||||
Per_CPU_State state;
|
Per_CPU_State state;
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Action to be executed by this processor in the
|
|
||||||
* SYSTEM_STATE_BEFORE_MULTITASKING state on behalf of the boot processor.
|
|
||||||
*
|
|
||||||
* @see _SMP_Before_multitasking_action().
|
|
||||||
*/
|
|
||||||
Atomic_Uintptr before_multitasking_action;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FIFO list of jobs to be performed by this processor.
|
* @brief FIFO list of jobs to be performed by this processor.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -260,50 +260,6 @@ void _SMP_Multicast_action(
|
|||||||
void *arg
|
void *arg
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Executes a handler with argument on the specified processor on behalf
|
|
||||||
* of the boot processor.
|
|
||||||
*
|
|
||||||
* The calling processor must be the boot processor. In case the specified
|
|
||||||
* processor is not online or not in the
|
|
||||||
* PER_CPU_STATE_READY_TO_START_MULTITASKING state, then no action is
|
|
||||||
* performed.
|
|
||||||
*
|
|
||||||
* @param cpu The processor to execute the action.
|
|
||||||
* @param handler The handler of the action.
|
|
||||||
* @param arg The argument of the action.
|
|
||||||
*
|
|
||||||
* @retval true The handler executed on the specified processor.
|
|
||||||
* @retval false Otherwise.
|
|
||||||
*
|
|
||||||
* @see _SMP_Before_multitasking_action_broadcast().
|
|
||||||
*/
|
|
||||||
bool _SMP_Before_multitasking_action(
|
|
||||||
Per_CPU_Control *cpu,
|
|
||||||
SMP_Action_handler handler,
|
|
||||||
void *arg
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Executes a handler with argument on all online processors except the
|
|
||||||
* boot processor on behalf of the boot processor.
|
|
||||||
*
|
|
||||||
* The calling processor must be the boot processor.
|
|
||||||
*
|
|
||||||
* @param handler The handler of the action.
|
|
||||||
* @param arg The argument of the action.
|
|
||||||
*
|
|
||||||
* @retval true The handler executed on all online processors except the boot
|
|
||||||
* processor.
|
|
||||||
* @retval false Otherwise.
|
|
||||||
*
|
|
||||||
* @see _SMP_Before_multitasking_action().
|
|
||||||
*/
|
|
||||||
bool _SMP_Before_multitasking_action_broadcast(
|
|
||||||
SMP_Action_handler handler,
|
|
||||||
void *arg
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* defined( RTEMS_SMP ) */
|
#endif /* defined( RTEMS_SMP ) */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,11 +36,6 @@ RTEMS_STATIC_ASSERT(
|
|||||||
|
|
||||||
#if defined(RTEMS_SMP)
|
#if defined(RTEMS_SMP)
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
SMP_Action_handler handler;
|
|
||||||
void *arg;
|
|
||||||
} SMP_Before_multicast_action;
|
|
||||||
|
|
||||||
ISR_LOCK_DEFINE( static, _Per_CPU_State_lock, "Per-CPU State" )
|
ISR_LOCK_DEFINE( static, _Per_CPU_State_lock, "Per-CPU State" )
|
||||||
|
|
||||||
static void _Per_CPU_State_acquire( ISR_lock_Context *lock_context )
|
static void _Per_CPU_State_acquire( ISR_lock_Context *lock_context )
|
||||||
@@ -53,29 +48,6 @@ static void _Per_CPU_State_release( ISR_lock_Context *lock_context )
|
|||||||
_ISR_lock_Release_and_ISR_enable( &_Per_CPU_State_lock, lock_context );
|
_ISR_lock_Release_and_ISR_enable( &_Per_CPU_State_lock, lock_context );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _Per_CPU_State_before_multitasking_action( Per_CPU_Control *cpu )
|
|
||||||
{
|
|
||||||
uintptr_t action_value;
|
|
||||||
|
|
||||||
action_value = _Atomic_Load_uintptr(
|
|
||||||
&cpu->before_multitasking_action,
|
|
||||||
ATOMIC_ORDER_ACQUIRE
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( action_value != 0 ) {
|
|
||||||
SMP_Before_multicast_action *action =
|
|
||||||
(SMP_Before_multicast_action *) action_value;
|
|
||||||
|
|
||||||
( *action->handler )( action->arg );
|
|
||||||
|
|
||||||
_Atomic_Store_uintptr(
|
|
||||||
&cpu->before_multitasking_action,
|
|
||||||
0,
|
|
||||||
ATOMIC_ORDER_RELEASE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void _Per_CPU_State_busy_wait(
|
static void _Per_CPU_State_busy_wait(
|
||||||
Per_CPU_Control *cpu,
|
Per_CPU_Control *cpu,
|
||||||
Per_CPU_State new_state
|
Per_CPU_State new_state
|
||||||
@@ -99,7 +71,6 @@ static void _Per_CPU_State_busy_wait(
|
|||||||
state != PER_CPU_STATE_REQUEST_START_MULTITASKING
|
state != PER_CPU_STATE_REQUEST_START_MULTITASKING
|
||||||
&& state != PER_CPU_STATE_SHUTDOWN
|
&& state != PER_CPU_STATE_SHUTDOWN
|
||||||
) {
|
) {
|
||||||
_Per_CPU_State_before_multitasking_action( cpu );
|
|
||||||
_Per_CPU_Perform_jobs( cpu );
|
_Per_CPU_Perform_jobs( cpu );
|
||||||
_CPU_SMP_Processor_event_receive();
|
_CPU_SMP_Processor_event_receive();
|
||||||
state = cpu->state;
|
state = cpu->state;
|
||||||
@@ -206,47 +177,6 @@ void _Per_CPU_State_change(
|
|||||||
_SMP_Fatal( SMP_FATAL_SHUTDOWN );
|
_SMP_Fatal( SMP_FATAL_SHUTDOWN );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _SMP_Before_multitasking_action(
|
|
||||||
Per_CPU_Control *cpu,
|
|
||||||
SMP_Action_handler handler,
|
|
||||||
void *arg
|
|
||||||
)
|
|
||||||
{
|
|
||||||
bool done;
|
|
||||||
|
|
||||||
_Assert( _Per_CPU_Is_boot_processor( _Per_CPU_Get() ) );
|
|
||||||
|
|
||||||
if ( _Per_CPU_Is_processor_online( cpu ) ) {
|
|
||||||
SMP_Before_multicast_action action = {
|
|
||||||
.handler = handler,
|
|
||||||
.arg = arg
|
|
||||||
};
|
|
||||||
Per_CPU_State expected_state = PER_CPU_STATE_READY_TO_START_MULTITASKING;
|
|
||||||
|
|
||||||
_Atomic_Store_uintptr(
|
|
||||||
&cpu->before_multitasking_action,
|
|
||||||
(uintptr_t) &action,
|
|
||||||
ATOMIC_ORDER_RELEASE
|
|
||||||
);
|
|
||||||
|
|
||||||
_CPU_SMP_Processor_event_broadcast();
|
|
||||||
|
|
||||||
_Per_CPU_State_busy_wait( cpu, expected_state );
|
|
||||||
|
|
||||||
do {
|
|
||||||
done = _Atomic_Load_uintptr(
|
|
||||||
&cpu->before_multitasking_action,
|
|
||||||
ATOMIC_ORDER_ACQUIRE
|
|
||||||
) == 0;
|
|
||||||
} while ( !done && cpu->state == expected_state );
|
|
||||||
} else {
|
|
||||||
done = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* On single core systems, we can efficiently directly access a single
|
* On single core systems, we can efficiently directly access a single
|
||||||
|
|||||||
@@ -253,30 +253,4 @@ void _SMP_Send_message_multicast(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _SMP_Before_multitasking_action_broadcast(
|
|
||||||
SMP_Action_handler handler,
|
|
||||||
void *arg
|
|
||||||
)
|
|
||||||
{
|
|
||||||
bool done;
|
|
||||||
uint32_t cpu_max;
|
|
||||||
uint32_t 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 (
|
|
||||||
!_Per_CPU_Is_boot_processor( cpu )
|
|
||||||
&& _Per_CPU_Is_processor_online( cpu )
|
|
||||||
) {
|
|
||||||
done = _SMP_Before_multitasking_action( cpu, handler, arg );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return done;
|
|
||||||
}
|
|
||||||
|
|
||||||
SMP_Test_message_handler _SMP_Test_message_handler;
|
SMP_Test_message_handler _SMP_Test_message_handler;
|
||||||
|
|||||||
Reference in New Issue
Block a user