Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / include / rca / cray_event_def.h
1 /*
2  * Copyright (c) 2003 Cray, Inc.
3  *
4  * The contents of this file are proprietary information of Cray Inc. 
5  * and may not be disclosed without prior written consent.
6  */
7 /*
8  *
9  * This code is licensed under the GNU General Public License,
10  * Version 2.  See the file COPYING for more details.
11  */
12
13
14 #ifndef __CRAY_EVENT_DEF_H__
15 #define __CRAY_EVENT_DEF_H__
16
17
18 #include <lwk/types.h>
19 #include <lwk/time.h>
20 #include <rca/rca_defs.h>
21
22 typedef union rs_node_u {
23     /* Little Endian */
24     struct {
25         uint32_t _node_arch     : 2;    /* System architecture      */
26         uint32_t _node_type     : 6;    /* Component type           */
27         uint32_t _node_state    : 7;    /* Component state from SM  */
28         uint32_t _node_is_svc   : 1;    /* Service node bit         */
29
30         uint32_t _node_id       : 16;   /* Node and Seastar NID     */
31
32         uint32_t                : 2;    /* Unused                   */
33         uint32_t _node_x        : 6;    /* What position in the row */
34         uint32_t _node_subtype  : 4;    /* Component subtype        */
35         uint32_t _node_row      : 4;    /* Which row of cabinets    */
36
37         uint32_t _node_cage     : 4;    /* Cage in the cabinet      */
38         uint32_t _node_slot     : 4;    /* Slot in the cage         */
39         uint32_t _node_modcomp  : 4;    /* Component on a module    */
40         uint32_t _node_link     : 4;    /* Link on seastar          */
41     } __attribute__((packed)) rs_node_s;
42     struct {
43         uint32_t :2, :6, :7, :1, :16, :2, :6, :4, :4; /* Unused fields */
44         uint32_t _node_startx   : 8;    /* What position in the row */
45         uint32_t _node_endx     : 8;    /* Which row of cabinets */
46     } __attribute__((packed)) rs_node_s1;
47     uint64_t rs_node_flat;
48 } __attribute__((packed)) rs_node_t;
49
50 /* TODO: this and RCA RS_MSG_LEN define needs to be taken out soon. */
51 #ifndef RS_MSG_LEN 
52 #define RS_MSG_LEN 1
53 #endif
54
55 typedef uint32_t rs_error_code_t;
56 typedef int32_t rs_event_code_t;
57
58
59 // from rs_svc_id.h
60
61 /* NOTE for the following event related structures:
62  * ###################################################################
63  * There are following restrictions for the L0 Opteron communication
64  * related structures.
65  * The elements must be aligned on 4-byte boundaries.  The structure
66  * size must be a multiple of 4 bytes. Structures should be packed so
67  * that the compiler will not insert padding.
68  * ###################################################################
69  */
70 typedef uint32_t rs_service_t;
71 typedef uint32_t rs_instance_t;
72 typedef uint32_t  rs_priority_t;
73 typedef uint32_t  rs_flag_t;
74
75 /*
76  * NOTE: This rs_service_id_t is packed.  If we update this structure,
77  *  we need to make sure that each element is 4-byte aligned,
78  *  otherwise it might break the L0 Opteron communication (size
79  *  of rs_service_id_t must be a multiple of 4bytes).
80  */
81 typedef struct rs_service_id_s {
82     rs_instance_t svid_inst;    /* a sequence identifier */
83     rs_service_t  svid_type;    /* the kind of service */
84     rs_node_t     svid_node;    /* the x.y.z coordinates */
85 } __attribute__((packed)) rs_service_id_t;
86
87
88 /* time structure
89  * rt_tv1 and rt_tv2 are hedges against field size inflation.
90  */
91 typedef union rs_time_u {
92     struct timeval _rt_tv;
93     struct {
94             uint64_t _rt_tv1;
95             uint64_t _rt_tv2;
96     } rs_evtime_s;      /* timeval needs to be adjusted for 32/64 bits */
97 } rs_time_t;
98
99 /*
100  * NOTE: This rs_event_t is packed.  If we update this structure, we need to
101  *      make sure that each element is 4-byte aligned, otherwise it might
102  *      break the L0 Opteron communication (size of rs_event_t must be a
103  *      multiple of 4bytes).
104  *
105  * event structure:
106  * may be used as a fixed or variable length event.
107  * In RCA's case, ev_data is fixed length and RS_MSG_LEN should be defined
108  * before inclusion of this file.  ev_len here signifies the length in
109  * bytes of significant data in ev_data.  The SMW, in contrast, treats events
110  * as variable length;  RS_MSG_LEN is 1 and the actual length of the data is
111  * determined when the object is allocated. In this case the real length
112  * of ev_data is stored in ev_len.  RCA related events has fixed length
113  * ev_data and RS_MSG_LEN is 256 (multiple of 4bytes).  Same as the SMW
114  * events, real length of ev_data needs to be stored in ev_len.
115  */
116 typedef struct rs_event_s {
117     rs_event_code_t     ev_id;               /* type of event */
118     uint32_t            ev_seqnum;           /* req/rsp sequence number */
119     rs_service_id_t     ev_gen;              /* what this event pertains to */
120     rs_service_id_t     ev_src;              /* creator of this event */
121     rs_flag_t           ev_flag;             /* any bit flags */
122     rs_time_t           _ev_stp;             /* time of event creation */
123     rs_priority_t       ev_priority;         /* priority [0 low, 9 high] */
124     int32_t             ev_len;              /* length of data */
125     char                ev_data[RS_MSG_LEN]; /* payload (must be last) */
126 } __attribute__((packed)) rs_event_t;
127
128 #define rs_sizeof_event(data_length) \
129     (((int)(&((rs_event_t*)0)->ev_data)) + (data_length)) 
130
131 #endif /* __CRAY_EVENT_DEF_H__ */
132