RTEMS 6.1-rc5
Loading...
Searching...
No Matches
smpimpl.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12/*
13 * COPYRIGHT (c) 1989-2011.
14 * On-Line Applications Research Corporation (OAR).
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#ifndef _RTEMS_SCORE_SMPIMPL_H
39#define _RTEMS_SCORE_SMPIMPL_H
40
41#include <rtems/score/smp.h>
42#include <rtems/score/percpu.h>
44#include <rtems/fatal.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
63#define SMP_MESSAGE_SHUTDOWN 0x1UL
64
70#define SMP_MESSAGE_PERFORM_JOBS 0x2UL
71
80#define SMP_MESSAGE_FORCE_PROCESSING 0x4UL
81
85typedef enum {
86 SMP_FATAL_BOOT_PROCESSOR_NOT_ASSIGNED_TO_SCHEDULER,
87 SMP_FATAL_MANDATORY_PROCESSOR_NOT_PRESENT,
88 SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR,
89 SMP_FATAL_MULTITASKING_START_ON_UNASSIGNED_PROCESSOR,
90 SMP_FATAL_SHUTDOWN,
91 SMP_FATAL_SHUTDOWN_RESPONSE,
92 SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED,
93 SMP_FATAL_SCHEDULER_PIN_OR_UNPIN_NOT_SUPPORTED,
94 SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS,
95 SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR,
96 SMP_FATAL_MULTITASKING_START_ON_NOT_ONLINE_PROCESSOR
98
104static inline void _SMP_Fatal( SMP_Fatal_code code )
105{
107}
108
114#if defined( RTEMS_SMP )
115 void _SMP_Handler_initialize( void );
116#else
117 #define _SMP_Handler_initialize() \
118 do { } while ( 0 )
119#endif
120
121#if defined( RTEMS_SMP )
122
131extern Processor_mask _SMP_Online_processors;
132
159RTEMS_NO_RETURN void _SMP_Start_multitasking_on_secondary_processor(
160 Per_CPU_Control *cpu_self
161);
162
171void _SMP_Process_message( Per_CPU_Control *cpu_self, long unsigned message );
172
187void _SMP_Try_to_process_message(
188 Per_CPU_Control *cpu_self,
189 unsigned long message
190);
191
201static inline void _SMP_Inter_processor_interrupt_handler(
202 Per_CPU_Control *cpu_self
203)
204{
205 unsigned long message;
206
207 /*
208 * In the common case the inter-processor interrupt is issued to carry out a
209 * thread dispatch.
210 */
211 cpu_self->dispatch_necessary = true;
212
213 message = _Atomic_Exchange_ulong(
214 &cpu_self->message,
215 0,
216 ATOMIC_ORDER_ACQUIRE
217 );
218
219 if ( RTEMS_PREDICT_FALSE( message != 0 ) ) {
220 _SMP_Process_message( cpu_self, message );
221 }
222}
223
232bool _SMP_Should_start_processor( uint32_t cpu_index );
233
243void _SMP_Send_message( Per_CPU_Control *cpu, unsigned long message );
244
245typedef void ( *SMP_Action_handler )( void *arg );
246
260void _SMP_Multicast_action(
261 const Processor_mask *targets,
262 SMP_Action_handler handler,
263 void *arg
264);
265
276void _SMP_Broadcast_action(
277 SMP_Action_handler handler,
278 void *arg
279);
280
291void _SMP_Othercast_action(
292 SMP_Action_handler handler,
293 void *arg
294);
295
305void _SMP_Unicast_action(
306 uint32_t cpu_index,
307 SMP_Action_handler handler,
308 void *arg
309);
310
317void _SMP_Synchronize( void );
318
330void _SMP_Wait_for_ready_to_start_multitasking( void );
331
332#endif /* defined( RTEMS_SMP ) */
333
338#if defined( RTEMS_SMP )
340#else
341 #define _SMP_Request_start_multitasking() \
342 do { } while ( 0 )
343#endif
344
352#if defined( RTEMS_SMP )
353 void _SMP_Request_shutdown( void );
354#else
355 #define _SMP_Request_shutdown() \
356 do { } while ( 0 )
357#endif
358
364static inline const Processor_mask *_SMP_Get_online_processors( void )
365{
366#if defined(RTEMS_SMP)
367 return &_SMP_Online_processors;
368#else
369 return &_Processor_mask_The_one_and_only;
370#endif
371}
372
379static inline bool _SMP_Need_inter_processor_interrupts( void )
380{
381 /*
382 * Use the configured processor maximum instead of the actual to allow
383 * testing on uni-processor systems.
384 */
386}
387
390#ifdef __cplusplus
391}
392#endif
393
394#endif
395/* end of include file */
This header file defines the Fatal Error Manager API.
This header file provides interfaces of the SMP Support which are used by the implementation and the ...
#define RTEMS_PREDICT_FALSE(_exp)
Evaluates the integral expression and tells the compiler that the predicted value is false (0).
Definition: basedefs.h:732
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
RTEMS_NO_RETURN void _Terminate(Internal_errors_Source the_source, Internal_errors_t the_error)
Initiates the system termination.
Definition: interr.c:51
@ RTEMS_FATAL_SOURCE_SMP
Fatal source of SMP domain.
Definition: interr.h:142
#define _SMP_Handler_initialize()
Initializes SMP Handler.
Definition: smpimpl.h:117
SMP_Fatal_code
SMP fatal codes.
Definition: smpimpl.h:85
#define _SMP_Request_shutdown()
Requests a shutdown of all processors.
Definition: smpimpl.h:355
#define _SMP_Request_start_multitasking()
Requests a multitasking start on all configured and available processors.
Definition: smpimpl.h:341
#define _SMP_Processor_configured_maximum
The configured processor maximum.
Definition: smp.h:68
This header file provides the interfaces of the Processor Mask.
This header file provides the interfaces of the Per-CPU Information.
Per CPU Core Structure.
Definition: percpu.h:384
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:437
Definition: inftrees.h:24
Definition: media-server.c:46