xref: /illumos-gate/usr/src/cmd/dcs/sparc/sun4u/rsrc_info_impl.h (revision 628e3cbed6489fa1db545d8524a06cd6535af456)
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_IMPL_H
28 #define	_RSRC_INFO_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #include <assert.h>
37 #include <libdevinfo.h>
38 #include <librcm.h>
39 #include <sys/types.h>
40 #include <sys/param.h>
41 #include <sys/processor.h>
42 #include <config_admin.h>
43 #include "rsrc_info.h"
44 
45 #ifdef	DEBUG
46 static int ri_debug = 1;
47 #define	dprintf(args) if (ri_debug) (void) fprintf args
48 #else
49 #define	dprintf(args)
50 #endif	/* DEBUG */
51 
52 #define	RI_REQ_MASK		(RI_INCLUDE_UNMANAGED|RI_INCLUDE_QUERY|\
53 				RI_FORCE|RI_VERBOSE)
54 
55 /*
56  * Packing delimiters
57  */
58 #define	RI_HDL_FLAGS		"ri.h_flags"
59 #define	RI_HDL_APS		"ri.h_aps"
60 #define	RI_HDL_CPU_CAPS		"ri.h_ccaps"
61 #define	RI_HDL_MEM_CAPS		"ri.h_mcaps"
62 #define	RI_CLIENT_T		"ri.cli_t"
63 #define	RI_CLIENT_USAGE_PROPS	"ri.cli_u_props"
64 #define	RI_CLIENT_VERB_PROPS	"ri.cli_v_props"
65 #define	RI_DEV_T		"ri.dev_t"
66 #define	RI_DEV_PROPS		"ri.dev_props"
67 #define	RI_DEV_CLIENTS		"ri.dev_clients"
68 #define	RI_AP_T			"ri.ap_t"
69 #define	RI_AP_PROPS		"ri.ap_props"
70 #define	RI_AP_CPUS		"ri.ap_cpus"
71 #define	RI_AP_MEMS		"ri.ap_mems"
72 #define	RI_AP_IOS		"ri.ap_ios"
73 
74 #define	s_free(x)	(((x) != NULL) ? (free(x), (x) = NULL) : (void *)0)
75 
76 struct ri_hdl {
77 	int		flags;
78 	ri_ap_t		*aps;
79 	ri_client_t	*cpu_cap_clients;
80 	ri_client_t 	*mem_cap_clients;
81 };
82 
83 struct ri_ap {
84 	nvlist_t	*conf_props;
85 	ri_dev_t	*cpus;
86 	ri_dev_t	*mems;
87 	ri_dev_t	*ios;
88 	ri_ap_t		*next;
89 };
90 
91 struct ri_dev {
92 	nvlist_t	*conf_props;
93 	ri_client_t	*rcm_clients;
94 	ri_dev_t	*next;
95 };
96 
97 struct ri_client {
98 	nvlist_t	*usg_props;
99 	nvlist_t	*v_props;
100 	ri_client_t	*next;
101 };
102 
103 void	ri_dev_free(ri_dev_t *);
104 void	ri_client_free(ri_client_t *);
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _RSRC_INFO_IMPL_H */
111