xref: /onnv-gate/usr/src/uts/common/sys/mdesc.h (revision 962)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
230Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate #ifndef	_MDESC_H_
280Sstevel@tonic-gate #define	_MDESC_H_
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
310Sstevel@tonic-gate 
32*962Stsien #include <sys/types.h>
33*962Stsien 
340Sstevel@tonic-gate #ifdef __cplusplus
350Sstevel@tonic-gate extern "C" {
360Sstevel@tonic-gate #endif
370Sstevel@tonic-gate 
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /*
400Sstevel@tonic-gate  * Each logical domain is detailed via a (Virtual) Machine Description
410Sstevel@tonic-gate  * available to each guest Operating System courtesy of a
420Sstevel@tonic-gate  * Hypervisor service.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate 
460Sstevel@tonic-gate 
470Sstevel@tonic-gate #ifdef	_ASM
480Sstevel@tonic-gate #define	U8(_s)	_s
490Sstevel@tonic-gate #define	U16(_s)	_s
500Sstevel@tonic-gate #define	U32(_s)	_s
510Sstevel@tonic-gate #define	U64(_s)	_s
520Sstevel@tonic-gate #else
530Sstevel@tonic-gate #define	U8(_s)	((uint8_t)(_s))
540Sstevel@tonic-gate #define	U16(_s)	((uint16_t)(_s))
550Sstevel@tonic-gate #define	U32(_s)	((uint32_t)(_s))
560Sstevel@tonic-gate #define	U64(_s)	((uint64_t)(_s))
570Sstevel@tonic-gate #endif
580Sstevel@tonic-gate 
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 
630Sstevel@tonic-gate 	/* the version this library understands */
640Sstevel@tonic-gate 
650Sstevel@tonic-gate #define	MD_HEADER_VERS_OFF	0x0
660Sstevel@tonic-gate #define	MD_HEADER_NODE_OFF	0x4
670Sstevel@tonic-gate #define	MD_HEADER_NAME_OFF	0x8
680Sstevel@tonic-gate #define	MD_HEADER_DATA_OFF	0xc
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	MD_HEADER_SIZE	0x10
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #define	MD_TRANSPORT_VERSION	U32(0x10000)
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #define	MD_ELEMENT_SIZE	0x10
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #define	MDE_ILLEGAL_IDX		U64(-1)
770Sstevel@tonic-gate 
780Sstevel@tonic-gate #define	MDET_LIST_END	U8(0x0)
790Sstevel@tonic-gate #define	MDET_NULL	U8(' ')
800Sstevel@tonic-gate #define	MDET_NODE	U8('N')
810Sstevel@tonic-gate #define	MDET_NODE_END	U8('E')
820Sstevel@tonic-gate #define	MDET_PROP_ARC	U8('a')
830Sstevel@tonic-gate #define	MDET_PROP_VAL	U8('v')
840Sstevel@tonic-gate #define	MDET_PROP_STR	U8('s')
850Sstevel@tonic-gate #define	MDET_PROP_DAT	U8('d')
860Sstevel@tonic-gate 
870Sstevel@tonic-gate 
880Sstevel@tonic-gate #ifndef _ASM	/* { */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate typedef uint64_t mde_cookie_t;
910Sstevel@tonic-gate #define	MDE_INVAL_ELEM_COOKIE	((mde_cookie_t)-1)
920Sstevel@tonic-gate 
930Sstevel@tonic-gate typedef	uint32_t		mde_str_cookie_t;
940Sstevel@tonic-gate #define	MDE_INVAL_STR_COOKIE	((mde_str_cookie_t)-1)
950Sstevel@tonic-gate 
960Sstevel@tonic-gate 
970Sstevel@tonic-gate 	/* Opaque structure for handling in functions */
980Sstevel@tonic-gate typedef void * md_t;
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate extern md_t		*md_init(void *);
1040Sstevel@tonic-gate extern md_t		*md_init_intern(uint64_t *, void*(*)(size_t),
105221Sla135387 				void (*)(void*, size_t));
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate extern int		md_fini(md_t *);
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate extern int		md_node_count(md_t *);
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate extern mde_str_cookie_t md_find_name(md_t *, char *namep);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate extern mde_cookie_t	md_root_node(md_t *);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate extern int		md_scan_dag(md_t *,
1160Sstevel@tonic-gate 				mde_cookie_t,
1170Sstevel@tonic-gate 				mde_str_cookie_t,
1180Sstevel@tonic-gate 				mde_str_cookie_t,
1190Sstevel@tonic-gate 				mde_cookie_t *);
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate extern int		md_get_prop_val(md_t *,
1220Sstevel@tonic-gate 				mde_cookie_t,
1230Sstevel@tonic-gate 				char *,
1240Sstevel@tonic-gate 				uint64_t *);
1250Sstevel@tonic-gate 
1260Sstevel@tonic-gate extern int		md_get_prop_str(md_t *,
1270Sstevel@tonic-gate 				mde_cookie_t,
1280Sstevel@tonic-gate 				char *,
1290Sstevel@tonic-gate 				char **);
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate extern int		md_get_prop_data(md_t *,
1320Sstevel@tonic-gate 				mde_cookie_t,
1330Sstevel@tonic-gate 				char *,
1340Sstevel@tonic-gate 				uint8_t **,
1350Sstevel@tonic-gate 				int *);
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate #endif	/* } _ASM */
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate 
1430Sstevel@tonic-gate /*
1440Sstevel@tonic-gate  * ioctl info for mdesc device
1450Sstevel@tonic-gate  */
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate #define	MDESCIOC	('m' << 24 | 'd' << 16 | 'd' << 8)
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate #define	MDESCIOCGSZ	(MDESCIOC | 1)   /* Get quote buffer size */
1500Sstevel@tonic-gate #define	MDESCIOCSSZ	(MDESCIOC | 2)   /* Set new quote buffer size */
1510Sstevel@tonic-gate #define	MDESCIOCDISCARD	(MDESCIOC | 3)   /* Discard quotes and reset */
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate 
1540Sstevel@tonic-gate #ifdef __cplusplus
1550Sstevel@tonic-gate }
1560Sstevel@tonic-gate #endif
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate #endif	/* _MDESC_H_ */
159