xref: /titanic_41/usr/src/uts/sun4v/sys/dds.h (revision e4f5a11d4a234623168c1558fcdf4341e11769e1)
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 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _DDS_H
28 #define	_DDS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * DDS class values
38  *	DDS_GENERIC_XXX		0x0 - 0xf
39  *	DDS_VNET_XXX		0x10 - 0x1f
40  *	DDS_VDSK_XXX		0x20 - 0x2f
41  *	reserved		0x30 - 0xff
42  */
43 
44 #define	DDS_VNET_NIU	0x10	/* NIU vNet class */
45 
46 
47 /*
48  * Subclasses for DDS_VNET_NIU class
49  */
50 #define	DDS_VNET_ADD_SHARE	0x01	/* Add a share */
51 #define	DDS_VNET_DEL_SHARE	0x02	/* Delete a share */
52 #define	DDS_VNET_REL_SHARE	0x03	/* Release a share */
53 #define	DDS_VNET_MOD_SHARE	0x04	/* Modify a share */
54 
55 /*
56  * The following structure is used for the following class/subclass messages.
57  *	DDS_VNET_NIU/DDS_VNET_ADD_SHARE
58  *	DDS_VNET_NIU/DDS_VNET_DEL_SHARE
59  *	DDS_VNET_NIU/DDS_VNET_REL_SHARE
60  */
61 typedef struct dds_share_msg {
62 	/*
63 	 * MAC-address to which this resource belongs to.
64 	 * It is stored in the following fashion:
65 	 *	Bytes:	7   6   5    4    3    2    1    0
66 	 *		X   X   M0   M1   M2   M3   M4   M5
67 	 */
68 	uint64_t	macaddr;
69 
70 	/*
71 	 * A 64 bit cookie. It consists two pars:
72 	 *	Low 32bits == HV cookie
73 	 *	High 32bits == config_hdl of NIU
74 	 */
75 	uint64_t	cookie;
76 } dds_share_msg_t;
77 
78 /*
79  * The following structure is used as a response for all DDS_VNET_NIU
80  * messages.
81  */
82 typedef struct dds_share_resp_msg {
83 	/*
84 	 * When the response is NACK, resp_val can be used optionally
85 	 * to provide additional information regarding failure.
86 	 */
87 	uint64_t	status;
88 } dds_share_resp_msg_t;
89 
90 /*
91  * status values
92  */
93 #define	DDS_VNET_SUCCESS	0x0	/* Operation success */
94 #define	DDS_VNET_FAIL		0x1	/* Operation failed */
95 
96 /*
97  * The following structure is used for the following class/subclass messages.
98  *	DDS_VNET_NIU/DDS_VNET_MODIFY_SHARE
99  */
100 typedef struct dds_share_modify_msg {
101 	uint64_t	macaddr;
102 	uint64_t	cookie;
103 
104 	/*
105 	 * rx_res_map -- Intended modification to RX resources
106 	 *		 indicated as a map.
107 	 * tx_res_map -- Intended modification to TX resources
108 	 *		 indicated as a map.
109 	 */
110 	uint64_t	rx_res_map;
111 	uint64_t	tx_res_map;
112 } dds_share_modify_msg_t;
113 
114 /*
115  * VIO DDS Info message.
116  *
117  * tag.msgtype == VIO_TYPE_CTRL
118  * tag.submsgtype = VIO_SUBTYPE_{INFO|ACK|NACK}
119  * tag.subtype_env == VIO_DDS_INFO
120  */
121 typedef struct vio_dds_msg {
122 	/* Common tag */
123 	vio_msg_tag_t		tag;
124 	uint8_t			dds_class;
125 	uint8_t			dds_subclass;
126 	uint16_t		resv;
127 	uint32_t		dds_req_id;
128 	union {
129 		struct dds_share_msg		share_msg;
130 		struct dds_share_resp_msg	share_resp_msg;
131 		struct dds_share_modify_msg	share_mod_msg;
132 		uint64_t			pad2[5];
133 	} msg;
134 } vio_dds_msg_t;
135 
136 
137 #ifdef __cplusplus
138 }
139 #endif
140 
141 #endif	/* _DDS_H */
142