source: rtems/cpukit/score/include/rtems/score/mpci.h @ d4dc7c8

4.115
Last change on this file since d4dc7c8 was 20f02c6, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/28/09 at 05:58:54

Whitespace removal.

  • Property mode set to 100644
File size: 12.0 KB
Line 
1/**
2 *  @file  rtems/score/mpci.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the MPCI layer.  It provides mechanisms to utilize packets.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2008.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_MPCI_H
20#define _RTEMS_SCORE_MPCI_H
21
22/**
23 *  @defgroup ScoreMPCI MPCI Handler
24 *
25 *  The MPCI Handler encapsulates functionality which is related to the
26 *  generation, receipt, and processing of remote operations in a
27 *  multiprocessor system.  This handler contains the message passing
28 *  support for making remote service calls as well as the server thread
29 *  which processes requests from remote nodes.
30*/
31/**@{*/
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
37#include <rtems/score/mppkt.h>
38#include <rtems/score/states.h>
39#include <rtems/score/thread.h>
40#include <rtems/score/threadq.h>
41#include <rtems/score/tqdata.h>
42#include <rtems/score/watchdog.h>
43
44/**
45 *  The following defines the node number used when a broadcast is desired.
46 */
47#define MPCI_ALL_NODES 0
48
49/**
50 *  For packets associated with requests that don't already have a timeout,
51 *  use the one specified by this MPCI driver.  The value specified by
52 *   the MPCI driver sets an upper limit on how long a remote request
53 *   should take to complete.
54 */
55#define MPCI_DEFAULT_TIMEOUT    0xFFFFFFFF
56
57/**
58 *  This type is returned by all user provided MPCI routines.
59 */
60typedef void MPCI_Entry;
61
62/**
63 *  This type defines the prototype for the initization entry point
64 *  in an Multiprocessor Communications Interface.
65 */
66typedef MPCI_Entry ( *MPCI_initialization_entry )( void );
67
68/**
69 *  This type defines the prototype for the get packet entry point
70 *  in an Multiprocessor Communications Interface.  The single
71 *  parameter will point to the packet allocated.
72 */
73typedef MPCI_Entry ( *MPCI_get_packet_entry )(
74                     MP_packet_Prefix **
75                   );
76
77/**
78 *  This type defines the prototype for the return packet entry point
79 *  in an Multiprocessor Communications Interface.  The single
80 *  parameter will point to a packet previously allocated by the
81 *  get packet MPCI entry.
82 */
83typedef MPCI_Entry ( *MPCI_return_packet_entry )(
84                     MP_packet_Prefix *
85                   );
86
87/**
88 *  This type defines the prototype for send get packet entry point
89 *  in an Multiprocessor Communications Interface.  The single
90 *  parameter will point to a packet previously allocated by the
91 *  get packet entry point that has been filled in by the caller.
92 */
93typedef MPCI_Entry ( *MPCI_send_entry )(
94                     uint32_t,
95                     MP_packet_Prefix *
96                   );
97
98/**
99 *  This type defines the prototype for the receive packet entry point
100 *  in an Multiprocessor Communications Interface.  The single
101 *  parameter will point to a packet allocated and filled in by the
102 *  receive packet handler.  The caller will block until a packet is
103 *  received.
104 */
105typedef MPCI_Entry ( *MPCI_receive_entry )(
106                     MP_packet_Prefix **
107                   );
108
109/**
110 *  This type defines the Multiprocessor Communications
111 *  Interface (MPCI) Table.  This table defines the user-provided
112 *  MPCI which is a required part of a multiprocessor system.
113 *
114 *  For non-blocking local operations that become remote operations,
115 *  we need a timeout.  This is a per-driver timeout: default_timeout
116 */
117typedef struct {
118  /** This fields contains the timeout for MPCI operations in ticks. */
119  uint32_t                   default_timeout;
120  /** This field contains the maximum size of a packet supported by this
121   *  MPCI layer.  This size places a limit on the size of a message
122   *  which can be transmitted over this interface.
123   **/
124  size_t                     maximum_packet_size;
125  /** This field points to the MPCI initialization entry point. */
126  MPCI_initialization_entry  initialization;
127  /** This field points to the MPCI get packet entry point. */
128  MPCI_get_packet_entry      get_packet;
129  /** This field points to the MPCI return packet entry point. */
130  MPCI_return_packet_entry   return_packet;
131  /** This field points to the MPCI send packet entry point. */
132  MPCI_send_entry            send_packet;
133  /** This field points to the MPCI receive packet entry point. */
134  MPCI_receive_entry         receive_packet;
135} MPCI_Control;
136
137/**
138 *  The following defines the type for packet processing routines
139 *  invoked by the MPCI Receive server.
140 */
141typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * );
142
143/**
144 *  The following enumerated type defines the list of
145 *  internal MP operations.
146 */
147typedef enum {
148  MPCI_PACKETS_SYSTEM_VERIFY  =  0
149}   MPCI_Internal_Remote_operations;
150
151/**
152 *  The following data structure defines the packet used to perform
153 *  remote event operations.
154 */
155typedef struct {
156  /** This field is the general header for all packets. */
157  MP_packet_Prefix                 Prefix;
158  /** This value specifies the operation. */
159  MPCI_Internal_Remote_operations  operation;
160  /** This is the maximum number of nodes in the system. It must agree
161   *  on all nodes.
162   */
163  uint32_t                         maximum_nodes;
164  /** This field is the maximum number of concurrently existent
165   *  globally offered objects.
166   */
167  uint32_t                         maximum_global_objects;
168}    MPCI_Internal_packet;
169
170/**
171 *  The following thread queue is used to maintain a list of tasks
172 *  which currently have outstanding remote requests.
173 */
174SCORE_EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads;
175
176/**
177 *  The following define the internal pointers to the user's
178 *  configuration information.
179 */
180SCORE_EXTERN MPCI_Control *_MPCI_table;
181
182/** @brief Pointer to MP Thread Control Block
183 *
184 *  The following is used to determine when the multiprocessing receive
185 *  thread is executing so that a proxy can be allocated instead of
186 *  blocking the multiprocessing receive thread.
187 */
188SCORE_EXTERN Thread_Control *_MPCI_Receive_server_tcb;
189
190/**
191 *  The following table contains the process packet routines provided
192 *  by each object that supports MP operations.
193 */
194SCORE_EXTERN MPCI_Packet_processor
195               _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
196
197/**
198 *  This routine performs the initialization necessary for this handler.
199 *
200 *  @param[in] timeout_status is the value which should be returned to
201 *             blocking threads when they timeout on a remote operation.
202 */
203void _MPCI_Handler_initialization(
204  uint32_t   timeout_status
205);
206
207/**
208 *  This routine creates the packet receive server used in MP systems.
209 */
210void _MPCI_Create_server( void );
211
212/**
213 *  This routine initializes the MPCI driver by
214 *  invoking the user provided MPCI initialization callout.
215 */
216void _MPCI_Initialization ( void );
217
218/**
219 *  This routine registers the MPCI packet processor for the
220 *  designated object class.
221 *
222 *  @param[in] the_class is the class indicator for packets which will
223 *             be processed by @a the_packet_processor method.
224 *  @param[in] the_packet_processor is a pointer to a method which is
225 *             invoked when packets with @a the_class are received.
226 */
227void _MPCI_Register_packet_processor(
228  MP_packet_Classes      the_class,
229  MPCI_Packet_processor  the_packet_processor
230
231);
232
233/**
234 *  This function obtains a packet by invoking the user provided
235 *  MPCI get packet callout.
236 *
237 *  @return This method returns a pointer to a MPCI packet which can be
238 *          filled in by the caller and used to perform a subsequent
239 *          remote operation.
240 */
241MP_packet_Prefix *_MPCI_Get_packet ( void );
242
243/**
244 *  This routine deallocates a packet by invoking the user provided
245 *  MPCI return packet callout.
246 *
247 *  @param[in] the_packet is the MP packet to deallocate.
248 */
249void _MPCI_Return_packet (
250  MP_packet_Prefix *the_packet
251);
252
253/**
254 *  This routine sends a process packet by invoking the user provided
255 *  MPCI send callout.
256 *
257 *  @param[in] destination is the node which should receive this packet.
258 *  @param[in] the_packet is the packet to be sent.
259 */
260void _MPCI_Send_process_packet (
261  uint32_t          destination,
262  MP_packet_Prefix *the_packet
263);
264
265/**
266 *  This routine sends a request packet by invoking the user provided
267 *  MPCI send callout.
268 *
269 *  @param[in] destination is the node which should receive this packet.
270 *  @param[in] the_packet is the packet to be sent.
271 *  @param[in] extra_state is the extra thread state bits which should be
272 *             set in addition to the remote operation pending state.  It
273 *             may indicate the caller is blocking on a message queue
274 *             operation.
275 *
276 *  @return This method returns the operation status from the remote node.
277 */
278uint32_t _MPCI_Send_request_packet (
279  uint32_t           destination,
280  MP_packet_Prefix  *the_packet,
281  States_Control     extra_state
282);
283
284/**
285 *  This routine sends a response packet by invoking the user provided
286 *  MPCI send callout.
287 *
288 *  @param[in] destination is the node which should receive this packet.
289 *  @param[in] the_packet is the packet to be sent.
290 */
291void _MPCI_Send_response_packet (
292  uint32_t          destination,
293  MP_packet_Prefix *the_packet
294);
295
296/**
297 *  This routine receives a packet by invoking the user provided
298 *  MPCI receive callout.
299 *
300 *  @return This method returns the packet received.
301 */
302MP_packet_Prefix  *_MPCI_Receive_packet ( void );
303
304/**
305 *  This routine is responsible for passing @a the_packet to the thread
306 *  waiting on the remote operation to complete.  The unblocked thread is
307 *  responsible for eventually freeing @a the_packet.
308 *
309 *  @param[in] the_packet is the response packet to be processed.
310 *
311 *  @return This method returns a pointer to the thread which was if unblocked
312 *          or NULL if the waiting thread no longer exists.
313 */
314Thread_Control *_MPCI_Process_response (
315  MP_packet_Prefix *the_packet
316);
317
318/**
319 *  This is the server thread which receives and processes all MCPI packets.
320 *
321 *  @param[in] ignored is the thread argument.  It is not used.
322 */
323Thread _MPCI_Receive_server(
324  uint32_t   ignored
325);
326
327/**
328 *  This routine informs RTEMS of the availability of an MPCI packet.
329 */
330void _MPCI_Announce ( void );
331
332/**
333 *  This routine performs a remote procedure call so that a
334 *  process operation can be performed on another node.
335 *
336 *  @param[in] operation is the remote operation to perform.
337 */
338void _MPCI_Internal_packets_Send_process_packet (
339   MPCI_Internal_Remote_operations operation
340);
341
342/**
343 *  _MPCI_Internal_packets_Send_request_packet
344 *
345 *  This routine performs a remote procedure call so that a
346 *  directive operation can be initiated on another node.
347 *
348 *  This routine is not needed since there are no request
349 *  packets to be sent by this manager.
350 */
351
352/**
353 *  _MPCI_Internal_packets_Send_response_packet
354 *
355 *  This routine performs a remote procedure call so that a
356 *  directive can be performed on another node.
357 *
358 *  This routine is not needed since there are no response
359 *  packets to be sent by this manager.
360 */
361
362/**
363 *  This routine performs the actions specific to this package for
364 *  the request from another node.
365 */
366void _MPCI_Internal_packets_Process_packet (
367  MP_packet_Prefix *the_packet_prefix
368);
369
370/**
371 *  _MPCI_Internal_packets_Send_object_was_deleted
372 *
373 *  This routine is invoked indirectly by the thread queue
374 *  when a proxy has been removed from the thread queue and
375 *  the remote node must be informed of this.
376 *
377 *  This routine is not needed since there are no objects
378 *  deleted by this manager.
379 */
380
381/**
382 *  _MPCI_Internal_packets_Send_extract_proxy
383 *
384 *  This routine is invoked when a task is deleted and it
385 *  has a proxy which must be removed from a thread queue and
386 *  the remote node must be informed of this.
387 *
388 *  This routine is not needed since there are no objects
389 *  deleted by this manager.
390 */
391
392/**
393 *  This routine is used to obtain a internal threads mp packet.
394 */
395MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void );
396
397#ifdef __cplusplus
398}
399#endif
400
401/**@}*/
402
403#endif
404/* end of include file */
Note: See TracBrowser for help on using the repository browser.