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