35 #define _Per_CPU_Jobs_ISR_disable_and_acquire( cpu, lock_context ) \ 36 _ISR_lock_ISR_disable_and_acquire( &( cpu )->Jobs.Lock, lock_context ) 38 #define _Per_CPU_Jobs_release_and_ISR_enable( cpu, lock_context ) \ 39 _ISR_lock_Release_and_ISR_enable( &( cpu )->Jobs.Lock, lock_context ) 46 _Per_CPU_Jobs_ISR_disable_and_acquire( cpu, &lock_context );
49 _Per_CPU_Jobs_release_and_ISR_enable( cpu, &lock_context );
51 while ( job != NULL ) {
58 _Atomic_Store_ulong( &job->
done, PER_CPU_JOB_DONE, ATOMIC_ORDER_RELEASE );
68 _Atomic_Store_ulong( &job->
done, 0, ATOMIC_ORDER_RELAXED );
71 _Per_CPU_Jobs_ISR_disable_and_acquire( cpu, &lock_context );
81 _Per_CPU_Jobs_release_and_ISR_enable( cpu, &lock_context );
86 unsigned long message;
88 message = _Atomic_Load_ulong( &cpu_self->
message, ATOMIC_ORDER_RELAXED );
93 success = _Atomic_Compare_exchange_ulong(
111 _Atomic_Load_ulong( &job->
done, ATOMIC_ORDER_ACQUIRE )
114 switch ( cpu->
state ) {
118 _CPU_SMP_Processor_event_broadcast();
126 _Per_CPU_Try_perform_jobs( _Per_CPU_Get() );
129 _SMP_Fatal( SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS );
140 static void _SMP_Issue_action_jobs(
141 const Processor_mask *targets,
148 for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
153 job = &jobs->Jobs[ cpu_index ];
155 cpu = _Per_CPU_Get_by_index( cpu_index );
163 static void _SMP_Wait_for_action_jobs(
164 const Processor_mask *targets,
171 for ( cpu_index = 0; cpu_index < cpu_max; ++cpu_index ) {
176 cpu = _Per_CPU_Get_by_index( cpu_index );
177 job = &jobs->Jobs[ cpu_index ];
184 const Processor_mask *targets,
185 SMP_Action_handler handler,
192 cpu_max = _SMP_Get_processor_maximum();
195 jobs.Context.
handler = handler;
196 jobs.Context.
arg = arg;
198 _SMP_Issue_action_jobs( targets, &jobs, cpu_max );
199 _SMP_Wait_for_action_jobs( targets, &jobs, cpu_max );
203 SMP_Action_handler handler,
211 SMP_Action_handler handler,
215 Processor_mask targets;
222 static void _SMP_Do_nothing_action(
void *arg )
The per CPU controls are initialized to zero.
void _Per_CPU_Perform_jobs(Per_CPU_Control *cpu)
Performs the jobs of the specified processor in FIFO order.
Processor is ready to start multitasking.
struct Per_CPU_Job ** tail
Tail of the FIFO list of jobs to be performed by this processor.
Per_CPU_Job_handler handler
The job handler.
void _Per_CPU_Wait_for_job(const Per_CPU_Control *cpu, const Per_CPU_Job *job)
Waits for the job carried out by the specified processor.
struct Per_CPU_Control::@15 Jobs
FIFO list of jobs to be performed by this processor.
static __inline__ const Processor_mask * _SMP_Get_online_processors(void)
Gets all online processors.
RTEMS_INLINE_ROUTINE void _Processor_mask_Clear(Processor_mask *mask, uint32_t index)
Clears the specified index bit of the mask.
Information for the Assert Handler.
RTEMS_INLINE_ROUTINE bool _Processor_mask_Is_set(const Processor_mask *mask, uint32_t index)
Checks if the specified index bit of the mask is set.
void * arg
The job handler argument.
#define SMP_MESSAGE_PERFORM_JOBS
SMP message to perform per-processor jobs.
static void _SMP_Fatal(SMP_Fatal_code code)
Terminates with the given code.
void _Per_CPU_Add_job(Per_CPU_Control *cpu, Per_CPU_Job *job)
Adds the job to the tail of the processing list of the specified processor.
Context for per-processor jobs.
Atomic_Ulong done
Indication if the job is done.
struct Per_CPU_Job * next
The next job in the corresponding per-processor job list.
const Per_CPU_Job_context * context
Pointer to the job context to get the handler and argument.
Per_CPU_State state
Indicates the current state of the CPU.
Normal multitasking state.
Test context for spec:/rtems/event/req/send-receive test case.
void _SMP_Synchronize(void)
Ensures that all store operations issued by the current processor before the call this function are v...
#define RTEMS_ARRAY_SIZE(_array)
Returns the element count of the specified array.
void _SMP_Othercast_action(SMP_Action_handler handler, void *arg)
Initiates an SMP multicast action to the set of all online processors excluding the current processor...
Atomic_Ulong message
Bit field for SMP messages.
void _SMP_Broadcast_action(SMP_Action_handler handler, void *arg)
Initiates an SMP multicast action to the set of all online processors.
RTEMS_INLINE_ROUTINE void _Processor_mask_Assign(Processor_mask *dst, const Processor_mask *src)
Copies the mask to another mask, also considers CPU_MAXIMUM_PROCESSORS.
Local ISR lock context for acquire and release pairs.
void _SMP_Multicast_action(const Processor_mask *targets, SMP_Action_handler handler, void *arg)
Initiates an SMP multicast action to the set of target processors.
struct Per_CPU_Job * head
Head of the FIFO list of jobs to be performed by this processor.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
void _SMP_Send_message(uint32_t cpu_index, unsigned long message)
Sends an SMP message to a processor.
Multitasking start of processor is requested.
SuperCore SMP Implementation.