xref: /titanic_44/usr/src/cmd/dcs/sparc/sun4u/rsrc_info.h (revision 4a634bb80136cc001d14ab96addd9915105e5223)
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 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <libnvpair.h>
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 /*
38  * Request flags
39  */
40 #define	RI_INCLUDE_QUERY	0x01
41 #define	RI_INCLUDE_UNMANAGED	0x02
42 #define	RI_FORCE		0x04
43 #define	RI_VERBOSE		0x08
44 
45 /*
46  * Error codes
47  */
48 #define	RI_SUCCESS		0	/* No error */
49 #define	RI_FAILURE		1	/* Internal error */
50 #define	RI_INVAL		2	/* Invalid argument */
51 #define	RI_NOTSUP		3	/* Unsupported request */
52 
53 /*
54  * Attachment point properties
55  *
56  * 	Name	- RI_AP_REQ_ID
57  * 	Value	- DATA_TYPE_STRING
58  */
59 #define	RI_AP_REQ_ID	"ri.ap_req_id"
60 
61 /*
62  * CPU properties
63  *
64  * 	Name	- RI_CPU_ID
65  * 	Value	- DATA_TYPE_INT32
66  * 	Name	- RI_CPU_STATE
67  * 	Value	- DATA_TYPE_STRING
68  * 	Name	- RI_CPU_SPEED
69  * 	Value	- DATA_TYPE_INT32
70  * 	Name	- RI_CPU_ECACHE
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 
78 /*
79  * Memory properties
80  *
81  * 	Name	- RI_MEM_BRD
82  * 	Value	- DATA_TYPE_INT32
83  * 	Name	- RI_MEM_PERM
84  * 	Value	- DATA_TYPE_INT32
85  * 	Name	- RI_MEM_ADDR
86  * 	Value 	- DATA_TYPE_INT32
87  * 	Name	- RI_MEM_DOMAIN
88  * 	Value 	- DATA_TYPE_INT32
89  * 	Name	- RI_MEM_TARG
90  * 	Value	- DATA_TYPE_STRING
91  * 	Name	- RI_MEM_SRC
92  * 	Value	- DATA_TYPE_STRING
93  * 	Name	- RI_MEM_DEL
94  * 	Value	- DATA_TYPE_INT32
95  * 	Name	- RI_MEM_REMAIN
96  * 	Value	- DATA_TYPE_INT32
97  */
98 #define	RI_MEM_BRD	"ri.mem_brd"
99 #define	RI_MEM_PERM	"ri.mem_perm"
100 #define	RI_MEM_ADDR	"ri.mem_addr"
101 #define	RI_MEM_DOMAIN	"ri.mem_domain"
102 #define	RI_MEM_TARG	"ri.mem_targ"
103 #define	RI_MEM_SRC	"ri.mem_src"
104 #define	RI_MEM_DEL	"ri.mem_del"
105 #define	RI_MEM_REMAIN	"ri.mem_rem"
106 
107 /*
108  * IO device properties
109  *
110  * 	Name	- RI_IO_DRV_INST
111  * 	Value 	- DATA_TYPE_STRING
112  */
113 #define	RI_IO_DRV_INST	"ri.io_drv_inst"
114 
115 /*
116  * RCM client usage properties
117  *
118  * 	Name	- RI_CLIENT_RSRC
119  * 	Value	- DATA_TYPE_STRING
120  * 	Name	- RI_CLIENT_USAGE
121  * 	Value	- DATA_TYPE_STRING
122  * 	Name	- RI_QUERY_STATE
123  * 	Value	- DATA_TYPE_INT32
124  * 	Name	- RI_QUERY_ERR
125  * 	Value	- DATA_TYPE_STRING
126  */
127 #define	RI_CLIENT_RSRC	"ri.client_rsrc"
128 #define	RI_CLIENT_USAGE	"ri.client_usage"
129 #define	RI_QUERY_STATE	"ri.query_state"
130 #define	RI_QUERY_ERR	"ri.query_err"
131 
132 /*
133  * Query states
134  */
135 #define	RI_QUERY_UNKNOWN	-1
136 #define	RI_QUERY_OK		0
137 #define	RI_QUERY_FAIL		1
138 
139 typedef	struct ri_hdl ri_hdl_t;
140 typedef struct ri_ap ri_ap_t;
141 typedef struct ri_dev ri_dev_t;
142 typedef struct ri_client ri_client_t;
143 
144 #ifdef SMSLIB_TARGET
145 int		ri_init(uint_t, int, char **, int, ri_hdl_t **);
146 #else
147 int		ri_init(int, char **, int, ri_hdl_t **);
148 #endif /* SMSLIB_TARGET */
149 int		ri_pack(ri_hdl_t *, caddr_t *, size_t *, int encoding);
150 int		ri_unpack(caddr_t, size_t, ri_hdl_t **);
151 void		ri_fini(ri_hdl_t *);
152 ri_ap_t		*ri_ap_next(ri_hdl_t *, ri_ap_t *);
153 nvlist_t	*ri_ap_conf_props(ri_ap_t *);
154 ri_dev_t	*ri_cpu_next(ri_ap_t *, ri_dev_t *);
155 ri_dev_t	*ri_mem_next(ri_ap_t *, ri_dev_t *);
156 ri_dev_t	*ri_io_next(ri_ap_t *, ri_dev_t *);
157 nvlist_t	*ri_dev_conf_props(ri_dev_t *);
158 ri_client_t	*ri_client_next(ri_dev_t *, ri_client_t *);
159 nvlist_t	*ri_client_usage_props(ri_client_t *);
160 nvlist_t	*ri_client_verbose_props(ri_client_t *);
161 ri_client_t	*ri_cpu_cap_client_next(ri_hdl_t *, ri_client_t *);
162 ri_client_t	*ri_mem_cap_client_next(ri_hdl_t *, ri_client_t *);
163 
164 #ifdef	__cplusplus
165 }
166 #endif
167 
168 #endif	/* _RSRC_INFO_H */
169