xref: /titanic_44/usr/src/uts/sun4v/sys/vlds.h (revision a600f50d43405fe4fd9ab16cc92b28df19656392)
130588217SMike Christensen /*
230588217SMike Christensen  * CDDL HEADER START
330588217SMike Christensen  *
430588217SMike Christensen  * The contents of this file are subject to the terms of the
530588217SMike Christensen  * Common Development and Distribution License (the "License").
630588217SMike Christensen  * You may not use this file except in compliance with the License.
730588217SMike Christensen  *
830588217SMike Christensen  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
930588217SMike Christensen  * or http://www.opensolaris.org/os/licensing.
1030588217SMike Christensen  * See the License for the specific language governing permissions
1130588217SMike Christensen  * and limitations under the License.
1230588217SMike Christensen  *
1330588217SMike Christensen  * When distributing Covered Code, include this CDDL HEADER in each
1430588217SMike Christensen  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1530588217SMike Christensen  * If applicable, add the following below this CDDL HEADER, with the
1630588217SMike Christensen  * fields enclosed by brackets "[]" replaced with your own identifying
1730588217SMike Christensen  * information: Portions Copyright [yyyy] [name of copyright owner]
1830588217SMike Christensen  *
1930588217SMike Christensen  * CDDL HEADER END
2030588217SMike Christensen  */
2130588217SMike Christensen 
2230588217SMike Christensen /*
2330588217SMike Christensen  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
2430588217SMike Christensen  * Use is subject to license terms.
2530588217SMike Christensen  */
2630588217SMike Christensen 
2730588217SMike Christensen #ifndef	_SYS_VLDS_H_
2830588217SMike Christensen #define	_SYS_VLDS_H_
2930588217SMike Christensen 
3030588217SMike Christensen #include <sys/types.h>
3130588217SMike Christensen 
3230588217SMike Christensen #ifdef __cplusplus
3330588217SMike Christensen extern "C" {
3430588217SMike Christensen #endif
3530588217SMike Christensen 
3630588217SMike Christensen /*
3730588217SMike Christensen  * LDOMS Domain Services Device Driver
3830588217SMike Christensen  */
3930588217SMike Christensen 
4030588217SMike Christensen /*
4130588217SMike Christensen  * ioctl info for vlds device
4230588217SMike Christensen  */
4330588217SMike Christensen 
4430588217SMike Christensen #define	VLDSIOC		('d' << 16 | 's' << 8)
4530588217SMike Christensen 
4630588217SMike Christensen #define	VLDS_SVC_REG	(VLDSIOC | 1)	/* Register DS Service */
4730588217SMike Christensen #define	VLDS_UNREG_HDL	(VLDSIOC | 2)	/* Unregister DS Service by Handle */
4830588217SMike Christensen #define	VLDS_HDL_LOOKUP	(VLDSIOC | 3)	/* Lookup DS Handle(s) by Service id */
4930588217SMike Christensen #define	VLDS_DMN_LOOKUP	(VLDSIOC | 4)	/* Lookup DS Domain id by Handle */
5030588217SMike Christensen #define	VLDS_SEND_MSG	(VLDSIOC | 5)	/* Send DS Message by Handle */
5130588217SMike Christensen #define	VLDS_RECV_MSG	(VLDSIOC | 6)	/* Receive DS Message by Handle */
5230588217SMike Christensen #define	VLDS_HDL_ISREADY (VLDSIOC | 7)	/* Handle ready for data transfers */
5330588217SMike Christensen #define	VLDS_DOM_NAM2HDL (VLDSIOC | 8)	/* Domain Name to Handle translation */
5430588217SMike Christensen #define	VLDS_DOM_HDL2NAM (VLDSIOC | 9)	/* Handle ready for data transfers */
5530588217SMike Christensen 
5630588217SMike Christensen /* vlds_reg_flags */
5730588217SMike Christensen #define	VLDS_REG_CLIENT		0x01	/* Register as client */
5830588217SMike Christensen #define	VLDS_REGCB_VALID	0x02	/* User supplied Register callback */
5930588217SMike Christensen #define	VLDS_UNREGCB_VALID	0x04	/* User supplied Unregister callback */
6030588217SMike Christensen #define	VLDS_DATACB_VALID	0x08	/* User supplied Data callback */
6130588217SMike Christensen #define	VLDS_ANYCB_VALID	(VLDS_REGCB_VALID | VLDS_UNREGCB_VALID | \
6230588217SMike Christensen 				    VLDS_DATACB_VALID)
6330588217SMike Christensen 
6430588217SMike Christensen #define	VLDS_MAX_VERS		20	/* Max no. of vlds_ver_t entries */
6530588217SMike Christensen 
6630588217SMike Christensen /*
6730588217SMike Christensen  * The following are declared so that they are size-invariant.
6830588217SMike Christensen  */
6930588217SMike Christensen 
7030588217SMike Christensen /* String arguments to ioctl */
7130588217SMike Christensen typedef struct vlds_string_arg {
7230588217SMike Christensen 	uint64_t	vlds_strp;
7330588217SMike Christensen 	uint64_t	vlds_strlen;
7430588217SMike Christensen } vlds_string_t;
7530588217SMike Christensen 
7630588217SMike Christensen /* Version array (used by VLDS_SVC_REG) */
7730588217SMike Christensen typedef struct vlds_ver {
7830588217SMike Christensen 	uint16_t	vlds_major;
7930588217SMike Christensen 	uint16_t	vlds_minor;
8030588217SMike Christensen } vlds_ver_t;
8130588217SMike Christensen 
8230588217SMike Christensen /* Capability structure (used by VLDS_SVC_REG) */
8330588217SMike Christensen typedef struct vlds_cap {
8430588217SMike Christensen 	vlds_string_t	vlds_service;
8530588217SMike Christensen 	uint64_t	vlds_nver;
8630588217SMike Christensen 	uint64_t	vlds_versp;
8730588217SMike Christensen } vlds_cap_t;
8830588217SMike Christensen 
8930588217SMike Christensen /*
9030588217SMike Christensen  * VLDS_SVC_REG
9130588217SMike Christensen  */
9230588217SMike Christensen typedef struct vlds_svc_reg_arg {
9330588217SMike Christensen 	uint64_t	vlds_hdlp;	/* DS Service Handle ptr. (returned) */
9430588217SMike Christensen 	uint64_t	vlds_capp;	/* DS Capability Structure ptr. */
9530588217SMike Christensen 	uint64_t	vlds_reg_flags;	/* DS reg flags */
9630588217SMike Christensen } vlds_svc_reg_arg_t;
9730588217SMike Christensen 
9830588217SMike Christensen /*
9930588217SMike Christensen  * VLDS_UNREG_HDL
10030588217SMike Christensen  */
10130588217SMike Christensen typedef struct vlds_unreg_hdl_arg {
10230588217SMike Christensen 	uint64_t	vlds_hdl;	/* DS Service Handle */
10330588217SMike Christensen } vlds_unreg_hdl_arg_t;
10430588217SMike Christensen 
10530588217SMike Christensen /*
10630588217SMike Christensen  * VLDS_DMN_LOOKUP
10730588217SMike Christensen  */
10830588217SMike Christensen typedef struct vlds_dmn_lookup_arg {
10930588217SMike Christensen 	uint64_t	vlds_hdl;	/* DS Service Handle */
11030588217SMike Christensen 	uint64_t	vlds_dhdlp;	/* DS Domain hdl ptr. (returned) */
11130588217SMike Christensen } vlds_dmn_lookup_arg_t;
11230588217SMike Christensen 
11330588217SMike Christensen /*
11430588217SMike Christensen  * VLDS_HDL_LOOKUP
11530588217SMike Christensen  */
11630588217SMike Christensen typedef struct vlds_hdl_lookup_arg {
11730588217SMike Christensen 	vlds_string_t	vlds_service;	/* DS Service Name */
11830588217SMike Christensen 	uint64_t	vlds_isclient;	/* DS Client flag */
11930588217SMike Christensen 	uint64_t	vlds_hdlsp;	/* DS Handle array ptr */
12030588217SMike Christensen 	uint64_t	vlds_maxhdls;	/* DS Max no. of hdls to return */
12130588217SMike Christensen 	uint64_t	vlds_nhdlsp;	/* DS No. of hdls returned */
12230588217SMike Christensen } vlds_hdl_lookup_arg_t;
12330588217SMike Christensen 
12430588217SMike Christensen /*
12530588217SMike Christensen  * VLDS_SEND_MSG
12630588217SMike Christensen  */
12730588217SMike Christensen typedef struct vlds_send_msg_arg {
12830588217SMike Christensen 	uint64_t	vlds_hdl;	/* DS Service Handle */
12930588217SMike Christensen 	uint64_t	vlds_bufp;	/* buffer */
13030588217SMike Christensen 	uint64_t	vlds_buflen;	/* message length/buffer size */
13130588217SMike Christensen } vlds_send_msg_arg_t;
13230588217SMike Christensen 
13330588217SMike Christensen /*
13430588217SMike Christensen  * VLDS_RECV_MSG
13530588217SMike Christensen  */
13630588217SMike Christensen typedef struct vlds_recv_msg_arg {
13730588217SMike Christensen 	uint64_t	vlds_hdl;	/* DS Service Handle */
13830588217SMike Christensen 	uint64_t	vlds_bufp;	/* buffer */
13930588217SMike Christensen 	uint64_t	vlds_buflen;	/* message length/buffer size */
14030588217SMike Christensen 	uint64_t	vlds_msglenp;	/* ptr to returned message length */
14130588217SMike Christensen } vlds_recv_msg_arg_t;
14230588217SMike Christensen 
14330588217SMike Christensen /*
14430588217SMike Christensen  * VLDS_HDL_ISREADY
14530588217SMike Christensen  */
14630588217SMike Christensen typedef struct vlds_hdl_isready_arg {
14730588217SMike Christensen 	uint64_t	vlds_hdl;	/* DS Service Handle */
14830588217SMike Christensen 	uint64_t	vlds_isreadyp;	/* Ptr to isready flag */
14930588217SMike Christensen } vlds_hdl_isready_arg_t;
15030588217SMike Christensen 
15130588217SMike Christensen /*
15230588217SMike Christensen  * VLDS_DOM_NAM2HDL
15330588217SMike Christensen  */
15430588217SMike Christensen typedef struct vlds_dom_nam2hdl_arg {
15530588217SMike Christensen 	vlds_string_t	vlds_domain_name; /* Domain Name string */
15630588217SMike Christensen 	uint64_t	vlds_dhdlp;	/* ptr to returned Domain Handle */
15730588217SMike Christensen } vlds_dom_nam2hdl_arg_t;
15830588217SMike Christensen 
15930588217SMike Christensen /*
16030588217SMike Christensen  * VLDS_DOM_HDL2NAM
16130588217SMike Christensen  */
16230588217SMike Christensen typedef struct vlds_dom_hdl2nam_arg {
16330588217SMike Christensen 	uint64_t	vlds_dhdl;	/* Domain Handle */
16430588217SMike Christensen 	vlds_string_t	vlds_domain_name; /* returned Domain Name string */
16530588217SMike Christensen } vlds_dom_hdl2nam_arg_t;
16630588217SMike Christensen 
16730588217SMike Christensen /*
16830588217SMike Christensen  * Machine Description Constants for vlds driver.
16930588217SMike Christensen  */
170*a600f50dSMike Christensen #define	VLDS_MD_VIRT_DEV_NAME	"virtual-device"
171*a600f50dSMike Christensen #define	VLDS_MD_VIRT_ROOT_NAME	"virtual-domain-service"
172*a600f50dSMike Christensen #define	VLDS_MD_DOMAIN_HDL	"vlds-domain-handle"
173*a600f50dSMike Christensen #define	VLDS_MD_DOMAIN_NAME	"vlds-domain-name"
174*a600f50dSMike Christensen #define	VLDS_MD_VIRT_PORT_NAME	"virtual-device-port"
175*a600f50dSMike Christensen #define	VLDS_MD_REM_DOMAIN_HDL	"vlds-remote-domain-handle"
176*a600f50dSMike Christensen #define	VLDS_MD_REM_DOMAIN_NAME	"vlds-remote-domain-name"
17730588217SMike Christensen 
17830588217SMike Christensen /*
17930588217SMike Christensen  * VLDS Sysevent defines.
18030588217SMike Christensen  * VLDS System Event Channel names are of the form:
18130588217SMike Christensen  *    sun.com:vlds:pid<pid_number>
18230588217SMike Christensen  */
18330588217SMike Christensen #define	VLDS_SYSEV_CHAN_FMT		"sun.com:vlds:pid%06d"
18430588217SMike Christensen #define	VLDS_SYSEV_MAX_CHAN_NAME	32
18530588217SMike Christensen 
18630588217SMike Christensen #define	EC_VLDS		"EC_vlds"	/* LDOMS Domain Services event class */
18730588217SMike Christensen 
18830588217SMike Christensen /*
18930588217SMike Christensen  * EC_VLDS subclass definitions - supporting attributes (name/value pairs) are
19030588217SMike Christensen  * found in sys/sysevent/vlds.h
19130588217SMike Christensen  */
19230588217SMike Christensen #define	ESC_VLDS_REGISTER	"ESC_VLDS_register"
19330588217SMike Christensen #define	ESC_VLDS_UNREGISTER	"ESC_VLDS_unregister"
19430588217SMike Christensen #define	ESC_VLDS_DATA		"ESC_VLDS_data"
19530588217SMike Christensen 
19630588217SMike Christensen /*
19730588217SMike Christensen  * Event type EC_VLDS
19830588217SMike Christensen  *	Event Class	- EC_VLDS
19930588217SMike Christensen  *	Event Sub-Class	- ESC_VLDS_REGISTER
20030588217SMike Christensen  *	Event Publisher	- SUNW:kern:[ds_module_name]
20130588217SMike Christensen  *	Attribute Name	- VLDS_HDL
20230588217SMike Christensen  *	Attribute Type  - SE_DATA_TYPE_UINT64
20330588217SMike Christensen  *	Attribute Value	- [Domain Service Handle]
20430588217SMike Christensen  *	Attribute Name	- VLDS_VER_MAJOR
20530588217SMike Christensen  *	Attribute Type	- SE_DATA_TYPE_UINT16
20630588217SMike Christensen  *	Attribute Value	- [major version of the DS interface]
20730588217SMike Christensen  *	Attribute Name	- VLDS_VER_MINOR
20830588217SMike Christensen  *	Attribute Type	- SE_DATA_TYPE_UINT16
20930588217SMike Christensen  *	Attribute Value	- [minor version of the DS interface]
21030588217SMike Christensen  *	Attribute Name	- VLDS_DOMAIN_HDL
21130588217SMike Christensen  *	Attribute Type	- SE_DATA_TYPE_UINT64
21230588217SMike Christensen  *	Attribute Value	- [Domain handle of registered service]
21330588217SMike Christensen  *	Attribute Name	- VLDS_SERVICE_ID
21430588217SMike Christensen  *	Attribute Type	- SE_DATA_TYPE_STRING
21530588217SMike Christensen  *	Attribute Value	- [Service name of registered service]
21630588217SMike Christensen  *	Attribute Name	- VLDS_ISCLIENT
21730588217SMike Christensen  *	Attribute Type	- SE_DATA_TYPE_BOOLEAN_VALUE
21830588217SMike Christensen  *	Attribute Value	- [Service is client or provider]
21930588217SMike Christensen  *
22030588217SMike Christensen  *	Event Class	- EC_VLDS
22130588217SMike Christensen  *	Event Sub-Class	- ESC_VLDS_UNREGISTER
22230588217SMike Christensen  *	Event Publisher	- SUNW:kern:[ds_module_name]
22330588217SMike Christensen  *	Attribute Name	- VLDS_HDL
22430588217SMike Christensen  *	Attribute Type  - SE_DATA_TYPE_UINT64
22530588217SMike Christensen  *	Attribute Value	- [Domain Service Handle]
22630588217SMike Christensen  *
22730588217SMike Christensen  *	Event Class	- EC_VLDS
22830588217SMike Christensen  *	Event Sub-Class	- ESC_VLDS_DATA
22930588217SMike Christensen  *	Event Publisher	- SUNW:kern:[ds_module_name]
23030588217SMike Christensen  *	Attribute Name	- VLDS_HDL
23130588217SMike Christensen  *	Attribute Type  - SE_DATA_TYPE_UINT64
23230588217SMike Christensen  *	Attribute Value	- [Domain Service Handle]
23330588217SMike Christensen  *	Attribute Name	- VLDS_DATA
23430588217SMike Christensen  *	Attribute Type  - SE_DATA_TYPE_BYTE_ARRAY
23530588217SMike Christensen  *	Attribute Value	- [Data array passed to user]
23630588217SMike Christensen  */
23730588217SMike Christensen 
23830588217SMike Christensen #define	VLDS_HDL	"vlds_hdl"		/* service handle */
23930588217SMike Christensen #define	VLDS_VER_MAJOR	"vlds_ver_major"	/* major version */
24030588217SMike Christensen #define	VLDS_VER_MINOR	"vlds_ver_minor"	/* minor version */
24130588217SMike Christensen #define	VLDS_DOMAIN_HDL	"vlds_domain_hdl"	/* domain handle */
24230588217SMike Christensen #define	VLDS_SERVICE_ID	"vlds_service_id"	/* service id */
24330588217SMike Christensen #define	VLDS_ISCLIENT	"vlds_isclient"		/* service is client */
24430588217SMike Christensen #define	VLDS_DATA	"vlds_data"		/* data buffer */
24530588217SMike Christensen 
24630588217SMike Christensen #ifdef __cplusplus
24730588217SMike Christensen }
24830588217SMike Christensen #endif
24930588217SMike Christensen 
25030588217SMike Christensen #endif /* _SYS_VLDS_H_ */
251