xref: /titanic_44/usr/src/cmd/fm/modules/sun4v/etm/etm_etm_proto.h (revision 4b476ed547ce189d989c425cd2f82986abd37b4d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28  * etm_etm_proto.h	FMA ETM-to-ETM Protocol header
29  *			for sun4v/Ontario
30  *
31  * const/type defns for protocol used between two event transport
32  * modules (ETMs)
33  */
34 
35 #ifndef _ETM_ETM_PROTO_H
36 #define	_ETM_ETM_PROTO_H
37 
38 #pragma ident	"%Z%%M%	%I%	%E% SMI"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * --------------------------------- includes --------------------------------
46  */
47 
48 #include <sys/types.h>
49 
50 /*
51  * ------------------------ etm protocol all versions ------------------------
52  */
53 
54 /* magic number for ETM protocol (start of msg hdr) */
55 
56 #define	ETM_PROTO_MAGIC_NUM (0xADB8A5A0)
57 
58 /* protocol version numbers 1, 2, ... */
59 
60 #define	ETM_PROTO_V1 (1)
61 #define	ETM_PROTO_V2 (2)
62 #define	ETM_PROTO_V3 (3)
63 
64 /*
65  * Design_Note:	Protocol V2 uses the same headers and constants as V1.
66  *		The V1 and V2 protocols differ from each other only in the
67  *		support of response messages for FMA event messages with
68  *		non-NONE timeout fields. In V1 it is invalid to supply a
69  *		timeout value that is non-NONE when sending an ETM message
70  *		containing an FMA event; in V2 it is valid. In both V1 and
71  *		V2 it is valid to supply a non-NONE timeout when sending an
72  *		ETM control message. V1 is the initial bootup protocol version;
73  *		from there version is negotiated upward.
74  */
75 
76 /*
77  * Design_Note: Protocol V3 introduces a new message type for
78  * syslog alerting.  It uses the same protocols and preambles.
79  */
80 
81 /*
82  * Design_Note:	Care should be taken for any future V4 protocol, particularly
83  *		if the size of the protocol preamble shrinks vs the current
84  *		size, so that if ETM is implemented to receive each message
85  *		header as a whole, it won't pend indefinitely when sent a
86  *		[tiny] V4 message.
87  */
88 
89 /*
90  * ------------------------ etm protocol versions 1,2 ----------------------
91  */
92 
93 typedef enum {
94 
95 	ETM_MSG_TYPE_TOO_LOW = 0,	/* range check place holder */
96 	ETM_MSG_TYPE_FMA_EVENT,		/* pp_msg_type: FMA event */
97 	ETM_MSG_TYPE_CONTROL,		/* pp_msg_type: ETM control */
98 	ETM_MSG_TYPE_RESPONSE,		/* pp_msg_type: ETM response */
99 	ETM_MSG_TYPE_ALERT,		/* pp_msg_type: Syslog alert */
100 	ETM_MSG_TYPE_TOO_BIG		/* range check place holder */
101 
102 } etm_proto_v3_msg_type_t;	/* 8-bit pp_msg_type ETM message types */
103 
104 #define	ETM_PROTO_V1_TIMEOUT_NONE	((uint32_t)(-1))
105 #define	ETM_PROTO_V1_TIMEOUT_FOREVER	((uint32_t)(-2))
106 
107 typedef struct etm_proto_v1_pp {
108 
109 	uint32_t	pp_magic_num;	/* magic number */
110 	uint8_t		pp_proto_ver;	/* version of ETM protocol */
111 	uint8_t		pp_msg_type;	/* type of ETM msg */
112 	uint8_t		pp_sub_type;	/* sub type within pp_msg_type */
113 	uint8_t		pp_rsvd_pad;	/* reserved/padding/alignment */
114 	uint32_t	pp_xid;		/* transaction id */
115 	uint32_t	pp_timeout;	/* timeout (in sec) for response */
116 
117 } etm_proto_v1_pp_t;	/* protocol preamble for all v1 msg hdrs */
118 
119 typedef struct etm_proto_v1_ev_hdr {
120 
121 	etm_proto_v1_pp_t	ev_pp;		/* protocol preamble */
122 	uint32_t		ev_lens[1];	/* 0-termed lengths vector */
123 
124 	/* uint8_t ev_bodies[];		contig packed FMA events */
125 
126 } etm_proto_v1_ev_hdr_t;	/* header for FMA_EVENT msgs */
127 
128 /*
129  * V3 addition: Syslog Alert.  Uses the same protocol preamble as V1/V2
130  */
131 
132 typedef struct etm_proto_v3_sa_hdr {
133 
134 	etm_proto_v1_pp_t	sa_pp;		/* protocol preamble */
135 	uint32_t		sa_priority;	/* priority for syslog */
136 	uint32_t		sa_len;		/* message string length */
137 
138 	/* uint8_t sa_message[];		contig message string */
139 
140 } etm_proto_v3_sa_hdr_t;	/* header for ALERT msgs */
141 
142 typedef enum {
143 
144 	ETM_CTL_SEL_TOO_LOW = 16,	/* range check place holder */
145 	ETM_CTL_SEL_PING_REQ,		/* ping request */
146 	ETM_CTL_SEL_VER_NEGOT_REQ,	/* negotiate proto version request */
147 	ETM_CTL_SEL_TOO_BIG		/* range check place holder */
148 
149 } etm_proto_v1_ctl_sel_t;	/* 8-bit pp_sub_type control selectors */
150 
151 typedef struct etm_proto_v1_ctl_hdr {
152 
153 	etm_proto_v1_pp_t	ctl_pp;		/* protocol preamble */
154 	uint32_t  		ctl_len;	/* length of control body */
155 
156 	/* uint8_t ctl_body[];	   contig accompanying control data */
157 
158 } etm_proto_v1_ctl_hdr_t;	/* header for CONTROL msgs */
159 
160 typedef struct etm_proto_v1_resp_hdr {
161 
162 	etm_proto_v1_pp_t	resp_pp;	/* protocol preamble */
163 	int32_t   		resp_code;	/* -errno or success code */
164 	uint32_t  		resp_len;	/* length of response body */
165 
166 	/* uint8_t resp_body[];	   contig accompanying response data */
167 
168 } etm_proto_v1_resp_hdr_t;
169 
170 /*
171  * --------------------------------- prolog ----------------------------------
172  */
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* _ETM_ETM_PROTO_H */
179