xref: /onnv-gate/usr/src/uts/common/sys/mdesc.h (revision 221:d5626b06daab)
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 
320Sstevel@tonic-gate #ifdef __cplusplus
330Sstevel@tonic-gate extern "C" {
340Sstevel@tonic-gate #endif
350Sstevel@tonic-gate 
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * Each logical domain is detailed via a (Virtual) Machine Description
390Sstevel@tonic-gate  * available to each guest Operating System courtesy of a
400Sstevel@tonic-gate  * Hypervisor service.
410Sstevel@tonic-gate  */
420Sstevel@tonic-gate 
430Sstevel@tonic-gate 
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #ifdef	_ASM
460Sstevel@tonic-gate #define	U8(_s)	_s
470Sstevel@tonic-gate #define	U16(_s)	_s
480Sstevel@tonic-gate #define	U32(_s)	_s
490Sstevel@tonic-gate #define	U64(_s)	_s
500Sstevel@tonic-gate #else
510Sstevel@tonic-gate #define	U8(_s)	((uint8_t)(_s))
520Sstevel@tonic-gate #define	U16(_s)	((uint16_t)(_s))
530Sstevel@tonic-gate #define	U32(_s)	((uint32_t)(_s))
540Sstevel@tonic-gate #define	U64(_s)	((uint64_t)(_s))
550Sstevel@tonic-gate #endif
560Sstevel@tonic-gate 
570Sstevel@tonic-gate 
580Sstevel@tonic-gate 
590Sstevel@tonic-gate 
600Sstevel@tonic-gate 
610Sstevel@tonic-gate 	/* the version this library understands */
620Sstevel@tonic-gate 
630Sstevel@tonic-gate #define	MD_HEADER_VERS_OFF	0x0
640Sstevel@tonic-gate #define	MD_HEADER_NODE_OFF	0x4
650Sstevel@tonic-gate #define	MD_HEADER_NAME_OFF	0x8
660Sstevel@tonic-gate #define	MD_HEADER_DATA_OFF	0xc
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #define	MD_HEADER_SIZE	0x10
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #define	MD_TRANSPORT_VERSION	U32(0x10000)
710Sstevel@tonic-gate 
720Sstevel@tonic-gate #define	MD_ELEMENT_SIZE	0x10
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #define	MDE_ILLEGAL_IDX		U64(-1)
750Sstevel@tonic-gate 
760Sstevel@tonic-gate #define	MDET_LIST_END	U8(0x0)
770Sstevel@tonic-gate #define	MDET_NULL	U8(' ')
780Sstevel@tonic-gate #define	MDET_NODE	U8('N')
790Sstevel@tonic-gate #define	MDET_NODE_END	U8('E')
800Sstevel@tonic-gate #define	MDET_PROP_ARC	U8('a')
810Sstevel@tonic-gate #define	MDET_PROP_VAL	U8('v')
820Sstevel@tonic-gate #define	MDET_PROP_STR	U8('s')
830Sstevel@tonic-gate #define	MDET_PROP_DAT	U8('d')
840Sstevel@tonic-gate 
850Sstevel@tonic-gate 
860Sstevel@tonic-gate #ifndef _ASM	/* { */
870Sstevel@tonic-gate 
880Sstevel@tonic-gate typedef uint64_t mde_cookie_t;
890Sstevel@tonic-gate #define	MDE_INVAL_ELEM_COOKIE	((mde_cookie_t)-1)
900Sstevel@tonic-gate 
910Sstevel@tonic-gate typedef	uint32_t		mde_str_cookie_t;
920Sstevel@tonic-gate #define	MDE_INVAL_STR_COOKIE	((mde_str_cookie_t)-1)
930Sstevel@tonic-gate 
940Sstevel@tonic-gate 
950Sstevel@tonic-gate 	/* Opaque structure for handling in functions */
960Sstevel@tonic-gate typedef void * md_t;
970Sstevel@tonic-gate 
980Sstevel@tonic-gate 
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate extern md_t		*md_init(void *);
1020Sstevel@tonic-gate extern md_t		*md_init_intern(uint64_t *, void*(*)(size_t),
103*221Sla135387 				void (*)(void*, size_t));
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate extern int		md_fini(md_t *);
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate extern int		md_node_count(md_t *);
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate extern mde_str_cookie_t md_find_name(md_t *, char *namep);
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate extern mde_cookie_t	md_root_node(md_t *);
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate extern int		md_scan_dag(md_t *,
1140Sstevel@tonic-gate 				mde_cookie_t,
1150Sstevel@tonic-gate 				mde_str_cookie_t,
1160Sstevel@tonic-gate 				mde_str_cookie_t,
1170Sstevel@tonic-gate 				mde_cookie_t *);
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate extern int		md_get_prop_val(md_t *,
1200Sstevel@tonic-gate 				mde_cookie_t,
1210Sstevel@tonic-gate 				char *,
1220Sstevel@tonic-gate 				uint64_t *);
1230Sstevel@tonic-gate 
1240Sstevel@tonic-gate extern int		md_get_prop_str(md_t *,
1250Sstevel@tonic-gate 				mde_cookie_t,
1260Sstevel@tonic-gate 				char *,
1270Sstevel@tonic-gate 				char **);
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate extern int		md_get_prop_data(md_t *,
1300Sstevel@tonic-gate 				mde_cookie_t,
1310Sstevel@tonic-gate 				char *,
1320Sstevel@tonic-gate 				uint8_t **,
1330Sstevel@tonic-gate 				int *);
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate #endif	/* } _ASM */
1380Sstevel@tonic-gate 
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate 
1410Sstevel@tonic-gate /*
1420Sstevel@tonic-gate  * ioctl info for mdesc device
1430Sstevel@tonic-gate  */
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate #define	MDESCIOC	('m' << 24 | 'd' << 16 | 'd' << 8)
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate #define	MDESCIOCGSZ	(MDESCIOC | 1)   /* Get quote buffer size */
1480Sstevel@tonic-gate #define	MDESCIOCSSZ	(MDESCIOC | 2)   /* Set new quote buffer size */
1490Sstevel@tonic-gate #define	MDESCIOCDISCARD	(MDESCIOC | 3)   /* Discard quotes and reset */
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate 
1520Sstevel@tonic-gate #ifdef __cplusplus
1530Sstevel@tonic-gate }
1540Sstevel@tonic-gate #endif
1550Sstevel@tonic-gate 
1560Sstevel@tonic-gate #endif	/* _MDESC_H_ */
157