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

4.115
Last change on this file since d8cd045c was d8cd045c, checked in by Joel Sherrill <joel.sherrill@…>, on 06/17/11 at 15:40:09

2011-06-17 Joel Sherrill <joel.sherrill@…>

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