etm_etm_proto.h revision 733a5356058ae0150a67d61f0ad8e5260d2acae3
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* etm_etm_proto.h FMA ETM-to-ETM Protocol header
* for sun4v/Ontario
*
* const/type defns for protocol used between two event transport
* modules (ETMs)
*/
#ifndef _ETM_ETM_PROTO_H
#define _ETM_ETM_PROTO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* --------------------------------- includes --------------------------------
*/
#include <sys/types.h>
/*
* ------------------------ etm protocol all versions ------------------------
*/
/* magic number for ETM protocol (start of msg hdr) */
#define ETM_PROTO_MAGIC_NUM (0xADB8A5A0)
/* protocol version numbers 1, 2, ... */
#define ETM_PROTO_V1 (1)
/*
* Design_Note: Care should be taken for any future V2 protocol, particularly
* if the size of the message headers shrinks vs the V1 sizes,
* so that if ETM receives each message header in a single
* read() call, that it won't pend indefinitely when sent a
* V2 header.
*/
/*
* -------------------------- etm protocol version 1 -------------------------
*/
typedef enum {
ETM_MSG_TYPE_TOO_LOW = 0, /* range check place holder */
ETM_MSG_TYPE_FMA_EVENT, /* pp_msg_type: FMA event */
ETM_MSG_TYPE_CONTROL, /* pp_msg_type: ETM control */
ETM_MSG_TYPE_RESPONSE, /* pp_msg_type: ETM response */
ETM_MSG_TYPE_TOO_BIG /* range check place holder */
} etm_proto_v1_msg_type_t; /* 8-bit pp_msg_type ETM message types */
#define ETM_PROTO_V1_TIMEOUT_NONE ((uint32_t)(-1))
#define ETM_PROTO_V1_TIMEOUT_FOREVER ((uint32_t)(-2))
typedef struct etm_proto_v1_pp {
uint32_t pp_magic_num; /* magic number */
uint8_t pp_proto_ver; /* version of ETM protocol */
uint8_t pp_msg_type; /* type of ETM msg */
uint8_t pp_sub_type; /* sub type within pp_msg_type */
uint8_t pp_rsvd_pad; /* reserved/padding/alignment */
uint32_t pp_xid; /* transaction id */
uint32_t pp_timeout; /* timeout (in sec) for response */
} etm_proto_v1_pp_t; /* protocol preamble for all v1 msg hdrs */
typedef struct etm_proto_v1_ev_hdr {
etm_proto_v1_pp_t ev_pp; /* protocol preamble */
uint32_t ev_lens[1]; /* 0-termed lengths vector */
/* uint8_t ev_bodies[]; contig packed FMA events */
} etm_proto_v1_ev_hdr_t; /* header for FMA_EVENT msgs */
typedef enum {
ETM_CTL_SEL_TOO_LOW = 16, /* range check place holder */
ETM_CTL_SEL_PING_REQ, /* ping request */
ETM_CTL_SEL_VER_SET_REQ, /* set proto version request */
ETM_CTL_SEL_TOO_BIG /* range check place holder */
} etm_proto_v1_ctl_sel_t; /* 8-bit pp_sub_type control selectors */
typedef struct etm_proto_v1_ctl_hdr {
etm_proto_v1_pp_t ctl_pp; /* protocol preamble */
uint32_t ctl_len; /* length of control body */
/* uint8_t ctl_body[]; contig accompanying control data */
} etm_proto_v1_ctl_hdr_t; /* header for CONTROL msgs */
typedef struct etm_proto_v1_resp_hdr {
etm_proto_v1_pp_t resp_pp; /* protocol preamble */
int32_t resp_code; /* -errno or success code */
uint32_t resp_len; /* length of response body */
/* uint8_t resp_body[]; contig accompanying response data */
} etm_proto_v1_resp_hdr_t;
/*
* --------------------------------- prolog ----------------------------------
*/
#ifdef __cplusplus
}
#endif
#endif /* _ETM_ETM_PROTO_H */