xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/libtopo.h (revision 8abca89f418632e2ebd3bcbc8b0d814c394ebef1)
17aec1d6eScindi /*
27aec1d6eScindi  * CDDL HEADER START
37aec1d6eScindi  *
47aec1d6eScindi  * The contents of this file are subject to the terms of the
57aec1d6eScindi  * Common Development and Distribution License (the "License").
67aec1d6eScindi  * You may not use this file except in compliance with the License.
77aec1d6eScindi  *
87aec1d6eScindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6eScindi  * or http://www.opensolaris.org/os/licensing.
107aec1d6eScindi  * See the License for the specific language governing permissions
117aec1d6eScindi  * and limitations under the License.
127aec1d6eScindi  *
137aec1d6eScindi  * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6eScindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6eScindi  * If applicable, add the following below this CDDL HEADER, with the
167aec1d6eScindi  * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6eScindi  * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6eScindi  *
197aec1d6eScindi  * CDDL HEADER END
207aec1d6eScindi  */
217aec1d6eScindi 
227aec1d6eScindi /*
238393544eSHyon Kim  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
247aec1d6eScindi  */
25208e1562SRob Johnston /*
26*8abca89fSRob Johnston  * Copyright (c) 2019, Joyent, Inc. All rights reserved.
27208e1562SRob Johnston  */
287aec1d6eScindi 
297aec1d6eScindi #ifndef _LIBTOPO_H
307aec1d6eScindi #define	_LIBTOPO_H
317aec1d6eScindi 
327aec1d6eScindi #include <sys/nvpair.h>
330eb822a1Scindi #include <stdio.h>
34c93c462eSCheng Sean Ye #include <libdevinfo.h>
357aec1d6eScindi 
367aec1d6eScindi #ifdef __cplusplus
377aec1d6eScindi extern "C" {
387aec1d6eScindi #endif
397aec1d6eScindi 
407aec1d6eScindi #define	TOPO_VERSION	1	/* Library ABI Interface Version */
417aec1d6eScindi 
427aec1d6eScindi typedef struct topo_hdl topo_hdl_t;
437aec1d6eScindi typedef struct topo_node tnode_t;
447aec1d6eScindi typedef struct topo_walk topo_walk_t;
457aec1d6eScindi typedef int32_t topo_instance_t;
467aec1d6eScindi typedef uint32_t topo_version_t;
477aec1d6eScindi 
48825ba0f2Srobj typedef struct topo_list {
49825ba0f2Srobj 	struct topo_list *l_prev;
50825ba0f2Srobj 	struct topo_list *l_next;
51825ba0f2Srobj } topo_list_t;
52825ba0f2Srobj 
53825ba0f2Srobj typedef struct topo_faclist {
54825ba0f2Srobj 	topo_list_t	tf_list;
55825ba0f2Srobj 	tnode_t		*tf_node;
56825ba0f2Srobj } topo_faclist_t;
57825ba0f2Srobj 
587aec1d6eScindi /*
59c40d7343Scindi  * The following functions, error codes and data structures are private
60c40d7343Scindi  * to libtopo snapshot consumers and enumerator modules.
617aec1d6eScindi  */
627aec1d6eScindi extern topo_hdl_t *topo_open(int, const char *, int *);
637aec1d6eScindi extern void topo_close(topo_hdl_t *);
647aec1d6eScindi extern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
657aec1d6eScindi extern void topo_snap_release(topo_hdl_t *);
660eb822a1Scindi 
670eb822a1Scindi /*
680eb822a1Scindi  * Snapshot walker support
690eb822a1Scindi  */
700eb822a1Scindi typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *);
710eb822a1Scindi 
727aec1d6eScindi extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
737aec1d6eScindi     void *, int *);
747aec1d6eScindi extern int topo_walk_step(topo_walk_t *, int);
757aec1d6eScindi extern void topo_walk_fini(topo_walk_t *);
76c93c462eSCheng Sean Ye extern di_node_t topo_hdl_devinfo(topo_hdl_t *);
77c93c462eSCheng Sean Ye extern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *);
787aec1d6eScindi 
79c40d7343Scindi /*
80c40d7343Scindi  * Walk status returned from walker
81c40d7343Scindi  */
827aec1d6eScindi #define	TOPO_WALK_ERR		-1
837aec1d6eScindi #define	TOPO_WALK_NEXT		0
847aec1d6eScindi #define	TOPO_WALK_TERMINATE	1
857aec1d6eScindi 
86c40d7343Scindi /*
87c40d7343Scindi  * Types of walks: depth-first (child) or breadth-first (sibling)
88c40d7343Scindi  */
897aec1d6eScindi #define	TOPO_WALK_CHILD		0x0001
907aec1d6eScindi #define	TOPO_WALK_SIBLING	0x0002
917aec1d6eScindi 
920eb822a1Scindi /*
930eb822a1Scindi  * FMRI helper routines
940eb822a1Scindi  */
957aec1d6eScindi extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *);
9625c6ff4bSstephh extern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *);
977aec1d6eScindi extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
98dd566498Svn extern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *);
997aec1d6eScindi extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *);
10025c6ff4bSstephh extern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *);
101e4b86885SCheng Sean Ye extern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *);
102e4b86885SCheng Sean Ye extern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *);
1037aec1d6eScindi extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *);
1047aec1d6eScindi extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *);
1057aec1d6eScindi extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *);
1067aec1d6eScindi extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **,
1077aec1d6eScindi     int *);
1089dd0f810Scindi extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *);
1092cb5535aSrobj extern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *);
1107aec1d6eScindi extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
111825ba0f2Srobj extern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *,
112825ba0f2Srobj     uint32_t, topo_walk_cb_t, void *, int *);
1137aec1d6eScindi 
114940d71d2Seschrock /*
115069f55e2SEric Schrock  * Consolidation private utility functions
116940d71d2Seschrock  */
117940d71d2Seschrock extern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *);
118069f55e2SEric Schrock extern ulong_t topo_fmri_strhash_noauth(topo_hdl_t *, const char *);
119940d71d2Seschrock extern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *);
120069f55e2SEric Schrock extern boolean_t topo_fmri_strcmp_noauth(topo_hdl_t *, const char *,
121069f55e2SEric Schrock     const char *);
122940d71d2Seschrock 
1237aec1d6eScindi /*
1247aec1d6eScindi  * Topo node utilities: callable from topo_walk_step() callback or module
1257aec1d6eScindi  * enumeration, topo_mod_enumerate()
1267aec1d6eScindi  */
1277aec1d6eScindi extern char *topo_node_name(tnode_t *);
1287aec1d6eScindi extern topo_instance_t topo_node_instance(tnode_t *);
1294557a2a1Srobj extern tnode_t *topo_node_parent(tnode_t *);
1307aec1d6eScindi extern void *topo_node_private(tnode_t *);
131825ba0f2Srobj extern int topo_node_flags(tnode_t *);
1327aec1d6eScindi extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *);
1337aec1d6eScindi extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *);
1347aec1d6eScindi extern int topo_node_resource(tnode_t *, nvlist_t **, int *);
1357aec1d6eScindi extern int topo_node_label(tnode_t *, char **, int *);
136e4b86885SCheng Sean Ye extern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t);
1377aec1d6eScindi extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t,
1387aec1d6eScindi     nvlist_t *, nvlist_t **, int *);
139825ba0f2Srobj extern boolean_t topo_method_supported(tnode_t *, const char *,
140825ba0f2Srobj     topo_version_t);
141825ba0f2Srobj extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *,
142825ba0f2Srobj     uint32_t, topo_faclist_t *, int *);
1431410cb93SJoshua M. Clulow extern int topo_node_child_walk(topo_hdl_t *, tnode_t *, topo_walk_cb_t,
1441410cb93SJoshua M. Clulow     void *, int *);
145*8abca89fSRob Johnston extern int topo_node_occupied(tnode_t *, boolean_t *);
146825ba0f2Srobj 
147825ba0f2Srobj /*
148825ba0f2Srobj  * Node flags: denotes type of node
149825ba0f2Srobj  */
150825ba0f2Srobj #define	TOPO_NODE_DEFAULT	0
151825ba0f2Srobj #define	TOPO_NODE_FACILITY	1
1527aec1d6eScindi 
153825ba0f2Srobj #define	TOPO_FAC_TYPE_SENSOR	"sensor"
154825ba0f2Srobj #define	TOPO_FAC_TYPE_INDICATOR	"indicator"
155825ba0f2Srobj 
156825ba0f2Srobj /*
157825ba0f2Srobj  * Topo property get functions
158825ba0f2Srobj  */
1597aec1d6eScindi extern int topo_prop_get_int32(tnode_t *, const char *, const char *,
1607aec1d6eScindi     int32_t *, int *);
1617aec1d6eScindi extern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
1627aec1d6eScindi     uint32_t *, int *);
1637aec1d6eScindi extern int topo_prop_get_int64(tnode_t *, const char *, const char *,
1647aec1d6eScindi     int64_t *, int *);
1657aec1d6eScindi extern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
1667aec1d6eScindi     uint64_t *, int *);
167825ba0f2Srobj extern int topo_prop_get_double(tnode_t *, const char *, const char *,
168825ba0f2Srobj     double *, int *);
1697aec1d6eScindi extern int topo_prop_get_string(tnode_t *, const char *, const char *,
1707aec1d6eScindi     char **, int *);
1717aec1d6eScindi extern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
1727aec1d6eScindi     nvlist_t **, int *);
1730eb822a1Scindi extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
1740eb822a1Scindi     int32_t **, uint_t *, int *);
1750eb822a1Scindi extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
1760eb822a1Scindi     uint32_t **, uint_t *, int *);
1770eb822a1Scindi extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
1780eb822a1Scindi     int64_t **, uint_t *, int *);
1790eb822a1Scindi extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
1800eb822a1Scindi     uint64_t **, uint_t *, int *);
1810eb822a1Scindi extern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
1820eb822a1Scindi     char ***, uint_t *, int *);
1830eb822a1Scindi extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
1840eb822a1Scindi     nvlist_t ***, uint_t *, int *);
1857aec1d6eScindi 
186825ba0f2Srobj /*
187825ba0f2Srobj  * Topo property set functions
188825ba0f2Srobj  */
189825ba0f2Srobj extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
190825ba0f2Srobj     int32_t, int *);
191825ba0f2Srobj extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
192825ba0f2Srobj     uint32_t, int *);
193825ba0f2Srobj extern int topo_prop_set_int64(tnode_t *, const char *, const char *,
194825ba0f2Srobj     int, int64_t, int *);
195825ba0f2Srobj extern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
196825ba0f2Srobj     int, uint64_t, int *);
197825ba0f2Srobj extern int topo_prop_set_double(tnode_t *, const char *, const char *,
198825ba0f2Srobj     int, double, int *);
199825ba0f2Srobj extern int topo_prop_set_string(tnode_t *, const char *, const char *,
200825ba0f2Srobj     int, const char *, int *);
201825ba0f2Srobj extern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
202825ba0f2Srobj     int, const nvlist_t *, int *);
203825ba0f2Srobj extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
204825ba0f2Srobj     int32_t *, uint_t, int *);
205825ba0f2Srobj extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
206825ba0f2Srobj     int, uint32_t *, uint_t, int *);
207825ba0f2Srobj extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
208825ba0f2Srobj     int, int64_t *, uint_t, int *);
209825ba0f2Srobj extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
210825ba0f2Srobj     int, uint64_t *, uint_t, int *);
211825ba0f2Srobj extern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
212825ba0f2Srobj     int, const char **, uint_t, int *);
213825ba0f2Srobj extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
214825ba0f2Srobj     int, const nvlist_t **, uint_t, int *);
215825ba0f2Srobj 
2160eb822a1Scindi #define	TOPO_PROP_IMMUTABLE	0
217e5dcf7beSRobert Johnston #define	TOPO_PROP_MUTABLE	0x01
218e5dcf7beSRobert Johnston #define	TOPO_PROP_NONVOLATILE	0x02
2197aec1d6eScindi 
2207aec1d6eScindi /* Protocol property group and property names */
2217aec1d6eScindi #define	TOPO_PGROUP_PROTOCOL	"protocol"	/* Required property group */
2227aec1d6eScindi #define	TOPO_PROP_RESOURCE	"resource"	/* resource FMRI */
2237aec1d6eScindi #define	TOPO_PROP_ASRU		"ASRU"		/* ASRU FMRI */
2247aec1d6eScindi #define	TOPO_PROP_FRU		"FRU"		/* FRU FMRI */
2257aec1d6eScindi #define	TOPO_PROP_MOD		"module"	/* software module FMRI */
2267aec1d6eScindi #define	TOPO_PROP_PKG		"package"	/* software package FMRI */
2277aec1d6eScindi #define	TOPO_PROP_LABEL		"label"		/*  property LABEL */
2287aec1d6eScindi 
229825ba0f2Srobj #define	TOPO_METH_FAC_ENUM	"fac_enum"
230825ba0f2Srobj 
2317aec1d6eScindi /*
2327aec1d6eScindi  * System property group
2337aec1d6eScindi  */
2347aec1d6eScindi #define	TOPO_PGROUP_SYSTEM	"system"
2357aec1d6eScindi #define	TOPO_PROP_ISA		"isa"
2367aec1d6eScindi #define	TOPO_PROP_MACHINE	"machine"
2377aec1d6eScindi 
23888045cffSRobert Johnston #define	TOPO_PGROUP_IPMI	"ipmi"
23988045cffSRobert Johnston 
2400eb822a1Scindi /*
241c40d7343Scindi  * These enum definitions are used to define a set of error tags associated with
242c40d7343Scindi  * libtopo error conditions occuring during the adminstration of
243c40d7343Scindi  * properties, invocation of methods and fmri-based queries.  The shell script
244c40d7343Scindi  * mkerror.sh is used to parse this file and create a corresponding topo_error.c
245c40d7343Scindi  * source file.
246c40d7343Scindi  *
2470eb822a1Scindi  * If you do something other than add a new error tag here, you may need to
2480eb822a1Scindi  * update the mkerror shell script as it is based upon simple regexps.
2490eb822a1Scindi  */
2500eb822a1Scindi typedef enum topo_prop_errno {
2510eb822a1Scindi     ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */
2520eb822a1Scindi     ETOPO_PROP_NOENT,   /* undefined property or property group */
2530eb822a1Scindi     ETOPO_PROP_DEFD,    /* static property already defined */
2540eb822a1Scindi     ETOPO_PROP_NOMEM,   /* memory limit exceeded during property allocation */
2550eb822a1Scindi     ETOPO_PROP_TYPE,    /* invalid property type */
256c40d7343Scindi     ETOPO_PROP_NAME,    /* invalid property name */
2570eb822a1Scindi     ETOPO_PROP_NOINHERIT, /* can not inherit property */
2580eb822a1Scindi     ETOPO_PROP_NVL,	/* malformed property nvlist */
259c40d7343Scindi     ETOPO_PROP_METHOD,	/* get property method failed */
2600eb822a1Scindi     ETOPO_PROP_END	/* end of prop errno list (to ease auto-merge) */
2610eb822a1Scindi } topo_prop_errno_t;
2627aec1d6eScindi 
263dd566498Svn typedef enum topo_method_errno {
264c40d7343Scindi     ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */
265c40d7343Scindi     ETOPO_METHOD_INVAL,		/* invalid method registration */
266c40d7343Scindi     ETOPO_METHOD_NOTSUP,	/* method not supported */
267c40d7343Scindi     ETOPO_METHOD_FAIL,		/* method failed */
268c40d7343Scindi     ETOPO_METHOD_VEROLD,	/* app is compiled to use obsolete method */
269c40d7343Scindi     ETOPO_METHOD_VERNEW,	/* app is compiled to use obsolete method */
270c40d7343Scindi     ETOPO_METHOD_NOMEM,		/* memory limit exceeded during method op */
271c40d7343Scindi     ETOPO_METHOD_DEFD,		/* method op already defined */
272c40d7343Scindi     ETOPO_METHOD_END		/* end of method errno list */
273dd566498Svn } topo_method_errno_t;
274dd566498Svn 
275c40d7343Scindi typedef enum topo_fmri_errno {
276c40d7343Scindi     ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */
277c40d7343Scindi     ETOPO_FMRI_NVL,		/* nvlist allocation failure for FMRI */
278c40d7343Scindi     ETOPO_FMRI_VERSION,		/* invalid FMRI scheme version */
279c40d7343Scindi     ETOPO_FMRI_MALFORM,		/* malformed FMRI */
280c40d7343Scindi     ETOPO_FMRI_NOMEM,		/* memory limit exceeded */
281c40d7343Scindi     ETOPO_FMRI_END		/* end of fmri errno list */
282c40d7343Scindi } topo_fmri_errno_t;
283c40d7343Scindi 
284c40d7343Scindi typedef enum topo_hdl_errno {
285c40d7343Scindi     ETOPO_HDL_UNKNOWN = 3300,	/* unknown topo handle error */
286c40d7343Scindi     ETOPO_HDL_ABIVER,		/* handle opened with invalid ABI version */
287c40d7343Scindi     ETOPO_HDL_SNAP,		/* snapshot already taken */
288c40d7343Scindi     ETOPO_HDL_INVAL,		/* invalid argument specified */
289c40d7343Scindi     ETOPO_HDL_UUID,		/* uuid already set */
290c40d7343Scindi     ETOPO_HDL_NOMEM,		/* memory limit exceeded */
291c40d7343Scindi     ETOPO_HDL_END		/* end of handle errno list */
292c40d7343Scindi } topo_hdl_errno_t;
293dd566498Svn 
2947aec1d6eScindi extern const char *topo_strerror(int);
295c40d7343Scindi extern void topo_hdl_strfree(topo_hdl_t *, char *);
2960eb822a1Scindi extern void topo_debug_set(topo_hdl_t *, const char *, const char *);
297c40d7343Scindi 
298c40d7343Scindi /*
299c40d7343Scindi  * The following functions and data structures to support property
300c40d7343Scindi  * observability are private to the fmtopo command.
301c40d7343Scindi  */
302c40d7343Scindi 
303c40d7343Scindi /*
304c40d7343Scindi  * Each topology node advertises the name and data stability of each of its
305c40d7343Scindi  * modules and properties. (see attributes(5)).
306c40d7343Scindi  */
307c40d7343Scindi 
308c40d7343Scindi /*
309c40d7343Scindi  * Topo stability attributes
310c40d7343Scindi  */
311c40d7343Scindi typedef enum topo_stability {
312c40d7343Scindi 	TOPO_STABILITY_UNKNOWN = 0,	/* private to libtopo */
313c40d7343Scindi 	TOPO_STABILITY_INTERNAL,	/* private to libtopo */
314c40d7343Scindi 	TOPO_STABILITY_PRIVATE,		/* private to Sun */
315c40d7343Scindi 	TOPO_STABILITY_OBSOLETE,	/* scheduled for removal */
316c40d7343Scindi 	TOPO_STABILITY_EXTERNAL,	/* not controlled by Sun */
317c40d7343Scindi 	TOPO_STABILITY_UNSTABLE,	/* new or rapidly changing */
318c40d7343Scindi 	TOPO_STABILITY_EVOLVING,	/* less rapidly changing */
319c40d7343Scindi 	TOPO_STABILITY_STABLE,		/* mature interface from Sun */
320c40d7343Scindi 	TOPO_STABILITY_STANDARD		/* industry standard */
321c40d7343Scindi } topo_stability_t;
322c40d7343Scindi 
323c40d7343Scindi #define	TOPO_STABILITY_MAX	TOPO_STABILITY_STANDARD	/* max valid stab */
324c40d7343Scindi 
325c40d7343Scindi typedef struct topo_pgroup_info {
326c40d7343Scindi 	const char *tpi_name;		/* property group name */
327c40d7343Scindi 	topo_stability_t tpi_namestab;	/* stability of group name */
328c40d7343Scindi 	topo_stability_t tpi_datastab;	/* stability of all property values */
329c40d7343Scindi 	topo_version_t tpi_version;	/* version of pgroup definition */
330c40d7343Scindi } topo_pgroup_info_t;
331c40d7343Scindi 
332c40d7343Scindi extern topo_stability_t topo_name2stability(const char *);
333c40d7343Scindi extern const char *topo_stability2name(topo_stability_t);
334c40d7343Scindi extern void topo_pgroup_destroy(tnode_t *, const char *);
335c40d7343Scindi extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *);
336c40d7343Scindi 
337c40d7343Scindi typedef enum {
338c40d7343Scindi 	TOPO_TYPE_INVALID = 0,
339c40d7343Scindi 	TOPO_TYPE_BOOLEAN,	/* boolean */
340c40d7343Scindi 	TOPO_TYPE_INT32,	/* int32_t */
341c40d7343Scindi 	TOPO_TYPE_UINT32,	/* uint32_t */
342c40d7343Scindi 	TOPO_TYPE_INT64,	/* int64_t */
343c40d7343Scindi 	TOPO_TYPE_UINT64,	/* uint64_t */
344c40d7343Scindi 	TOPO_TYPE_STRING,	/* const char* */
345c40d7343Scindi 	TOPO_TYPE_TIME,		/* uint64_t */
346c40d7343Scindi 	TOPO_TYPE_SIZE,		/* uint64_t */
347c40d7343Scindi 	TOPO_TYPE_FMRI,		/* nvlist_t */
348c40d7343Scindi 	TOPO_TYPE_INT32_ARRAY,	/* array of int32_t */
349c40d7343Scindi 	TOPO_TYPE_UINT32_ARRAY,	/* array of uint32_t */
350c40d7343Scindi 	TOPO_TYPE_INT64_ARRAY,	/* array of int64_t */
351c40d7343Scindi 	TOPO_TYPE_UINT64_ARRAY,	/* array of uint64_t */
352c40d7343Scindi 	TOPO_TYPE_STRING_ARRAY,	/* array of const char* */
353825ba0f2Srobj 	TOPO_TYPE_FMRI_ARRAY,	/* array of nvlist_t */
354825ba0f2Srobj 	TOPO_TYPE_DOUBLE	/* double */
355c40d7343Scindi } topo_type_t;
356c40d7343Scindi 
357c40d7343Scindi extern nvlist_t *topo_prop_getprops(tnode_t *, int *err);
358c40d7343Scindi extern int topo_prop_getprop(tnode_t *, const char *, const char *,
359c40d7343Scindi     nvlist_t *, nvlist_t **, int *);
360c40d7343Scindi extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *);
361c40d7343Scindi extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *,
362c40d7343Scindi     int, nvlist_t *, int *);
363c40d7343Scindi extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *,
364c40d7343Scindi     const char *, nvlist_t *,  nvlist_t **, int *);
365c40d7343Scindi extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *,
366c40d7343Scindi     nvlist_t **, int *);
367c40d7343Scindi extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *,
368c40d7343Scindi     nvlist_t *, int, nvlist_t *, int *);
3698522c52aSRob Johnston extern void topo_pgroup_hcset(tnode_t *, nvlist_t *);
370c40d7343Scindi 
371c40d7343Scindi /* Property node NVL names used in topo_prop_getprops */
372c40d7343Scindi #define	TOPO_PROP_GROUP		"property-group"
373c40d7343Scindi #define	TOPO_PROP_GROUP_NAME	"property-group-name"
374c40d7343Scindi #define	TOPO_PROP_GROUP_DSTAB	"property-group-data-stability"
375c40d7343Scindi #define	TOPO_PROP_GROUP_NSTAB	"property-group-name-stability"
376c40d7343Scindi #define	TOPO_PROP_GROUP_VERSION	"property-group-version"
377c40d7343Scindi #define	TOPO_PROP_VAL		"property"
378c40d7343Scindi #define	TOPO_PROP_VAL_NAME	"property-name"
379c40d7343Scindi #define	TOPO_PROP_VAL_VAL	"property-value"
380c40d7343Scindi #define	TOPO_PROP_VAL_TYPE	"property-type"
381c40d7343Scindi #define	TOPO_PROP_FLAG		"property-flag"
382c40d7343Scindi 
383c40d7343Scindi /*
384c40d7343Scindi  * ARGS list used in topo property methods
385c40d7343Scindi  */
386c40d7343Scindi #define	TOPO_PROP_ARGS	"args"
387c40d7343Scindi #define	TOPO_PROP_PARGS	"private-args"
388c40d7343Scindi 
389c40d7343Scindi extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
390c40d7343Scindi 
3917aec1d6eScindi extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
3927aec1d6eScindi extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
3937aec1d6eScindi extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
3947aec1d6eScindi extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
3957aec1d6eScindi extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
3967aec1d6eScindi extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
3977aec1d6eScindi 
398825ba0f2Srobj /*
399825ba0f2Srobj  * Interfaces for converting sensor/indicator types, units, states, etc to
400825ba0f2Srobj  * a string
401825ba0f2Srobj  */
402825ba0f2Srobj void topo_sensor_type_name(uint32_t type, char *buf, size_t len);
403825ba0f2Srobj void topo_sensor_units_name(uint8_t type, char *buf, size_t len);
404825ba0f2Srobj void topo_led_type_name(uint8_t type, char *buf, size_t len);
405825ba0f2Srobj void topo_led_state_name(uint8_t type, char *buf, size_t len);
406825ba0f2Srobj void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
407825ba0f2Srobj     size_t len);
408825ba0f2Srobj 
409825ba0f2Srobj /*
410825ba0f2Srobj  * Defines for standard properties for sensors and indicators
411825ba0f2Srobj  */
412825ba0f2Srobj #define	TOPO_PGROUP_FACILITY	"facility"
413825ba0f2Srobj 
414825ba0f2Srobj #define	TOPO_SENSOR_READING	"reading"
415825ba0f2Srobj #define	TOPO_SENSOR_STATE	"state"
416825ba0f2Srobj #define	TOPO_SENSOR_CLASS	"sensor-class"
417825ba0f2Srobj #define	TOPO_FACILITY_TYPE	"type"
418825ba0f2Srobj #define	TOPO_SENSOR_UNITS	"units"
419825ba0f2Srobj #define	TOPO_LED_MODE		"mode"
420825ba0f2Srobj 
421208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_LNC		"threshold-lower-non-critical"
422208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_LCR		"threshold-lower-critical"
423208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_LNR		"threshold-lower-non-recoverable"
424208e1562SRob Johnston 
425208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_UNC		"threshold-upper-non-critical"
426208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_UCR		"threshold-upper-critical"
427208e1562SRob Johnston #define	TOPO_PROP_THRESHOLD_UNR		"threshold-upper-non-recoverable"
428208e1562SRob Johnston 
429825ba0f2Srobj /*
430825ba0f2Srobj  * Sensor Classes
431825ba0f2Srobj  *
432825ba0f2Srobj  * The "sensor-class" property in the "facility" propgroup on
433825ba0f2Srobj  * facility nodes of type "sensor" should be set to one of these
434825ba0f2Srobj  * two values.
435825ba0f2Srobj  *
436825ba0f2Srobj  * Threshold sensors provide an analog sensor reading via the
437825ba0f2Srobj  * "reading" property in the facility propgroup.  They will also
438825ba0f2Srobj  * provide one or more discrete states via the "state" property
439825ba0f2Srobj  * in the facility propgroup.
440825ba0f2Srobj  *
441825ba0f2Srobj  * Discrete sensors will not provide an analog reading by will
442825ba0f2Srobj  * provide one or more discrete states via the "state" property
443825ba0f2Srobj  * in the facility propgroup.
444825ba0f2Srobj  */
445825ba0f2Srobj #define	TOPO_SENSOR_CLASS_THRESHOLD	"threshold"
446825ba0f2Srobj #define	TOPO_SENSOR_CLASS_DISCRETE	"discrete"
447825ba0f2Srobj 
448825ba0f2Srobj /*
449825ba0f2Srobj  * Sensor unit types.  We're using the unit types and corresponding
45091e105c6SRob Johnston  * codes described in section 43.17 of the IPMI 2.0 as a reference as it seems
45191e105c6SRob Johnston  * to be a reasonably comprehensive list.  This also simplifies the IPMI
45291e105c6SRob Johnston  * facility provider code since the unit type codes will map exactly to what
45391e105c6SRob Johnston  * libtopo uses (so no conversion necessary).  To allow for future growth if
45491e105c6SRob Johnston  * new unit types are added to IPMI in the future, while still allowing unit
45591e105c6SRob Johnston  * types not supported by IPMI to be represented, we include a gap between
45691e105c6SRob Johnston  * the last IPMI unit type and the first non-IPMI unit type.
457825ba0f2Srobj  */
458825ba0f2Srobj typedef enum topo_sensor_unit {
459825ba0f2Srobj 	TOPO_SENSOR_UNITS_UNSPECIFIED = 0,
460825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_C,
461825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_F,
462825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_K,
463825ba0f2Srobj 	TOPO_SENSOR_UNITS_VOLTS,
464825ba0f2Srobj 	TOPO_SENSOR_UNITS_AMPS,
465825ba0f2Srobj 	TOPO_SENSOR_UNITS_WATTS,
466825ba0f2Srobj 	TOPO_SENSOR_UNITS_JOULES,
467825ba0f2Srobj 	TOPO_SENSOR_UNITS_COULOMBS,
468825ba0f2Srobj 	TOPO_SENSOR_UNITS_VA,
469825ba0f2Srobj 	TOPO_SENSOR_UNITS_NITS,
470825ba0f2Srobj 	TOPO_SENSOR_UNITS_LUMEN,
471825ba0f2Srobj 	TOPO_SENSOR_UNITS_LUX,
472825ba0f2Srobj 	TOPO_SENSOR_UNITS_CANDELA,
473825ba0f2Srobj 	TOPO_SENSOR_UNITS_KPA,
474825ba0f2Srobj 	TOPO_SENSOR_UNITS_PSI,
475825ba0f2Srobj 
476825ba0f2Srobj 	TOPO_SENSOR_UNITS_NEWTON,
477825ba0f2Srobj 	TOPO_SENSOR_UNITS_CFM,
478825ba0f2Srobj 	TOPO_SENSOR_UNITS_RPM,
479825ba0f2Srobj 	TOPO_SENSOR_UNITS_HZ,
480825ba0f2Srobj 	TOPO_SENSOR_UNITS_MICROSEC,
481825ba0f2Srobj 	TOPO_SENSOR_UNITS_MILLISEC,
482825ba0f2Srobj 	TOPO_SENSOR_UNITS_SECS,
483825ba0f2Srobj 	TOPO_SENSOR_UNITS_MIN,
484825ba0f2Srobj 	TOPO_SENSOR_UNITS_HOUR,
485825ba0f2Srobj 	TOPO_SENSOR_UNITS_DAY,
486825ba0f2Srobj 	TOPO_SENSOR_UNITS_WEEK,
487825ba0f2Srobj 	TOPO_SENSOR_UNITS_MIL,
488825ba0f2Srobj 	TOPO_SENSOR_UNITS_INCHES,
489825ba0f2Srobj 	TOPO_SENSOR_UNITS_FEET,
490825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_INCH,
491825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_FEET,
492825ba0f2Srobj 
493825ba0f2Srobj 	TOPO_SENSOR_UNITS_MM,
494825ba0f2Srobj 	TOPO_SENSOR_UNITS_CM,
495825ba0f2Srobj 	TOPO_SENSOR_UNITS_METERS,
496825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_CM,
497825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_METER,
498825ba0f2Srobj 	TOPO_SENSOR_UNITS_LITERS,
499825ba0f2Srobj 	TOPO_SENSOR_UNITS_FLUID_OUNCE,
500825ba0f2Srobj 	TOPO_SENSOR_UNITS_RADIANS,
501825ba0f2Srobj 	TOPO_SENSOR_UNITS_STERADIANS,
502825ba0f2Srobj 	TOPO_SENSOR_UNITS_REVOLUTIONS,
503825ba0f2Srobj 	TOPO_SENSOR_UNITS_CYCLES,
504825ba0f2Srobj 	TOPO_SENSOR_UNITS_GRAVITIES,
505825ba0f2Srobj 	TOPO_SENSOR_UNITS_OUNCE,
506825ba0f2Srobj 	TOPO_SENSOR_UNITS_POUND,
507825ba0f2Srobj 	TOPO_SENSOR_UNITS_FOOT_POUND,
508825ba0f2Srobj 	TOPO_SENSOR_UNITS_OZ_INCH,
509825ba0f2Srobj 
510825ba0f2Srobj 	TOPO_SENSOR_UNITS_GAUSS,
511825ba0f2Srobj 	TOPO_SENSOR_UNITS_GILBERTS,
512825ba0f2Srobj 	TOPO_SENSOR_UNITS_HENRY,
513825ba0f2Srobj 	TOPO_SENSOR_UNITS_MILHENRY,
514825ba0f2Srobj 	TOPO_SENSOR_UNITS_FARAD,
515825ba0f2Srobj 	TOPO_SENSOR_UNITS_MICROFARAD,
516825ba0f2Srobj 	TOPO_SENSOR_UNITS_OHMS,
517825ba0f2Srobj 	TOPO_SENSOR_UNITS_SIEMENS,
518825ba0f2Srobj 	TOPO_SENSOR_UNITS_MOLE,
519825ba0f2Srobj 	TOPO_SENSOR_UNITS_BECQUEREL,
520825ba0f2Srobj 	TOPO_SENSOR_UNITS_PPM,
521825ba0f2Srobj 	TOPO_SENSOR_UNITS_RESERVED1,
522825ba0f2Srobj 	TOPO_SENSOR_UNITS_DECIBELS,
523825ba0f2Srobj 	TOPO_SENSOR_UNITS_DBA,
524825ba0f2Srobj 	TOPO_SENSOR_UNITS_DBC,
525825ba0f2Srobj 	TOPO_SENSOR_UNITS_GRAY,
526825ba0f2Srobj 
527825ba0f2Srobj 	TOPO_SENSOR_UNITS_SIEVERT,
528825ba0f2Srobj 	TOPO_SENSOR_UNITS_COLOR_TEMP_K,
529825ba0f2Srobj 	TOPO_SENSOR_UNITS_BIT,
530825ba0f2Srobj 	TOPO_SENSOR_UNITS_KILOBIT,
531825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEGABIT,
532825ba0f2Srobj 	TOPO_SENSOR_UNITS_GIGABIT,
533825ba0f2Srobj 	TOPO_SENSOR_UNITS_BYTE,
534825ba0f2Srobj 	TOPO_SENSOR_UNITS_KILOBYTE,
535825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEGABYTE,
536825ba0f2Srobj 	TOPO_SENSOR_UNITS_GIGABYTE,
537825ba0f2Srobj 	TOPO_SENSOR_UNITS_WORD,
538825ba0f2Srobj 	TOPO_SENSOR_UNITS_DWORD,
539825ba0f2Srobj 	TOPO_SENSOR_UNITS_QWORD,
540825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEMLINE,
541825ba0f2Srobj 	TOPO_SENSOR_UNITS_HIT,
542825ba0f2Srobj 	TOPO_SENSOR_UNITS_MISS,
543825ba0f2Srobj 
544825ba0f2Srobj 	TOPO_SENSOR_UNITS_RETRY,
545825ba0f2Srobj 	TOPO_SENSOR_UNITS_RESET,
546825ba0f2Srobj 	TOPO_SENSOR_UNITS_OVERFLOW,
547825ba0f2Srobj 	TOPO_SENSOR_UNITS_UNDERRUN,
548825ba0f2Srobj 	TOPO_SENSOR_UNITS_COLLISION,
549825ba0f2Srobj 	TOPO_SENSOR_UNITS_PACKETS,
550825ba0f2Srobj 	TOPO_SENSOR_UNITS_MESSAGES,
551825ba0f2Srobj 	TOPO_SENSOR_UNITS_CHARACTERS,
552825ba0f2Srobj 	TOPO_SENSOR_UNITS_ERROR,
553825ba0f2Srobj 	TOPO_SENSOR_UNITS_CE,
554825ba0f2Srobj 	TOPO_SENSOR_UNITS_UE,
555825ba0f2Srobj 	TOPO_SENSOR_UNITS_FATAL_ERROR,
55691e105c6SRob Johnston 	TOPO_SENSOR_UNITS_GRAMS,
55791e105c6SRob Johnston 
55891e105c6SRob Johnston 	TOPO_SENSOR_UNITS_PERCENT = 512
559825ba0f2Srobj } topo_sensor_unit_t;
560825ba0f2Srobj 
561e5dcf7beSRobert Johnston /*
562e5dcf7beSRobert Johnston  * These defines are used by the topo_method_sensor_failure to indicate
563e5dcf7beSRobert Johnston  * whether the source of a sensor failure is believed to be the result of an
564e5dcf7beSRobert Johnston  * internal failure, external condition or unknown
565e5dcf7beSRobert Johnston  */
566e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_UNKNOWN	0
567e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_INTERNAL	1
568e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_EXTERNAL	2
569e5dcf7beSRobert Johnston 
570825ba0f2Srobj /*
571825ba0f2Srobj  * Sensor Types amd the associated sensor-type-specific states
572825ba0f2Srobj  *
573825ba0f2Srobj  * These are used to decode the type and state properties in the facility
574825ba0f2Srobj  * propgroup on facility nodes of type sensor.
575825ba0f2Srobj  *
57691e105c6SRob Johnston  * Again we're basically using the same defines as listed in the IPMI
57791e105c6SRob Johnston  * specification (see section 42) as it's serves as a good starting point and
57891e105c6SRob Johnston  * simplifies the IPMI provider code.  Of course other facility providers will
57991e105c6SRob Johnston  * need to convert from their native codes to the topo code when they set the
58091e105c6SRob Johnston  * type and state properties.
581825ba0f2Srobj  */
582825ba0f2Srobj #define	TOPO_SENSOR_TYPE_RESERVED			0x0000
583825ba0f2Srobj #define	TOPO_SENSOR_TYPE_TEMP				0x0001
584825ba0f2Srobj #define	TOPO_SENSOR_TYPE_VOLTAGE			0x0002
585825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CURRENT			0x0003
586825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FAN				0x0004
587825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PHYSICAL			0x0005
588825ba0f2Srobj 
589825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_GENERAL		0x0001
590825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_BAY			0x0002
591825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_CARD			0x0004
592825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR		0x0008
593825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_LAN			0x0010
594825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_DOCK			0x0020
595825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_FAN			0x0040
596825ba0f2Srobj 
597825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PLATFORM			0x0006
598825ba0f2Srobj 
599825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_SECURE		0x0001
600825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_USER_PASS		0x0002
601825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS		0x0004
602825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS		0x0008
603825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS		0x0010
604825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND		0x0020
605825ba0f2Srobj 
606825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PROCESSOR			0x0007
607825ba0f2Srobj 
608825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_IERR		0x0001
609825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_THERMAL		0x0002
610825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB1		0x0004
611825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB2		0x0008
612825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB3		0x0010
613825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_CONFIG		0x0020
614825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_SMBIOS		0x0040
615825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_PRESENT		0x0080
616825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_DISABLED		0x0100
617825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR		0x0200
618825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_THROTTLED		0x0400
619825ba0f2Srobj 
620825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POWER_SUPPLY			0x0008
621825ba0f2Srobj 
622825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT		0x0001
623825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE		0x0002
624825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL		0x0004
625825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST	0x0008
626825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE	0x0010
627825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES	0x0020
628825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR	0x0040
629825ba0f2Srobj 
630825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POWER_UNIT			0x0009
631825ba0f2Srobj 
632825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_OFF		0x0001
633825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_CYCLE		0x0002
634825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN		0x0004
635825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN	0x0008
636825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST		0x0010
637825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE	0x0020
638825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_FAIL		0x0040
639825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL		0x0080
640825ba0f2Srobj 
641825ba0f2Srobj #define	TOPO_SENSOR_TYPE_COOLING			0x000A
642825ba0f2Srobj #define	TOPO_SENSOR_TYPE_OTHER				0x000B
643825ba0f2Srobj 
644825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MEMORY				0x000C
645825ba0f2Srobj 
646825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CE			0x0001
647825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_UE			0x0002
648825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_PARITY			0x0004
649825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL		0x0008
650825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_DISABLED		0x0010
651825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT		0x0020
652825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_PRESENT		0x0040
653825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR		0x0080
654825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_SPARE			0x0100
655825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_THROTTLED		0x0200
656825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_OVERTEMP		0x0400
657825ba0f2Srobj 
658825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BAY				0x000D
659825ba0f2Srobj 
660825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_PRESENT			0x0001
661825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_FAULT			0x0002
662825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_PREDFAIL			0x0004
663825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_SPARE			0x0008
664825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_CHECK			0x0010
665825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_CRITICAL			0x0020
666825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_FAILED			0x0040
667825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_REBUILDING		0x0080
668825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_ABORTED			0x0100
669825ba0f2Srobj 
670825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POST_RESIZE			0x000E
671825ba0f2Srobj 
672825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FIRMWARE			0x000F
673825ba0f2Srobj 
674825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_ERROR		0x0001
675825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_HANG			0x0002
676825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_PROGRESS		0x0004
677825ba0f2Srobj 
678825ba0f2Srobj #define	TOPO_SENSOR_TYPE_EVENT_LOG			0x0010
679825ba0f2Srobj 
680825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_CE			0x0001
681825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_TYPE		0x0002
682825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_RESET		0x0004
683825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_ALL			0x0008
684825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_FULL		0x0010
685825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL		0x0020
686825ba0f2Srobj 
687825ba0f2Srobj #define	TOPO_SENSOR_TYPE_WATCHDOG1			0x0011
688825ba0f2Srobj 
689825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET		0x0001
690825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_RESET		0x0002
691825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN		0x0004
692825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN		0x0008
693825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE		0x0010
694825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG		0x0020
695825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_EXPIRED		0x0040
696825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT	0x0080
697825ba0f2Srobj 
698825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SYSTEM				0x0012
699825ba0f2Srobj 
700825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_RECONF			0x0001
701825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_BOOT			0x0002
702825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE	0x0004
703825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED	0x0008
704825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION		0x0010
705825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC	0x0020
706825ba0f2Srobj 
707825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CRITICAL			0x0013
708825ba0f2Srobj 
709825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_EXT_NMI		0x0001
710825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT		0x0002
711825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_IO_NMI		0x0004
712825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_SW_NMI		0x0008
713825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_PCI_PERR		0x0010
714825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_PCI_SERR		0x0020
715825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE	0x0040
716825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_CE		0x0080
717825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_UE		0x0100
718825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI		0x0200
719825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR	0x0400
720825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED		0x0800
721825ba0f2Srobj 
722825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BUTTON				0x0014
723825ba0f2Srobj 
724825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_PWR			0x0001
725825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_SLEEP			0x0002
726825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_RESET			0x0004
727825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_FRU_LATCH		0x0008
728825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE		0x0010
729825ba0f2Srobj 
730825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MODULE				0x0015
731825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MICROCONTROLLER		0x0016
732825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CARD				0x0017
733825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CHASSIS			0x0018
734825ba0f2Srobj 
735825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CHIPSET			0x0019
736825ba0f2Srobj 
737825ba0f2Srobj #define	TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL		0x0001
738825ba0f2Srobj 
739825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FRU				0x001A
740825ba0f2Srobj 
741825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CABLE				0x001B
742825ba0f2Srobj 
743825ba0f2Srobj #define	TOPO_SENSOR_STATE_CABLE_CONNECTED		0x0001
744825ba0f2Srobj #define	TOPO_SENSOR_STATE_CABLE_CONFIG_ERR		0x0002
745825ba0f2Srobj 
746825ba0f2Srobj #define	TOPO_SENSOR_TYPE_TERMINATOR			0x001C
747825ba0f2Srobj 
748825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_STATE			0x001D
749825ba0f2Srobj 
750825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP	0x0001
751825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET	0x0002
752825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET	0x0004
753825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT		0x0008
754825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT		0x0010
755825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET	0x0020
756825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET	0x0040
757825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART	0x0080
758825ba0f2Srobj 
759825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_ERROR			0x001E
760825ba0f2Srobj 
761825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA		0x0001
762825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK	0x0002
763825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER	0x0004
764825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT	0x0008
765825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT	0x0010
766825ba0f2Srobj 
767825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_OS			0x001F
768825ba0f2Srobj 
769825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE	0x0001
770825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE	0x0002
771825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE	0x0004
772825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE	0x0008
773825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE	0x0010
774825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE	0x0020
775825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE	0x0040
776825ba0f2Srobj 
777825ba0f2Srobj #define	TOPO_SENSOR_TYPE_OS_SHUTDOWN			0x0020
778825ba0f2Srobj 
779825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING		0x0001
780825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH		0x0002
781825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_STOP_GRACEFUL		0x0004
782825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL		0x0008
783825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF		0x0010
784825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC		0x0020
785825ba0f2Srobj 
786825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SLOT				0x0021
787825ba0f2Srobj 
788825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED		0x0001
789825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED	0x0002
790825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_CONNECTED		0x0004
791825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_INSTALL_READY		0x0008
792825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_REMOVE_READY		0x0010
793825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_PWR_OFF			0x0020
794825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_REMOVED			0x0040
795825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED	0x0080
796825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_DISABLED			0x0100
797825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE		0x0200
798825ba0f2Srobj 
799825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ACPI				0x0022
800825ba0f2Srobj 
801825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0		0x0001
802825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1		0x0002
803825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S2		0x0004
804825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S3		0x0008
805825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4		0x0010
806825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF	0x0020
807825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF	0x0040
808825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF	0x0080
809825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP	0x0100
810825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP		0x0200
811825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE	0x0400
812825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON		0x0800
813825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF	0x1000
814825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN		0x2000
815825ba0f2Srobj 
816825ba0f2Srobj #define	TOPO_SENSOR_TYPE_WATCHDOG2			0x0023
817825ba0f2Srobj 
818825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED		0x0001
819825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET		0x0002
820825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN		0x0004
821825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE		0x0008
822825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1		0x0010
823825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2		0x0020
824825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3		0x0040
825825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4		0x0080
826825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT		0x0100
827825ba0f2Srobj 
828825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ALERT				0x0024
829825ba0f2Srobj 
830825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_PAGE		0x0001
831825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT		0x0002
832825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP		0x0004
833825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP		0x0008
834825ba0f2Srobj 
835825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PRESENCE			0x0025
836825ba0f2Srobj 
837825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_PRESENT		0x0001
838825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_ABSENT		0x0002
839825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_DISABLED		0x0004
840825ba0f2Srobj 
841825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ASIC				0x0026
842825ba0f2Srobj 
843825ba0f2Srobj #define	TOPO_SENSOR_TYPE_LAN				0x0027
844825ba0f2Srobj 
845825ba0f2Srobj #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST		0x0001
846825ba0f2Srobj #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT			0x0002
847825ba0f2Srobj 
848825ba0f2Srobj #define	TOPO_SENSOR_TYPE_HEALTH				0x0028
849825ba0f2Srobj 
850825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED	0x0001
851825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED	0x0002
852825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE		0x0004
853825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL		0x0008
854825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE		0x0010
855825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE		0x0020
856825ba0f2Srobj 
857825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BATTERY			0x0029
858825ba0f2Srobj 
859825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_LOW			0x0001
860825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_FAILED		0x0002
861825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_PRESENCE		0x0004
862825ba0f2Srobj 
863825ba0f2Srobj #define	TOPO_SENSOR_TYPE_AUDIT				0x002A
864825ba0f2Srobj 
865825ba0f2Srobj #define	TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED	0x0001
866825ba0f2Srobj #define	TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED	0x0002
867825ba0f2Srobj 
868825ba0f2Srobj #define	TOPO_SENSOR_TYPE_VERSION			0x002B
869825ba0f2Srobj 
870825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE		0x0001
871825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE		0x0002
872825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE	0x0004
873825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE	0x0008
874825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_INVAL		0x0010
875825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_INVAL		0x0020
876825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS	0x0040
877825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS	0x0080
878825ba0f2Srobj 
879825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FRU_STATE			0x002C
880825ba0f2Srobj 
881825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED	0x0001
882825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_INACTIVE		0x0002
883825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ		0x0004
884825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS	0x0008
885825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACTIVE		0x0010
886825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ		0x0020
887825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS	0x0040
888825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST		0x0080
889825ba0f2Srobj 
890825ba0f2Srobj /*
891825ba0f2Srobj  * We simplify the IPMI sensor type code defines by combining the generic
892825ba0f2Srobj  * and sensor-specific codes into a single range.  Because there's overlap
893825ba0f2Srobj  * between the two ranges we offset the generic type codes by 0x0100
894825ba0f2Srobj  * which allows ample room in the hole for future expansion of the table to
895825ba0f2Srobj  * accomodate either additions to the IPMI spec or to support new sensor types
896825ba0f2Srobj  * for alternate provider modules.
897825ba0f2Srobj  */
8987793aa8bSEric Schrock #define	TOPO_SENSOR_TYPE_THRESHOLD_STATE		0x0101
8997793aa8bSEric Schrock 
9000b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT		0x0001
9010b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_CRIT		0x0002
9020b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONREC		0x0004
9030b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT		0x0008
9040b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_CRIT		0x0010
9050b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONREC		0x0020
906825ba0f2Srobj 
907825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_USAGE			0x0102
908825ba0f2Srobj 
909825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE		0x0001
910825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE		0x0002
911825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY		0x0004
912825ba0f2Srobj 
913825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_STATE			0x0103
914825ba0f2Srobj 
915825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED	0x0001
916825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED	0x0002
917825ba0f2Srobj 
918825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PREDFAIL		0x0104
919825ba0f2Srobj 
920825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED	0x0001
921825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED	0x0002
922825ba0f2Srobj 
923825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_LIMIT			0x0105
924825ba0f2Srobj 
925825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED	0x0001
926825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED	0x0002
927825ba0f2Srobj 
928825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE		0x0106
929825ba0f2Srobj 
930825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET	0x0001
931825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS	0x0002
932825ba0f2Srobj 
933825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SEVERITY			0x0107
934825ba0f2Srobj 
935825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_OK			0x0001
936825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH	0x0002
937825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH	0x0004
938825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH	0x0008
939825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW	0x0010
940825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW	0x0020
941825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW	0x0020
942825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_MONITOR		0x0040
943825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL	0x0080
944825ba0f2Srobj 
945825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PRESENCE		0x0108
946825ba0f2Srobj 
947825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED	0x0001
948825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED	0x0002
949825ba0f2Srobj 
950825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY		0x0109
951825ba0f2Srobj 
952825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED	0x0001
953825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED	0x0002
954825ba0f2Srobj 
955825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_STATUS			0x010A
956825ba0f2Srobj 
957825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING	0x0001
958825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST	0x0002
959825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF	0x0004
960825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE		0x0008
961825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE	0x0010
962825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY	0x0020
963825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED	0x0040
964825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE	0x0080
965825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR	0x0100
966825ba0f2Srobj 
967825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY		0x010B
968825ba0f2Srobj 
969825ba0f2Srobj /*
970825ba0f2Srobj  * ACPI power state
971825ba0f2Srobj  */
972825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_ACPI			0x010C
973825ba0f2Srobj 
974825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D0		0x0001
975825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D1		0x0002
976825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D2		0x0004
977825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D3		0x0008
978825ba0f2Srobj 
979e5dcf7beSRobert Johnston /*
980e5dcf7beSRobert Johnston  * These sensor types don't exist in the IPMI spec, but allow consumers to
981e5dcf7beSRobert Johnston  * associate discrete sensors with component failure.  The 'ok' sensor is the
982e5dcf7beSRobert Johnston  * inverse of the 'failure' sensor.  Note that the values intentionally mimic
983e5dcf7beSRobert Johnston  * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors
984e5dcf7beSRobert Johnston  * but just change the type to get semantically meaningful behavior.
985e5dcf7beSRobert Johnston  */
986e5dcf7beSRobert Johnston #define	TOPO_SENSOR_TYPE_GENERIC_FAILURE		0x010D
987e5dcf7beSRobert Johnston 
988e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED	0x0001
989e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV		0x0002
990e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL		0x0004
991e5dcf7beSRobert Johnston 
992e5dcf7beSRobert Johnston #define	TOPO_SENSOR_TYPE_GENERIC_OK			0x010E
993e5dcf7beSRobert Johnston 
994e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED		0x0001
995e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED		0x0002
996e5dcf7beSRobert Johnston 
997825ba0f2Srobj /*
998825ba0f2Srobj  * Indicator modes and types
999825ba0f2Srobj  */
1000825ba0f2Srobj typedef enum topo_led_state {
1001825ba0f2Srobj 	TOPO_LED_STATE_OFF = 0,
1002825ba0f2Srobj 	TOPO_LED_STATE_ON
1003825ba0f2Srobj } topo_led_state_t;
1004825ba0f2Srobj 
1005e5dcf7beSRobert Johnston #define	TOPO_FAC_TYPE_ANY	0xFFFFFFFF
1006e5dcf7beSRobert Johnston 
1007825ba0f2Srobj /*
1008825ba0f2Srobj  * This list is limited to the set of LED's that we're likely to manage through
1009825ba0f2Srobj  * FMA.  Thus is does not include things like power or activity LED's
1010825ba0f2Srobj  */
1011825ba0f2Srobj typedef enum topo_led_type {
1012825ba0f2Srobj 	TOPO_LED_TYPE_SERVICE = 0,
1013825ba0f2Srobj 	TOPO_LED_TYPE_LOCATE,
1014825ba0f2Srobj 	TOPO_LED_TYPE_OK2RM,
1015825ba0f2Srobj 	TOPO_LED_TYPE_PRESENT
1016825ba0f2Srobj } topo_led_type_t;
1017825ba0f2Srobj 
10186d65bee7SRob Johnston typedef enum topo_slot_type {
10196d65bee7SRob Johnston 	TOPO_SLOT_TYPE_DIMM = 1
10206d65bee7SRob Johnston } topo_slot_type_t;
10216d65bee7SRob Johnston 
1022825ba0f2Srobj 
10237aec1d6eScindi #ifdef __cplusplus
10247aec1d6eScindi }
10257aec1d6eScindi #endif
10267aec1d6eScindi 
10277aec1d6eScindi #endif /* _LIBTOPO_H */
1028