xref: /onnv-gate/usr/src/cmd/dcs/sparc/sun4u/rsrc_info.h (revision 9739:6d565cf1d9cc)
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
51772Sjl139090  * Common Development and Distribution License (the "License").
61772Sjl139090  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*9739SJames.Anderson@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
231772Sjl139090  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_RSRC_INFO_H
270Sstevel@tonic-gate #define	_RSRC_INFO_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <libnvpair.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Request flags
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate #define	RI_INCLUDE_QUERY	0x01
390Sstevel@tonic-gate #define	RI_INCLUDE_UNMANAGED	0x02
400Sstevel@tonic-gate #define	RI_FORCE		0x04
410Sstevel@tonic-gate #define	RI_VERBOSE		0x08
420Sstevel@tonic-gate 
430Sstevel@tonic-gate /*
440Sstevel@tonic-gate  * Error codes
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate #define	RI_SUCCESS		0	/* No error */
470Sstevel@tonic-gate #define	RI_FAILURE		1	/* Internal error */
480Sstevel@tonic-gate #define	RI_INVAL		2	/* Invalid argument */
490Sstevel@tonic-gate #define	RI_NOTSUP		3	/* Unsupported request */
500Sstevel@tonic-gate 
510Sstevel@tonic-gate /*
520Sstevel@tonic-gate  * Attachment point properties
530Sstevel@tonic-gate  *
540Sstevel@tonic-gate  * 	Name	- RI_AP_REQ_ID
550Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
560Sstevel@tonic-gate  */
570Sstevel@tonic-gate #define	RI_AP_REQ_ID	"ri.ap_req_id"
580Sstevel@tonic-gate 
590Sstevel@tonic-gate /*
600Sstevel@tonic-gate  * CPU properties
610Sstevel@tonic-gate  *
620Sstevel@tonic-gate  * 	Name	- RI_CPU_ID
630Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
640Sstevel@tonic-gate  * 	Name	- RI_CPU_STATE
650Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
660Sstevel@tonic-gate  * 	Name	- RI_CPU_SPEED
670Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
680Sstevel@tonic-gate  * 	Name	- RI_CPU_ECACHE
690Sstevel@tonic-gate  * 	Value 	_ DATA_TYPE_INT32
70*9739SJames.Anderson@Sun.COM  * 	Name	- RI_CPU_ECACHE_KBYTE
71*9739SJames.Anderson@Sun.COM  * 	Value 	_ DATA_TYPE_INT32
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate #define	RI_CPU_ID	"ri.cpu_id"
740Sstevel@tonic-gate #define	RI_CPU_STATE	"ri.cpu_state"
750Sstevel@tonic-gate #define	RI_CPU_SPEED	"ri.cpu_speed"
760Sstevel@tonic-gate #define	RI_CPU_ECACHE	"ri.cpu_ecache"
77*9739SJames.Anderson@Sun.COM #define	RI_CPU_ECACHE_KBYTE "ri.cpu_ecache_kbyte"
780Sstevel@tonic-gate 
790Sstevel@tonic-gate /*
800Sstevel@tonic-gate  * Memory properties
810Sstevel@tonic-gate  *
820Sstevel@tonic-gate  * 	Name	- RI_MEM_BRD
830Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
840Sstevel@tonic-gate  * 	Name	- RI_MEM_PERM
850Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
860Sstevel@tonic-gate  * 	Name	- RI_MEM_ADDR
870Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_INT32
880Sstevel@tonic-gate  * 	Name	- RI_MEM_DOMAIN
890Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_INT32
900Sstevel@tonic-gate  * 	Name	- RI_MEM_TARG
910Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
920Sstevel@tonic-gate  * 	Name	- RI_MEM_SRC
930Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
940Sstevel@tonic-gate  * 	Name	- RI_MEM_DEL
950Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
960Sstevel@tonic-gate  * 	Name	- RI_MEM_REMAIN
970Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
980Sstevel@tonic-gate  */
990Sstevel@tonic-gate #define	RI_MEM_BRD	"ri.mem_brd"
1000Sstevel@tonic-gate #define	RI_MEM_PERM	"ri.mem_perm"
1010Sstevel@tonic-gate #define	RI_MEM_ADDR	"ri.mem_addr"
1020Sstevel@tonic-gate #define	RI_MEM_DOMAIN	"ri.mem_domain"
1030Sstevel@tonic-gate #define	RI_MEM_TARG	"ri.mem_targ"
1040Sstevel@tonic-gate #define	RI_MEM_SRC	"ri.mem_src"
1050Sstevel@tonic-gate #define	RI_MEM_DEL	"ri.mem_del"
1060Sstevel@tonic-gate #define	RI_MEM_REMAIN	"ri.mem_rem"
1070Sstevel@tonic-gate 
1080Sstevel@tonic-gate /*
1090Sstevel@tonic-gate  * IO device properties
1100Sstevel@tonic-gate  *
1110Sstevel@tonic-gate  * 	Name	- RI_IO_DRV_INST
1120Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_STRING
1130Sstevel@tonic-gate  */
1140Sstevel@tonic-gate #define	RI_IO_DRV_INST	"ri.io_drv_inst"
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate /*
1170Sstevel@tonic-gate  * RCM client usage properties
1180Sstevel@tonic-gate  *
1190Sstevel@tonic-gate  * 	Name	- RI_CLIENT_RSRC
1200Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1210Sstevel@tonic-gate  * 	Name	- RI_CLIENT_USAGE
1220Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1230Sstevel@tonic-gate  * 	Name	- RI_QUERY_STATE
1240Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
1250Sstevel@tonic-gate  * 	Name	- RI_QUERY_ERR
1260Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1270Sstevel@tonic-gate  */
1280Sstevel@tonic-gate #define	RI_CLIENT_RSRC	"ri.client_rsrc"
1290Sstevel@tonic-gate #define	RI_CLIENT_USAGE	"ri.client_usage"
1300Sstevel@tonic-gate #define	RI_QUERY_STATE	"ri.query_state"
1310Sstevel@tonic-gate #define	RI_QUERY_ERR	"ri.query_err"
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate /*
1340Sstevel@tonic-gate  * Query states
1350Sstevel@tonic-gate  */
1360Sstevel@tonic-gate #define	RI_QUERY_UNKNOWN	-1
1370Sstevel@tonic-gate #define	RI_QUERY_OK		0
1380Sstevel@tonic-gate #define	RI_QUERY_FAIL		1
1390Sstevel@tonic-gate 
1400Sstevel@tonic-gate typedef	struct ri_hdl ri_hdl_t;
1410Sstevel@tonic-gate typedef struct ri_ap ri_ap_t;
1420Sstevel@tonic-gate typedef struct ri_dev ri_dev_t;
1430Sstevel@tonic-gate typedef struct ri_client ri_client_t;
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate #ifdef SMSLIB_TARGET
1460Sstevel@tonic-gate int		ri_init(uint_t, int, char **, int, ri_hdl_t **);
1470Sstevel@tonic-gate #else
1480Sstevel@tonic-gate int		ri_init(int, char **, int, ri_hdl_t **);
1490Sstevel@tonic-gate #endif /* SMSLIB_TARGET */
1501772Sjl139090 int		ri_pack(ri_hdl_t *, caddr_t *, size_t *, int encoding);
1510Sstevel@tonic-gate int		ri_unpack(caddr_t, size_t, ri_hdl_t **);
1520Sstevel@tonic-gate void		ri_fini(ri_hdl_t *);
1530Sstevel@tonic-gate ri_ap_t		*ri_ap_next(ri_hdl_t *, ri_ap_t *);
1540Sstevel@tonic-gate nvlist_t	*ri_ap_conf_props(ri_ap_t *);
1550Sstevel@tonic-gate ri_dev_t	*ri_cpu_next(ri_ap_t *, ri_dev_t *);
1560Sstevel@tonic-gate ri_dev_t	*ri_mem_next(ri_ap_t *, ri_dev_t *);
1570Sstevel@tonic-gate ri_dev_t	*ri_io_next(ri_ap_t *, ri_dev_t *);
1580Sstevel@tonic-gate nvlist_t	*ri_dev_conf_props(ri_dev_t *);
1590Sstevel@tonic-gate ri_client_t	*ri_client_next(ri_dev_t *, ri_client_t *);
1600Sstevel@tonic-gate nvlist_t	*ri_client_usage_props(ri_client_t *);
1610Sstevel@tonic-gate nvlist_t	*ri_client_verbose_props(ri_client_t *);
1620Sstevel@tonic-gate ri_client_t	*ri_cpu_cap_client_next(ri_hdl_t *, ri_client_t *);
1630Sstevel@tonic-gate ri_client_t	*ri_mem_cap_client_next(ri_hdl_t *, ri_client_t *);
1640Sstevel@tonic-gate 
1650Sstevel@tonic-gate #ifdef	__cplusplus
1660Sstevel@tonic-gate }
1670Sstevel@tonic-gate #endif
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate #endif	/* _RSRC_INFO_H */
170