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