xref: /titanic_52/usr/src/cmd/dcs/sparc/sun4u/rsrc_info.h (revision 263f549e5da8b32c4922f586afb365b8ae388a6c)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_RSRC_INFO_H
27 #define	_RSRC_INFO_H
28 
29 #include <libnvpair.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Request flags
37  */
38 #define	RI_INCLUDE_QUERY	0x01
39 #define	RI_INCLUDE_UNMANAGED	0x02
40 #define	RI_FORCE		0x04
41 #define	RI_VERBOSE		0x08
42 
43 /*
44  * Error codes
45  */
46 #define	RI_SUCCESS		0	/* No error */
47 #define	RI_FAILURE		1	/* Internal error */
48 #define	RI_INVAL		2	/* Invalid argument */
49 #define	RI_NOTSUP		3	/* Unsupported request */
50 
51 /*
52  * Attachment point properties
53  *
54  * 	Name	- RI_AP_REQ_ID
55  * 	Value	- DATA_TYPE_STRING
56  */
57 #define	RI_AP_REQ_ID	"ri.ap_req_id"
58 
59 /*
60  * CPU properties
61  *
62  * 	Name	- RI_CPU_ID
63  * 	Value	- DATA_TYPE_INT32
64  * 	Name	- RI_CPU_STATE
65  * 	Value	- DATA_TYPE_STRING
66  * 	Name	- RI_CPU_SPEED
67  * 	Value	- DATA_TYPE_INT32
68  * 	Name	- RI_CPU_ECACHE
69  * 	Value 	_ DATA_TYPE_INT32
70  * 	Name	- RI_CPU_ECACHE_KBYTE
71  * 	Value 	_ DATA_TYPE_INT32
72  */
73 #define	RI_CPU_ID	"ri.cpu_id"
74 #define	RI_CPU_STATE	"ri.cpu_state"
75 #define	RI_CPU_SPEED	"ri.cpu_speed"
76 #define	RI_CPU_ECACHE	"ri.cpu_ecache"
77 #define	RI_CPU_ECACHE_KBYTE "ri.cpu_ecache_kbyte"
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 *, int encoding);
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