xref: /titanic_41/usr/src/uts/sun4v/sys/dds.h (revision 678453a8ed49104d8adad58f3ba591bdc39883e8)
1*678453a8Sspeer /*
2*678453a8Sspeer  * CDDL HEADER START
3*678453a8Sspeer  *
4*678453a8Sspeer  * The contents of this file are subject to the terms of the
5*678453a8Sspeer  * Common Development and Distribution License (the "License").
6*678453a8Sspeer  * You may not use this file except in compliance with the License.
7*678453a8Sspeer  *
8*678453a8Sspeer  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*678453a8Sspeer  * or http://www.opensolaris.org/os/licensing.
10*678453a8Sspeer  * See the License for the specific language governing permissions
11*678453a8Sspeer  * and limitations under the License.
12*678453a8Sspeer  *
13*678453a8Sspeer  * When distributing Covered Code, include this CDDL HEADER in each
14*678453a8Sspeer  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*678453a8Sspeer  * If applicable, add the following below this CDDL HEADER, with the
16*678453a8Sspeer  * fields enclosed by brackets "[]" replaced with your own identifying
17*678453a8Sspeer  * information: Portions Copyright [yyyy] [name of copyright owner]
18*678453a8Sspeer  *
19*678453a8Sspeer  * CDDL HEADER END
20*678453a8Sspeer  */
21*678453a8Sspeer 
22*678453a8Sspeer /*
23*678453a8Sspeer  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*678453a8Sspeer  * Use is subject to license terms.
25*678453a8Sspeer  */
26*678453a8Sspeer 
27*678453a8Sspeer #ifndef _DDS_H
28*678453a8Sspeer #define	_DDS_H
29*678453a8Sspeer 
30*678453a8Sspeer #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*678453a8Sspeer 
32*678453a8Sspeer #ifdef __cplusplus
33*678453a8Sspeer extern "C" {
34*678453a8Sspeer #endif
35*678453a8Sspeer 
36*678453a8Sspeer /*
37*678453a8Sspeer  * DDS class values
38*678453a8Sspeer  *	DDS_GENERIC_XXX		0x0 - 0xf
39*678453a8Sspeer  *	DDS_VNET_XXX		0x10 - 0x1f
40*678453a8Sspeer  *	DDS_VDSK_XXX		0x20 - 0x2f
41*678453a8Sspeer  *	reserved		0x30 - 0xff
42*678453a8Sspeer  */
43*678453a8Sspeer 
44*678453a8Sspeer #define	DDS_VNET_NIU	0x10	/* NIU vNet class */
45*678453a8Sspeer 
46*678453a8Sspeer 
47*678453a8Sspeer /*
48*678453a8Sspeer  * Subclasses for DDS_VNET_NIU class
49*678453a8Sspeer  */
50*678453a8Sspeer #define	DDS_VNET_ADD_SHARE	0x01	/* Add a share */
51*678453a8Sspeer #define	DDS_VNET_DEL_SHARE	0x02	/* Delete a share */
52*678453a8Sspeer #define	DDS_VNET_REL_SHARE	0x03	/* Release a share */
53*678453a8Sspeer #define	DDS_VNET_MOD_SHARE	0x04	/* Modify a share */
54*678453a8Sspeer 
55*678453a8Sspeer /*
56*678453a8Sspeer  * The following structure is used for the following class/subclass messages.
57*678453a8Sspeer  *	DDS_VNET_NIU/DDS_VNET_ADD_SHARE
58*678453a8Sspeer  *	DDS_VNET_NIU/DDS_VNET_DEL_SHARE
59*678453a8Sspeer  *	DDS_VNET_NIU/DDS_VNET_REL_SHARE
60*678453a8Sspeer  */
61*678453a8Sspeer typedef struct dds_share_msg {
62*678453a8Sspeer 	/*
63*678453a8Sspeer 	 * MAC-address to which this resource belongs to.
64*678453a8Sspeer 	 * It is stored in the following fashion:
65*678453a8Sspeer 	 *	Bytes:	7   6   5    4    3    2    1    0
66*678453a8Sspeer 	 *		X   X   M0   M1   M2   M3   M4   M5
67*678453a8Sspeer 	 */
68*678453a8Sspeer 	uint64_t	macaddr;
69*678453a8Sspeer 
70*678453a8Sspeer 	/*
71*678453a8Sspeer 	 * A 64 bit cookie. It consists two pars:
72*678453a8Sspeer 	 *	Low 32bits == HV cookie
73*678453a8Sspeer 	 *	High 32bits == config_hdl of NIU
74*678453a8Sspeer 	 */
75*678453a8Sspeer 	uint64_t	cookie;
76*678453a8Sspeer } dds_share_msg_t;
77*678453a8Sspeer 
78*678453a8Sspeer /*
79*678453a8Sspeer  * The following structure is used as a response for all DDS_VNET_NIU
80*678453a8Sspeer  * messages.
81*678453a8Sspeer  */
82*678453a8Sspeer typedef struct dds_share_resp_msg {
83*678453a8Sspeer 	/*
84*678453a8Sspeer 	 * When the response is NACK, resp_val can be used optionally
85*678453a8Sspeer 	 * to provide additional information regarding failure.
86*678453a8Sspeer 	 */
87*678453a8Sspeer 	uint64_t	status;
88*678453a8Sspeer } dds_share_resp_msg_t;
89*678453a8Sspeer 
90*678453a8Sspeer /*
91*678453a8Sspeer  * status values
92*678453a8Sspeer  */
93*678453a8Sspeer #define	DDS_VNET_SUCCESS	0x0	/* Operation success */
94*678453a8Sspeer #define	DDS_VNET_FAIL		0x1	/* Operation failed */
95*678453a8Sspeer 
96*678453a8Sspeer /*
97*678453a8Sspeer  * The following structure is used for the following class/subclass messages.
98*678453a8Sspeer  *	DDS_VNET_NIU/DDS_VNET_MODIFY_SHARE
99*678453a8Sspeer  */
100*678453a8Sspeer typedef struct dds_share_modify_msg {
101*678453a8Sspeer 	uint64_t	macaddr;
102*678453a8Sspeer 	uint64_t	cookie;
103*678453a8Sspeer 
104*678453a8Sspeer 	/*
105*678453a8Sspeer 	 * rx_res_map -- Intended modification to RX resources
106*678453a8Sspeer 	 *		 indicated as a map.
107*678453a8Sspeer 	 * tx_res_map -- Intended modification to TX resources
108*678453a8Sspeer 	 *		 indicated as a map.
109*678453a8Sspeer 	 */
110*678453a8Sspeer 	uint64_t	rx_res_map;
111*678453a8Sspeer 	uint64_t	tx_res_map;
112*678453a8Sspeer } dds_share_modify_msg_t;
113*678453a8Sspeer 
114*678453a8Sspeer /*
115*678453a8Sspeer  * VIO DDS Info message.
116*678453a8Sspeer  *
117*678453a8Sspeer  * tag.msgtype == VIO_TYPE_CTRL
118*678453a8Sspeer  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
119*678453a8Sspeer  * tag.subtype_env == VIO_DDS_INFO
120*678453a8Sspeer  */
121*678453a8Sspeer typedef struct vio_dds_msg {
122*678453a8Sspeer 	/* Common tag */
123*678453a8Sspeer 	vio_msg_tag_t		tag;
124*678453a8Sspeer 	uint8_t			dds_class;
125*678453a8Sspeer 	uint8_t			dds_subclass;
126*678453a8Sspeer 	uint16_t		resv;
127*678453a8Sspeer 	uint32_t		dds_req_id;
128*678453a8Sspeer 	union {
129*678453a8Sspeer 		struct dds_share_msg		share_msg;
130*678453a8Sspeer 		struct dds_share_resp_msg	share_resp_msg;
131*678453a8Sspeer 		struct dds_share_modify_msg	share_mod_msg;
132*678453a8Sspeer 		uint64_t			pad2[5];
133*678453a8Sspeer 	} msg;
134*678453a8Sspeer } vio_dds_msg_t;
135*678453a8Sspeer 
136*678453a8Sspeer 
137*678453a8Sspeer #ifdef __cplusplus
138*678453a8Sspeer }
139*678453a8Sspeer #endif
140*678453a8Sspeer 
141*678453a8Sspeer #endif	/* _DDS_H */
142