source: rtems/cpukit/score/include/rtems/score/mpci.h @ 2f1d801

4.104.114.95
Last change on this file since 2f1d801 was 976162a6, checked in by Joel Sherrill <joel.sherrill@…>, on 12/03/07 at 22:23:13

2007-12-03 Joel Sherrill <joel.sherrill@…>

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