1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_RSRC_INFO_H
28 #define	_RSRC_INFO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <libnvpair.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Request flags
40  */
41 #define	RI_INCLUDE_QUERY	0x01
42 #define	RI_INCLUDE_UNMANAGED	0x02
43 #define	RI_FORCE		0x04
44 #define	RI_VERBOSE		0x08
45 
46 /*
47  * Error codes
48  */
49 #define	RI_SUCCESS		0	/* No error */
50 #define	RI_FAILURE		1	/* Internal error */
51 #define	RI_INVAL		2	/* Invalid argument */
52 #define	RI_NOTSUP		3	/* Unsupported request */
53 
54 /*
55  * Attachment point properties
56  *
57  * 	Name	- RI_AP_REQ_ID
58  * 	Value	- DATA_TYPE_STRING
59  */
60 #define	RI_AP_REQ_ID	"ri.ap_req_id"
61 
62 /*
63  * CPU properties
64  *
65  * 	Name	- RI_CPU_ID
66  * 	Value	- DATA_TYPE_INT32
67  * 	Name	- RI_CPU_STATE
68  * 	Value	- DATA_TYPE_STRING
69  * 	Name	- RI_CPU_SPEED
70  * 	Value	- DATA_TYPE_INT32
71  * 	Name	- RI_CPU_ECACHE
72  * 	Value 	_ DATA_TYPE_INT32
73  */
74 #define	RI_CPU_ID	"ri.cpu_id"
75 #define	RI_CPU_STATE	"ri.cpu_state"
76 #define	RI_CPU_SPEED	"ri.cpu_speed"
77 #define	RI_CPU_ECACHE	"ri.cpu_ecache"
78 
79 /*
80  * Memory properties
81  *
82  * 	Name	- RI_MEM_BRD
83  * 	Value	- DATA_TYPE_INT32
84  * 	Name	- RI_MEM_PERM
85  * 	Value	- DATA_TYPE_INT32
86  * 	Name	- RI_MEM_ADDR
87  * 	Value 	- DATA_TYPE_INT32
88  * 	Name	- RI_MEM_DOMAIN
89  * 	Value 	- DATA_TYPE_INT32
90  * 	Name	- RI_MEM_TARG
91  * 	Value	- DATA_TYPE_STRING
92  * 	Name	- RI_MEM_SRC
93  * 	Value	- DATA_TYPE_STRING
94  * 	Name	- RI_MEM_DEL
95  * 	Value	- DATA_TYPE_INT32
96  * 	Name	- RI_MEM_REMAIN
97  * 	Value	- DATA_TYPE_INT32
98  */
99 #define	RI_MEM_BRD	"ri.mem_brd"
100 #define	RI_MEM_PERM	"ri.mem_perm"
101 #define	RI_MEM_ADDR	"ri.mem_addr"
102 #define	RI_MEM_DOMAIN	"ri.mem_domain"
103 #define	RI_MEM_TARG	"ri.mem_targ"
104 #define	RI_MEM_SRC	"ri.mem_src"
105 #define	RI_MEM_DEL	"ri.mem_del"
106 #define	RI_MEM_REMAIN	"ri.mem_rem"
107 
108 /*
109  * IO device properties
110  *
111  * 	Name	- RI_IO_DRV_INST
112  * 	Value 	- DATA_TYPE_STRING
113  */
114 #define	RI_IO_DRV_INST	"ri.io_drv_inst"
115 
116 /*
117  * RCM client usage properties
118  *
119  * 	Name	- RI_CLIENT_RSRC
120  * 	Value	- DATA_TYPE_STRING
121  * 	Name	- RI_CLIENT_USAGE
122  * 	Value	- DATA_TYPE_STRING
123  * 	Name	- RI_QUERY_STATE
124  * 	Value	- DATA_TYPE_INT32
125  * 	Name	- RI_QUERY_ERR
126  * 	Value	- DATA_TYPE_STRING
127  */
128 #define	RI_CLIENT_RSRC	"ri.client_rsrc"
129 #define	RI_CLIENT_USAGE	"ri.client_usage"
130 #define	RI_QUERY_STATE	"ri.query_state"
131 #define	RI_QUERY_ERR	"ri.query_err"
132 
133 /*
134  * Query states
135  */
136 #define	RI_QUERY_UNKNOWN	-1
137 #define	RI_QUERY_OK		0
138 #define	RI_QUERY_FAIL		1
139 
140 typedef	struct ri_hdl ri_hdl_t;
141 typedef struct ri_ap ri_ap_t;
142 typedef struct ri_dev ri_dev_t;
143 typedef struct ri_client ri_client_t;
144 
145 #ifdef SMSLIB_TARGET
146 int		ri_init(uint_t, int, char **, int, ri_hdl_t **);
147 #else
148 int		ri_init(int, char **, int, ri_hdl_t **);
149 #endif /* SMSLIB_TARGET */
150 int		ri_pack(ri_hdl_t *, caddr_t *, size_t *);
151 int		ri_unpack(caddr_t, size_t, ri_hdl_t **);
152 void		ri_fini(ri_hdl_t *);
153 ri_ap_t		*ri_ap_next(ri_hdl_t *, ri_ap_t *);
154 nvlist_t	*ri_ap_conf_props(ri_ap_t *);
155 ri_dev_t	*ri_cpu_next(ri_ap_t *, ri_dev_t *);
156 ri_dev_t	*ri_mem_next(ri_ap_t *, ri_dev_t *);
157 ri_dev_t	*ri_io_next(ri_ap_t *, ri_dev_t *);
158 nvlist_t	*ri_dev_conf_props(ri_dev_t *);
159 ri_client_t	*ri_client_next(ri_dev_t *, ri_client_t *);
160 nvlist_t	*ri_client_usage_props(ri_client_t *);
161 nvlist_t	*ri_client_verbose_props(ri_client_t *);
162 ri_client_t	*ri_cpu_cap_client_next(ri_hdl_t *, ri_client_t *);
163 ri_client_t	*ri_mem_cap_client_next(ri_hdl_t *, ri_client_t *);
164 
165 #ifdef	__cplusplus
166 }
167 #endif
168 
169 #endif	/* _RSRC_INFO_H */
170