mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 00:25:13 +08:00
score: Change _SMP_Send_message() parameter type
Use the processor control to specify the target processor since this is what the callers have available.
This commit is contained in:
@@ -218,14 +218,15 @@ static inline long unsigned _SMP_Inter_processor_interrupt_handler(
|
||||
bool _SMP_Should_start_processor( uint32_t cpu_index );
|
||||
|
||||
/**
|
||||
* @brief Sends an SMP message to a processor.
|
||||
* @brief Sends the SMP message to the processor.
|
||||
*
|
||||
* The target processor may be the sending processor.
|
||||
*
|
||||
* @param cpu_index The target processor of the message.
|
||||
* @param message The message to send.
|
||||
* @param[in, out] cpu is the processor control of the target processor.
|
||||
*
|
||||
* @param message is the message to send.
|
||||
*/
|
||||
void _SMP_Send_message( uint32_t cpu_index, unsigned long message );
|
||||
void _SMP_Send_message( Per_CPU_Control *cpu, unsigned long message );
|
||||
|
||||
typedef void ( *SMP_Action_handler )( void *arg );
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ void _Per_CPU_Add_job( Per_CPU_Control *cpu, Per_CPU_Job *job )
|
||||
void _Per_CPU_Submit_job( Per_CPU_Control *cpu, Per_CPU_Job *job )
|
||||
{
|
||||
_Per_CPU_Add_job( cpu, job );
|
||||
_SMP_Send_message( _Per_CPU_Get_index( cpu ), SMP_MESSAGE_PERFORM_JOBS );
|
||||
_SMP_Send_message( cpu, SMP_MESSAGE_PERFORM_JOBS );
|
||||
}
|
||||
|
||||
void _Per_CPU_Wait_for_job(
|
||||
|
||||
@@ -322,16 +322,14 @@ void _SMP_Try_to_process_message(
|
||||
}
|
||||
}
|
||||
|
||||
void _SMP_Send_message( uint32_t cpu_index, unsigned long message )
|
||||
void _SMP_Send_message( Per_CPU_Control *cpu, unsigned long message )
|
||||
{
|
||||
Per_CPU_Control *cpu = _Per_CPU_Get_by_index( cpu_index );
|
||||
|
||||
(void) _Atomic_Fetch_or_ulong(
|
||||
&cpu->message, message,
|
||||
ATOMIC_ORDER_RELEASE
|
||||
);
|
||||
|
||||
if ( _Per_CPU_Get_state( cpu ) == PER_CPU_STATE_UP ) {
|
||||
_CPU_SMP_Send_interrupt( cpu_index );
|
||||
_CPU_SMP_Send_interrupt( _Per_CPU_Get_index( cpu ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,10 @@ static void test_send_message_while_processing_a_message(
|
||||
barrier(ctx, bs);
|
||||
|
||||
rtems_test_assert(ctx->counters[cpu_index].value == 1);
|
||||
_SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
|
||||
_SMP_Send_message(
|
||||
_Per_CPU_Get_by_index(cpu_index),
|
||||
SMP_MESSAGE_PERFORM_JOBS
|
||||
);
|
||||
|
||||
/* (B) */
|
||||
barrier(ctx, bs);
|
||||
@@ -199,9 +202,12 @@ static void test_send_message_flood(
|
||||
}
|
||||
|
||||
for (cpu_index = 0; cpu_index < cpu_count; ++cpu_index) {
|
||||
Per_CPU_Control *cpu;
|
||||
Per_CPU_Control *cpu_self;
|
||||
uint32_t i;
|
||||
|
||||
cpu = _Per_CPU_Get_by_index(cpu_index);
|
||||
|
||||
cpu_self = _Thread_Dispatch_disable();
|
||||
_SMP_Synchronize();
|
||||
_Thread_Dispatch_enable(cpu_self);
|
||||
@@ -213,7 +219,7 @@ static void test_send_message_flood(
|
||||
}
|
||||
|
||||
for (i = 0; i < 100000; ++i) {
|
||||
_SMP_Send_message(cpu_index, SMP_MESSAGE_PERFORM_JOBS);
|
||||
_SMP_Send_message(cpu, SMP_MESSAGE_PERFORM_JOBS);
|
||||
}
|
||||
|
||||
for (i = 0; i < cpu_count; ++i) {
|
||||
|
||||
@@ -466,7 +466,7 @@ T_TEST_CASE(JobOrder)
|
||||
}
|
||||
|
||||
T_step(0);
|
||||
_SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS);
|
||||
_SMP_Send_message(cpu_self, SMP_MESSAGE_PERFORM_JOBS);
|
||||
_Thread_Dispatch_enable(cpu_self);
|
||||
}
|
||||
|
||||
@@ -505,9 +505,9 @@ T_TEST_CASE(AddJobInJob)
|
||||
|
||||
_Per_CPU_Add_job(cpu_self, &add_job_in_job_jobs[0]);
|
||||
T_step(0);
|
||||
_SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS);
|
||||
_SMP_Send_message(cpu_self, SMP_MESSAGE_PERFORM_JOBS);
|
||||
T_step(2);
|
||||
_SMP_Send_message(_Per_CPU_Get_index(cpu_self), SMP_MESSAGE_PERFORM_JOBS);
|
||||
_SMP_Send_message(cpu_self, SMP_MESSAGE_PERFORM_JOBS);
|
||||
_Thread_Dispatch_enable(cpu_self);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user