[ac7d5ef0] | 1 | /* mpci.h |
---|
| 2 | * |
---|
| 3 | * This include file contains all the constants and structures associated |
---|
| 4 | * with the MPCI layer. It provides mechanisms to utilize packets. |
---|
| 5 | * |
---|
[60b791ad] | 6 | * COPYRIGHT (c) 1989-1998. |
---|
[ac7d5ef0] | 7 | * On-Line Applications Research Corporation (OAR). |
---|
[03f2154e] | 8 | * Copyright assigned to U.S. Government, 1994. |
---|
[ac7d5ef0] | 9 | * |
---|
[98e4ebf5] | 10 | * The license and distribution terms for this file may be |
---|
| 11 | * found in the file LICENSE in this distribution or at |
---|
[03f2154e] | 12 | * http://www.OARcorp.com/rtems/license.html. |
---|
[ac7d5ef0] | 13 | * |
---|
| 14 | * $Id$ |
---|
| 15 | */ |
---|
| 16 | |
---|
[3a4ae6c] | 17 | #ifndef __MPCI_h |
---|
| 18 | #define __MPCI_h |
---|
[ac7d5ef0] | 19 | |
---|
| 20 | #ifdef __cplusplus |
---|
| 21 | extern "C" { |
---|
| 22 | #endif |
---|
| 23 | |
---|
[5e9b32b] | 24 | #include <rtems/score/mppkt.h> |
---|
| 25 | #include <rtems/score/states.h> |
---|
| 26 | #include <rtems/score/thread.h> |
---|
| 27 | #include <rtems/score/threadq.h> |
---|
| 28 | #include <rtems/score/tqdata.h> |
---|
| 29 | #include <rtems/score/watchdog.h> |
---|
| 30 | #include <rtems/score/coresem.h> |
---|
[ac7d5ef0] | 31 | |
---|
[adf98bd] | 32 | /* |
---|
| 33 | * The following constants define the stack size requirements for |
---|
| 34 | * the system threads. |
---|
| 35 | */ |
---|
| 36 | |
---|
| 37 | #define MPCI_RECEIVE_SERVER_STACK_SIZE \ |
---|
| 38 | ( STACK_MINIMUM_SIZE + \ |
---|
| 39 | CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ |
---|
| 40 | _CPU_Table.extra_mpci_receive_server_stack \ |
---|
| 41 | ) |
---|
| 42 | |
---|
[ac7d5ef0] | 43 | /* |
---|
| 44 | * The following defines the node number used when a broadcast is desired. |
---|
| 45 | */ |
---|
| 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 | |
---|
| 56 | #define MPCI_DEFAULT_TIMEOUT 0xFFFFFFFF |
---|
| 57 | |
---|
[3a4ae6c] | 58 | /* |
---|
| 59 | * The following records define the Multiprocessor Communications |
---|
| 60 | * Interface (MPCI) Table. This table defines the user-provided |
---|
| 61 | * MPCI which is a required part of a multiprocessor system. |
---|
| 62 | * |
---|
| 63 | * For non-blocking local operations that become remote operations, |
---|
| 64 | * we need a timeout. This is a per-driver timeout: default_timeout |
---|
| 65 | */ |
---|
| 66 | |
---|
| 67 | typedef void MPCI_Entry; |
---|
| 68 | |
---|
| 69 | typedef MPCI_Entry ( *MPCI_initialization_entry )( void ); |
---|
| 70 | |
---|
| 71 | typedef MPCI_Entry ( *MPCI_get_packet_entry )( |
---|
| 72 | MP_packet_Prefix ** |
---|
| 73 | ); |
---|
| 74 | |
---|
| 75 | typedef MPCI_Entry ( *MPCI_return_packet_entry )( |
---|
| 76 | MP_packet_Prefix * |
---|
| 77 | ); |
---|
| 78 | |
---|
| 79 | typedef MPCI_Entry ( *MPCI_send_entry )( |
---|
| 80 | unsigned32, |
---|
| 81 | MP_packet_Prefix * |
---|
| 82 | ); |
---|
| 83 | |
---|
| 84 | typedef MPCI_Entry ( *MPCI_receive_entry )( |
---|
| 85 | MP_packet_Prefix ** |
---|
| 86 | ); |
---|
| 87 | |
---|
| 88 | typedef struct { |
---|
| 89 | unsigned32 default_timeout; /* in ticks */ |
---|
| 90 | unsigned32 maximum_packet_size; |
---|
| 91 | MPCI_initialization_entry initialization; |
---|
| 92 | MPCI_get_packet_entry get_packet; |
---|
| 93 | MPCI_return_packet_entry return_packet; |
---|
| 94 | MPCI_send_entry send_packet; |
---|
| 95 | MPCI_receive_entry receive_packet; |
---|
| 96 | } MPCI_Control; |
---|
| 97 | |
---|
| 98 | /* |
---|
| 99 | * The following defines the type for packet processing routines |
---|
| 100 | * invoked by the MPCI Receive server. |
---|
| 101 | */ |
---|
| 102 | |
---|
| 103 | typedef void (*MPCI_Packet_processor)( MP_packet_Prefix * ); |
---|
| 104 | |
---|
[adf98bd] | 105 | /* |
---|
| 106 | * The following enumerated type defines the list of |
---|
| 107 | * internal MP operations. |
---|
| 108 | */ |
---|
| 109 | |
---|
| 110 | typedef enum { |
---|
| 111 | MPCI_PACKETS_SYSTEM_VERIFY = 0 |
---|
| 112 | } MPCI_Internal_Remote_operations; |
---|
| 113 | |
---|
| 114 | /* |
---|
| 115 | * The following data structure defines the packet used to perform |
---|
| 116 | * remote event operations. |
---|
| 117 | */ |
---|
| 118 | |
---|
| 119 | typedef struct { |
---|
| 120 | MP_packet_Prefix Prefix; |
---|
| 121 | MPCI_Internal_Remote_operations operation; |
---|
| 122 | unsigned32 maximum_nodes; |
---|
| 123 | unsigned32 maximum_global_objects; |
---|
| 124 | } MPCI_Internal_packet; |
---|
| 125 | |
---|
[3a4ae6c] | 126 | /* |
---|
| 127 | * This is the core semaphore which the MPCI Receive Server blocks on. |
---|
| 128 | */ |
---|
| 129 | |
---|
[c627b2a3] | 130 | SCORE_EXTERN CORE_semaphore_Control _MPCI_Semaphore; |
---|
[3a4ae6c] | 131 | /* |
---|
| 132 | * The following thread queue is used to maintain a list of tasks |
---|
| 133 | * which currently have outstanding remote requests. |
---|
| 134 | */ |
---|
| 135 | |
---|
[c627b2a3] | 136 | SCORE_EXTERN Thread_queue_Control _MPCI_Remote_blocked_threads; |
---|
[3a4ae6c] | 137 | |
---|
| 138 | /* |
---|
| 139 | * The following define the internal pointers to the user's |
---|
| 140 | * configuration information. |
---|
| 141 | */ |
---|
| 142 | |
---|
[c627b2a3] | 143 | SCORE_EXTERN MPCI_Control *_MPCI_table; |
---|
[3a4ae6c] | 144 | |
---|
| 145 | /* |
---|
| 146 | * The following points to the MPCI Receive Server. |
---|
| 147 | */ |
---|
| 148 | |
---|
[c627b2a3] | 149 | SCORE_EXTERN Thread_Control *_MPCI_Receive_server_tcb; |
---|
[3a4ae6c] | 150 | |
---|
| 151 | /* |
---|
| 152 | * The following table contains the process packet routines provided |
---|
| 153 | * by each object that supports MP operations. |
---|
| 154 | */ |
---|
| 155 | |
---|
[c627b2a3] | 156 | SCORE_EXTERN MPCI_Packet_processor |
---|
| 157 | _MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1]; |
---|
[3a4ae6c] | 158 | |
---|
[ac7d5ef0] | 159 | /* |
---|
| 160 | * _MPCI_Handler_initialization |
---|
| 161 | * |
---|
| 162 | * DESCRIPTION: |
---|
| 163 | * |
---|
| 164 | * This routine performs the initialization necessary for this handler. |
---|
| 165 | */ |
---|
| 166 | |
---|
[3a4ae6c] | 167 | void _MPCI_Handler_initialization( |
---|
[cda7ecc] | 168 | MPCI_Control *users_mpci_table, |
---|
| 169 | unsigned32 timeout_status |
---|
[3a4ae6c] | 170 | ); |
---|
[ac7d5ef0] | 171 | |
---|
[adf98bd] | 172 | /* |
---|
| 173 | * _MPCI_Create_server |
---|
| 174 | * |
---|
| 175 | * DESCRIPTION: |
---|
| 176 | * |
---|
| 177 | * This routine creates the packet receive server used in MP systems. |
---|
| 178 | */ |
---|
| 179 | |
---|
| 180 | void _MPCI_Create_server( void ); |
---|
| 181 | |
---|
[ac7d5ef0] | 182 | /* |
---|
| 183 | * _MPCI_Initialization |
---|
| 184 | * |
---|
| 185 | * DESCRIPTION: |
---|
| 186 | * |
---|
| 187 | * This routine initializes the MPCI driver by |
---|
| 188 | * invoking the user provided MPCI initialization callout. |
---|
| 189 | */ |
---|
| 190 | |
---|
| 191 | void _MPCI_Initialization ( void ); |
---|
| 192 | |
---|
[3a4ae6c] | 193 | /* |
---|
| 194 | * _MPCI_Register_packet_processor |
---|
| 195 | * |
---|
| 196 | * DESCRIPTION: |
---|
| 197 | * |
---|
| 198 | * This routine registers the MPCI packet processor for the |
---|
| 199 | * designated object class. |
---|
| 200 | */ |
---|
| 201 | |
---|
| 202 | void _MPCI_Register_packet_processor( |
---|
[6b722e2] | 203 | MP_packet_Classes the_class, |
---|
[3a4ae6c] | 204 | MPCI_Packet_processor the_packet_processor |
---|
| 205 | |
---|
| 206 | ); |
---|
| 207 | |
---|
[ac7d5ef0] | 208 | /* |
---|
| 209 | * _MPCI_Get_packet |
---|
| 210 | * |
---|
| 211 | * DESCRIPTION: |
---|
| 212 | * |
---|
| 213 | * This function obtains a packet by invoking the user provided |
---|
| 214 | * MPCI get packet callout. |
---|
| 215 | */ |
---|
| 216 | |
---|
[3a4ae6c] | 217 | MP_packet_Prefix *_MPCI_Get_packet ( void ); |
---|
[ac7d5ef0] | 218 | |
---|
| 219 | /* |
---|
| 220 | * _MPCI_Return_packet |
---|
| 221 | * |
---|
| 222 | * DESCRIPTION: |
---|
| 223 | * |
---|
| 224 | * This routine returns a packet by invoking the user provided |
---|
| 225 | * MPCI return packet callout. |
---|
| 226 | */ |
---|
| 227 | |
---|
| 228 | void _MPCI_Return_packet ( |
---|
[3a4ae6c] | 229 | MP_packet_Prefix *the_packet |
---|
[ac7d5ef0] | 230 | ); |
---|
| 231 | |
---|
| 232 | /* |
---|
| 233 | * _MPCI_Send_process_packet |
---|
| 234 | * |
---|
| 235 | * DESCRIPTION: |
---|
| 236 | * |
---|
| 237 | * This routine sends a process packet by invoking the user provided |
---|
| 238 | * MPCI send callout. |
---|
| 239 | */ |
---|
| 240 | |
---|
| 241 | void _MPCI_Send_process_packet ( |
---|
| 242 | unsigned32 destination, |
---|
[3a4ae6c] | 243 | MP_packet_Prefix *the_packet |
---|
[ac7d5ef0] | 244 | ); |
---|
| 245 | |
---|
| 246 | /* |
---|
| 247 | * _MPCI_Send_request_packet |
---|
| 248 | * |
---|
| 249 | * DESCRIPTION: |
---|
| 250 | * |
---|
| 251 | * This routine sends a request packet by invoking the user provided |
---|
| 252 | * MPCI send callout. |
---|
| 253 | */ |
---|
| 254 | |
---|
[3a4ae6c] | 255 | unsigned32 _MPCI_Send_request_packet ( |
---|
[ac7d5ef0] | 256 | unsigned32 destination, |
---|
[3a4ae6c] | 257 | MP_packet_Prefix *the_packet, |
---|
[ac7d5ef0] | 258 | States_Control extra_state |
---|
| 259 | ); |
---|
| 260 | |
---|
| 261 | /* |
---|
| 262 | * _MPCI_Send_response_packet |
---|
| 263 | * |
---|
| 264 | * DESCRIPTION: |
---|
| 265 | * |
---|
| 266 | * This routine sends a response packet by invoking the user provided |
---|
| 267 | * MPCI send callout. |
---|
| 268 | */ |
---|
| 269 | |
---|
| 270 | void _MPCI_Send_response_packet ( |
---|
| 271 | unsigned32 destination, |
---|
[3a4ae6c] | 272 | MP_packet_Prefix *the_packet |
---|
[ac7d5ef0] | 273 | ); |
---|
| 274 | |
---|
| 275 | /* |
---|
| 276 | * _MPCI_Receive_packet |
---|
| 277 | * |
---|
| 278 | * DESCRIPTION: |
---|
| 279 | * |
---|
| 280 | * This routine receives a packet by invoking the user provided |
---|
| 281 | * MPCI receive callout. |
---|
| 282 | */ |
---|
| 283 | |
---|
[3a4ae6c] | 284 | MP_packet_Prefix *_MPCI_Receive_packet ( void ); |
---|
[ac7d5ef0] | 285 | |
---|
| 286 | /* |
---|
| 287 | * _MPCI_Process_response |
---|
| 288 | * |
---|
| 289 | * DESCRIPTION: |
---|
| 290 | * |
---|
| 291 | * This routine obtains a packet by invoking the user provided |
---|
| 292 | * MPCI get packet callout. |
---|
| 293 | */ |
---|
| 294 | |
---|
| 295 | Thread_Control *_MPCI_Process_response ( |
---|
[3a4ae6c] | 296 | MP_packet_Prefix *the_packet |
---|
[ac7d5ef0] | 297 | ); |
---|
| 298 | |
---|
[3a4ae6c] | 299 | /*PAGE |
---|
| 300 | * |
---|
| 301 | * _MPCI_Receive_server |
---|
| 302 | * |
---|
[ac7d5ef0] | 303 | */ |
---|
[3a4ae6c] | 304 | |
---|
[adf98bd] | 305 | Thread _MPCI_Receive_server( |
---|
| 306 | unsigned32 ignored |
---|
| 307 | ); |
---|
[ac7d5ef0] | 308 | |
---|
[3a4ae6c] | 309 | /*PAGE |
---|
| 310 | * |
---|
| 311 | * _MPCI_Announce |
---|
| 312 | * |
---|
| 313 | * DESCRIPTION: |
---|
| 314 | * |
---|
| 315 | * XXX |
---|
| 316 | */ |
---|
| 317 | |
---|
| 318 | void _MPCI_Announce ( void ); |
---|
[ac7d5ef0] | 319 | |
---|
[adf98bd] | 320 | /* |
---|
| 321 | * _MPCI_Internal_packets_Send_process_packet |
---|
| 322 | * |
---|
| 323 | * DESCRIPTION: |
---|
| 324 | * |
---|
| 325 | * This routine performs a remote procedure call so that a |
---|
| 326 | * process operation can be performed on another node. |
---|
| 327 | */ |
---|
| 328 | |
---|
| 329 | void _MPCI_Internal_packets_Send_process_packet ( |
---|
| 330 | MPCI_Internal_Remote_operations operation |
---|
| 331 | ); |
---|
| 332 | |
---|
| 333 | /* |
---|
| 334 | * _MPCI_Internal_packets_Send_request_packet |
---|
| 335 | * |
---|
| 336 | * DESCRIPTION: |
---|
| 337 | * |
---|
| 338 | * This routine performs a remote procedure call so that a |
---|
| 339 | * directive operation can be initiated on another node. |
---|
| 340 | * |
---|
| 341 | * This routine is not needed since there are no request |
---|
| 342 | * packets to be sent by this manager. |
---|
| 343 | */ |
---|
| 344 | |
---|
| 345 | /* |
---|
| 346 | * _MPCI_Internal_packets_Send_response_packet |
---|
| 347 | * |
---|
| 348 | * DESCRIPTION: |
---|
| 349 | * |
---|
| 350 | * This routine performs a remote procedure call so that a |
---|
| 351 | * directive can be performed on another node. |
---|
| 352 | * |
---|
| 353 | * This routine is not needed since there are no response |
---|
| 354 | * packets to be sent by this manager. |
---|
| 355 | */ |
---|
| 356 | |
---|
| 357 | /* |
---|
| 358 | * |
---|
| 359 | * _MPCI_Internal_packets_Process_packet |
---|
| 360 | * |
---|
| 361 | * DESCRIPTION: |
---|
| 362 | * |
---|
| 363 | * This routine performs the actions specific to this package for |
---|
| 364 | * the request from another node. |
---|
| 365 | */ |
---|
| 366 | |
---|
| 367 | void _MPCI_Internal_packets_Process_packet ( |
---|
| 368 | MP_packet_Prefix *the_packet_prefix |
---|
| 369 | ); |
---|
| 370 | |
---|
| 371 | /* |
---|
| 372 | * _MPCI_Internal_packets_Send_object_was_deleted |
---|
| 373 | * |
---|
| 374 | * DESCRIPTION: |
---|
| 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 | * DESCRIPTION: |
---|
| 388 | * |
---|
| 389 | * This routine is invoked when a task is deleted and it |
---|
| 390 | * has a proxy which must be removed from a thread queue and |
---|
| 391 | * the remote node must be informed of this. |
---|
| 392 | * |
---|
| 393 | * This routine is not needed since there are no objects |
---|
| 394 | * deleted by this manager. |
---|
| 395 | */ |
---|
| 396 | |
---|
| 397 | /* |
---|
| 398 | * _MPCI_Internal_packets_Get_packet |
---|
| 399 | * |
---|
| 400 | * DESCRIPTION: |
---|
| 401 | * |
---|
| 402 | * This routine is used to obtain a internal threads mp packet. |
---|
| 403 | */ |
---|
| 404 | |
---|
| 405 | MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void ); |
---|
| 406 | |
---|
[ac7d5ef0] | 407 | #ifdef __cplusplus |
---|
| 408 | } |
---|
| 409 | #endif |
---|
| 410 | |
---|
| 411 | #endif |
---|
| 412 | /* end of include file */ |
---|