17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
525cf1a30Sjl  * Common Development and Distribution License (the "License").
625cf1a30Sjl  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*fc0105deSJames Anderson  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
2325cf1a30Sjl  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_RSRC_INFO_H
277c478bd9Sstevel@tonic-gate #define	_RSRC_INFO_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <libnvpair.h>
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Request flags
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #define	RI_INCLUDE_QUERY	0x01
397c478bd9Sstevel@tonic-gate #define	RI_INCLUDE_UNMANAGED	0x02
407c478bd9Sstevel@tonic-gate #define	RI_FORCE		0x04
417c478bd9Sstevel@tonic-gate #define	RI_VERBOSE		0x08
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Error codes
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate #define	RI_SUCCESS		0	/* No error */
477c478bd9Sstevel@tonic-gate #define	RI_FAILURE		1	/* Internal error */
487c478bd9Sstevel@tonic-gate #define	RI_INVAL		2	/* Invalid argument */
497c478bd9Sstevel@tonic-gate #define	RI_NOTSUP		3	/* Unsupported request */
507c478bd9Sstevel@tonic-gate 
517c478bd9Sstevel@tonic-gate /*
527c478bd9Sstevel@tonic-gate  * Attachment point properties
537c478bd9Sstevel@tonic-gate  *
547c478bd9Sstevel@tonic-gate  * 	Name	- RI_AP_REQ_ID
557c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	RI_AP_REQ_ID	"ri.ap_req_id"
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * CPU properties
617c478bd9Sstevel@tonic-gate  *
627c478bd9Sstevel@tonic-gate  * 	Name	- RI_CPU_ID
637c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
647c478bd9Sstevel@tonic-gate  * 	Name	- RI_CPU_STATE
657c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
667c478bd9Sstevel@tonic-gate  * 	Name	- RI_CPU_SPEED
677c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
687c478bd9Sstevel@tonic-gate  * 	Name	- RI_CPU_ECACHE
697c478bd9Sstevel@tonic-gate  * 	Value 	_ DATA_TYPE_INT32
70*fc0105deSJames Anderson  * 	Name	- RI_CPU_ECACHE_KBYTE
71*fc0105deSJames Anderson  * 	Value 	_ DATA_TYPE_INT32
727c478bd9Sstevel@tonic-gate  */
737c478bd9Sstevel@tonic-gate #define	RI_CPU_ID	"ri.cpu_id"
747c478bd9Sstevel@tonic-gate #define	RI_CPU_STATE	"ri.cpu_state"
757c478bd9Sstevel@tonic-gate #define	RI_CPU_SPEED	"ri.cpu_speed"
767c478bd9Sstevel@tonic-gate #define	RI_CPU_ECACHE	"ri.cpu_ecache"
77*fc0105deSJames Anderson #define	RI_CPU_ECACHE_KBYTE "ri.cpu_ecache_kbyte"
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate /*
807c478bd9Sstevel@tonic-gate  * Memory properties
817c478bd9Sstevel@tonic-gate  *
827c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_BRD
837c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
847c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_PERM
857c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
867c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_ADDR
877c478bd9Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_INT32
887c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_DOMAIN
897c478bd9Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_INT32
907c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_TARG
917c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
927c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_SRC
937c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
947c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_DEL
957c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
967c478bd9Sstevel@tonic-gate  * 	Name	- RI_MEM_REMAIN
977c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate #define	RI_MEM_BRD	"ri.mem_brd"
1007c478bd9Sstevel@tonic-gate #define	RI_MEM_PERM	"ri.mem_perm"
1017c478bd9Sstevel@tonic-gate #define	RI_MEM_ADDR	"ri.mem_addr"
1027c478bd9Sstevel@tonic-gate #define	RI_MEM_DOMAIN	"ri.mem_domain"
1037c478bd9Sstevel@tonic-gate #define	RI_MEM_TARG	"ri.mem_targ"
1047c478bd9Sstevel@tonic-gate #define	RI_MEM_SRC	"ri.mem_src"
1057c478bd9Sstevel@tonic-gate #define	RI_MEM_DEL	"ri.mem_del"
1067c478bd9Sstevel@tonic-gate #define	RI_MEM_REMAIN	"ri.mem_rem"
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate /*
1097c478bd9Sstevel@tonic-gate  * IO device properties
1107c478bd9Sstevel@tonic-gate  *
1117c478bd9Sstevel@tonic-gate  * 	Name	- RI_IO_DRV_INST
1127c478bd9Sstevel@tonic-gate  * 	Value 	- DATA_TYPE_STRING
1137c478bd9Sstevel@tonic-gate  */
1147c478bd9Sstevel@tonic-gate #define	RI_IO_DRV_INST	"ri.io_drv_inst"
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * RCM client usage properties
1187c478bd9Sstevel@tonic-gate  *
1197c478bd9Sstevel@tonic-gate  * 	Name	- RI_CLIENT_RSRC
1207c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1217c478bd9Sstevel@tonic-gate  * 	Name	- RI_CLIENT_USAGE
1227c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1237c478bd9Sstevel@tonic-gate  * 	Name	- RI_QUERY_STATE
1247c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_INT32
1257c478bd9Sstevel@tonic-gate  * 	Name	- RI_QUERY_ERR
1267c478bd9Sstevel@tonic-gate  * 	Value	- DATA_TYPE_STRING
1277c478bd9Sstevel@tonic-gate  */
1287c478bd9Sstevel@tonic-gate #define	RI_CLIENT_RSRC	"ri.client_rsrc"
1297c478bd9Sstevel@tonic-gate #define	RI_CLIENT_USAGE	"ri.client_usage"
1307c478bd9Sstevel@tonic-gate #define	RI_QUERY_STATE	"ri.query_state"
1317c478bd9Sstevel@tonic-gate #define	RI_QUERY_ERR	"ri.query_err"
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate /*
1347c478bd9Sstevel@tonic-gate  * Query states
1357c478bd9Sstevel@tonic-gate  */
1367c478bd9Sstevel@tonic-gate #define	RI_QUERY_UNKNOWN	-1
1377c478bd9Sstevel@tonic-gate #define	RI_QUERY_OK		0
1387c478bd9Sstevel@tonic-gate #define	RI_QUERY_FAIL		1
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate typedef	struct ri_hdl ri_hdl_t;
1417c478bd9Sstevel@tonic-gate typedef struct ri_ap ri_ap_t;
1427c478bd9Sstevel@tonic-gate typedef struct ri_dev ri_dev_t;
1437c478bd9Sstevel@tonic-gate typedef struct ri_client ri_client_t;
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate #ifdef SMSLIB_TARGET
1467c478bd9Sstevel@tonic-gate int		ri_init(uint_t, int, char **, int, ri_hdl_t **);
1477c478bd9Sstevel@tonic-gate #else
1487c478bd9Sstevel@tonic-gate int		ri_init(int, char **, int, ri_hdl_t **);
1497c478bd9Sstevel@tonic-gate #endif /* SMSLIB_TARGET */
15025cf1a30Sjl int		ri_pack(ri_hdl_t *, caddr_t *, size_t *, int encoding);
1517c478bd9Sstevel@tonic-gate int		ri_unpack(caddr_t, size_t, ri_hdl_t **);
1527c478bd9Sstevel@tonic-gate void		ri_fini(ri_hdl_t *);
1537c478bd9Sstevel@tonic-gate ri_ap_t		*ri_ap_next(ri_hdl_t *, ri_ap_t *);
1547c478bd9Sstevel@tonic-gate nvlist_t	*ri_ap_conf_props(ri_ap_t *);
1557c478bd9Sstevel@tonic-gate ri_dev_t	*ri_cpu_next(ri_ap_t *, ri_dev_t *);
1567c478bd9Sstevel@tonic-gate ri_dev_t	*ri_mem_next(ri_ap_t *, ri_dev_t *);
1577c478bd9Sstevel@tonic-gate ri_dev_t	*ri_io_next(ri_ap_t *, ri_dev_t *);
1587c478bd9Sstevel@tonic-gate nvlist_t	*ri_dev_conf_props(ri_dev_t *);
1597c478bd9Sstevel@tonic-gate ri_client_t	*ri_client_next(ri_dev_t *, ri_client_t *);
1607c478bd9Sstevel@tonic-gate nvlist_t	*ri_client_usage_props(ri_client_t *);
1617c478bd9Sstevel@tonic-gate nvlist_t	*ri_client_verbose_props(ri_client_t *);
1627c478bd9Sstevel@tonic-gate ri_client_t	*ri_cpu_cap_client_next(ri_hdl_t *, ri_client_t *);
1637c478bd9Sstevel@tonic-gate ri_client_t	*ri_mem_cap_client_next(ri_hdl_t *, ri_client_t *);
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1667c478bd9Sstevel@tonic-gate }
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #endif	/* _RSRC_INFO_H */
170