xref: /titanic_41/usr/src/uts/sun4v/sys/vlds.h (revision 24a1f0af9f770e0e795ef1fa1c6dece8dd8dc959)
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	_SYS_VLDS_H_
28 #define	_SYS_VLDS_H_
29 
30 #include <sys/types.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * LDOMS Domain Services Device Driver
38  */
39 
40 /*
41  * ioctl info for vlds device
42  */
43 
44 #define	VLDSIOC		('d' << 16 | 's' << 8)
45 
46 #define	VLDS_SVC_REG	(VLDSIOC | 1)	/* Register DS Service */
47 #define	VLDS_UNREG_HDL	(VLDSIOC | 2)	/* Unregister DS Service by Handle */
48 #define	VLDS_HDL_LOOKUP	(VLDSIOC | 3)	/* Lookup DS Handle(s) by Service id */
49 #define	VLDS_DMN_LOOKUP	(VLDSIOC | 4)	/* Lookup DS Domain id by Handle */
50 #define	VLDS_SEND_MSG	(VLDSIOC | 5)	/* Send DS Message by Handle */
51 #define	VLDS_RECV_MSG	(VLDSIOC | 6)	/* Receive DS Message by Handle */
52 #define	VLDS_HDL_ISREADY (VLDSIOC | 7)	/* Handle ready for data transfers */
53 #define	VLDS_DOM_NAM2HDL (VLDSIOC | 8)	/* Domain Name to Handle translation */
54 #define	VLDS_DOM_HDL2NAM (VLDSIOC | 9)	/* Handle ready for data transfers */
55 
56 /* vlds_reg_flags */
57 #define	VLDS_REG_CLIENT		0x01	/* Register as client */
58 #define	VLDS_REGCB_VALID	0x02	/* User supplied Register callback */
59 #define	VLDS_UNREGCB_VALID	0x04	/* User supplied Unregister callback */
60 #define	VLDS_DATACB_VALID	0x08	/* User supplied Data callback */
61 #define	VLDS_ANYCB_VALID	(VLDS_REGCB_VALID | VLDS_UNREGCB_VALID | \
62 				    VLDS_DATACB_VALID)
63 
64 #define	VLDS_MAX_VERS		20	/* Max no. of vlds_ver_t entries */
65 
66 /*
67  * The following are declared so that they are size-invariant.
68  */
69 
70 /* String arguments to ioctl */
71 typedef struct vlds_string_arg {
72 	uint64_t	vlds_strp;
73 	uint64_t	vlds_strlen;
74 } vlds_string_t;
75 
76 /* Version array (used by VLDS_SVC_REG) */
77 typedef struct vlds_ver {
78 	uint16_t	vlds_major;
79 	uint16_t	vlds_minor;
80 } vlds_ver_t;
81 
82 /* Capability structure (used by VLDS_SVC_REG) */
83 typedef struct vlds_cap {
84 	vlds_string_t	vlds_service;
85 	uint64_t	vlds_nver;
86 	uint64_t	vlds_versp;
87 } vlds_cap_t;
88 
89 /*
90  * VLDS_SVC_REG
91  */
92 typedef struct vlds_svc_reg_arg {
93 	uint64_t	vlds_hdlp;	/* DS Service Handle ptr. (returned) */
94 	uint64_t	vlds_capp;	/* DS Capability Structure ptr. */
95 	uint64_t	vlds_reg_flags;	/* DS reg flags */
96 } vlds_svc_reg_arg_t;
97 
98 /*
99  * VLDS_UNREG_HDL
100  */
101 typedef struct vlds_unreg_hdl_arg {
102 	uint64_t	vlds_hdl;	/* DS Service Handle */
103 } vlds_unreg_hdl_arg_t;
104 
105 /*
106  * VLDS_DMN_LOOKUP
107  */
108 typedef struct vlds_dmn_lookup_arg {
109 	uint64_t	vlds_hdl;	/* DS Service Handle */
110 	uint64_t	vlds_dhdlp;	/* DS Domain hdl ptr. (returned) */
111 } vlds_dmn_lookup_arg_t;
112 
113 /*
114  * VLDS_HDL_LOOKUP
115  */
116 typedef struct vlds_hdl_lookup_arg {
117 	vlds_string_t	vlds_service;	/* DS Service Name */
118 	uint64_t	vlds_isclient;	/* DS Client flag */
119 	uint64_t	vlds_hdlsp;	/* DS Handle array ptr */
120 	uint64_t	vlds_maxhdls;	/* DS Max no. of hdls to return */
121 	uint64_t	vlds_nhdlsp;	/* DS No. of hdls returned */
122 } vlds_hdl_lookup_arg_t;
123 
124 /*
125  * VLDS_SEND_MSG
126  */
127 typedef struct vlds_send_msg_arg {
128 	uint64_t	vlds_hdl;	/* DS Service Handle */
129 	uint64_t	vlds_bufp;	/* buffer */
130 	uint64_t	vlds_buflen;	/* message length/buffer size */
131 } vlds_send_msg_arg_t;
132 
133 /*
134  * VLDS_RECV_MSG
135  */
136 typedef struct vlds_recv_msg_arg {
137 	uint64_t	vlds_hdl;	/* DS Service Handle */
138 	uint64_t	vlds_bufp;	/* buffer */
139 	uint64_t	vlds_buflen;	/* message length/buffer size */
140 	uint64_t	vlds_msglenp;	/* ptr to returned message length */
141 } vlds_recv_msg_arg_t;
142 
143 /*
144  * VLDS_HDL_ISREADY
145  */
146 typedef struct vlds_hdl_isready_arg {
147 	uint64_t	vlds_hdl;	/* DS Service Handle */
148 	uint64_t	vlds_isreadyp;	/* Ptr to isready flag */
149 } vlds_hdl_isready_arg_t;
150 
151 /*
152  * VLDS_DOM_NAM2HDL
153  */
154 typedef struct vlds_dom_nam2hdl_arg {
155 	vlds_string_t	vlds_domain_name; /* Domain Name string */
156 	uint64_t	vlds_dhdlp;	/* ptr to returned Domain Handle */
157 } vlds_dom_nam2hdl_arg_t;
158 
159 /*
160  * VLDS_DOM_HDL2NAM
161  */
162 typedef struct vlds_dom_hdl2nam_arg {
163 	uint64_t	vlds_dhdl;	/* Domain Handle */
164 	vlds_string_t	vlds_domain_name; /* returned Domain Name string */
165 } vlds_dom_hdl2nam_arg_t;
166 
167 /*
168  * Machine Description Constants for vlds driver.
169  */
170 #define	VLDS_MD_VIRT_DEV_NAME	"virtual-device"
171 #define	VLDS_MD_VIRT_ROOT_NAME	"virtual-domain-service"
172 #define	VLDS_MD_DOMAIN_HDL	"vlds-domain-handle"
173 #define	VLDS_MD_DOMAIN_NAME	"vlds-domain-name"
174 #define	VLDS_MD_VIRT_PORT_NAME	"virtual-device-port"
175 #define	VLDS_MD_REM_DOMAIN_HDL	"vlds-remote-domain-handle"
176 #define	VLDS_MD_REM_DOMAIN_NAME	"vlds-remote-domain-name"
177 
178 /*
179  * VLDS Sysevent defines.
180  * VLDS System Event Channel names are of the form:
181  *    sun.com:vlds:pid<pid_number>
182  */
183 #define	VLDS_SYSEV_CHAN_FMT		"sun.com:vlds:pid%06d"
184 #define	VLDS_SYSEV_MAX_CHAN_NAME	32
185 
186 #define	EC_VLDS		"EC_vlds"	/* LDOMS Domain Services event class */
187 
188 /*
189  * EC_VLDS subclass definitions - supporting attributes (name/value pairs) are
190  * found in sys/sysevent/vlds.h
191  */
192 #define	ESC_VLDS_REGISTER	"ESC_VLDS_register"
193 #define	ESC_VLDS_UNREGISTER	"ESC_VLDS_unregister"
194 #define	ESC_VLDS_DATA		"ESC_VLDS_data"
195 
196 /*
197  * Event type EC_VLDS
198  *	Event Class	- EC_VLDS
199  *	Event Sub-Class	- ESC_VLDS_REGISTER
200  *	Event Publisher	- SUNW:kern:[ds_module_name]
201  *	Attribute Name	- VLDS_HDL
202  *	Attribute Type  - SE_DATA_TYPE_UINT64
203  *	Attribute Value	- [Domain Service Handle]
204  *	Attribute Name	- VLDS_VER_MAJOR
205  *	Attribute Type	- SE_DATA_TYPE_UINT16
206  *	Attribute Value	- [major version of the DS interface]
207  *	Attribute Name	- VLDS_VER_MINOR
208  *	Attribute Type	- SE_DATA_TYPE_UINT16
209  *	Attribute Value	- [minor version of the DS interface]
210  *	Attribute Name	- VLDS_DOMAIN_HDL
211  *	Attribute Type	- SE_DATA_TYPE_UINT64
212  *	Attribute Value	- [Domain handle of registered service]
213  *	Attribute Name	- VLDS_SERVICE_ID
214  *	Attribute Type	- SE_DATA_TYPE_STRING
215  *	Attribute Value	- [Service name of registered service]
216  *	Attribute Name	- VLDS_ISCLIENT
217  *	Attribute Type	- SE_DATA_TYPE_BOOLEAN_VALUE
218  *	Attribute Value	- [Service is client or provider]
219  *
220  *	Event Class	- EC_VLDS
221  *	Event Sub-Class	- ESC_VLDS_UNREGISTER
222  *	Event Publisher	- SUNW:kern:[ds_module_name]
223  *	Attribute Name	- VLDS_HDL
224  *	Attribute Type  - SE_DATA_TYPE_UINT64
225  *	Attribute Value	- [Domain Service Handle]
226  *
227  *	Event Class	- EC_VLDS
228  *	Event Sub-Class	- ESC_VLDS_DATA
229  *	Event Publisher	- SUNW:kern:[ds_module_name]
230  *	Attribute Name	- VLDS_HDL
231  *	Attribute Type  - SE_DATA_TYPE_UINT64
232  *	Attribute Value	- [Domain Service Handle]
233  *	Attribute Name	- VLDS_DATA
234  *	Attribute Type  - SE_DATA_TYPE_BYTE_ARRAY
235  *	Attribute Value	- [Data array passed to user]
236  */
237 
238 #define	VLDS_HDL	"vlds_hdl"		/* service handle */
239 #define	VLDS_VER_MAJOR	"vlds_ver_major"	/* major version */
240 #define	VLDS_VER_MINOR	"vlds_ver_minor"	/* minor version */
241 #define	VLDS_DOMAIN_HDL	"vlds_domain_hdl"	/* domain handle */
242 #define	VLDS_SERVICE_ID	"vlds_service_id"	/* service id */
243 #define	VLDS_ISCLIENT	"vlds_isclient"		/* service is client */
244 #define	VLDS_DATA	"vlds_data"		/* data buffer */
245 
246 #ifdef __cplusplus
247 }
248 #endif
249 
250 #endif /* _SYS_VLDS_H_ */
251