xref: /illumos-gate/usr/src/lib/fm/topo/libtopo/common/libtopo.h (revision 8393544efeffe8042bf5273c148010b32fa827e2)
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 /*
23*8393544eSHyon Kim  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
247aec1d6eScindi  */
257aec1d6eScindi 
267aec1d6eScindi #ifndef _LIBTOPO_H
277aec1d6eScindi #define	_LIBTOPO_H
287aec1d6eScindi 
297aec1d6eScindi #include <sys/nvpair.h>
300eb822a1Scindi #include <stdio.h>
31c93c462eSCheng Sean Ye #include <libdevinfo.h>
327aec1d6eScindi 
337aec1d6eScindi #ifdef __cplusplus
347aec1d6eScindi extern "C" {
357aec1d6eScindi #endif
367aec1d6eScindi 
377aec1d6eScindi #define	TOPO_VERSION	1	/* Library ABI Interface Version */
387aec1d6eScindi 
397aec1d6eScindi typedef struct topo_hdl topo_hdl_t;
407aec1d6eScindi typedef struct topo_node tnode_t;
417aec1d6eScindi typedef struct topo_walk topo_walk_t;
427aec1d6eScindi typedef int32_t topo_instance_t;
437aec1d6eScindi typedef uint32_t topo_version_t;
447aec1d6eScindi 
45825ba0f2Srobj typedef struct topo_list {
46825ba0f2Srobj 	struct topo_list *l_prev;
47825ba0f2Srobj 	struct topo_list *l_next;
48825ba0f2Srobj } topo_list_t;
49825ba0f2Srobj 
50825ba0f2Srobj typedef struct topo_faclist {
51825ba0f2Srobj 	topo_list_t	tf_list;
52825ba0f2Srobj 	tnode_t		*tf_node;
53825ba0f2Srobj } topo_faclist_t;
54825ba0f2Srobj 
557aec1d6eScindi /*
56c40d7343Scindi  * The following functions, error codes and data structures are private
57c40d7343Scindi  * to libtopo snapshot consumers and enumerator modules.
587aec1d6eScindi  */
597aec1d6eScindi extern topo_hdl_t *topo_open(int, const char *, int *);
607aec1d6eScindi extern void topo_close(topo_hdl_t *);
617aec1d6eScindi extern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
627aec1d6eScindi extern void topo_snap_release(topo_hdl_t *);
630eb822a1Scindi 
640eb822a1Scindi /*
650eb822a1Scindi  * Snapshot walker support
660eb822a1Scindi  */
670eb822a1Scindi typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *);
680eb822a1Scindi 
697aec1d6eScindi extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
707aec1d6eScindi     void *, int *);
717aec1d6eScindi extern int topo_walk_step(topo_walk_t *, int);
727aec1d6eScindi extern void topo_walk_fini(topo_walk_t *);
73c93c462eSCheng Sean Ye extern di_node_t topo_hdl_devinfo(topo_hdl_t *);
74c93c462eSCheng Sean Ye extern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *);
757aec1d6eScindi 
76c40d7343Scindi /*
77c40d7343Scindi  * Walk status returned from walker
78c40d7343Scindi  */
797aec1d6eScindi #define	TOPO_WALK_ERR		-1
807aec1d6eScindi #define	TOPO_WALK_NEXT		0
817aec1d6eScindi #define	TOPO_WALK_TERMINATE	1
827aec1d6eScindi 
83c40d7343Scindi /*
84c40d7343Scindi  * Types of walks: depth-first (child) or breadth-first (sibling)
85c40d7343Scindi  */
867aec1d6eScindi #define	TOPO_WALK_CHILD		0x0001
877aec1d6eScindi #define	TOPO_WALK_SIBLING	0x0002
887aec1d6eScindi 
890eb822a1Scindi /*
900eb822a1Scindi  * FMRI helper routines
910eb822a1Scindi  */
927aec1d6eScindi extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *);
9325c6ff4bSstephh extern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *);
947aec1d6eScindi extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
95dd566498Svn extern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *);
967aec1d6eScindi extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *);
9725c6ff4bSstephh extern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *);
98e4b86885SCheng Sean Ye extern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *);
99e4b86885SCheng Sean Ye extern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *);
1007aec1d6eScindi extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *);
1017aec1d6eScindi extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *);
1027aec1d6eScindi extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *);
1037aec1d6eScindi extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **,
1047aec1d6eScindi     int *);
1059dd0f810Scindi extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *);
1062cb5535aSrobj extern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *);
1077aec1d6eScindi extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
108825ba0f2Srobj extern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *,
109825ba0f2Srobj     uint32_t, topo_walk_cb_t, void *, int *);
1107aec1d6eScindi 
111940d71d2Seschrock /*
112069f55e2SEric Schrock  * Consolidation private utility functions
113940d71d2Seschrock  */
114940d71d2Seschrock extern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *);
115069f55e2SEric Schrock extern ulong_t topo_fmri_strhash_noauth(topo_hdl_t *, const char *);
116940d71d2Seschrock extern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *);
117069f55e2SEric Schrock extern boolean_t topo_fmri_strcmp_noauth(topo_hdl_t *, const char *,
118069f55e2SEric Schrock     const char *);
119940d71d2Seschrock 
1207aec1d6eScindi /*
1217aec1d6eScindi  * Topo node utilities: callable from topo_walk_step() callback or module
1227aec1d6eScindi  * enumeration, topo_mod_enumerate()
1237aec1d6eScindi  */
1247aec1d6eScindi extern char *topo_node_name(tnode_t *);
1257aec1d6eScindi extern topo_instance_t topo_node_instance(tnode_t *);
1264557a2a1Srobj extern tnode_t *topo_node_parent(tnode_t *);
1277aec1d6eScindi extern void *topo_node_private(tnode_t *);
128825ba0f2Srobj extern int topo_node_flags(tnode_t *);
1297aec1d6eScindi extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *);
1307aec1d6eScindi extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *);
1317aec1d6eScindi extern int topo_node_resource(tnode_t *, nvlist_t **, int *);
1327aec1d6eScindi extern int topo_node_label(tnode_t *, char **, int *);
133e4b86885SCheng Sean Ye extern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t);
1347aec1d6eScindi extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t,
1357aec1d6eScindi     nvlist_t *, nvlist_t **, int *);
136825ba0f2Srobj extern boolean_t topo_method_supported(tnode_t *, const char *,
137825ba0f2Srobj     topo_version_t);
138825ba0f2Srobj extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *,
139825ba0f2Srobj     uint32_t, topo_faclist_t *, int *);
140825ba0f2Srobj 
141825ba0f2Srobj /*
142825ba0f2Srobj  * Node flags: denotes type of node
143825ba0f2Srobj  */
144825ba0f2Srobj #define	TOPO_NODE_DEFAULT	0
145825ba0f2Srobj #define	TOPO_NODE_FACILITY	1
1467aec1d6eScindi 
147825ba0f2Srobj #define	TOPO_FAC_TYPE_SENSOR	"sensor"
148825ba0f2Srobj #define	TOPO_FAC_TYPE_INDICATOR	"indicator"
149825ba0f2Srobj 
150825ba0f2Srobj /*
151825ba0f2Srobj  * Topo property get functions
152825ba0f2Srobj  */
1537aec1d6eScindi extern int topo_prop_get_int32(tnode_t *, const char *, const char *,
1547aec1d6eScindi     int32_t *, int *);
1557aec1d6eScindi extern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
1567aec1d6eScindi     uint32_t *, int *);
1577aec1d6eScindi extern int topo_prop_get_int64(tnode_t *, const char *, const char *,
1587aec1d6eScindi     int64_t *, int *);
1597aec1d6eScindi extern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
1607aec1d6eScindi     uint64_t *, int *);
161825ba0f2Srobj extern int topo_prop_get_double(tnode_t *, const char *, const char *,
162825ba0f2Srobj     double *, int *);
1637aec1d6eScindi extern int topo_prop_get_string(tnode_t *, const char *, const char *,
1647aec1d6eScindi     char **, int *);
1657aec1d6eScindi extern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
1667aec1d6eScindi     nvlist_t **, int *);
1670eb822a1Scindi extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
1680eb822a1Scindi     int32_t **, uint_t *, int *);
1690eb822a1Scindi extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
1700eb822a1Scindi     uint32_t **, uint_t *, int *);
1710eb822a1Scindi extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
1720eb822a1Scindi     int64_t **, uint_t *, int *);
1730eb822a1Scindi extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
1740eb822a1Scindi     uint64_t **, uint_t *, int *);
1750eb822a1Scindi extern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
1760eb822a1Scindi     char ***, uint_t *, int *);
1770eb822a1Scindi extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
1780eb822a1Scindi     nvlist_t ***, uint_t *, int *);
1797aec1d6eScindi 
180825ba0f2Srobj /*
181825ba0f2Srobj  * Topo property set functions
182825ba0f2Srobj  */
183825ba0f2Srobj extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
184825ba0f2Srobj     int32_t, int *);
185825ba0f2Srobj extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
186825ba0f2Srobj     uint32_t, int *);
187825ba0f2Srobj extern int topo_prop_set_int64(tnode_t *, const char *, const char *,
188825ba0f2Srobj     int, int64_t, int *);
189825ba0f2Srobj extern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
190825ba0f2Srobj     int, uint64_t, int *);
191825ba0f2Srobj extern int topo_prop_set_double(tnode_t *, const char *, const char *,
192825ba0f2Srobj     int, double, int *);
193825ba0f2Srobj extern int topo_prop_set_string(tnode_t *, const char *, const char *,
194825ba0f2Srobj     int, const char *, int *);
195825ba0f2Srobj extern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
196825ba0f2Srobj     int, const nvlist_t *, int *);
197825ba0f2Srobj extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
198825ba0f2Srobj     int32_t *, uint_t, int *);
199825ba0f2Srobj extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
200825ba0f2Srobj     int, uint32_t *, uint_t, int *);
201825ba0f2Srobj extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
202825ba0f2Srobj     int, int64_t *, uint_t, int *);
203825ba0f2Srobj extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
204825ba0f2Srobj     int, uint64_t *, uint_t, int *);
205825ba0f2Srobj extern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
206825ba0f2Srobj     int, const char **, uint_t, int *);
207825ba0f2Srobj extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
208825ba0f2Srobj     int, const nvlist_t **, uint_t, int *);
209825ba0f2Srobj 
2100eb822a1Scindi #define	TOPO_PROP_IMMUTABLE	0
211e5dcf7beSRobert Johnston #define	TOPO_PROP_MUTABLE	0x01
212e5dcf7beSRobert Johnston #define	TOPO_PROP_NONVOLATILE	0x02
2137aec1d6eScindi 
2147aec1d6eScindi /* Protocol property group and property names */
2157aec1d6eScindi #define	TOPO_PGROUP_PROTOCOL	"protocol"	/* Required property group */
2167aec1d6eScindi #define	TOPO_PROP_RESOURCE	"resource"	/* resource FMRI */
2177aec1d6eScindi #define	TOPO_PROP_ASRU		"ASRU"		/* ASRU FMRI */
2187aec1d6eScindi #define	TOPO_PROP_FRU		"FRU"		/* FRU FMRI */
2197aec1d6eScindi #define	TOPO_PROP_MOD		"module"	/* software module FMRI */
2207aec1d6eScindi #define	TOPO_PROP_PKG		"package"	/* software package FMRI */
2217aec1d6eScindi #define	TOPO_PROP_LABEL		"label"		/*  property LABEL */
2227aec1d6eScindi 
223825ba0f2Srobj #define	TOPO_METH_FAC_ENUM	"fac_enum"
224825ba0f2Srobj 
2257aec1d6eScindi /*
2267aec1d6eScindi  * System property group
2277aec1d6eScindi  */
2287aec1d6eScindi #define	TOPO_PGROUP_SYSTEM	"system"
2297aec1d6eScindi #define	TOPO_PROP_ISA		"isa"
2307aec1d6eScindi #define	TOPO_PROP_MACHINE	"machine"
2317aec1d6eScindi 
23288045cffSRobert Johnston #define	TOPO_PGROUP_IPMI	"ipmi"
23388045cffSRobert Johnston 
2340eb822a1Scindi /*
235c40d7343Scindi  * These enum definitions are used to define a set of error tags associated with
236c40d7343Scindi  * libtopo error conditions occuring during the adminstration of
237c40d7343Scindi  * properties, invocation of methods and fmri-based queries.  The shell script
238c40d7343Scindi  * mkerror.sh is used to parse this file and create a corresponding topo_error.c
239c40d7343Scindi  * source file.
240c40d7343Scindi  *
2410eb822a1Scindi  * If you do something other than add a new error tag here, you may need to
2420eb822a1Scindi  * update the mkerror shell script as it is based upon simple regexps.
2430eb822a1Scindi  */
2440eb822a1Scindi typedef enum topo_prop_errno {
2450eb822a1Scindi     ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */
2460eb822a1Scindi     ETOPO_PROP_NOENT,   /* undefined property or property group */
2470eb822a1Scindi     ETOPO_PROP_DEFD,    /* static property already defined */
2480eb822a1Scindi     ETOPO_PROP_NOMEM,   /* memory limit exceeded during property allocation */
2490eb822a1Scindi     ETOPO_PROP_TYPE,    /* invalid property type */
250c40d7343Scindi     ETOPO_PROP_NAME,    /* invalid property name */
2510eb822a1Scindi     ETOPO_PROP_NOINHERIT, /* can not inherit property */
2520eb822a1Scindi     ETOPO_PROP_NVL,	/* malformed property nvlist */
253c40d7343Scindi     ETOPO_PROP_METHOD,	/* get property method failed */
2540eb822a1Scindi     ETOPO_PROP_END	/* end of prop errno list (to ease auto-merge) */
2550eb822a1Scindi } topo_prop_errno_t;
2567aec1d6eScindi 
257dd566498Svn typedef enum topo_method_errno {
258c40d7343Scindi     ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */
259c40d7343Scindi     ETOPO_METHOD_INVAL,		/* invalid method registration */
260c40d7343Scindi     ETOPO_METHOD_NOTSUP,	/* method not supported */
261c40d7343Scindi     ETOPO_METHOD_FAIL,		/* method failed */
262c40d7343Scindi     ETOPO_METHOD_VEROLD,	/* app is compiled to use obsolete method */
263c40d7343Scindi     ETOPO_METHOD_VERNEW,	/* app is compiled to use obsolete method */
264c40d7343Scindi     ETOPO_METHOD_NOMEM,		/* memory limit exceeded during method op */
265c40d7343Scindi     ETOPO_METHOD_DEFD,		/* method op already defined */
266c40d7343Scindi     ETOPO_METHOD_END		/* end of method errno list */
267dd566498Svn } topo_method_errno_t;
268dd566498Svn 
269c40d7343Scindi typedef enum topo_fmri_errno {
270c40d7343Scindi     ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */
271c40d7343Scindi     ETOPO_FMRI_NVL,		/* nvlist allocation failure for FMRI */
272c40d7343Scindi     ETOPO_FMRI_VERSION,		/* invalid FMRI scheme version */
273c40d7343Scindi     ETOPO_FMRI_MALFORM,		/* malformed FMRI */
274c40d7343Scindi     ETOPO_FMRI_NOMEM,		/* memory limit exceeded */
275c40d7343Scindi     ETOPO_FMRI_END		/* end of fmri errno list */
276c40d7343Scindi } topo_fmri_errno_t;
277c40d7343Scindi 
278c40d7343Scindi typedef enum topo_hdl_errno {
279c40d7343Scindi     ETOPO_HDL_UNKNOWN = 3300,	/* unknown topo handle error */
280c40d7343Scindi     ETOPO_HDL_ABIVER,		/* handle opened with invalid ABI version */
281c40d7343Scindi     ETOPO_HDL_SNAP,		/* snapshot already taken */
282c40d7343Scindi     ETOPO_HDL_INVAL,		/* invalid argument specified */
283c40d7343Scindi     ETOPO_HDL_UUID,		/* uuid already set */
284c40d7343Scindi     ETOPO_HDL_NOMEM,		/* memory limit exceeded */
285c40d7343Scindi     ETOPO_HDL_END		/* end of handle errno list */
286c40d7343Scindi } topo_hdl_errno_t;
287dd566498Svn 
2887aec1d6eScindi extern const char *topo_strerror(int);
289c40d7343Scindi extern void topo_hdl_strfree(topo_hdl_t *, char *);
2900eb822a1Scindi extern void topo_debug_set(topo_hdl_t *, const char *, const char *);
291c40d7343Scindi 
292c40d7343Scindi /*
293c40d7343Scindi  * The following functions and data structures to support property
294c40d7343Scindi  * observability are private to the fmtopo command.
295c40d7343Scindi  */
296c40d7343Scindi 
297c40d7343Scindi /*
298c40d7343Scindi  * Each topology node advertises the name and data stability of each of its
299c40d7343Scindi  * modules and properties. (see attributes(5)).
300c40d7343Scindi  */
301c40d7343Scindi 
302c40d7343Scindi /*
303c40d7343Scindi  * Topo stability attributes
304c40d7343Scindi  */
305c40d7343Scindi typedef enum topo_stability {
306c40d7343Scindi 	TOPO_STABILITY_UNKNOWN = 0,	/* private to libtopo */
307c40d7343Scindi 	TOPO_STABILITY_INTERNAL,	/* private to libtopo */
308c40d7343Scindi 	TOPO_STABILITY_PRIVATE,		/* private to Sun */
309c40d7343Scindi 	TOPO_STABILITY_OBSOLETE,	/* scheduled for removal */
310c40d7343Scindi 	TOPO_STABILITY_EXTERNAL,	/* not controlled by Sun */
311c40d7343Scindi 	TOPO_STABILITY_UNSTABLE,	/* new or rapidly changing */
312c40d7343Scindi 	TOPO_STABILITY_EVOLVING,	/* less rapidly changing */
313c40d7343Scindi 	TOPO_STABILITY_STABLE,		/* mature interface from Sun */
314c40d7343Scindi 	TOPO_STABILITY_STANDARD		/* industry standard */
315c40d7343Scindi } topo_stability_t;
316c40d7343Scindi 
317c40d7343Scindi #define	TOPO_STABILITY_MAX	TOPO_STABILITY_STANDARD	/* max valid stab */
318c40d7343Scindi 
319c40d7343Scindi typedef struct topo_pgroup_info {
320c40d7343Scindi 	const char *tpi_name;		/* property group name */
321c40d7343Scindi 	topo_stability_t tpi_namestab;	/* stability of group name */
322c40d7343Scindi 	topo_stability_t tpi_datastab;	/* stability of all property values */
323c40d7343Scindi 	topo_version_t tpi_version;	/* version of pgroup definition */
324c40d7343Scindi } topo_pgroup_info_t;
325c40d7343Scindi 
326c40d7343Scindi extern topo_stability_t topo_name2stability(const char *);
327c40d7343Scindi extern const char *topo_stability2name(topo_stability_t);
328c40d7343Scindi extern void topo_pgroup_destroy(tnode_t *, const char *);
329c40d7343Scindi extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *);
330c40d7343Scindi 
331c40d7343Scindi typedef enum {
332c40d7343Scindi 	TOPO_TYPE_INVALID = 0,
333c40d7343Scindi 	TOPO_TYPE_BOOLEAN,	/* boolean */
334c40d7343Scindi 	TOPO_TYPE_INT32,	/* int32_t */
335c40d7343Scindi 	TOPO_TYPE_UINT32,	/* uint32_t */
336c40d7343Scindi 	TOPO_TYPE_INT64,	/* int64_t */
337c40d7343Scindi 	TOPO_TYPE_UINT64,	/* uint64_t */
338c40d7343Scindi 	TOPO_TYPE_STRING,	/* const char* */
339c40d7343Scindi 	TOPO_TYPE_TIME,		/* uint64_t */
340c40d7343Scindi 	TOPO_TYPE_SIZE,		/* uint64_t */
341c40d7343Scindi 	TOPO_TYPE_FMRI,		/* nvlist_t */
342c40d7343Scindi 	TOPO_TYPE_INT32_ARRAY,	/* array of int32_t */
343c40d7343Scindi 	TOPO_TYPE_UINT32_ARRAY,	/* array of uint32_t */
344c40d7343Scindi 	TOPO_TYPE_INT64_ARRAY,	/* array of int64_t */
345c40d7343Scindi 	TOPO_TYPE_UINT64_ARRAY,	/* array of uint64_t */
346c40d7343Scindi 	TOPO_TYPE_STRING_ARRAY,	/* array of const char* */
347825ba0f2Srobj 	TOPO_TYPE_FMRI_ARRAY,	/* array of nvlist_t */
348825ba0f2Srobj 	TOPO_TYPE_DOUBLE	/* double */
349c40d7343Scindi } topo_type_t;
350c40d7343Scindi 
351c40d7343Scindi extern nvlist_t *topo_prop_getprops(tnode_t *, int *err);
352c40d7343Scindi extern int topo_prop_getprop(tnode_t *, const char *, const char *,
353c40d7343Scindi     nvlist_t *, nvlist_t **, int *);
354c40d7343Scindi extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *);
355c40d7343Scindi extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *,
356c40d7343Scindi     int, nvlist_t *, int *);
357c40d7343Scindi extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *,
358c40d7343Scindi     const char *, nvlist_t *,  nvlist_t **, int *);
359c40d7343Scindi extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *,
360c40d7343Scindi     nvlist_t **, int *);
361c40d7343Scindi extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *,
362c40d7343Scindi     nvlist_t *, int, nvlist_t *, int *);
363c40d7343Scindi 
364c40d7343Scindi /* Property node NVL names used in topo_prop_getprops */
365c40d7343Scindi #define	TOPO_PROP_GROUP		"property-group"
366c40d7343Scindi #define	TOPO_PROP_GROUP_NAME	"property-group-name"
367c40d7343Scindi #define	TOPO_PROP_GROUP_DSTAB	"property-group-data-stability"
368c40d7343Scindi #define	TOPO_PROP_GROUP_NSTAB	"property-group-name-stability"
369c40d7343Scindi #define	TOPO_PROP_GROUP_VERSION	"property-group-version"
370c40d7343Scindi #define	TOPO_PROP_VAL		"property"
371c40d7343Scindi #define	TOPO_PROP_VAL_NAME	"property-name"
372c40d7343Scindi #define	TOPO_PROP_VAL_VAL	"property-value"
373c40d7343Scindi #define	TOPO_PROP_VAL_TYPE	"property-type"
374c40d7343Scindi #define	TOPO_PROP_FLAG		"property-flag"
375c40d7343Scindi 
376c40d7343Scindi /*
377c40d7343Scindi  * ARGS list used in topo property methods
378c40d7343Scindi  */
379c40d7343Scindi #define	TOPO_PROP_ARGS	"args"
380c40d7343Scindi #define	TOPO_PROP_PARGS	"private-args"
381c40d7343Scindi 
382c40d7343Scindi extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
383c40d7343Scindi 
3847aec1d6eScindi extern void *topo_hdl_alloc(topo_hdl_t *, size_t);
3857aec1d6eScindi extern void *topo_hdl_zalloc(topo_hdl_t *, size_t);
3867aec1d6eScindi extern void topo_hdl_free(topo_hdl_t *, void *, size_t);
3877aec1d6eScindi extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
3887aec1d6eScindi extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
3897aec1d6eScindi extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
3907aec1d6eScindi 
391825ba0f2Srobj /*
392825ba0f2Srobj  * Interfaces for converting sensor/indicator types, units, states, etc to
393825ba0f2Srobj  * a string
394825ba0f2Srobj  */
395825ba0f2Srobj void topo_sensor_type_name(uint32_t type, char *buf, size_t len);
396825ba0f2Srobj void topo_sensor_units_name(uint8_t type, char *buf, size_t len);
397825ba0f2Srobj void topo_led_type_name(uint8_t type, char *buf, size_t len);
398825ba0f2Srobj void topo_led_state_name(uint8_t type, char *buf, size_t len);
399825ba0f2Srobj void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
400825ba0f2Srobj     size_t len);
401825ba0f2Srobj 
402825ba0f2Srobj /*
403825ba0f2Srobj  * Defines for standard properties for sensors and indicators
404825ba0f2Srobj  */
405825ba0f2Srobj #define	TOPO_PGROUP_FACILITY	"facility"
406825ba0f2Srobj 
407825ba0f2Srobj #define	TOPO_SENSOR_READING	"reading"
408825ba0f2Srobj #define	TOPO_SENSOR_STATE	"state"
409825ba0f2Srobj #define	TOPO_SENSOR_CLASS	"sensor-class"
410825ba0f2Srobj #define	TOPO_FACILITY_TYPE	"type"
411825ba0f2Srobj #define	TOPO_SENSOR_UNITS	"units"
412825ba0f2Srobj #define	TOPO_LED_MODE		"mode"
413825ba0f2Srobj 
414825ba0f2Srobj /*
415825ba0f2Srobj  * Sensor Classes
416825ba0f2Srobj  *
417825ba0f2Srobj  * The "sensor-class" property in the "facility" propgroup on
418825ba0f2Srobj  * facility nodes of type "sensor" should be set to one of these
419825ba0f2Srobj  * two values.
420825ba0f2Srobj  *
421825ba0f2Srobj  * Threshold sensors provide an analog sensor reading via the
422825ba0f2Srobj  * "reading" property in the facility propgroup.  They will also
423825ba0f2Srobj  * provide one or more discrete states via the "state" property
424825ba0f2Srobj  * in the facility propgroup.
425825ba0f2Srobj  *
426825ba0f2Srobj  * Discrete sensors will not provide an analog reading by will
427825ba0f2Srobj  * provide one or more discrete states via the "state" property
428825ba0f2Srobj  * in the facility propgroup.
429825ba0f2Srobj  */
430825ba0f2Srobj #define	TOPO_SENSOR_CLASS_THRESHOLD	"threshold"
431825ba0f2Srobj #define	TOPO_SENSOR_CLASS_DISCRETE	"discrete"
432825ba0f2Srobj 
433825ba0f2Srobj /*
434825ba0f2Srobj  * Sensor unit types.  We're using the unit types and corresponding
435825ba0f2Srobj  * codes described in the IPMI 2.0 spec as a reference as it seems to be a
436825ba0f2Srobj  * reasonably comprehensive list.  This also simplifies the IPMI provider code
437825ba0f2Srobj  * since the unit type codes will map exactly to what libtopo uses (so no
438825ba0f2Srobj  * conversion necessary).
439825ba0f2Srobj  */
440825ba0f2Srobj typedef enum topo_sensor_unit {
441825ba0f2Srobj 	TOPO_SENSOR_UNITS_UNSPECIFIED = 0,
442825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_C,
443825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_F,
444825ba0f2Srobj 	TOPO_SENSOR_UNITS_DEGREES_K,
445825ba0f2Srobj 	TOPO_SENSOR_UNITS_VOLTS,
446825ba0f2Srobj 	TOPO_SENSOR_UNITS_AMPS,
447825ba0f2Srobj 	TOPO_SENSOR_UNITS_WATTS,
448825ba0f2Srobj 	TOPO_SENSOR_UNITS_JOULES,
449825ba0f2Srobj 	TOPO_SENSOR_UNITS_COULOMBS,
450825ba0f2Srobj 	TOPO_SENSOR_UNITS_VA,
451825ba0f2Srobj 	TOPO_SENSOR_UNITS_NITS,
452825ba0f2Srobj 	TOPO_SENSOR_UNITS_LUMEN,
453825ba0f2Srobj 	TOPO_SENSOR_UNITS_LUX,
454825ba0f2Srobj 	TOPO_SENSOR_UNITS_CANDELA,
455825ba0f2Srobj 	TOPO_SENSOR_UNITS_KPA,
456825ba0f2Srobj 	TOPO_SENSOR_UNITS_PSI,
457825ba0f2Srobj 
458825ba0f2Srobj 	TOPO_SENSOR_UNITS_NEWTON,
459825ba0f2Srobj 	TOPO_SENSOR_UNITS_CFM,
460825ba0f2Srobj 	TOPO_SENSOR_UNITS_RPM,
461825ba0f2Srobj 	TOPO_SENSOR_UNITS_HZ,
462825ba0f2Srobj 	TOPO_SENSOR_UNITS_MICROSEC,
463825ba0f2Srobj 	TOPO_SENSOR_UNITS_MILLISEC,
464825ba0f2Srobj 	TOPO_SENSOR_UNITS_SECS,
465825ba0f2Srobj 	TOPO_SENSOR_UNITS_MIN,
466825ba0f2Srobj 	TOPO_SENSOR_UNITS_HOUR,
467825ba0f2Srobj 	TOPO_SENSOR_UNITS_DAY,
468825ba0f2Srobj 	TOPO_SENSOR_UNITS_WEEK,
469825ba0f2Srobj 	TOPO_SENSOR_UNITS_MIL,
470825ba0f2Srobj 	TOPO_SENSOR_UNITS_INCHES,
471825ba0f2Srobj 	TOPO_SENSOR_UNITS_FEET,
472825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_INCH,
473825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_FEET,
474825ba0f2Srobj 
475825ba0f2Srobj 	TOPO_SENSOR_UNITS_MM,
476825ba0f2Srobj 	TOPO_SENSOR_UNITS_CM,
477825ba0f2Srobj 	TOPO_SENSOR_UNITS_METERS,
478825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_CM,
479825ba0f2Srobj 	TOPO_SENSOR_UNITS_CUB_METER,
480825ba0f2Srobj 	TOPO_SENSOR_UNITS_LITERS,
481825ba0f2Srobj 	TOPO_SENSOR_UNITS_FLUID_OUNCE,
482825ba0f2Srobj 	TOPO_SENSOR_UNITS_RADIANS,
483825ba0f2Srobj 	TOPO_SENSOR_UNITS_STERADIANS,
484825ba0f2Srobj 	TOPO_SENSOR_UNITS_REVOLUTIONS,
485825ba0f2Srobj 	TOPO_SENSOR_UNITS_CYCLES,
486825ba0f2Srobj 	TOPO_SENSOR_UNITS_GRAVITIES,
487825ba0f2Srobj 	TOPO_SENSOR_UNITS_OUNCE,
488825ba0f2Srobj 	TOPO_SENSOR_UNITS_POUND,
489825ba0f2Srobj 	TOPO_SENSOR_UNITS_FOOT_POUND,
490825ba0f2Srobj 	TOPO_SENSOR_UNITS_OZ_INCH,
491825ba0f2Srobj 
492825ba0f2Srobj 	TOPO_SENSOR_UNITS_GAUSS,
493825ba0f2Srobj 	TOPO_SENSOR_UNITS_GILBERTS,
494825ba0f2Srobj 	TOPO_SENSOR_UNITS_HENRY,
495825ba0f2Srobj 	TOPO_SENSOR_UNITS_MILHENRY,
496825ba0f2Srobj 	TOPO_SENSOR_UNITS_FARAD,
497825ba0f2Srobj 	TOPO_SENSOR_UNITS_MICROFARAD,
498825ba0f2Srobj 	TOPO_SENSOR_UNITS_OHMS,
499825ba0f2Srobj 	TOPO_SENSOR_UNITS_SIEMENS,
500825ba0f2Srobj 	TOPO_SENSOR_UNITS_MOLE,
501825ba0f2Srobj 	TOPO_SENSOR_UNITS_BECQUEREL,
502825ba0f2Srobj 	TOPO_SENSOR_UNITS_PPM,
503825ba0f2Srobj 	TOPO_SENSOR_UNITS_RESERVED1,
504825ba0f2Srobj 	TOPO_SENSOR_UNITS_DECIBELS,
505825ba0f2Srobj 	TOPO_SENSOR_UNITS_DBA,
506825ba0f2Srobj 	TOPO_SENSOR_UNITS_DBC,
507825ba0f2Srobj 	TOPO_SENSOR_UNITS_GRAY,
508825ba0f2Srobj 
509825ba0f2Srobj 	TOPO_SENSOR_UNITS_SIEVERT,
510825ba0f2Srobj 	TOPO_SENSOR_UNITS_COLOR_TEMP_K,
511825ba0f2Srobj 	TOPO_SENSOR_UNITS_BIT,
512825ba0f2Srobj 	TOPO_SENSOR_UNITS_KILOBIT,
513825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEGABIT,
514825ba0f2Srobj 	TOPO_SENSOR_UNITS_GIGABIT,
515825ba0f2Srobj 	TOPO_SENSOR_UNITS_BYTE,
516825ba0f2Srobj 	TOPO_SENSOR_UNITS_KILOBYTE,
517825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEGABYTE,
518825ba0f2Srobj 	TOPO_SENSOR_UNITS_GIGABYTE,
519825ba0f2Srobj 	TOPO_SENSOR_UNITS_WORD,
520825ba0f2Srobj 	TOPO_SENSOR_UNITS_DWORD,
521825ba0f2Srobj 	TOPO_SENSOR_UNITS_QWORD,
522825ba0f2Srobj 	TOPO_SENSOR_UNITS_MEMLINE,
523825ba0f2Srobj 	TOPO_SENSOR_UNITS_HIT,
524825ba0f2Srobj 	TOPO_SENSOR_UNITS_MISS,
525825ba0f2Srobj 
526825ba0f2Srobj 	TOPO_SENSOR_UNITS_RETRY,
527825ba0f2Srobj 	TOPO_SENSOR_UNITS_RESET,
528825ba0f2Srobj 	TOPO_SENSOR_UNITS_OVERFLOW,
529825ba0f2Srobj 	TOPO_SENSOR_UNITS_UNDERRUN,
530825ba0f2Srobj 	TOPO_SENSOR_UNITS_COLLISION,
531825ba0f2Srobj 	TOPO_SENSOR_UNITS_PACKETS,
532825ba0f2Srobj 	TOPO_SENSOR_UNITS_MESSAGES,
533825ba0f2Srobj 	TOPO_SENSOR_UNITS_CHARACTERS,
534825ba0f2Srobj 	TOPO_SENSOR_UNITS_ERROR,
535825ba0f2Srobj 	TOPO_SENSOR_UNITS_CE,
536825ba0f2Srobj 	TOPO_SENSOR_UNITS_UE,
537825ba0f2Srobj 	TOPO_SENSOR_UNITS_FATAL_ERROR,
538825ba0f2Srobj 	TOPO_SENSOR_UNITS_GRAMS
539825ba0f2Srobj } topo_sensor_unit_t;
540825ba0f2Srobj 
541e5dcf7beSRobert Johnston /*
542e5dcf7beSRobert Johnston  * These defines are used by the topo_method_sensor_failure to indicate
543e5dcf7beSRobert Johnston  * whether the source of a sensor failure is believed to be the result of an
544e5dcf7beSRobert Johnston  * internal failure, external condition or unknown
545e5dcf7beSRobert Johnston  */
546e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_UNKNOWN	0
547e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_INTERNAL	1
548e5dcf7beSRobert Johnston #define	TOPO_SENSOR_ERRSRC_EXTERNAL	2
549e5dcf7beSRobert Johnston 
550825ba0f2Srobj /*
551825ba0f2Srobj  * Sensor Types amd the associated sensor-type-specific states
552825ba0f2Srobj  *
553825ba0f2Srobj  * These are used to decode the type and state properties in the facility
554825ba0f2Srobj  * propgroup on facility nodes of type sensor.
555825ba0f2Srobj  *
556825ba0f2Srobj  * Again we're basically using the same defines as for IPMI as it's serves
557825ba0f2Srobj  * as a good starting point and simplifies the IPMI provider code.  Of course
558825ba0f2Srobj  * other facility providers will need to convert from their native codes
559825ba0f2Srobj  * to the topo code when they set the type and state properties.
560825ba0f2Srobj  */
561825ba0f2Srobj #define	TOPO_SENSOR_TYPE_RESERVED			0x0000
562825ba0f2Srobj #define	TOPO_SENSOR_TYPE_TEMP				0x0001
563825ba0f2Srobj #define	TOPO_SENSOR_TYPE_VOLTAGE			0x0002
564825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CURRENT			0x0003
565825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FAN				0x0004
566825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PHYSICAL			0x0005
567825ba0f2Srobj 
568825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_GENERAL		0x0001
569825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_BAY			0x0002
570825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_CARD			0x0004
571825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR		0x0008
572825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_LAN			0x0010
573825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_DOCK			0x0020
574825ba0f2Srobj #define	TOPO_SENSOR_STATE_PHYSICAL_FAN			0x0040
575825ba0f2Srobj 
576825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PLATFORM			0x0006
577825ba0f2Srobj 
578825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_SECURE		0x0001
579825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_USER_PASS		0x0002
580825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS		0x0004
581825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS		0x0008
582825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS		0x0010
583825ba0f2Srobj #define	TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND		0x0020
584825ba0f2Srobj 
585825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PROCESSOR			0x0007
586825ba0f2Srobj 
587825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_IERR		0x0001
588825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_THERMAL		0x0002
589825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB1		0x0004
590825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB2		0x0008
591825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_FRB3		0x0010
592825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_CONFIG		0x0020
593825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_SMBIOS		0x0040
594825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_PRESENT		0x0080
595825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_DISABLED		0x0100
596825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR		0x0200
597825ba0f2Srobj #define	TOPO_SENSOR_STATE_PROCESSOR_THROTTLED		0x0400
598825ba0f2Srobj 
599825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POWER_SUPPLY			0x0008
600825ba0f2Srobj 
601825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT		0x0001
602825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE		0x0002
603825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL		0x0004
604825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST	0x0008
605825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE	0x0010
606825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES	0x0020
607825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR	0x0040
608825ba0f2Srobj 
609825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POWER_UNIT			0x0009
610825ba0f2Srobj 
611825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_OFF		0x0001
612825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_CYCLE		0x0002
613825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN		0x0004
614825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN	0x0008
615825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST		0x0010
616825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE	0x0020
617825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_FAIL		0x0040
618825ba0f2Srobj #define	TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL		0x0080
619825ba0f2Srobj 
620825ba0f2Srobj #define	TOPO_SENSOR_TYPE_COOLING			0x000A
621825ba0f2Srobj #define	TOPO_SENSOR_TYPE_OTHER				0x000B
622825ba0f2Srobj 
623825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MEMORY				0x000C
624825ba0f2Srobj 
625825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CE			0x0001
626825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_UE			0x0002
627825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_PARITY			0x0004
628825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL		0x0008
629825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_DISABLED		0x0010
630825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT		0x0020
631825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_PRESENT		0x0040
632825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR		0x0080
633825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_SPARE			0x0100
634825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_THROTTLED		0x0200
635825ba0f2Srobj #define	TOPO_SENSOR_STATE_MEMORY_OVERTEMP		0x0400
636825ba0f2Srobj 
637825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BAY				0x000D
638825ba0f2Srobj 
639825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_PRESENT			0x0001
640825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_FAULT			0x0002
641825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_PREDFAIL			0x0004
642825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_SPARE			0x0008
643825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_CHECK			0x0010
644825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_CRITICAL			0x0020
645825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_FAILED			0x0040
646825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_REBUILDING		0x0080
647825ba0f2Srobj #define	TOPO_SENSOR_STATE_BAY_ABORTED			0x0100
648825ba0f2Srobj 
649825ba0f2Srobj #define	TOPO_SENSOR_TYPE_POST_RESIZE			0x000E
650825ba0f2Srobj 
651825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FIRMWARE			0x000F
652825ba0f2Srobj 
653825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_ERROR		0x0001
654825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_HANG			0x0002
655825ba0f2Srobj #define	TOPO_SENSOR_STATE_FIRMWARE_PROGRESS		0x0004
656825ba0f2Srobj 
657825ba0f2Srobj #define	TOPO_SENSOR_TYPE_EVENT_LOG			0x0010
658825ba0f2Srobj 
659825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_CE			0x0001
660825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_TYPE		0x0002
661825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_RESET		0x0004
662825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_ALL			0x0008
663825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_FULL		0x0010
664825ba0f2Srobj #define	TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL		0x0020
665825ba0f2Srobj 
666825ba0f2Srobj #define	TOPO_SENSOR_TYPE_WATCHDOG1			0x0011
667825ba0f2Srobj 
668825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET		0x0001
669825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_RESET		0x0002
670825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN		0x0004
671825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN		0x0008
672825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE		0x0010
673825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG		0x0020
674825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_EXPIRED		0x0040
675825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT	0x0080
676825ba0f2Srobj 
677825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SYSTEM				0x0012
678825ba0f2Srobj 
679825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_RECONF			0x0001
680825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_BOOT			0x0002
681825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE	0x0004
682825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED	0x0008
683825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION		0x0010
684825ba0f2Srobj #define	TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC	0x0020
685825ba0f2Srobj 
686825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CRITICAL			0x0013
687825ba0f2Srobj 
688825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_EXT_NMI		0x0001
689825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT		0x0002
690825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_IO_NMI		0x0004
691825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_SW_NMI		0x0008
692825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_PCI_PERR		0x0010
693825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_PCI_SERR		0x0020
694825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE	0x0040
695825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_CE		0x0080
696825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_UE		0x0100
697825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI		0x0200
698825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR	0x0400
699825ba0f2Srobj #define	TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED		0x0800
700825ba0f2Srobj 
701825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BUTTON				0x0014
702825ba0f2Srobj 
703825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_PWR			0x0001
704825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_SLEEP			0x0002
705825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_RESET			0x0004
706825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_FRU_LATCH		0x0008
707825ba0f2Srobj #define	TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE		0x0010
708825ba0f2Srobj 
709825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MODULE				0x0015
710825ba0f2Srobj #define	TOPO_SENSOR_TYPE_MICROCONTROLLER		0x0016
711825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CARD				0x0017
712825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CHASSIS			0x0018
713825ba0f2Srobj 
714825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CHIPSET			0x0019
715825ba0f2Srobj 
716825ba0f2Srobj #define	TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL		0x0001
717825ba0f2Srobj 
718825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FRU				0x001A
719825ba0f2Srobj 
720825ba0f2Srobj #define	TOPO_SENSOR_TYPE_CABLE				0x001B
721825ba0f2Srobj 
722825ba0f2Srobj #define	TOPO_SENSOR_STATE_CABLE_CONNECTED		0x0001
723825ba0f2Srobj #define	TOPO_SENSOR_STATE_CABLE_CONFIG_ERR		0x0002
724825ba0f2Srobj 
725825ba0f2Srobj #define	TOPO_SENSOR_TYPE_TERMINATOR			0x001C
726825ba0f2Srobj 
727825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_STATE			0x001D
728825ba0f2Srobj 
729825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP	0x0001
730825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET	0x0002
731825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET	0x0004
732825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT		0x0008
733825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT		0x0010
734825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET	0x0020
735825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET	0x0040
736825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART	0x0080
737825ba0f2Srobj 
738825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_ERROR			0x001E
739825ba0f2Srobj 
740825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA		0x0001
741825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK	0x0002
742825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER	0x0004
743825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT	0x0008
744825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT	0x0010
745825ba0f2Srobj 
746825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BOOT_OS			0x001F
747825ba0f2Srobj 
748825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE	0x0001
749825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE	0x0002
750825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE	0x0004
751825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE	0x0008
752825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE	0x0010
753825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE	0x0020
754825ba0f2Srobj #define	TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE	0x0040
755825ba0f2Srobj 
756825ba0f2Srobj #define	TOPO_SENSOR_TYPE_OS_SHUTDOWN			0x0020
757825ba0f2Srobj 
758825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING		0x0001
759825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH		0x0002
760825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_STOP_GRACEFUL		0x0004
761825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL		0x0008
762825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF		0x0010
763825ba0f2Srobj #define	TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC		0x0020
764825ba0f2Srobj 
765825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SLOT				0x0021
766825ba0f2Srobj 
767825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED		0x0001
768825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED	0x0002
769825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_CONNECTED		0x0004
770825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_INSTALL_READY		0x0008
771825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_REMOVE_READY		0x0010
772825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_PWR_OFF			0x0020
773825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_REMOVED			0x0040
774825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED	0x0080
775825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_DISABLED			0x0100
776825ba0f2Srobj #define	TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE		0x0200
777825ba0f2Srobj 
778825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ACPI				0x0022
779825ba0f2Srobj 
780825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0		0x0001
781825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1		0x0002
782825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S2		0x0004
783825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S3		0x0008
784825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4		0x0010
785825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF	0x0020
786825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF	0x0040
787825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF	0x0080
788825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP	0x0100
789825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP		0x0200
790825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE	0x0400
791825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON		0x0800
792825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF	0x1000
793825ba0f2Srobj #define	TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN		0x2000
794825ba0f2Srobj 
795825ba0f2Srobj #define	TOPO_SENSOR_TYPE_WATCHDOG2			0x0023
796825ba0f2Srobj 
797825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED		0x0001
798825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET		0x0002
799825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN		0x0004
800825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE		0x0008
801825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1		0x0010
802825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2		0x0020
803825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3		0x0040
804825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4		0x0080
805825ba0f2Srobj #define	TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT		0x0100
806825ba0f2Srobj 
807825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ALERT				0x0024
808825ba0f2Srobj 
809825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_PAGE		0x0001
810825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT		0x0002
811825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP		0x0004
812825ba0f2Srobj #define	TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP		0x0008
813825ba0f2Srobj 
814825ba0f2Srobj #define	TOPO_SENSOR_TYPE_PRESENCE			0x0025
815825ba0f2Srobj 
816825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_PRESENT		0x0001
817825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_ABSENT		0x0002
818825ba0f2Srobj #define	TOPO_SENSOR_STATE_PRESENCE_DISABLED		0x0004
819825ba0f2Srobj 
820825ba0f2Srobj #define	TOPO_SENSOR_TYPE_ASIC				0x0026
821825ba0f2Srobj 
822825ba0f2Srobj #define	TOPO_SENSOR_TYPE_LAN				0x0027
823825ba0f2Srobj 
824825ba0f2Srobj #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST		0x0001
825825ba0f2Srobj #define	TOPO_SENSOR_STATE_LAN_HEARTBEAT			0x0002
826825ba0f2Srobj 
827825ba0f2Srobj #define	TOPO_SENSOR_TYPE_HEALTH				0x0028
828825ba0f2Srobj 
829825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED	0x0001
830825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED	0x0002
831825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE		0x0004
832825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL		0x0008
833825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE		0x0010
834825ba0f2Srobj #define	TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE		0x0020
835825ba0f2Srobj 
836825ba0f2Srobj #define	TOPO_SENSOR_TYPE_BATTERY			0x0029
837825ba0f2Srobj 
838825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_LOW			0x0001
839825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_FAILED		0x0002
840825ba0f2Srobj #define	TOPO_SENSOR_STATE_BATTERY_PRESENCE		0x0004
841825ba0f2Srobj 
842825ba0f2Srobj #define	TOPO_SENSOR_TYPE_AUDIT				0x002A
843825ba0f2Srobj 
844825ba0f2Srobj #define	TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED	0x0001
845825ba0f2Srobj #define	TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED	0x0002
846825ba0f2Srobj 
847825ba0f2Srobj #define	TOPO_SENSOR_TYPE_VERSION			0x002B
848825ba0f2Srobj 
849825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE		0x0001
850825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE		0x0002
851825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE	0x0004
852825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE	0x0008
853825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_INVAL		0x0010
854825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_INVAL		0x0020
855825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS	0x0040
856825ba0f2Srobj #define	TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS	0x0080
857825ba0f2Srobj 
858825ba0f2Srobj #define	TOPO_SENSOR_TYPE_FRU_STATE			0x002C
859825ba0f2Srobj 
860825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED	0x0001
861825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_INACTIVE		0x0002
862825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ		0x0004
863825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS	0x0008
864825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_ACTIVE		0x0010
865825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ		0x0020
866825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS	0x0040
867825ba0f2Srobj #define	TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST		0x0080
868825ba0f2Srobj 
869825ba0f2Srobj /*
870825ba0f2Srobj  * We simplify the IPMI sensor type code defines by combining the generic
871825ba0f2Srobj  * and sensor-specific codes into a single range.  Because there's overlap
872825ba0f2Srobj  * between the two ranges we offset the generic type codes by 0x0100
873825ba0f2Srobj  * which allows ample room in the hole for future expansion of the table to
874825ba0f2Srobj  * accomodate either additions to the IPMI spec or to support new sensor types
875825ba0f2Srobj  * for alternate provider modules.
876825ba0f2Srobj  */
8777793aa8bSEric Schrock #define	TOPO_SENSOR_TYPE_THRESHOLD_STATE		0x0101
8787793aa8bSEric Schrock 
8790b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT		0x0001
8800b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_CRIT		0x0002
8810b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_LOWER_NONREC		0x0004
8820b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT		0x0008
8830b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_CRIT		0x0010
8840b1b4412SEric Schrock #define	TOPO_SENSOR_STATE_THRESH_UPPER_NONREC		0x0020
885825ba0f2Srobj 
886825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_USAGE			0x0102
887825ba0f2Srobj 
888825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE		0x0001
889825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE		0x0002
890825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY		0x0004
891825ba0f2Srobj 
892825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_STATE			0x0103
893825ba0f2Srobj 
894825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED	0x0001
895825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED	0x0002
896825ba0f2Srobj 
897825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PREDFAIL		0x0104
898825ba0f2Srobj 
899825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED	0x0001
900825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED	0x0002
901825ba0f2Srobj 
902825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_LIMIT			0x0105
903825ba0f2Srobj 
904825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED	0x0001
905825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED	0x0002
906825ba0f2Srobj 
907825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE		0x0106
908825ba0f2Srobj 
909825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET	0x0001
910825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS	0x0002
911825ba0f2Srobj 
912825ba0f2Srobj #define	TOPO_SENSOR_TYPE_SEVERITY			0x0107
913825ba0f2Srobj 
914825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_OK			0x0001
915825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH	0x0002
916825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH	0x0004
917825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH	0x0008
918825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW	0x0010
919825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW	0x0020
920825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW	0x0020
921825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_MONITOR		0x0040
922825ba0f2Srobj #define	TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL	0x0080
923825ba0f2Srobj 
924825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_PRESENCE		0x0108
925825ba0f2Srobj 
926825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED	0x0001
927825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED	0x0002
928825ba0f2Srobj 
929825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY		0x0109
930825ba0f2Srobj 
931825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED	0x0001
932825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED	0x0002
933825ba0f2Srobj 
934825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_STATUS			0x010A
935825ba0f2Srobj 
936825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING	0x0001
937825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST	0x0002
938825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF	0x0004
939825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE		0x0008
940825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE	0x0010
941825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY	0x0020
942825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED	0x0040
943825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE	0x0080
944825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR	0x0100
945825ba0f2Srobj 
946825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY		0x010B
947825ba0f2Srobj 
948825ba0f2Srobj /*
949825ba0f2Srobj  * ACPI power state
950825ba0f2Srobj  */
951825ba0f2Srobj #define	TOPO_SENSOR_TYPE_GENERIC_ACPI			0x010C
952825ba0f2Srobj 
953825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D0		0x0001
954825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D1		0x0002
955825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D2		0x0004
956825ba0f2Srobj #define	TOPO_SENSOR_STATE_GENERIC_ACPI_D3		0x0008
957825ba0f2Srobj 
958e5dcf7beSRobert Johnston /*
959e5dcf7beSRobert Johnston  * These sensor types don't exist in the IPMI spec, but allow consumers to
960e5dcf7beSRobert Johnston  * associate discrete sensors with component failure.  The 'ok' sensor is the
961e5dcf7beSRobert Johnston  * inverse of the 'failure' sensor.  Note that the values intentionally mimic
962e5dcf7beSRobert Johnston  * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors
963e5dcf7beSRobert Johnston  * but just change the type to get semantically meaningful behavior.
964e5dcf7beSRobert Johnston  */
965e5dcf7beSRobert Johnston #define	TOPO_SENSOR_TYPE_GENERIC_FAILURE		0x010D
966e5dcf7beSRobert Johnston 
967e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED	0x0001
968e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV		0x0002
969e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL		0x0004
970e5dcf7beSRobert Johnston 
971e5dcf7beSRobert Johnston #define	TOPO_SENSOR_TYPE_GENERIC_OK			0x010E
972e5dcf7beSRobert Johnston 
973e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED		0x0001
974e5dcf7beSRobert Johnston #define	TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED		0x0002
975e5dcf7beSRobert Johnston 
976825ba0f2Srobj /*
977825ba0f2Srobj  * Indicator modes and types
978825ba0f2Srobj  */
979825ba0f2Srobj typedef enum topo_led_state {
980825ba0f2Srobj 	TOPO_LED_STATE_OFF = 0,
981825ba0f2Srobj 	TOPO_LED_STATE_ON
982825ba0f2Srobj } topo_led_state_t;
983825ba0f2Srobj 
984e5dcf7beSRobert Johnston #define	TOPO_FAC_TYPE_ANY	0xFFFFFFFF
985e5dcf7beSRobert Johnston 
986825ba0f2Srobj /*
987825ba0f2Srobj  * This list is limited to the set of LED's that we're likely to manage through
988825ba0f2Srobj  * FMA.  Thus is does not include things like power or activity LED's
989825ba0f2Srobj  */
990825ba0f2Srobj typedef enum topo_led_type {
991825ba0f2Srobj 	TOPO_LED_TYPE_SERVICE = 0,
992825ba0f2Srobj 	TOPO_LED_TYPE_LOCATE,
993825ba0f2Srobj 	TOPO_LED_TYPE_OK2RM,
994825ba0f2Srobj 	TOPO_LED_TYPE_PRESENT
995825ba0f2Srobj } topo_led_type_t;
996825ba0f2Srobj 
997825ba0f2Srobj 
9987aec1d6eScindi #ifdef __cplusplus
9997aec1d6eScindi }
10007aec1d6eScindi #endif
10017aec1d6eScindi 
10027aec1d6eScindi #endif /* _LIBTOPO_H */
1003