Print this page
OS-2444 richmond hardware maps need to support ivy bridge
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/lib/fm/topo/libtopo/common/topo_mod.h
+++ new/usr/src/lib/fm/topo/libtopo/common/topo_mod.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 23 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 */
25 +/*
26 + * Copyright (c) 2013, Joyent, Inc. All rights reserved.
27 + */
25 28
26 29 #ifndef _TOPO_MOD_H
27 30 #define _TOPO_MOD_H
28 31
29 32 #include <fm/libtopo.h>
30 33 #include <fm/topo_hc.h>
31 34 #include <libipmi.h>
32 35 #include <libnvpair.h>
33 36 #include <libdevinfo.h>
34 37 #include <smbios.h>
35 38
36 39 #ifdef __cplusplus
37 40 extern "C" {
38 41 #endif
39 42
40 43 /*
41 44 * Enumerator and method supplier module API
42 45 */
43 46 typedef struct topo_mod topo_mod_t;
44 47
45 48 typedef int topo_method_f(topo_mod_t *, tnode_t *, topo_version_t, nvlist_t *,
46 49 nvlist_t **);
47 50 typedef int topo_enum_f(topo_mod_t *, tnode_t *, const char *, topo_instance_t,
48 51 topo_instance_t, void *, void *);
49 52 typedef void topo_release_f(topo_mod_t *, tnode_t *);
50 53
51 54 typedef struct topo_method {
52 55 const char *tm_name; /* Method name */
53 56 const char *tm_desc; /* Method description */
54 57 const topo_version_t tm_version; /* Method version */
55 58 const topo_stability_t tm_stability; /* Attributes of method */
56 59 topo_method_f *tm_func; /* Method function */
57 60 } topo_method_t;
58 61
59 62 typedef struct topo_modops {
60 63 topo_enum_f *tmo_enum; /* enumeration op */
61 64 topo_release_f *tmo_release; /* resource release op */
62 65 } topo_modops_t;
63 66
64 67 typedef struct topo_mod_info {
65 68 const char *tmi_desc; /* module description */
66 69 const char *tmi_scheme; /* enumeration scheme type */
67 70 topo_version_t tmi_version; /* module version */
68 71 const topo_modops_t *tmi_ops; /* module ops vector */
69 72 } topo_modinfo_t;
70 73
71 74 extern topo_mod_t *topo_mod_load(topo_mod_t *, const char *, topo_version_t);
72 75 extern void topo_mod_unload(topo_mod_t *);
73 76 extern int topo_mod_register(topo_mod_t *, const topo_modinfo_t *,
74 77 topo_version_t);
75 78 extern void topo_mod_unregister(topo_mod_t *);
76 79 extern int topo_mod_enumerate(topo_mod_t *, tnode_t *, const char *,
77 80 const char *, topo_instance_t, topo_instance_t, void *);
78 81 extern int topo_mod_enummap(topo_mod_t *mod, tnode_t *, const char *,
79 82 const char *);
80 83 extern void topo_mod_release(topo_mod_t *, tnode_t *);
81 84 extern void topo_mod_setspecific(topo_mod_t *, void *);
82 85 extern void *topo_mod_getspecific(topo_mod_t *);
83 86
84 87 extern nvlist_t *topo_mod_cpufmri(topo_mod_t *, int, uint32_t, uint8_t,
85 88 const char *);
86 89 extern nvlist_t *topo_mod_devfmri(topo_mod_t *, int, const char *,
87 90 const char *);
88 91 extern nvlist_t *topo_mod_hcfmri(topo_mod_t *, tnode_t *, int, const char *,
89 92 topo_instance_t, nvlist_t *, nvlist_t *, const char *, const char *,
90 93 const char *);
91 94 extern nvlist_t *topo_mod_memfmri(topo_mod_t *, int, uint64_t, uint64_t,
92 95 const char *, int);
93 96 extern nvlist_t *topo_mod_modfmri(topo_mod_t *, int, const char *);
94 97 extern nvlist_t *topo_mod_pkgfmri(topo_mod_t *, int, const char *);
95 98 extern nvlist_t *topo_mod_swfmri(topo_mod_t *, int,
96 99 char *, char *, nvlist_t *,
97 100 char *, char *, char *, char *, int64_t,
98 101 char *, char *, int64_t, char *, int64_t, char **, uint_t);
99 102 extern int topo_mod_nvl2str(topo_mod_t *, nvlist_t *, char **);
100 103 extern int topo_mod_str2nvl(topo_mod_t *, const char *, nvlist_t **);
101 104 extern int topo_prop_setmutable(tnode_t *node, const char *pgname,
102 105 const char *pname, int *err);
103 106 extern int topo_prop_setnonvolatile(tnode_t *node, const char *pgname,
104 107 const char *pname, int *err);
105 108 /*
106 109 * Snapshot walker support
107 110 */
108 111 typedef int (*topo_mod_walk_cb_t)(topo_mod_t *, tnode_t *, void *);
109 112
110 113 extern topo_walk_t *topo_mod_walk_init(topo_mod_t *, tnode_t *,
111 114 topo_mod_walk_cb_t, void *, int *);
112 115
113 116 /*
114 117 * Flags for topo_mod_memfmri
115 118 */
116 119 #define TOPO_MEMFMRI_PA 0x0001 /* Valid physical address */
117 120 #define TOPO_MEMFMRI_OFFSET 0x0002 /* Valid offset */
118 121
119 122 extern int topo_method_register(topo_mod_t *, tnode_t *, const topo_method_t *);
120 123 extern void topo_method_unregister(topo_mod_t *, tnode_t *, const char *);
121 124 extern void topo_method_unregister_all(topo_mod_t *, tnode_t *);
122 125
123 126 extern di_node_t topo_mod_devinfo(topo_mod_t *);
124 127 extern ipmi_handle_t *topo_mod_ipmi_hold(topo_mod_t *);
125 128 extern void topo_mod_ipmi_rele(topo_mod_t *);
126 129 extern smbios_hdl_t *topo_mod_smbios(topo_mod_t *);
127 130 extern di_prom_handle_t topo_mod_prominfo(topo_mod_t *);
128 131 extern nvlist_t *topo_mod_auth(topo_mod_t *, tnode_t *);
129 132
130 133 extern int topo_method_sensor_failure(topo_mod_t *, tnode_t *, topo_version_t,
131 134 nvlist_t *, nvlist_t **);
132 135
133 136 /*
134 137 * FMRI methods
135 138 */
136 139 #define TOPO_METH_LABEL "topo_label"
137 140 #define TOPO_METH_LABEL_DESC "label constructor"
138 141 #define TOPO_METH_LABEL_VERSION0 0
139 142 #define TOPO_METH_LABEL_VERSION TOPO_METH_LABEL_VERSION0
140 143 #define TOPO_METH_LABEL_ARG_NVL "label-specific"
141 144 #define TOPO_METH_LABEL_RET_STR "label-string"
142 145
143 146 #define TOPO_METH_PRESENT "topo_present"
144 147 #define TOPO_METH_PRESENT_DESC "presence indicator"
145 148 #define TOPO_METH_PRESENT_VERSION0 0
146 149 #define TOPO_METH_PRESENT_VERSION TOPO_METH_PRESENT_VERSION0
147 150 #define TOPO_METH_PRESENT_RET "present-ret"
148 151
149 152 #define TOPO_METH_REPLACED "topo_replaced"
150 153 #define TOPO_METH_REPLACED_DESC "replaced indicator"
151 154 #define TOPO_METH_REPLACED_VERSION0 0
152 155 #define TOPO_METH_REPLACED_VERSION TOPO_METH_REPLACED_VERSION0
153 156 #define TOPO_METH_REPLACED_RET "replaced-ret"
154 157
155 158 #define TOPO_METH_UNUSABLE "topo_unusable"
156 159 #define TOPO_METH_UNUSABLE_DESC "unusable indicator"
157 160 #define TOPO_METH_UNUSABLE_VERSION0 0
158 161 #define TOPO_METH_UNUSABLE_VERSION TOPO_METH_UNUSABLE_VERSION0
159 162 #define TOPO_METH_UNUSABLE_RET "unusable-ret"
160 163
161 164 #define TOPO_METH_SERVICE_STATE "topo_service_state"
162 165 #define TOPO_METH_SERVICE_STATE_DESC "service_state indicator"
163 166 #define TOPO_METH_SERVICE_STATE_VERSION0 0
164 167 #define TOPO_METH_SERVICE_STATE_VERSION TOPO_METH_SERVICE_STATE_VERSION0
165 168 #define TOPO_METH_SERVICE_STATE_RET "service_state-ret"
166 169
167 170 #define TOPO_METH_RETIRE "topo_retire"
168 171 #define TOPO_METH_RETIRE_DESC "retire action"
169 172 #define TOPO_METH_RETIRE_VERSION0 0
170 173 #define TOPO_METH_RETIRE_VERSION TOPO_METH_RETIRE_VERSION0
171 174 #define TOPO_METH_RETIRE_RET "retire-ret"
172 175
173 176 #define TOPO_METH_UNRETIRE "topo_unretire"
174 177 #define TOPO_METH_UNRETIRE_DESC "unretire action"
175 178 #define TOPO_METH_UNRETIRE_VERSION0 0
176 179 #define TOPO_METH_UNRETIRE_VERSION TOPO_METH_UNRETIRE_VERSION0
177 180 #define TOPO_METH_UNRETIRE_RET "unretire-ret"
178 181
179 182 #define TOPO_METH_EXPAND "topo_expand"
180 183 #define TOPO_METH_EXPAND_DESC "expand FMRI"
181 184 #define TOPO_METH_EXPAND_VERSION0 0
182 185 #define TOPO_METH_EXPAND_VERSION TOPO_METH_EXPAND_VERSION0
183 186
184 187 #define TOPO_METH_CONTAINS "topo_contains"
185 188 #define TOPO_METH_CONTAINS_DESC "FMRI contains sub-FMRI"
186 189 #define TOPO_METH_CONTAINS_VERSION0 0
187 190 #define TOPO_METH_CONTAINS_VERSION TOPO_METH_CONTAINS_VERSION0
188 191 #define TOPO_METH_CONTAINS_RET "contains-return"
189 192 #define TOPO_METH_FMRI_ARG_FMRI "fmri"
190 193 #define TOPO_METH_FMRI_ARG_SUBFMRI "sub-fmri"
191 194
192 195 #define TOPO_METH_ASRU_COMPUTE "topo_asru_compute"
193 196 #define TOPO_METH_ASRU_COMPUTE_VERSION 0
194 197 #define TOPO_METH_ASRU_COMPUTE_DESC "Dynamic ASRU constructor"
195 198
196 199 #define TOPO_METH_FRU_COMPUTE "topo_fru_compute"
197 200 #define TOPO_METH_FRU_COMPUTE_VERSION 0
198 201 #define TOPO_METH_FRU_COMPUTE_DESC "Dynamic FRU constructor"
199 202
200 203 #define TOPO_METH_DISK_STATUS "topo_disk_status"
201 204 #define TOPO_METH_DISK_STATUS_VERSION 0
202 205 #define TOPO_METH_DISK_STATUS_DESC "Disk status"
203 206
204 207 #define TOPO_METH_SENSOR_FAILURE "topo_sensor_failure"
205 208 #define TOPO_METH_SENSOR_FAILURE_VERSION 0
206 209 #define TOPO_METH_SENSOR_FAILURE_DESC "Sensor failure state"
207 210
↓ open down ↓ |
173 lines elided |
↑ open up ↑ |
208 211 #define TOPO_PROP_METH_DESC "Dynamic Property method"
209 212
210 213 #define TOPO_METH_IPMI_ENTITY "ipmi_entity"
211 214 #define TOPO_METH_FAC_ENUM_DESC "Facility Enumerator"
212 215
213 216 extern void *topo_mod_alloc(topo_mod_t *, size_t);
214 217 extern void *topo_mod_zalloc(topo_mod_t *, size_t);
215 218 extern void topo_mod_free(topo_mod_t *, void *, size_t);
216 219 extern char *topo_mod_strdup(topo_mod_t *, const char *);
217 220 extern void topo_mod_strfree(topo_mod_t *, char *);
221 +extern char *topo_mod_strsplit(topo_mod_t *, const char *, const char *,
222 + char **);
218 223 extern int topo_mod_nvalloc(topo_mod_t *, nvlist_t **, uint_t);
219 224 extern int topo_mod_nvdup(topo_mod_t *, nvlist_t *, nvlist_t **);
220 225
221 226 extern void topo_mod_clrdebug(topo_mod_t *);
222 227 extern void topo_mod_setdebug(topo_mod_t *);
223 228 extern void topo_mod_dprintf(topo_mod_t *, const char *, ...);
224 229 extern const char *topo_mod_errmsg(topo_mod_t *);
225 230 extern int topo_mod_errno(topo_mod_t *);
226 231
227 232 /*
228 233 * Topo node utilities: callable from module enumeration, topo_mod_enumerate()
229 234 */
230 235 extern int topo_node_range_create(topo_mod_t *, tnode_t *, const char *,
231 236 topo_instance_t, topo_instance_t);
232 237 extern void topo_node_range_destroy(tnode_t *, const char *);
233 238 extern tnode_t *topo_node_bind(topo_mod_t *, tnode_t *, const char *,
234 239 topo_instance_t, nvlist_t *);
235 240 extern tnode_t *topo_node_facbind(topo_mod_t *, tnode_t *, const char *,
236 241 const char *);
237 242 extern void topo_node_unbind(tnode_t *);
238 243 extern void topo_node_setspecific(tnode_t *, void *);
239 244 extern void *topo_node_getspecific(tnode_t *);
240 245 extern int topo_node_asru_set(tnode_t *node, nvlist_t *, int, int *);
241 246 extern int topo_node_fru_set(tnode_t *node, nvlist_t *, int, int *);
242 247 extern int topo_node_label_set(tnode_t *node, char *, int *);
243 248
244 249 #define TOPO_ASRU_COMPUTE 0x0001 /* Compute ASRU dynamically */
245 250 #define TOPO_FRU_COMPUTE 0x0002 /* Compute FRU dynamically */
246 251
247 252 extern int topo_prop_inherit(tnode_t *, const char *, const char *, int *);
248 253 extern int topo_pgroup_create(tnode_t *, const topo_pgroup_info_t *, int *);
249 254
250 255 /*
251 256 * Topo property method registration
252 257 */
253 258 extern int topo_prop_method_register(tnode_t *, const char *, const char *,
254 259 topo_type_t, const char *, const nvlist_t *, int *);
255 260 extern void topo_prop_method_unregister(tnode_t *, const char *, const char *);
256 261
257 262 /*
258 263 * This enum definition is used to define a set of error tags associated with
259 264 * the module api error conditions. The shell script mkerror.sh is
260 265 * used to parse this file and create a corresponding topo_error.c source file.
261 266 * If you do something other than add a new error tag here, you may need to
262 267 * update the mkerror shell script as it is based upon simple regexps.
263 268 */
264 269 typedef enum topo_mod_errno {
265 270 EMOD_UNKNOWN = 2000, /* unknown libtopo error */
266 271 EMOD_NOMEM, /* module memory limit exceeded */
267 272 EMOD_PARTIAL_ENUM, /* module completed partial enumeration */
268 273 EMOD_METHOD_INVAL, /* method arguments invalid */
269 274 EMOD_METHOD_NOTSUP, /* method not supported */
270 275 EMOD_FMRI_NVL, /* nvlist allocation failure for FMRI */
271 276 EMOD_FMRI_VERSION, /* invalid FMRI scheme version */
272 277 EMOD_FMRI_MALFORM, /* malformed FMRI */
273 278 EMOD_NODE_BOUND, /* node already bound */
274 279 EMOD_NODE_DUP, /* duplicate node */
275 280 EMOD_NODE_NOENT, /* node not found */
276 281 EMOD_NODE_RANGE, /* invalid node range */
277 282 EMOD_VER_ABI, /* registered with invalid ABI version */
278 283 EMOD_VER_OLD, /* attempt to load obsolete module */
279 284 EMOD_VER_NEW, /* attempt to load a newer module */
280 285 EMOD_NVL_INVAL, /* invalid nvlist */
281 286 EMOD_NONCANON, /* non-canonical component name requested */
282 287 EMOD_MOD_NOENT, /* module lookup failed */
283 288 EMOD_UKNOWN_ENUM, /* unknown enumeration error */
284 289 EMOD_END /* end of mod errno list (to ease auto-merge) */
285 290 } topo_mod_errno_t;
286 291
287 292 extern int topo_mod_seterrno(topo_mod_t *, int);
288 293
289 294 #ifdef __cplusplus
290 295 }
291 296 #endif
292 297
293 298 #endif /* _TOPO_MOD_H */
↓ open down ↓ |
66 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX