source: rtems/cpukit/include/rtems/score/mpciimpl.h

Last change on this file was c15132aa, checked in by Sebastian Huber <sebastian.huber@…>, on 10/20/23 at 09:09:42

mpci: Hide implementation details

This improves the standard compatibility of API headers. It fixes
errors like this if RTEMS_MULTIPROCESSING is enabled:

cpukit/include/rtems/score/processormask.h: In function 'uint32_t _Processor_mask_Find_last_set(const Processor_mask*)':
cpukit/include/rtems/score/processormask.h:339:21: error: 'flsl' was not declared in this scope

339 | return (uint32_t) BIT_FLS( CPU_MAXIMUM_PROCESSORS, a );

|

  • Property mode set to 100644
File size: 10.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSScoreMPCI
7 *
8 * @brief This header file provides interfaces of the
9 *   @ref RTEMSScoreMPCI which are only used by the implementation.
10 */
11
12/*
13 *  COPYRIGHT (c) 1989-2009.
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_MPCIIMPL_H
39#define _RTEMS_SCORE_MPCIIMPL_H
40
41#include <rtems/score/mpci.h>
42#include <rtems/score/thread.h>
43#include <rtems/score/threadq.h>
44#include <rtems/score/watchdog.h>
45#include <rtems/score/status.h>
46
47#ifdef __cplusplus
48extern "C" {
49#endif
50
51/**
52 * @addtogroup RTEMSScoreMPCI
53 *
54 * @{
55 */
56
57/**
58 *  For packets associated with requests that don't already have a timeout,
59 *  use the one specified by this MPCI driver.  The value specified by
60 *   the MPCI driver sets an upper limit on how long a remote request
61 *   should take to complete.
62 */
63#define MPCI_DEFAULT_TIMEOUT    0xFFFFFFFF
64
65/**
66 *  The following defines the type for packet processing routines
67 *  invoked by the MPCI Receive server.
68 */
69typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
70
71/**
72 *  The following enumerated type defines the list of
73 *  internal MP operations.
74 */
75typedef enum {
76  MPCI_PACKETS_SYSTEM_VERIFY  =  0
77}   MPCI_Internal_Remote_operations;
78
79/**
80 *  The following data structure defines the packet used to perform
81 *  remote event operations.
82 */
83typedef struct {
84  /** This field is the general header for all packets. */
85  MP_packet_Prefix                 Prefix;
86  /** This value specifies the operation. */
87  MPCI_Internal_Remote_operations  operation;
88  /** This is the maximum number of nodes in the system. It must agree
89   *  on all nodes.
90   */
91  uint32_t                         maximum_nodes;
92  /** This field is the maximum number of concurrently existent
93   *  globally offered objects.
94   */
95  uint32_t                         maximum_global_objects;
96}    MPCI_Internal_packet;
97
98/**
99 *  The following thread queue is used to maintain a list of tasks
100 *  which currently have outstanding remote requests.
101 */
102extern Thread_queue_Control _MPCI_Remote_blocked_threads;
103
104/**
105 *  The following define the internal pointers to the user's
106 *  configuration information.
107 */
108extern MPCI_Control *_MPCI_table;
109
110/**
111 *  @brief Pointer to MP thread control block.
112 *
113 *  The following is used to determine when the multiprocessing receive
114 *  thread is executing so that a proxy can be allocated instead of
115 *  blocking the multiprocessing receive thread.
116 */
117extern Thread_Control *_MPCI_Receive_server_tcb;
118
119/**
120 *  The following table contains the process packet routines provided
121 *  by each object that supports MP operations.
122 */
123extern MPCI_Packet_processor
124_MPCI_Packet_processors[ MP_PACKET_CLASSES_LAST + 1 ];
125
126/**
127 * @brief Registers the MPCI packet processor for the designated object class.
128 *
129 * @param the_class The class indicator for packets which will
130 *            be processed by @a the_packet_processor method.
131 * @param the_packet_processor Pointer to a method which is
132 *            invoked when packets with @a the_class are received.
133 */
134void _MPCI_Register_packet_processor(
135  MP_packet_Classes      the_class,
136  MPCI_Packet_processor  the_packet_processor
137
138);
139
140/**
141 * @brief Obtains a packet by invoking the user provided
142 *          MPCI get packet callout.
143 *
144 * @return Returns a pointer to a MPCI packet which can be
145 *          filled in by the caller and used to perform a subsequent
146 *          remote operation.
147 */
148MP_packet_Prefix *_MPCI_Get_packet ( void );
149
150/**
151 * @brief Deallocates a packet.
152 *
153 * This routine deallocates a packet by invoking the user provided
154 * MPCI return packet callout.
155 *
156 * @param[out] the_packet The MP packet to deallocate.
157 */
158void _MPCI_Return_packet (
159  MP_packet_Prefix *the_packet
160);
161
162/**
163 * @brief Sends a process packet.
164 *
165 * This routine sends a process packet by invoking the user provided
166 * MPCI send callout.
167 *
168 * @param destination The node which should receive this packet.
169 * @param the_packet The packet to be sent.
170 */
171void _MPCI_Send_process_packet (
172  uint32_t          destination,
173  MP_packet_Prefix *the_packet
174);
175
176/**
177 * @brief Sends a request packet.
178 *
179 * This routine sends a request packet by invoking the user provided
180 * MPCI send callout.
181 *
182 * @param destination The node which should receive this packet.
183 * @param the_packet The packet to be sent.
184 * @param extra_state The extra thread state bits which should be
185 *            set in addition to the remote operation pending state.  It
186 *            may indicate the caller is blocking on a message queue
187 *            operation.
188 *
189 * @ret This method returns the operation status from the remote node.
190 */
191Status_Control _MPCI_Send_request_packet(
192  uint32_t          destination,
193  MP_packet_Prefix *the_packet,
194  States_Control    extra_state
195);
196
197/**
198 * @brief Sends a response packet.
199 *
200 * This routine sends a response packet by invoking the user provided
201 * MPCI send callout.
202 *
203 * @param destination The node which should receive this packet.
204 * @param the_packet The packet to be sent.
205 */
206void _MPCI_Send_response_packet (
207  uint32_t          destination,
208  MP_packet_Prefix *the_packet
209);
210
211/**
212 * @brief Receives a packet.
213 *
214 * This routine receives a packet by invoking the user provided
215 * MPCI receive callout.
216 *
217 * @return This method returns the packet received.
218 */
219MP_packet_Prefix  *_MPCI_Receive_packet ( void );
220
221/**
222 * @brief Passes a packet to the thread.
223 *
224 * This routine is responsible for passing @a the_packet to the thread
225 * waiting on the remote operation to complete.  The unblocked thread is
226 * responsible for eventually freeing @a the_packet.
227 *
228 * @param the_packet is the response packet to be processed.
229 *
230 * @retval pointer This method returns a pointer to the thread which was unblocked
231 * @retval NULL The waiting thread no longer exists.
232 */
233Thread_Control *_MPCI_Process_response (
234  MP_packet_Prefix *the_packet
235);
236
237/**
238 * @brief Receives and processes all packets.
239 *
240 * This is the server thread which receives and processes all MCPI packets.
241 *
242 * @param ignored The thread argument.  It is not used.
243 */
244void _MPCI_Receive_server(
245  Thread_Entry_numeric_type ignored
246);
247
248/**
249 * @brief Announces the availability of a packet.
250 *
251 * This routine informs RTEMS of the availability of an MPCI packet.
252 */
253void _MPCI_Announce ( void );
254
255/**
256 * @brief Performs a process on another node.
257 *
258 * This routine performs a remote procedure call so that a
259 * process operation can be performed on another node.
260 *
261 * @param operation The remote operation to perform.
262 */
263void _MPCI_Internal_packets_Send_process_packet (
264   MPCI_Internal_Remote_operations operation
265);
266
267/**
268 *  _MPCI_Internal_packets_Send_request_packet
269 *
270 *  This routine performs a remote procedure call so that a
271 *  directive operation can be initiated on another node.
272 *
273 *  This routine is not needed since there are no request
274 *  packets to be sent by this manager.
275 */
276
277/**
278 *  _MPCI_Internal_packets_Send_response_packet
279 *
280 *  This routine performs a remote procedure call so that a
281 *  directive can be performed on another node.
282 *
283 *  This routine is not needed since there are no response
284 *  packets to be sent by this manager.
285 */
286
287/**
288 * @brief Performs requested action from another node.
289 *
290 * This routine performs the actions specific to this package for
291 * the request from another node.
292 *
293 * @param the_packet_prefix The packet prefix for this method.
294 */
295void _MPCI_Internal_packets_Process_packet (
296  MP_packet_Prefix *the_packet_prefix
297);
298
299/**
300 *  _MPCI_Internal_packets_Send_object_was_deleted
301 *
302 *  This routine is invoked indirectly by the thread queue
303 *  when a proxy has been removed from the thread queue and
304 *  the remote node must be informed of this.
305 *
306 *  This routine is not needed since there are no objects
307 *  deleted by this manager.
308 */
309
310/**
311 *  _MPCI_Internal_packets_Send_extract_proxy
312 *
313 *  This routine is invoked when a task is deleted and it
314 *  has a proxy which must be removed from a thread queue and
315 *  the remote node must be informed of this.
316 *
317 *  This routine is not needed since there are no objects
318 *  deleted by this manager.
319 */
320
321/**
322 * @brief Obtains an internal thread.
323 *
324 * This routine is used to obtain an internal threads MP packet.
325 *
326 * @retval pointer The pointer to the obtained packet.
327 * @retval NULL Something went wrong.
328 */
329MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
330
331/**
332 * @brief Checks if the packet class is valid.
333 *
334 * @param the_packet_class The packet class to perform the validation on.
335 *
336 * @retval true @a the_packet_class is valid.
337 * @retval false @a the_packet_class is not valid.
338 *
339 * @note Check for lower bounds (MP_PACKET_CLASSES_FIRST ) is unnecessary
340 *       because this enum starts at lower bound of zero.
341 */
342
343static inline bool _Mp_packet_Is_valid_packet_class (
344  MP_packet_Classes the_packet_class
345)
346{
347  return ( the_packet_class <= MP_PACKET_CLASSES_LAST );
348}
349
350/** @} */
351
352#ifdef __cplusplus
353}
354#endif
355
356#endif
357/* end of include file */
Note: See TracBrowser for help on using the repository browser.