xref: /titanic_41/usr/src/lib/fm/topo/libtopo/common/libtopo.h (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _LIBTOPO_H
28 #define	_LIBTOPO_H
29 
30 #include <sys/nvpair.h>
31 #include <stdio.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define	TOPO_VERSION	1	/* Library ABI Interface Version */
38 
39 typedef struct topo_hdl topo_hdl_t;
40 typedef struct topo_node tnode_t;
41 typedef struct topo_walk topo_walk_t;
42 typedef int32_t topo_instance_t;
43 typedef uint32_t topo_version_t;
44 
45 typedef struct topo_list {
46 	struct topo_list *l_prev;
47 	struct topo_list *l_next;
48 } topo_list_t;
49 
50 typedef struct topo_faclist {
51 	topo_list_t	tf_list;
52 	tnode_t		*tf_node;
53 } topo_faclist_t;
54 
55 /*
56  * The following functions, error codes and data structures are private
57  * to libtopo snapshot consumers and enumerator modules.
58  */
59 extern topo_hdl_t *topo_open(int, const char *, int *);
60 extern void topo_close(topo_hdl_t *);
61 extern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
62 extern void topo_snap_release(topo_hdl_t *);
63 
64 /*
65  * Snapshot walker support
66  */
67 typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *);
68 
69 extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
70     void *, int *);
71 extern int topo_walk_step(topo_walk_t *, int);
72 extern void topo_walk_fini(topo_walk_t *);
73 
74 /*
75  * Walk status returned from walker
76  */
77 #define	TOPO_WALK_ERR		-1
78 #define	TOPO_WALK_NEXT		0
79 #define	TOPO_WALK_TERMINATE	1
80 
81 /*
82  * Types of walks: depth-first (child) or breadth-first (sibling)
83  */
84 #define	TOPO_WALK_CHILD		0x0001
85 #define	TOPO_WALK_SIBLING	0x0002
86 
87 /*
88  * FMRI helper routines
89  */
90 extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *);
91 extern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *);
92 extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
93 extern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *);
94 extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *);
95 extern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *);
96 extern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *);
97 extern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *);
98 extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *);
99 extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *);
100 extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *);
101 extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **,
102     int *);
103 extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *);
104 extern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *);
105 extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
106 extern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *,
107     uint32_t, topo_walk_cb_t, void *, int *);
108 
109 /*
110  * Private utility functions for fmd
111  */
112 extern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *);
113 extern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *);
114 
115 /*
116  * Topo node utilities: callable from topo_walk_step() callback or module
117  * enumeration, topo_mod_enumerate()
118  */
119 extern char *topo_node_name(tnode_t *);
120 extern topo_instance_t topo_node_instance(tnode_t *);
121 extern tnode_t *topo_node_parent(tnode_t *);
122 extern void *topo_node_private(tnode_t *);
123 extern int topo_node_flags(tnode_t *);
124 extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *);
125 extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *);
126 extern int topo_node_resource(tnode_t *, nvlist_t **, int *);
127 extern int topo_node_label(tnode_t *, char **, int *);
128 extern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t);
129 extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t,
130     nvlist_t *, nvlist_t **, int *);
131 extern boolean_t topo_method_supported(tnode_t *, const char *,
132     topo_version_t);
133 extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *,
134     uint32_t, topo_faclist_t *, int *);
135 
136 /*
137  * Node flags: denotes type of node
138  */
139 #define	TOPO_NODE_DEFAULT	0
140 #define	TOPO_NODE_FACILITY	1
141 
142 #define	TOPO_FAC_TYPE_SENSOR	"sensor"
143 #define	TOPO_FAC_TYPE_INDICATOR	"indicator"
144 
145 /*
146  * Topo property get functions
147  */
148 extern int topo_prop_get_int32(tnode_t *, const char *, const char *,
149     int32_t *, int *);
150 extern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
151     uint32_t *, int *);
152 extern int topo_prop_get_int64(tnode_t *, const char *, const char *,
153     int64_t *, int *);
154 extern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
155     uint64_t *, int *);
156 extern int topo_prop_get_double(tnode_t *, const char *, const char *,
157     double *, int *);
158 extern int topo_prop_get_string(tnode_t *, const char *, const char *,
159     char **, int *);
160 extern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
161     nvlist_t **, int *);
162 extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
163     int32_t **, uint_t *, int *);
164 extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
165     uint32_t **, uint_t *, int *);
166 extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
167     int64_t **, uint_t *, int *);
168 extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
169     uint64_t **, uint_t *, int *);
170 extern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
171     char ***, uint_t *, int *);
172 extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
173     nvlist_t ***, uint_t *, int *);
174 
175 /*
176  * Topo property set functions
177  */
178 extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
179     int32_t, int *);
180 extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
181     uint32_t, int *);
182 extern int topo_prop_set_int64(tnode_t *, const char *, const char *,
183     int, int64_t, int *);
184 extern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
185     int, uint64_t, int *);
186 extern int topo_prop_set_double(tnode_t *, const char *, const char *,
187     int, double, int *);
188 extern int topo_prop_set_string(tnode_t *, const char *, const char *,
189     int, const char *, int *);
190 extern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
191     int, const nvlist_t *, int *);
192 extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
193     int32_t *, uint_t, int *);
194 extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
195     int, uint32_t *, uint_t, int *);
196 extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
197     int, int64_t *, uint_t, int *);
198 extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
199     int, uint64_t *, uint_t, int *);
200 extern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
201     int, const char **, uint_t, int *);
202 extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
203     int, const nvlist_t **, uint_t, int *);
204 
205 #define	TOPO_PROP_IMMUTABLE	0
206 #define	TOPO_PROP_MUTABLE	1
207 
208 /* Protocol property group and property names */
209 #define	TOPO_PGROUP_PROTOCOL	"protocol"	/* Required property group */
210 #define	TOPO_PROP_RESOURCE	"resource"	/* resource FMRI */
211 #define	TOPO_PROP_ASRU		"ASRU"		/* ASRU FMRI */
212 #define	TOPO_PROP_FRU		"FRU"		/* FRU FMRI */
213 #define	TOPO_PROP_MOD		"module"	/* software module FMRI */
214 #define	TOPO_PROP_PKG		"package"	/* software package FMRI */
215 #define	TOPO_PROP_LABEL		"label"		/*  property LABEL */
216 
217 #define	TOPO_METH_FAC_ENUM	"fac_enum"
218 
219 /*
220  * System property group
221  */
222 #define	TOPO_PGROUP_SYSTEM	"system"
223 #define	TOPO_PROP_ISA		"isa"
224 #define	TOPO_PROP_MACHINE	"machine"
225 
226 /*
227  * These enum definitions are used to define a set of error tags associated with
228  * libtopo error conditions occuring during the adminstration of
229  * properties, invocation of methods and fmri-based queries.  The shell script
230  * mkerror.sh is used to parse this file and create a corresponding topo_error.c
231  * source file.
232  *
233  * If you do something other than add a new error tag here, you may need to
234  * update the mkerror shell script as it is based upon simple regexps.
235  */
236 typedef enum topo_prop_errno {
237     ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */
238     ETOPO_PROP_NOENT,   /* undefined property or property group */
239     ETOPO_PROP_DEFD,    /* static property already defined */
240     ETOPO_PROP_NOMEM,   /* memory limit exceeded during property allocation */
241     ETOPO_PROP_TYPE,    /* invalid property type */
242     ETOPO_PROP_NAME,    /* invalid property name */
243     ETOPO_PROP_NOINHERIT, /* can not inherit property */
244     ETOPO_PROP_NVL,	/* malformed property nvlist */
245     ETOPO_PROP_METHOD,	/* get property method failed */
246     ETOPO_PROP_END	/* end of prop errno list (to ease auto-merge) */
247 } topo_prop_errno_t;
248 
249 typedef enum topo_method_errno {
250     ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */
251     ETOPO_METHOD_INVAL,		/* invalid method registration */
252     ETOPO_METHOD_NOTSUP,	/* method not supported */
253     ETOPO_METHOD_FAIL,		/* method failed */
254     ETOPO_METHOD_VEROLD,	/* app is compiled to use obsolete method */
255     ETOPO_METHOD_VERNEW,	/* app is compiled to use obsolete method */
256     ETOPO_METHOD_NOMEM,		/* memory limit exceeded during method op */
257     ETOPO_METHOD_DEFD,		/* method op already defined */
258     ETOPO_METHOD_END		/* end of method errno list */
259 } topo_method_errno_t;
260 
261 typedef enum topo_fmri_errno {
262     ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */
263     ETOPO_FMRI_NVL,		/* nvlist allocation failure for FMRI */
264     ETOPO_FMRI_VERSION,		/* invalid FMRI scheme version */
265     ETOPO_FMRI_MALFORM,		/* malformed FMRI */
266     ETOPO_FMRI_NOMEM,		/* memory limit exceeded */
267     ETOPO_FMRI_END		/* end of fmri errno list */
268 } topo_fmri_errno_t;
269 
270 typedef enum topo_hdl_errno {
271     ETOPO_HDL_UNKNOWN = 3300,	/* unknown topo handle error */
272     ETOPO_HDL_ABIVER,		/* handle opened with invalid ABI version */
273     ETOPO_HDL_SNAP,		/* snapshot already taken */
274     ETOPO_HDL_INVAL,		/* invalid argument specified */
275     ETOPO_HDL_UUID,		/* uuid already set */
276     ETOPO_HDL_NOMEM,		/* memory limit exceeded */
277     ETOPO_HDL_END		/* end of handle errno list */
278 } topo_hdl_errno_t;
279 
280 extern const char *topo_strerror(int);
281 extern void topo_hdl_strfree(topo_hdl_t *, char *);
282 extern void topo_debug_set(topo_hdl_t *, const char *, const char *);
283 
284 /*
285  * The following functions and data structures to support property
286  * observability are private to the fmtopo command.
287  */
288 
289 /*
290  * Each topology node advertises the name and data stability of each of its
291  * modules and properties. (see attributes(5)).
292  */
293 
294 /*
295  * Topo stability attributes
296  */
297 typedef enum topo_stability {
298 	TOPO_STABILITY_UNKNOWN = 0,	/* private to libtopo */
299 	TOPO_STABILITY_INTERNAL,	/* private to libtopo */
300 	TOPO_STABILITY_PRIVATE,		/* private to Sun */
301 	TOPO_STABILITY_OBSOLETE,	/* scheduled for removal */
302 	TOPO_STABILITY_EXTERNAL,	/* not controlled by Sun */
303 	TOPO_STABILITY_UNSTABLE,	/* new or rapidly changing */
304 	TOPO_STABILITY_EVOLVING,	/* less rapidly changing */
305 	TOPO_STABILITY_STABLE,		/* mature interface from Sun */
306 	TOPO_STABILITY_STANDARD		/* industry standard */
307 } topo_stability_t;
308 
309 #define	TOPO_STABILITY_MAX	TOPO_STABILITY_STANDARD	/* max valid stab */
310 
311 typedef struct topo_pgroup_info {
312 	const char *tpi_name;		/* property group name */
313 	topo_stability_t tpi_namestab;	/* stability of group name */
314 	topo_stability_t tpi_datastab;	/* stability of all property values */
315 	topo_version_t tpi_version;	/* version of pgroup definition */
316 } topo_pgroup_info_t;
317 
318 extern topo_stability_t topo_name2stability(const char *);
319 extern const char *topo_stability2name(topo_stability_t);
320 extern void topo_pgroup_destroy(tnode_t *, const char *);
321 extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *);
322 
323 typedef enum {
324 	TOPO_TYPE_INVALID = 0,
325 	TOPO_TYPE_BOOLEAN,	/* boolean */
326 	TOPO_TYPE_INT32,	/* int32_t */
327 	TOPO_TYPE_UINT32,	/* uint32_t */
328 	TOPO_TYPE_INT64,	/* int64_t */
329 	TOPO_TYPE_UINT64,	/* uint64_t */
330 	TOPO_TYPE_STRING,	/* const char* */
331 	TOPO_TYPE_TIME,		/* uint64_t */
332 	TOPO_TYPE_SIZE,		/* uint64_t */
333 	TOPO_TYPE_FMRI,		/* nvlist_t */
334 	TOPO_TYPE_INT32_ARRAY,	/* array of int32_t */
335 	TOPO_TYPE_UINT32_ARRAY,	/* array of uint32_t */
336 	TOPO_TYPE_INT64_ARRAY,	/* array of int64_t */
337 	TOPO_TYPE_UINT64_ARRAY,	/* array of uint64_t */
338 	TOPO_TYPE_STRING_ARRAY,	/* array of const char* */
339 	TOPO_TYPE_FMRI_ARRAY,	/* array of nvlist_t */
340 	TOPO_TYPE_DOUBLE	/* double */
341 } topo_type_t;
342 
343 extern nvlist_t *topo_prop_getprops(tnode_t *, int *err);
344 extern int topo_prop_getprop(tnode_t *, const char *, const char *,
345     nvlist_t *, nvlist_t **, int *);
346 extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *);
347 extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *,
348     int, nvlist_t *, int *);
349 extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *,
350     const char *, nvlist_t *,  nvlist_t **, int *);
351 extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *,
352     nvlist_t **, int *);
353 extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *,
354     nvlist_t *, int, nvlist_t *, int *);
355 
356 /* Property node NVL names used in topo_prop_getprops */
357 #define	TOPO_PROP_GROUP		"property-group"
358 #define	TOPO_PROP_GROUP_NAME	"property-group-name"
359 #define	TOPO_PROP_GROUP_DSTAB	"property-group-data-stability"
360 #define	TOPO_PROP_GROUP_NSTAB	"property-group-name-stability"
361 #define	TOPO_PROP_GROUP_VERSION	"property-group-version"
362 #define	TOPO_PROP_VAL		"property"
363 #define	TOPO_PROP_VAL_NAME	"property-name"
364 #define	TOPO_PROP_VAL_VAL	"property-value"
365 #define	TOPO_PROP_VAL_TYPE	"property-type"
366 #define	TOPO_PROP_FLAG		"property-flag"
367 
368 /*
369  * ARGS list used in topo property methods
370  */
371 #define	TOPO_PROP_ARGS	"args"
372 #define	TOPO_PROP_PARGS	"private-args"
373 
374 extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
375 
376 extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
377 extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
378 extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
379 extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
380 extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
381 extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
382 
383 /*
384  * Interfaces for converting sensor/indicator types, units, states, etc to
385  * a string
386  */
387 void topo_sensor_type_name(uint32_t type, char *buf, size_t len);
388 void topo_sensor_units_name(uint8_t type, char *buf, size_t len);
389 void topo_led_type_name(uint8_t type, char *buf, size_t len);
390 void topo_led_state_name(uint8_t type, char *buf, size_t len);
391 void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
392     size_t len);
393 
394 /*
395  * Defines for standard properties for sensors and indicators
396  */
397 #define	TOPO_PGROUP_FACILITY	"facility"
398 
399 #define	TOPO_SENSOR_READING	"reading"
400 #define	TOPO_SENSOR_STATE	"state"
401 #define	TOPO_SENSOR_CLASS	"sensor-class"
402 #define	TOPO_FACILITY_TYPE	"type"
403 #define	TOPO_SENSOR_UNITS	"units"
404 #define	TOPO_LED_MODE		"mode"
405 
406 /*
407  * Sensor Classes
408  *
409  * The "sensor-class" property in the "facility" propgroup on
410  * facility nodes of type "sensor" should be set to one of these
411  * two values.
412  *
413  * Threshold sensors provide an analog sensor reading via the
414  * "reading" property in the facility propgroup.  They will also
415  * provide one or more discrete states via the "state" property
416  * in the facility propgroup.
417  *
418  * Discrete sensors will not provide an analog reading by will
419  * provide one or more discrete states via the "state" property
420  * in the facility propgroup.
421  */
422 #define	TOPO_SENSOR_CLASS_THRESHOLD	"threshold"
423 #define	TOPO_SENSOR_CLASS_DISCRETE	"discrete"
424 
425 /*
426  * Sensor unit types.  We're using the unit types and corresponding
427  * codes described in the IPMI 2.0 spec as a reference as it seems to be a
428  * reasonably comprehensive list.  This also simplifies the IPMI provider code
429  * since the unit type codes will map exactly to what libtopo uses (so no
430  * conversion necessary).
431  */
432 typedef enum topo_sensor_unit {
433 	TOPO_SENSOR_UNITS_UNSPECIFIED = 0,
434 	TOPO_SENSOR_UNITS_DEGREES_C,
435 	TOPO_SENSOR_UNITS_DEGREES_F,
436 	TOPO_SENSOR_UNITS_DEGREES_K,
437 	TOPO_SENSOR_UNITS_VOLTS,
438 	TOPO_SENSOR_UNITS_AMPS,
439 	TOPO_SENSOR_UNITS_WATTS,
440 	TOPO_SENSOR_UNITS_JOULES,
441 	TOPO_SENSOR_UNITS_COULOMBS,
442 	TOPO_SENSOR_UNITS_VA,
443 	TOPO_SENSOR_UNITS_NITS,
444 	TOPO_SENSOR_UNITS_LUMEN,
445 	TOPO_SENSOR_UNITS_LUX,
446 	TOPO_SENSOR_UNITS_CANDELA,
447 	TOPO_SENSOR_UNITS_KPA,
448 	TOPO_SENSOR_UNITS_PSI,
449 
450 	TOPO_SENSOR_UNITS_NEWTON,
451 	TOPO_SENSOR_UNITS_CFM,
452 	TOPO_SENSOR_UNITS_RPM,
453 	TOPO_SENSOR_UNITS_HZ,
454 	TOPO_SENSOR_UNITS_MICROSEC,
455 	TOPO_SENSOR_UNITS_MILLISEC,
456 	TOPO_SENSOR_UNITS_SECS,
457 	TOPO_SENSOR_UNITS_MIN,
458 	TOPO_SENSOR_UNITS_HOUR,
459 	TOPO_SENSOR_UNITS_DAY,
460 	TOPO_SENSOR_UNITS_WEEK,
461 	TOPO_SENSOR_UNITS_MIL,
462 	TOPO_SENSOR_UNITS_INCHES,
463 	TOPO_SENSOR_UNITS_FEET,
464 	TOPO_SENSOR_UNITS_CUB_INCH,
465 	TOPO_SENSOR_UNITS_CUB_FEET,
466 
467 	TOPO_SENSOR_UNITS_MM,
468 	TOPO_SENSOR_UNITS_CM,
469 	TOPO_SENSOR_UNITS_METERS,
470 	TOPO_SENSOR_UNITS_CUB_CM,
471 	TOPO_SENSOR_UNITS_CUB_METER,
472 	TOPO_SENSOR_UNITS_LITERS,
473 	TOPO_SENSOR_UNITS_FLUID_OUNCE,
474 	TOPO_SENSOR_UNITS_RADIANS,
475 	TOPO_SENSOR_UNITS_STERADIANS,
476 	TOPO_SENSOR_UNITS_REVOLUTIONS,
477 	TOPO_SENSOR_UNITS_CYCLES,
478 	TOPO_SENSOR_UNITS_GRAVITIES,
479 	TOPO_SENSOR_UNITS_OUNCE,
480 	TOPO_SENSOR_UNITS_POUND,
481 	TOPO_SENSOR_UNITS_FOOT_POUND,
482 	TOPO_SENSOR_UNITS_OZ_INCH,
483 
484 	TOPO_SENSOR_UNITS_GAUSS,
485 	TOPO_SENSOR_UNITS_GILBERTS,
486 	TOPO_SENSOR_UNITS_HENRY,
487 	TOPO_SENSOR_UNITS_MILHENRY,
488 	TOPO_SENSOR_UNITS_FARAD,
489 	TOPO_SENSOR_UNITS_MICROFARAD,
490 	TOPO_SENSOR_UNITS_OHMS,
491 	TOPO_SENSOR_UNITS_SIEMENS,
492 	TOPO_SENSOR_UNITS_MOLE,
493 	TOPO_SENSOR_UNITS_BECQUEREL,
494 	TOPO_SENSOR_UNITS_PPM,
495 	TOPO_SENSOR_UNITS_RESERVED1,
496 	TOPO_SENSOR_UNITS_DECIBELS,
497 	TOPO_SENSOR_UNITS_DBA,
498 	TOPO_SENSOR_UNITS_DBC,
499 	TOPO_SENSOR_UNITS_GRAY,
500 
501 	TOPO_SENSOR_UNITS_SIEVERT,
502 	TOPO_SENSOR_UNITS_COLOR_TEMP_K,
503 	TOPO_SENSOR_UNITS_BIT,
504 	TOPO_SENSOR_UNITS_KILOBIT,
505 	TOPO_SENSOR_UNITS_MEGABIT,
506 	TOPO_SENSOR_UNITS_GIGABIT,
507 	TOPO_SENSOR_UNITS_BYTE,
508 	TOPO_SENSOR_UNITS_KILOBYTE,
509 	TOPO_SENSOR_UNITS_MEGABYTE,
510 	TOPO_SENSOR_UNITS_GIGABYTE,
511 	TOPO_SENSOR_UNITS_WORD,
512 	TOPO_SENSOR_UNITS_DWORD,
513 	TOPO_SENSOR_UNITS_QWORD,
514 	TOPO_SENSOR_UNITS_MEMLINE,
515 	TOPO_SENSOR_UNITS_HIT,
516 	TOPO_SENSOR_UNITS_MISS,
517 
518 	TOPO_SENSOR_UNITS_RETRY,
519 	TOPO_SENSOR_UNITS_RESET,
520 	TOPO_SENSOR_UNITS_OVERFLOW,
521 	TOPO_SENSOR_UNITS_UNDERRUN,
522 	TOPO_SENSOR_UNITS_COLLISION,
523 	TOPO_SENSOR_UNITS_PACKETS,
524 	TOPO_SENSOR_UNITS_MESSAGES,
525 	TOPO_SENSOR_UNITS_CHARACTERS,
526 	TOPO_SENSOR_UNITS_ERROR,
527 	TOPO_SENSOR_UNITS_CE,
528 	TOPO_SENSOR_UNITS_UE,
529 	TOPO_SENSOR_UNITS_FATAL_ERROR,
530 	TOPO_SENSOR_UNITS_GRAMS
531 } topo_sensor_unit_t;
532 
533 /*
534  * Sensor Types amd the associated sensor-type-specific states
535  *
536  * These are used to decode the type and state properties in the facility
537  * propgroup on facility nodes of type sensor.
538  *
539  * Again we're basically using the same defines as for IPMI as it's serves
540  * as a good starting point and simplifies the IPMI provider code.  Of course
541  * other facility providers will need to convert from their native codes
542  * to the topo code when they set the type and state properties.
543  */
544 #define	TOPO_SENSOR_TYPE_RESERVED			0x0000
545 #define	TOPO_SENSOR_TYPE_TEMP				0x0001
546 #define	TOPO_SENSOR_TYPE_VOLTAGE			0x0002
547 #define	TOPO_SENSOR_TYPE_CURRENT			0x0003
548 #define	TOPO_SENSOR_TYPE_FAN				0x0004
549 #define	TOPO_SENSOR_TYPE_PHYSICAL			0x0005
550 
551 #define	TOPO_SENSOR_STATE_PHYSICAL_GENERAL		0x0001
552 #define	TOPO_SENSOR_STATE_PHYSICAL_BAY			0x0002
553 #define	TOPO_SENSOR_STATE_PHYSICAL_CARD			0x0004
554 #define	TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR		0x0008
555 #define	TOPO_SENSOR_STATE_PHYSICAL_LAN			0x0010
556 #define	TOPO_SENSOR_STATE_PHYSICAL_DOCK			0x0020
557 #define	TOPO_SENSOR_STATE_PHYSICAL_FAN			0x0040
558 
559 #define	TOPO_SENSOR_TYPE_PLATFORM			0x0006
560 
561 #define	TOPO_SENSOR_STATE_PLATFORM_SECURE		0x0001
562 #define	TOPO_SENSOR_STATE_PLATFORM_USER_PASS		0x0002
563 #define	TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS		0x0004
564 #define	TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS		0x0008
565 #define	TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS		0x0010
566 #define	TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND		0x0020
567 
568 #define	TOPO_SENSOR_TYPE_PROCESSOR			0x0007
569 
570 #define	TOPO_SENSOR_STATE_PROCESSOR_IERR		0x0001
571 #define	TOPO_SENSOR_STATE_PROCESSOR_THERMAL		0x0002
572 #define	TOPO_SENSOR_STATE_PROCESSOR_FRB1		0x0004
573 #define	TOPO_SENSOR_STATE_PROCESSOR_FRB2		0x0008
574 #define	TOPO_SENSOR_STATE_PROCESSOR_FRB3		0x0010
575 #define	TOPO_SENSOR_STATE_PROCESSOR_CONFIG		0x0020
576 #define	TOPO_SENSOR_STATE_PROCESSOR_SMBIOS		0x0040
577 #define	TOPO_SENSOR_STATE_PROCESSOR_PRESENT		0x0080
578 #define	TOPO_SENSOR_STATE_PROCESSOR_DISABLED		0x0100
579 #define	TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR		0x0200
580 #define	TOPO_SENSOR_STATE_PROCESSOR_THROTTLED		0x0400
581 
582 #define	TOPO_SENSOR_TYPE_POWER_SUPPLY			0x0008
583 
584 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT		0x0001
585 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE		0x0002
586 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL		0x0004
587 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST	0x0008
588 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE	0x0010
589 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES	0x0020
590 #define	TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR	0x0040
591 
592 #define	TOPO_SENSOR_TYPE_POWER_UNIT			0x0009
593 
594 #define	TOPO_SENSOR_STATE_POWER_UNIT_OFF		0x0001
595 #define	TOPO_SENSOR_STATE_POWER_UNIT_CYCLE		0x0002
596 #define	TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN		0x0004
597 #define	TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN	0x0008
598 #define	TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST		0x0010
599 #define	TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE	0x0020
600 #define	TOPO_SENSOR_STATE_POWER_UNIT_FAIL		0x0040
601 #define	TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL		0x0080
602 
603 #define	TOPO_SENSOR_TYPE_COOLING			0x000A
604 #define	TOPO_SENSOR_TYPE_OTHER				0x000B
605 
606 #define	TOPO_SENSOR_TYPE_MEMORY				0x000C
607 
608 #define	TOPO_SENSOR_STATE_MEMORY_CE			0x0001
609 #define	TOPO_SENSOR_STATE_MEMORY_UE			0x0002
610 #define	TOPO_SENSOR_STATE_MEMORY_PARITY			0x0004
611 #define	TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL		0x0008
612 #define	TOPO_SENSOR_STATE_MEMORY_DISABLED		0x0010
613 #define	TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT		0x0020
614 #define	TOPO_SENSOR_STATE_MEMORY_PRESENT		0x0040
615 #define	TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR		0x0080
616 #define	TOPO_SENSOR_STATE_MEMORY_SPARE			0x0100
617 #define	TOPO_SENSOR_STATE_MEMORY_THROTTLED		0x0200
618 #define	TOPO_SENSOR_STATE_MEMORY_OVERTEMP		0x0400
619 
620 #define	TOPO_SENSOR_TYPE_BAY				0x000D
621 
622 #define	TOPO_SENSOR_STATE_BAY_PRESENT			0x0001
623 #define	TOPO_SENSOR_STATE_BAY_FAULT			0x0002
624 #define	TOPO_SENSOR_STATE_BAY_PREDFAIL			0x0004
625 #define	TOPO_SENSOR_STATE_BAY_SPARE			0x0008
626 #define	TOPO_SENSOR_STATE_BAY_CHECK			0x0010
627 #define	TOPO_SENSOR_STATE_BAY_CRITICAL			0x0020
628 #define	TOPO_SENSOR_STATE_BAY_FAILED			0x0040
629 #define	TOPO_SENSOR_STATE_BAY_REBUILDING		0x0080
630 #define	TOPO_SENSOR_STATE_BAY_ABORTED			0x0100
631 
632 #define	TOPO_SENSOR_TYPE_POST_RESIZE			0x000E
633 
634 #define	TOPO_SENSOR_TYPE_FIRMWARE			0x000F
635 
636 #define	TOPO_SENSOR_STATE_FIRMWARE_ERROR		0x0001
637 #define	TOPO_SENSOR_STATE_FIRMWARE_HANG			0x0002
638 #define	TOPO_SENSOR_STATE_FIRMWARE_PROGRESS		0x0004
639 
640 #define	TOPO_SENSOR_TYPE_EVENT_LOG			0x0010
641 
642 #define	TOPO_SENSOR_STATE_EVENT_LOG_CE			0x0001
643 #define	TOPO_SENSOR_STATE_EVENT_LOG_TYPE		0x0002
644 #define	TOPO_SENSOR_STATE_EVENT_LOG_RESET		0x0004
645 #define	TOPO_SENSOR_STATE_EVENT_LOG_ALL			0x0008
646 #define	TOPO_SENSOR_STATE_EVENT_LOG_FULL		0x0010
647 #define	TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL		0x0020
648 
649 #define	TOPO_SENSOR_TYPE_WATCHDOG1			0x0011
650 
651 #define	TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET		0x0001
652 #define	TOPO_SENSOR_STATE_WATCHDOG_OS_RESET		0x0002
653 #define	TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN		0x0004
654 #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN		0x0008
655 #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE		0x0010
656 #define	TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG		0x0020
657 #define	TOPO_SENSOR_STATE_WATCHDOG_EXPIRED		0x0040
658 #define	TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT	0x0080
659 
660 #define	TOPO_SENSOR_TYPE_SYSTEM				0x0012
661 
662 #define	TOPO_SENSOR_STATE_SYSTEM_RECONF			0x0001
663 #define	TOPO_SENSOR_STATE_SYSTEM_BOOT			0x0002
664 #define	TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE	0x0004
665 #define	TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED	0x0008
666 #define	TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION		0x0010
667 #define	TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC	0x0020
668 
669 #define	TOPO_SENSOR_TYPE_CRITICAL			0x0013
670 
671 #define	TOPO_SENSOR_STATE_CRITICAL_EXT_NMI		0x0001
672 #define	TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT		0x0002
673 #define	TOPO_SENSOR_STATE_CRITICAL_IO_NMI		0x0004
674 #define	TOPO_SENSOR_STATE_CRITICAL_SW_NMI		0x0008
675 #define	TOPO_SENSOR_STATE_CRITICAL_PCI_PERR		0x0010
676 #define	TOPO_SENSOR_STATE_CRITICAL_PCI_SERR		0x0020
677 #define	TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE	0x0040
678 #define	TOPO_SENSOR_STATE_CRITICAL_BUS_CE		0x0080
679 #define	TOPO_SENSOR_STATE_CRITICAL_BUS_UE		0x0100
680 #define	TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI		0x0200
681 #define	TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR	0x0400
682 #define	TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED		0x0800
683 
684 #define	TOPO_SENSOR_TYPE_BUTTON				0x0014
685 
686 #define	TOPO_SENSOR_STATE_BUTTON_PWR			0x0001
687 #define	TOPO_SENSOR_STATE_BUTTON_SLEEP			0x0002
688 #define	TOPO_SENSOR_STATE_BUTTON_RESET			0x0004
689 #define	TOPO_SENSOR_STATE_BUTTON_FRU_LATCH		0x0008
690 #define	TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE		0x0010
691 
692 #define	TOPO_SENSOR_TYPE_MODULE				0x0015
693 #define	TOPO_SENSOR_TYPE_MICROCONTROLLER		0x0016
694 #define	TOPO_SENSOR_TYPE_CARD				0x0017
695 #define	TOPO_SENSOR_TYPE_CHASSIS			0x0018
696 
697 #define	TOPO_SENSOR_TYPE_CHIPSET			0x0019
698 
699 #define	TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL		0x0001
700 
701 #define	TOPO_SENSOR_TYPE_FRU				0x001A
702 
703 #define	TOPO_SENSOR_TYPE_CABLE				0x001B
704 
705 #define	TOPO_SENSOR_STATE_CABLE_CONNECTED		0x0001
706 #define	TOPO_SENSOR_STATE_CABLE_CONFIG_ERR		0x0002
707 
708 #define	TOPO_SENSOR_TYPE_TERMINATOR			0x001C
709 
710 #define	TOPO_SENSOR_TYPE_BOOT_STATE			0x001D
711 
712 #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP	0x0001
713 #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET	0x0002
714 #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET	0x0004
715 #define	TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT		0x0008
716 #define	TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT		0x0010
717 #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET	0x0020
718 #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET	0x0040
719 #define	TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART	0x0080
720 
721 #define	TOPO_SENSOR_TYPE_BOOT_ERROR			0x001E
722 
723 #define	TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA		0x0001
724 #define	TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK	0x0002
725 #define	TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER	0x0004
726 #define	TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT	0x0008
727 #define	TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT	0x0010
728 
729 #define	TOPO_SENSOR_TYPE_BOOT_OS			0x001F
730 
731 #define	TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE	0x0001
732 #define	TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE	0x0002
733 #define	TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE	0x0004
734 #define	TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE	0x0008
735 #define	TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE	0x0010
736 #define	TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE	0x0020
737 #define	TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE	0x0040
738 
739 #define	TOPO_SENSOR_TYPE_OS_SHUTDOWN			0x0020
740 
741 #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING		0x0001
742 #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH		0x0002
743 #define	TOPO_SENSOR_STATE_OS_STOP_GRACEFUL		0x0004
744 #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL		0x0008
745 #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF		0x0010
746 #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC		0x0020
747 
748 #define	TOPO_SENSOR_TYPE_SLOT				0x0021
749 
750 #define	TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED		0x0001
751 #define	TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED	0x0002
752 #define	TOPO_SENSOR_STATE_SLOT_CONNECTED		0x0004
753 #define	TOPO_SENSOR_STATE_SLOT_INSTALL_READY		0x0008
754 #define	TOPO_SENSOR_STATE_SLOT_REMOVE_READY		0x0010
755 #define	TOPO_SENSOR_STATE_SLOT_PWR_OFF			0x0020
756 #define	TOPO_SENSOR_STATE_SLOT_REMOVED			0x0040
757 #define	TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED	0x0080
758 #define	TOPO_SENSOR_STATE_SLOT_DISABLED			0x0100
759 #define	TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE		0x0200
760 
761 #define	TOPO_SENSOR_TYPE_ACPI				0x0022
762 
763 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0		0x0001
764 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1		0x0002
765 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S2		0x0004
766 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S3		0x0008
767 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4		0x0010
768 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF	0x0020
769 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF	0x0040
770 #define	TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF	0x0080
771 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP	0x0100
772 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP		0x0200
773 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE	0x0400
774 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON		0x0800
775 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF	0x1000
776 #define	TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN		0x2000
777 
778 #define	TOPO_SENSOR_TYPE_WATCHDOG2			0x0023
779 
780 #define	TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED		0x0001
781 #define	TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET		0x0002
782 #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN		0x0004
783 #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE		0x0008
784 #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1		0x0010
785 #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2		0x0020
786 #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3		0x0040
787 #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4		0x0080
788 #define	TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT		0x0100
789 
790 #define	TOPO_SENSOR_TYPE_ALERT				0x0024
791 
792 #define	TOPO_SENSOR_STATE_ALERT_PLAT_PAGE		0x0001
793 #define	TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT		0x0002
794 #define	TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP		0x0004
795 #define	TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP		0x0008
796 
797 #define	TOPO_SENSOR_TYPE_PRESENCE			0x0025
798 
799 #define	TOPO_SENSOR_STATE_PRESENCE_PRESENT		0x0001
800 #define	TOPO_SENSOR_STATE_PRESENCE_ABSENT		0x0002
801 #define	TOPO_SENSOR_STATE_PRESENCE_DISABLED		0x0004
802 
803 #define	TOPO_SENSOR_TYPE_ASIC				0x0026
804 
805 #define	TOPO_SENSOR_TYPE_LAN				0x0027
806 
807 #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST		0x0001
808 #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT			0x0002
809 
810 #define	TOPO_SENSOR_TYPE_HEALTH				0x0028
811 
812 #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED	0x0001
813 #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED	0x0002
814 #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE		0x0004
815 #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL		0x0008
816 #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE		0x0010
817 #define	TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE		0x0020
818 
819 #define	TOPO_SENSOR_TYPE_BATTERY			0x0029
820 
821 #define	TOPO_SENSOR_STATE_BATTERY_LOW			0x0001
822 #define	TOPO_SENSOR_STATE_BATTERY_FAILED		0x0002
823 #define	TOPO_SENSOR_STATE_BATTERY_PRESENCE		0x0004
824 
825 #define	TOPO_SENSOR_TYPE_AUDIT				0x002A
826 
827 #define	TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED	0x0001
828 #define	TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED	0x0002
829 
830 #define	TOPO_SENSOR_TYPE_VERSION			0x002B
831 
832 #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE		0x0001
833 #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE		0x0002
834 #define	TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE	0x0004
835 #define	TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE	0x0008
836 #define	TOPO_SENSOR_STATE_VERSION_HW_INVAL		0x0010
837 #define	TOPO_SENSOR_STATE_VERSION_SW_INVAL		0x0020
838 #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS	0x0040
839 #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS	0x0080
840 
841 #define	TOPO_SENSOR_TYPE_FRU_STATE			0x002C
842 
843 #define	TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED	0x0001
844 #define	TOPO_SENSOR_STATE_FRU_STATE_INACTIVE		0x0002
845 #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ		0x0004
846 #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS	0x0008
847 #define	TOPO_SENSOR_STATE_FRU_STATE_ACTIVE		0x0010
848 #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ		0x0020
849 #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS	0x0040
850 #define	TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST		0x0080
851 
852 /*
853  * We simplify the IPMI sensor type code defines by combining the generic
854  * and sensor-specific codes into a single range.  Because there's overlap
855  * between the two ranges we offset the generic type codes by 0x0100
856  * which allows ample room in the hole for future expansion of the table to
857  * accomodate either additions to the IPMI spec or to support new sensor types
858  * for alternate provider modules.
859  */
860 #define	TOPO_SENSOR_TYPE_THRESHOLD_STATE		0x0101
861 
862 #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT		0x0001
863 #define	TOPO_SENSOR_STATE_THRESH_LOWER_CRIT		0x0002
864 #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONREC		0x0004
865 #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT		0x0008
866 #define	TOPO_SENSOR_STATE_THRESH_UPPER_CRIT		0x0010
867 #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONREC		0x0020
868 
869 #define	TOPO_SENSOR_TYPE_GENERIC_USAGE			0x0102
870 
871 #define	TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE		0x0001
872 #define	TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE		0x0002
873 #define	TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY		0x0004
874 
875 #define	TOPO_SENSOR_TYPE_GENERIC_STATE			0x0103
876 
877 #define	TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED	0x0001
878 #define	TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED	0x0002
879 
880 #define	TOPO_SENSOR_TYPE_GENERIC_PREDFAIL		0x0104
881 
882 #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED	0x0001
883 #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED	0x0002
884 
885 #define	TOPO_SENSOR_TYPE_GENERIC_LIMIT			0x0105
886 
887 #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED	0x0001
888 #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED	0x0002
889 
890 #define	TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE		0x0106
891 
892 #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET	0x0001
893 #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS	0x0002
894 
895 #define	TOPO_SENSOR_TYPE_SEVERITY			0x0107
896 
897 #define	TOPO_SENSOR_STATE_SEVERITY_OK			0x0001
898 #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH	0x0002
899 #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH	0x0004
900 #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH	0x0008
901 #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW	0x0010
902 #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW	0x0020
903 #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW	0x0020
904 #define	TOPO_SENSOR_STATE_SEVERITY_MONITOR		0x0040
905 #define	TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL	0x0080
906 
907 #define	TOPO_SENSOR_TYPE_GENERIC_PRESENCE		0x0108
908 
909 #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED	0x0001
910 #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED	0x0002
911 
912 #define	TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY		0x0109
913 
914 #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED	0x0001
915 #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED	0x0002
916 
917 #define	TOPO_SENSOR_TYPE_GENERIC_STATUS			0x010A
918 
919 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING	0x0001
920 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST	0x0002
921 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF	0x0004
922 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE		0x0008
923 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE	0x0010
924 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY	0x0020
925 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED	0x0040
926 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE	0x0080
927 #define	TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR	0x0100
928 
929 #define	TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY		0x010B
930 
931 /*
932  * ACPI power state
933  */
934 #define	TOPO_SENSOR_TYPE_GENERIC_ACPI			0x010C
935 
936 #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D0		0x0001
937 #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D1		0x0002
938 #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D2		0x0004
939 #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D3		0x0008
940 
941 /*
942  * Indicator modes and types
943  */
944 typedef enum topo_led_state {
945 	TOPO_LED_STATE_OFF = 0,
946 	TOPO_LED_STATE_ON
947 } topo_led_state_t;
948 
949 /*
950  * This list is limited to the set of LED's that we're likely to manage through
951  * FMA.  Thus is does not include things like power or activity LED's
952  */
953 typedef enum topo_led_type {
954 	TOPO_LED_TYPE_SERVICE = 0,
955 	TOPO_LED_TYPE_LOCATE,
956 	TOPO_LED_TYPE_OK2RM,
957 	TOPO_LED_TYPE_PRESENT
958 } topo_led_type_t;
959 
960 
961 #ifdef __cplusplus
962 }
963 #endif
964 
965 #endif /* _LIBTOPO_H */
966