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 */ 25*208e1562SRob Johnston /* 26*208e1562SRob Johnston * Copyright (c) 2018, Joyent, Inc. All rights reserved. 27*208e1562SRob 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 *); 145825ba0f2Srobj 146825ba0f2Srobj /* 147825ba0f2Srobj * Node flags: denotes type of node 148825ba0f2Srobj */ 149825ba0f2Srobj #define TOPO_NODE_DEFAULT 0 150825ba0f2Srobj #define TOPO_NODE_FACILITY 1 1517aec1d6eScindi 152825ba0f2Srobj #define TOPO_FAC_TYPE_SENSOR "sensor" 153825ba0f2Srobj #define TOPO_FAC_TYPE_INDICATOR "indicator" 154825ba0f2Srobj 155825ba0f2Srobj /* 156825ba0f2Srobj * Topo property get functions 157825ba0f2Srobj */ 1587aec1d6eScindi extern int topo_prop_get_int32(tnode_t *, const char *, const char *, 1597aec1d6eScindi int32_t *, int *); 1607aec1d6eScindi extern int topo_prop_get_uint32(tnode_t *, const char *, const char *, 1617aec1d6eScindi uint32_t *, int *); 1627aec1d6eScindi extern int topo_prop_get_int64(tnode_t *, const char *, const char *, 1637aec1d6eScindi int64_t *, int *); 1647aec1d6eScindi extern int topo_prop_get_uint64(tnode_t *, const char *, const char *, 1657aec1d6eScindi uint64_t *, int *); 166825ba0f2Srobj extern int topo_prop_get_double(tnode_t *, const char *, const char *, 167825ba0f2Srobj double *, int *); 1687aec1d6eScindi extern int topo_prop_get_string(tnode_t *, const char *, const char *, 1697aec1d6eScindi char **, int *); 1707aec1d6eScindi extern int topo_prop_get_fmri(tnode_t *, const char *, const char *, 1717aec1d6eScindi nvlist_t **, int *); 1720eb822a1Scindi extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *, 1730eb822a1Scindi int32_t **, uint_t *, int *); 1740eb822a1Scindi extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *, 1750eb822a1Scindi uint32_t **, uint_t *, int *); 1760eb822a1Scindi extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *, 1770eb822a1Scindi int64_t **, uint_t *, int *); 1780eb822a1Scindi extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *, 1790eb822a1Scindi uint64_t **, uint_t *, int *); 1800eb822a1Scindi extern int topo_prop_get_string_array(tnode_t *, const char *, const char *, 1810eb822a1Scindi char ***, uint_t *, int *); 1820eb822a1Scindi extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *, 1830eb822a1Scindi nvlist_t ***, uint_t *, int *); 1847aec1d6eScindi 185825ba0f2Srobj /* 186825ba0f2Srobj * Topo property set functions 187825ba0f2Srobj */ 188825ba0f2Srobj extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int, 189825ba0f2Srobj int32_t, int *); 190825ba0f2Srobj extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int, 191825ba0f2Srobj uint32_t, int *); 192825ba0f2Srobj extern int topo_prop_set_int64(tnode_t *, const char *, const char *, 193825ba0f2Srobj int, int64_t, int *); 194825ba0f2Srobj extern int topo_prop_set_uint64(tnode_t *, const char *, const char *, 195825ba0f2Srobj int, uint64_t, int *); 196825ba0f2Srobj extern int topo_prop_set_double(tnode_t *, const char *, const char *, 197825ba0f2Srobj int, double, int *); 198825ba0f2Srobj extern int topo_prop_set_string(tnode_t *, const char *, const char *, 199825ba0f2Srobj int, const char *, int *); 200825ba0f2Srobj extern int topo_prop_set_fmri(tnode_t *, const char *, const char *, 201825ba0f2Srobj int, const nvlist_t *, int *); 202825ba0f2Srobj extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int, 203825ba0f2Srobj int32_t *, uint_t, int *); 204825ba0f2Srobj extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *, 205825ba0f2Srobj int, uint32_t *, uint_t, int *); 206825ba0f2Srobj extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *, 207825ba0f2Srobj int, int64_t *, uint_t, int *); 208825ba0f2Srobj extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *, 209825ba0f2Srobj int, uint64_t *, uint_t, int *); 210825ba0f2Srobj extern int topo_prop_set_string_array(tnode_t *, const char *, const char *, 211825ba0f2Srobj int, const char **, uint_t, int *); 212825ba0f2Srobj extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *, 213825ba0f2Srobj int, const nvlist_t **, uint_t, int *); 214825ba0f2Srobj 2150eb822a1Scindi #define TOPO_PROP_IMMUTABLE 0 216e5dcf7beSRobert Johnston #define TOPO_PROP_MUTABLE 0x01 217e5dcf7beSRobert Johnston #define TOPO_PROP_NONVOLATILE 0x02 2187aec1d6eScindi 2197aec1d6eScindi /* Protocol property group and property names */ 2207aec1d6eScindi #define TOPO_PGROUP_PROTOCOL "protocol" /* Required property group */ 2217aec1d6eScindi #define TOPO_PROP_RESOURCE "resource" /* resource FMRI */ 2227aec1d6eScindi #define TOPO_PROP_ASRU "ASRU" /* ASRU FMRI */ 2237aec1d6eScindi #define TOPO_PROP_FRU "FRU" /* FRU FMRI */ 2247aec1d6eScindi #define TOPO_PROP_MOD "module" /* software module FMRI */ 2257aec1d6eScindi #define TOPO_PROP_PKG "package" /* software package FMRI */ 2267aec1d6eScindi #define TOPO_PROP_LABEL "label" /* property LABEL */ 2277aec1d6eScindi 228825ba0f2Srobj #define TOPO_METH_FAC_ENUM "fac_enum" 229825ba0f2Srobj 2307aec1d6eScindi /* 2317aec1d6eScindi * System property group 2327aec1d6eScindi */ 2337aec1d6eScindi #define TOPO_PGROUP_SYSTEM "system" 2347aec1d6eScindi #define TOPO_PROP_ISA "isa" 2357aec1d6eScindi #define TOPO_PROP_MACHINE "machine" 2367aec1d6eScindi 23788045cffSRobert Johnston #define TOPO_PGROUP_IPMI "ipmi" 23888045cffSRobert Johnston 2390eb822a1Scindi /* 240c40d7343Scindi * These enum definitions are used to define a set of error tags associated with 241c40d7343Scindi * libtopo error conditions occuring during the adminstration of 242c40d7343Scindi * properties, invocation of methods and fmri-based queries. The shell script 243c40d7343Scindi * mkerror.sh is used to parse this file and create a corresponding topo_error.c 244c40d7343Scindi * source file. 245c40d7343Scindi * 2460eb822a1Scindi * If you do something other than add a new error tag here, you may need to 2470eb822a1Scindi * update the mkerror shell script as it is based upon simple regexps. 2480eb822a1Scindi */ 2490eb822a1Scindi typedef enum topo_prop_errno { 2500eb822a1Scindi ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */ 2510eb822a1Scindi ETOPO_PROP_NOENT, /* undefined property or property group */ 2520eb822a1Scindi ETOPO_PROP_DEFD, /* static property already defined */ 2530eb822a1Scindi ETOPO_PROP_NOMEM, /* memory limit exceeded during property allocation */ 2540eb822a1Scindi ETOPO_PROP_TYPE, /* invalid property type */ 255c40d7343Scindi ETOPO_PROP_NAME, /* invalid property name */ 2560eb822a1Scindi ETOPO_PROP_NOINHERIT, /* can not inherit property */ 2570eb822a1Scindi ETOPO_PROP_NVL, /* malformed property nvlist */ 258c40d7343Scindi ETOPO_PROP_METHOD, /* get property method failed */ 2590eb822a1Scindi ETOPO_PROP_END /* end of prop errno list (to ease auto-merge) */ 2600eb822a1Scindi } topo_prop_errno_t; 2617aec1d6eScindi 262dd566498Svn typedef enum topo_method_errno { 263c40d7343Scindi ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */ 264c40d7343Scindi ETOPO_METHOD_INVAL, /* invalid method registration */ 265c40d7343Scindi ETOPO_METHOD_NOTSUP, /* method not supported */ 266c40d7343Scindi ETOPO_METHOD_FAIL, /* method failed */ 267c40d7343Scindi ETOPO_METHOD_VEROLD, /* app is compiled to use obsolete method */ 268c40d7343Scindi ETOPO_METHOD_VERNEW, /* app is compiled to use obsolete method */ 269c40d7343Scindi ETOPO_METHOD_NOMEM, /* memory limit exceeded during method op */ 270c40d7343Scindi ETOPO_METHOD_DEFD, /* method op already defined */ 271c40d7343Scindi ETOPO_METHOD_END /* end of method errno list */ 272dd566498Svn } topo_method_errno_t; 273dd566498Svn 274c40d7343Scindi typedef enum topo_fmri_errno { 275c40d7343Scindi ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */ 276c40d7343Scindi ETOPO_FMRI_NVL, /* nvlist allocation failure for FMRI */ 277c40d7343Scindi ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */ 278c40d7343Scindi ETOPO_FMRI_MALFORM, /* malformed FMRI */ 279c40d7343Scindi ETOPO_FMRI_NOMEM, /* memory limit exceeded */ 280c40d7343Scindi ETOPO_FMRI_END /* end of fmri errno list */ 281c40d7343Scindi } topo_fmri_errno_t; 282c40d7343Scindi 283c40d7343Scindi typedef enum topo_hdl_errno { 284c40d7343Scindi ETOPO_HDL_UNKNOWN = 3300, /* unknown topo handle error */ 285c40d7343Scindi ETOPO_HDL_ABIVER, /* handle opened with invalid ABI version */ 286c40d7343Scindi ETOPO_HDL_SNAP, /* snapshot already taken */ 287c40d7343Scindi ETOPO_HDL_INVAL, /* invalid argument specified */ 288c40d7343Scindi ETOPO_HDL_UUID, /* uuid already set */ 289c40d7343Scindi ETOPO_HDL_NOMEM, /* memory limit exceeded */ 290c40d7343Scindi ETOPO_HDL_END /* end of handle errno list */ 291c40d7343Scindi } topo_hdl_errno_t; 292dd566498Svn 2937aec1d6eScindi extern const char *topo_strerror(int); 294c40d7343Scindi extern void topo_hdl_strfree(topo_hdl_t *, char *); 2950eb822a1Scindi extern void topo_debug_set(topo_hdl_t *, const char *, const char *); 296c40d7343Scindi 297c40d7343Scindi /* 298c40d7343Scindi * The following functions and data structures to support property 299c40d7343Scindi * observability are private to the fmtopo command. 300c40d7343Scindi */ 301c40d7343Scindi 302c40d7343Scindi /* 303c40d7343Scindi * Each topology node advertises the name and data stability of each of its 304c40d7343Scindi * modules and properties. (see attributes(5)). 305c40d7343Scindi */ 306c40d7343Scindi 307c40d7343Scindi /* 308c40d7343Scindi * Topo stability attributes 309c40d7343Scindi */ 310c40d7343Scindi typedef enum topo_stability { 311c40d7343Scindi TOPO_STABILITY_UNKNOWN = 0, /* private to libtopo */ 312c40d7343Scindi TOPO_STABILITY_INTERNAL, /* private to libtopo */ 313c40d7343Scindi TOPO_STABILITY_PRIVATE, /* private to Sun */ 314c40d7343Scindi TOPO_STABILITY_OBSOLETE, /* scheduled for removal */ 315c40d7343Scindi TOPO_STABILITY_EXTERNAL, /* not controlled by Sun */ 316c40d7343Scindi TOPO_STABILITY_UNSTABLE, /* new or rapidly changing */ 317c40d7343Scindi TOPO_STABILITY_EVOLVING, /* less rapidly changing */ 318c40d7343Scindi TOPO_STABILITY_STABLE, /* mature interface from Sun */ 319c40d7343Scindi TOPO_STABILITY_STANDARD /* industry standard */ 320c40d7343Scindi } topo_stability_t; 321c40d7343Scindi 322c40d7343Scindi #define TOPO_STABILITY_MAX TOPO_STABILITY_STANDARD /* max valid stab */ 323c40d7343Scindi 324c40d7343Scindi typedef struct topo_pgroup_info { 325c40d7343Scindi const char *tpi_name; /* property group name */ 326c40d7343Scindi topo_stability_t tpi_namestab; /* stability of group name */ 327c40d7343Scindi topo_stability_t tpi_datastab; /* stability of all property values */ 328c40d7343Scindi topo_version_t tpi_version; /* version of pgroup definition */ 329c40d7343Scindi } topo_pgroup_info_t; 330c40d7343Scindi 331c40d7343Scindi extern topo_stability_t topo_name2stability(const char *); 332c40d7343Scindi extern const char *topo_stability2name(topo_stability_t); 333c40d7343Scindi extern void topo_pgroup_destroy(tnode_t *, const char *); 334c40d7343Scindi extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *); 335c40d7343Scindi 336c40d7343Scindi typedef enum { 337c40d7343Scindi TOPO_TYPE_INVALID = 0, 338c40d7343Scindi TOPO_TYPE_BOOLEAN, /* boolean */ 339c40d7343Scindi TOPO_TYPE_INT32, /* int32_t */ 340c40d7343Scindi TOPO_TYPE_UINT32, /* uint32_t */ 341c40d7343Scindi TOPO_TYPE_INT64, /* int64_t */ 342c40d7343Scindi TOPO_TYPE_UINT64, /* uint64_t */ 343c40d7343Scindi TOPO_TYPE_STRING, /* const char* */ 344c40d7343Scindi TOPO_TYPE_TIME, /* uint64_t */ 345c40d7343Scindi TOPO_TYPE_SIZE, /* uint64_t */ 346c40d7343Scindi TOPO_TYPE_FMRI, /* nvlist_t */ 347c40d7343Scindi TOPO_TYPE_INT32_ARRAY, /* array of int32_t */ 348c40d7343Scindi TOPO_TYPE_UINT32_ARRAY, /* array of uint32_t */ 349c40d7343Scindi TOPO_TYPE_INT64_ARRAY, /* array of int64_t */ 350c40d7343Scindi TOPO_TYPE_UINT64_ARRAY, /* array of uint64_t */ 351c40d7343Scindi TOPO_TYPE_STRING_ARRAY, /* array of const char* */ 352825ba0f2Srobj TOPO_TYPE_FMRI_ARRAY, /* array of nvlist_t */ 353825ba0f2Srobj TOPO_TYPE_DOUBLE /* double */ 354c40d7343Scindi } topo_type_t; 355c40d7343Scindi 356c40d7343Scindi extern nvlist_t *topo_prop_getprops(tnode_t *, int *err); 357c40d7343Scindi extern int topo_prop_getprop(tnode_t *, const char *, const char *, 358c40d7343Scindi nvlist_t *, nvlist_t **, int *); 359c40d7343Scindi extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *); 360c40d7343Scindi extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *, 361c40d7343Scindi int, nvlist_t *, int *); 362c40d7343Scindi extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *, 363c40d7343Scindi const char *, nvlist_t *, nvlist_t **, int *); 364c40d7343Scindi extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *, 365c40d7343Scindi nvlist_t **, int *); 366c40d7343Scindi extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *, 367c40d7343Scindi nvlist_t *, int, nvlist_t *, int *); 368c40d7343Scindi 369c40d7343Scindi /* Property node NVL names used in topo_prop_getprops */ 370c40d7343Scindi #define TOPO_PROP_GROUP "property-group" 371c40d7343Scindi #define TOPO_PROP_GROUP_NAME "property-group-name" 372c40d7343Scindi #define TOPO_PROP_GROUP_DSTAB "property-group-data-stability" 373c40d7343Scindi #define TOPO_PROP_GROUP_NSTAB "property-group-name-stability" 374c40d7343Scindi #define TOPO_PROP_GROUP_VERSION "property-group-version" 375c40d7343Scindi #define TOPO_PROP_VAL "property" 376c40d7343Scindi #define TOPO_PROP_VAL_NAME "property-name" 377c40d7343Scindi #define TOPO_PROP_VAL_VAL "property-value" 378c40d7343Scindi #define TOPO_PROP_VAL_TYPE "property-type" 379c40d7343Scindi #define TOPO_PROP_FLAG "property-flag" 380c40d7343Scindi 381c40d7343Scindi /* 382c40d7343Scindi * ARGS list used in topo property methods 383c40d7343Scindi */ 384c40d7343Scindi #define TOPO_PROP_ARGS "args" 385c40d7343Scindi #define TOPO_PROP_PARGS "private-args" 386c40d7343Scindi 387c40d7343Scindi extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *); 388c40d7343Scindi 3897aec1d6eScindi extern void *topo_hdl_alloc(topo_hdl_t *, size_t); 3907aec1d6eScindi extern void *topo_hdl_zalloc(topo_hdl_t *, size_t); 3917aec1d6eScindi extern void topo_hdl_free(topo_hdl_t *, void *, size_t); 3927aec1d6eScindi extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t); 3937aec1d6eScindi extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **); 3947aec1d6eScindi extern char *topo_hdl_strdup(topo_hdl_t *, const char *); 3957aec1d6eScindi 396825ba0f2Srobj /* 397825ba0f2Srobj * Interfaces for converting sensor/indicator types, units, states, etc to 398825ba0f2Srobj * a string 399825ba0f2Srobj */ 400825ba0f2Srobj void topo_sensor_type_name(uint32_t type, char *buf, size_t len); 401825ba0f2Srobj void topo_sensor_units_name(uint8_t type, char *buf, size_t len); 402825ba0f2Srobj void topo_led_type_name(uint8_t type, char *buf, size_t len); 403825ba0f2Srobj void topo_led_state_name(uint8_t type, char *buf, size_t len); 404825ba0f2Srobj void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf, 405825ba0f2Srobj size_t len); 406825ba0f2Srobj 407825ba0f2Srobj /* 408825ba0f2Srobj * Defines for standard properties for sensors and indicators 409825ba0f2Srobj */ 410825ba0f2Srobj #define TOPO_PGROUP_FACILITY "facility" 411825ba0f2Srobj 412825ba0f2Srobj #define TOPO_SENSOR_READING "reading" 413825ba0f2Srobj #define TOPO_SENSOR_STATE "state" 414825ba0f2Srobj #define TOPO_SENSOR_CLASS "sensor-class" 415825ba0f2Srobj #define TOPO_FACILITY_TYPE "type" 416825ba0f2Srobj #define TOPO_SENSOR_UNITS "units" 417825ba0f2Srobj #define TOPO_LED_MODE "mode" 418825ba0f2Srobj 419*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LNC "threshold-lower-non-critical" 420*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LCR "threshold-lower-critical" 421*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LNR "threshold-lower-non-recoverable" 422*208e1562SRob Johnston 423*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UNC "threshold-upper-non-critical" 424*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UCR "threshold-upper-critical" 425*208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UNR "threshold-upper-non-recoverable" 426*208e1562SRob Johnston 427825ba0f2Srobj /* 428825ba0f2Srobj * Sensor Classes 429825ba0f2Srobj * 430825ba0f2Srobj * The "sensor-class" property in the "facility" propgroup on 431825ba0f2Srobj * facility nodes of type "sensor" should be set to one of these 432825ba0f2Srobj * two values. 433825ba0f2Srobj * 434825ba0f2Srobj * Threshold sensors provide an analog sensor reading via the 435825ba0f2Srobj * "reading" property in the facility propgroup. They will also 436825ba0f2Srobj * provide one or more discrete states via the "state" property 437825ba0f2Srobj * in the facility propgroup. 438825ba0f2Srobj * 439825ba0f2Srobj * Discrete sensors will not provide an analog reading by will 440825ba0f2Srobj * provide one or more discrete states via the "state" property 441825ba0f2Srobj * in the facility propgroup. 442825ba0f2Srobj */ 443825ba0f2Srobj #define TOPO_SENSOR_CLASS_THRESHOLD "threshold" 444825ba0f2Srobj #define TOPO_SENSOR_CLASS_DISCRETE "discrete" 445825ba0f2Srobj 446825ba0f2Srobj /* 447825ba0f2Srobj * Sensor unit types. We're using the unit types and corresponding 448825ba0f2Srobj * codes described in the IPMI 2.0 spec as a reference as it seems to be a 449825ba0f2Srobj * reasonably comprehensive list. This also simplifies the IPMI provider code 450825ba0f2Srobj * since the unit type codes will map exactly to what libtopo uses (so no 451825ba0f2Srobj * conversion necessary). 452825ba0f2Srobj */ 453825ba0f2Srobj typedef enum topo_sensor_unit { 454825ba0f2Srobj TOPO_SENSOR_UNITS_UNSPECIFIED = 0, 455825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_C, 456825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_F, 457825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_K, 458825ba0f2Srobj TOPO_SENSOR_UNITS_VOLTS, 459825ba0f2Srobj TOPO_SENSOR_UNITS_AMPS, 460825ba0f2Srobj TOPO_SENSOR_UNITS_WATTS, 461825ba0f2Srobj TOPO_SENSOR_UNITS_JOULES, 462825ba0f2Srobj TOPO_SENSOR_UNITS_COULOMBS, 463825ba0f2Srobj TOPO_SENSOR_UNITS_VA, 464825ba0f2Srobj TOPO_SENSOR_UNITS_NITS, 465825ba0f2Srobj TOPO_SENSOR_UNITS_LUMEN, 466825ba0f2Srobj TOPO_SENSOR_UNITS_LUX, 467825ba0f2Srobj TOPO_SENSOR_UNITS_CANDELA, 468825ba0f2Srobj TOPO_SENSOR_UNITS_KPA, 469825ba0f2Srobj TOPO_SENSOR_UNITS_PSI, 470825ba0f2Srobj 471825ba0f2Srobj TOPO_SENSOR_UNITS_NEWTON, 472825ba0f2Srobj TOPO_SENSOR_UNITS_CFM, 473825ba0f2Srobj TOPO_SENSOR_UNITS_RPM, 474825ba0f2Srobj TOPO_SENSOR_UNITS_HZ, 475825ba0f2Srobj TOPO_SENSOR_UNITS_MICROSEC, 476825ba0f2Srobj TOPO_SENSOR_UNITS_MILLISEC, 477825ba0f2Srobj TOPO_SENSOR_UNITS_SECS, 478825ba0f2Srobj TOPO_SENSOR_UNITS_MIN, 479825ba0f2Srobj TOPO_SENSOR_UNITS_HOUR, 480825ba0f2Srobj TOPO_SENSOR_UNITS_DAY, 481825ba0f2Srobj TOPO_SENSOR_UNITS_WEEK, 482825ba0f2Srobj TOPO_SENSOR_UNITS_MIL, 483825ba0f2Srobj TOPO_SENSOR_UNITS_INCHES, 484825ba0f2Srobj TOPO_SENSOR_UNITS_FEET, 485825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_INCH, 486825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_FEET, 487825ba0f2Srobj 488825ba0f2Srobj TOPO_SENSOR_UNITS_MM, 489825ba0f2Srobj TOPO_SENSOR_UNITS_CM, 490825ba0f2Srobj TOPO_SENSOR_UNITS_METERS, 491825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_CM, 492825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_METER, 493825ba0f2Srobj TOPO_SENSOR_UNITS_LITERS, 494825ba0f2Srobj TOPO_SENSOR_UNITS_FLUID_OUNCE, 495825ba0f2Srobj TOPO_SENSOR_UNITS_RADIANS, 496825ba0f2Srobj TOPO_SENSOR_UNITS_STERADIANS, 497825ba0f2Srobj TOPO_SENSOR_UNITS_REVOLUTIONS, 498825ba0f2Srobj TOPO_SENSOR_UNITS_CYCLES, 499825ba0f2Srobj TOPO_SENSOR_UNITS_GRAVITIES, 500825ba0f2Srobj TOPO_SENSOR_UNITS_OUNCE, 501825ba0f2Srobj TOPO_SENSOR_UNITS_POUND, 502825ba0f2Srobj TOPO_SENSOR_UNITS_FOOT_POUND, 503825ba0f2Srobj TOPO_SENSOR_UNITS_OZ_INCH, 504825ba0f2Srobj 505825ba0f2Srobj TOPO_SENSOR_UNITS_GAUSS, 506825ba0f2Srobj TOPO_SENSOR_UNITS_GILBERTS, 507825ba0f2Srobj TOPO_SENSOR_UNITS_HENRY, 508825ba0f2Srobj TOPO_SENSOR_UNITS_MILHENRY, 509825ba0f2Srobj TOPO_SENSOR_UNITS_FARAD, 510825ba0f2Srobj TOPO_SENSOR_UNITS_MICROFARAD, 511825ba0f2Srobj TOPO_SENSOR_UNITS_OHMS, 512825ba0f2Srobj TOPO_SENSOR_UNITS_SIEMENS, 513825ba0f2Srobj TOPO_SENSOR_UNITS_MOLE, 514825ba0f2Srobj TOPO_SENSOR_UNITS_BECQUEREL, 515825ba0f2Srobj TOPO_SENSOR_UNITS_PPM, 516825ba0f2Srobj TOPO_SENSOR_UNITS_RESERVED1, 517825ba0f2Srobj TOPO_SENSOR_UNITS_DECIBELS, 518825ba0f2Srobj TOPO_SENSOR_UNITS_DBA, 519825ba0f2Srobj TOPO_SENSOR_UNITS_DBC, 520825ba0f2Srobj TOPO_SENSOR_UNITS_GRAY, 521825ba0f2Srobj 522825ba0f2Srobj TOPO_SENSOR_UNITS_SIEVERT, 523825ba0f2Srobj TOPO_SENSOR_UNITS_COLOR_TEMP_K, 524825ba0f2Srobj TOPO_SENSOR_UNITS_BIT, 525825ba0f2Srobj TOPO_SENSOR_UNITS_KILOBIT, 526825ba0f2Srobj TOPO_SENSOR_UNITS_MEGABIT, 527825ba0f2Srobj TOPO_SENSOR_UNITS_GIGABIT, 528825ba0f2Srobj TOPO_SENSOR_UNITS_BYTE, 529825ba0f2Srobj TOPO_SENSOR_UNITS_KILOBYTE, 530825ba0f2Srobj TOPO_SENSOR_UNITS_MEGABYTE, 531825ba0f2Srobj TOPO_SENSOR_UNITS_GIGABYTE, 532825ba0f2Srobj TOPO_SENSOR_UNITS_WORD, 533825ba0f2Srobj TOPO_SENSOR_UNITS_DWORD, 534825ba0f2Srobj TOPO_SENSOR_UNITS_QWORD, 535825ba0f2Srobj TOPO_SENSOR_UNITS_MEMLINE, 536825ba0f2Srobj TOPO_SENSOR_UNITS_HIT, 537825ba0f2Srobj TOPO_SENSOR_UNITS_MISS, 538825ba0f2Srobj 539825ba0f2Srobj TOPO_SENSOR_UNITS_RETRY, 540825ba0f2Srobj TOPO_SENSOR_UNITS_RESET, 541825ba0f2Srobj TOPO_SENSOR_UNITS_OVERFLOW, 542825ba0f2Srobj TOPO_SENSOR_UNITS_UNDERRUN, 543825ba0f2Srobj TOPO_SENSOR_UNITS_COLLISION, 544825ba0f2Srobj TOPO_SENSOR_UNITS_PACKETS, 545825ba0f2Srobj TOPO_SENSOR_UNITS_MESSAGES, 546825ba0f2Srobj TOPO_SENSOR_UNITS_CHARACTERS, 547825ba0f2Srobj TOPO_SENSOR_UNITS_ERROR, 548825ba0f2Srobj TOPO_SENSOR_UNITS_CE, 549825ba0f2Srobj TOPO_SENSOR_UNITS_UE, 550825ba0f2Srobj TOPO_SENSOR_UNITS_FATAL_ERROR, 551825ba0f2Srobj TOPO_SENSOR_UNITS_GRAMS 552825ba0f2Srobj } topo_sensor_unit_t; 553825ba0f2Srobj 554e5dcf7beSRobert Johnston /* 555e5dcf7beSRobert Johnston * These defines are used by the topo_method_sensor_failure to indicate 556e5dcf7beSRobert Johnston * whether the source of a sensor failure is believed to be the result of an 557e5dcf7beSRobert Johnston * internal failure, external condition or unknown 558e5dcf7beSRobert Johnston */ 559e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_UNKNOWN 0 560e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_INTERNAL 1 561e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_EXTERNAL 2 562e5dcf7beSRobert Johnston 563825ba0f2Srobj /* 564825ba0f2Srobj * Sensor Types amd the associated sensor-type-specific states 565825ba0f2Srobj * 566825ba0f2Srobj * These are used to decode the type and state properties in the facility 567825ba0f2Srobj * propgroup on facility nodes of type sensor. 568825ba0f2Srobj * 569825ba0f2Srobj * Again we're basically using the same defines as for IPMI as it's serves 570825ba0f2Srobj * as a good starting point and simplifies the IPMI provider code. Of course 571825ba0f2Srobj * other facility providers will need to convert from their native codes 572825ba0f2Srobj * to the topo code when they set the type and state properties. 573825ba0f2Srobj */ 574825ba0f2Srobj #define TOPO_SENSOR_TYPE_RESERVED 0x0000 575825ba0f2Srobj #define TOPO_SENSOR_TYPE_TEMP 0x0001 576825ba0f2Srobj #define TOPO_SENSOR_TYPE_VOLTAGE 0x0002 577825ba0f2Srobj #define TOPO_SENSOR_TYPE_CURRENT 0x0003 578825ba0f2Srobj #define TOPO_SENSOR_TYPE_FAN 0x0004 579825ba0f2Srobj #define TOPO_SENSOR_TYPE_PHYSICAL 0x0005 580825ba0f2Srobj 581825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_GENERAL 0x0001 582825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_BAY 0x0002 583825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_CARD 0x0004 584825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR 0x0008 585825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_LAN 0x0010 586825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_DOCK 0x0020 587825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_FAN 0x0040 588825ba0f2Srobj 589825ba0f2Srobj #define TOPO_SENSOR_TYPE_PLATFORM 0x0006 590825ba0f2Srobj 591825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_SECURE 0x0001 592825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_USER_PASS 0x0002 593825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS 0x0004 594825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS 0x0008 595825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS 0x0010 596825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND 0x0020 597825ba0f2Srobj 598825ba0f2Srobj #define TOPO_SENSOR_TYPE_PROCESSOR 0x0007 599825ba0f2Srobj 600825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_IERR 0x0001 601825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THERMAL 0x0002 602825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB1 0x0004 603825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB2 0x0008 604825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB3 0x0010 605825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_CONFIG 0x0020 606825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_SMBIOS 0x0040 607825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_PRESENT 0x0080 608825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_DISABLED 0x0100 609825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR 0x0200 610825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THROTTLED 0x0400 611825ba0f2Srobj 612825ba0f2Srobj #define TOPO_SENSOR_TYPE_POWER_SUPPLY 0x0008 613825ba0f2Srobj 614825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT 0x0001 615825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE 0x0002 616825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL 0x0004 617825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST 0x0008 618825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE 0x0010 619825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES 0x0020 620825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR 0x0040 621825ba0f2Srobj 622825ba0f2Srobj #define TOPO_SENSOR_TYPE_POWER_UNIT 0x0009 623825ba0f2Srobj 624825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_OFF 0x0001 625825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_CYCLE 0x0002 626825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN 0x0004 627825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN 0x0008 628825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST 0x0010 629825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE 0x0020 630825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_FAIL 0x0040 631825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL 0x0080 632825ba0f2Srobj 633825ba0f2Srobj #define TOPO_SENSOR_TYPE_COOLING 0x000A 634825ba0f2Srobj #define TOPO_SENSOR_TYPE_OTHER 0x000B 635825ba0f2Srobj 636825ba0f2Srobj #define TOPO_SENSOR_TYPE_MEMORY 0x000C 637825ba0f2Srobj 638825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CE 0x0001 639825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_UE 0x0002 640825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_PARITY 0x0004 641825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL 0x0008 642825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_DISABLED 0x0010 643825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT 0x0020 644825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_PRESENT 0x0040 645825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR 0x0080 646825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_SPARE 0x0100 647825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_THROTTLED 0x0200 648825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_OVERTEMP 0x0400 649825ba0f2Srobj 650825ba0f2Srobj #define TOPO_SENSOR_TYPE_BAY 0x000D 651825ba0f2Srobj 652825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_PRESENT 0x0001 653825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_FAULT 0x0002 654825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_PREDFAIL 0x0004 655825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_SPARE 0x0008 656825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_CHECK 0x0010 657825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_CRITICAL 0x0020 658825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_FAILED 0x0040 659825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_REBUILDING 0x0080 660825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_ABORTED 0x0100 661825ba0f2Srobj 662825ba0f2Srobj #define TOPO_SENSOR_TYPE_POST_RESIZE 0x000E 663825ba0f2Srobj 664825ba0f2Srobj #define TOPO_SENSOR_TYPE_FIRMWARE 0x000F 665825ba0f2Srobj 666825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_ERROR 0x0001 667825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_HANG 0x0002 668825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_PROGRESS 0x0004 669825ba0f2Srobj 670825ba0f2Srobj #define TOPO_SENSOR_TYPE_EVENT_LOG 0x0010 671825ba0f2Srobj 672825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_CE 0x0001 673825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_TYPE 0x0002 674825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_RESET 0x0004 675825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALL 0x0008 676825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_FULL 0x0010 677825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL 0x0020 678825ba0f2Srobj 679825ba0f2Srobj #define TOPO_SENSOR_TYPE_WATCHDOG1 0x0011 680825ba0f2Srobj 681825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET 0x0001 682825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_RESET 0x0002 683825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN 0x0004 684825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN 0x0008 685825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE 0x0010 686825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG 0x0020 687825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_EXPIRED 0x0040 688825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT 0x0080 689825ba0f2Srobj 690825ba0f2Srobj #define TOPO_SENSOR_TYPE_SYSTEM 0x0012 691825ba0f2Srobj 692825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_RECONF 0x0001 693825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_BOOT 0x0002 694825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE 0x0004 695825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED 0x0008 696825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION 0x0010 697825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC 0x0020 698825ba0f2Srobj 699825ba0f2Srobj #define TOPO_SENSOR_TYPE_CRITICAL 0x0013 700825ba0f2Srobj 701825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_EXT_NMI 0x0001 702825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT 0x0002 703825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_IO_NMI 0x0004 704825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_SW_NMI 0x0008 705825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_PERR 0x0010 706825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_SERR 0x0020 707825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE 0x0040 708825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_CE 0x0080 709825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_UE 0x0100 710825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI 0x0200 711825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR 0x0400 712825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED 0x0800 713825ba0f2Srobj 714825ba0f2Srobj #define TOPO_SENSOR_TYPE_BUTTON 0x0014 715825ba0f2Srobj 716825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_PWR 0x0001 717825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_SLEEP 0x0002 718825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_RESET 0x0004 719825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_LATCH 0x0008 720825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE 0x0010 721825ba0f2Srobj 722825ba0f2Srobj #define TOPO_SENSOR_TYPE_MODULE 0x0015 723825ba0f2Srobj #define TOPO_SENSOR_TYPE_MICROCONTROLLER 0x0016 724825ba0f2Srobj #define TOPO_SENSOR_TYPE_CARD 0x0017 725825ba0f2Srobj #define TOPO_SENSOR_TYPE_CHASSIS 0x0018 726825ba0f2Srobj 727825ba0f2Srobj #define TOPO_SENSOR_TYPE_CHIPSET 0x0019 728825ba0f2Srobj 729825ba0f2Srobj #define TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL 0x0001 730825ba0f2Srobj 731825ba0f2Srobj #define TOPO_SENSOR_TYPE_FRU 0x001A 732825ba0f2Srobj 733825ba0f2Srobj #define TOPO_SENSOR_TYPE_CABLE 0x001B 734825ba0f2Srobj 735825ba0f2Srobj #define TOPO_SENSOR_STATE_CABLE_CONNECTED 0x0001 736825ba0f2Srobj #define TOPO_SENSOR_STATE_CABLE_CONFIG_ERR 0x0002 737825ba0f2Srobj 738825ba0f2Srobj #define TOPO_SENSOR_TYPE_TERMINATOR 0x001C 739825ba0f2Srobj 740825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_STATE 0x001D 741825ba0f2Srobj 742825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP 0x0001 743825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET 0x0002 744825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET 0x0004 745825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT 0x0008 746825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT 0x0010 747825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET 0x0020 748825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET 0x0040 749825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART 0x0080 750825ba0f2Srobj 751825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_ERROR 0x001E 752825ba0f2Srobj 753825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA 0x0001 754825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK 0x0002 755825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER 0x0004 756825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT 0x0008 757825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT 0x0010 758825ba0f2Srobj 759825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_OS 0x001F 760825ba0f2Srobj 761825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE 0x0001 762825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE 0x0002 763825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE 0x0004 764825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE 0x0008 765825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE 0x0010 766825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE 0x0020 767825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE 0x0040 768825ba0f2Srobj 769825ba0f2Srobj #define TOPO_SENSOR_TYPE_OS_SHUTDOWN 0x0020 770825ba0f2Srobj 771825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING 0x0001 772825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH 0x0002 773825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_STOP_GRACEFUL 0x0004 774825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL 0x0008 775825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF 0x0010 776825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC 0x0020 777825ba0f2Srobj 778825ba0f2Srobj #define TOPO_SENSOR_TYPE_SLOT 0x0021 779825ba0f2Srobj 780825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED 0x0001 781825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED 0x0002 782825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_CONNECTED 0x0004 783825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_INSTALL_READY 0x0008 784825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVE_READY 0x0010 785825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_PWR_OFF 0x0020 786825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVED 0x0040 787825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED 0x0080 788825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_DISABLED 0x0100 789825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE 0x0200 790825ba0f2Srobj 791825ba0f2Srobj #define TOPO_SENSOR_TYPE_ACPI 0x0022 792825ba0f2Srobj 793825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0 0x0001 794825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1 0x0002 795825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S2 0x0004 796825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S3 0x0008 797825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4 0x0010 798825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF 0x0020 799825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF 0x0040 800825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF 0x0080 801825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP 0x0100 802825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP 0x0200 803825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE 0x0400 804825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON 0x0800 805825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF 0x1000 806825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN 0x2000 807825ba0f2Srobj 808825ba0f2Srobj #define TOPO_SENSOR_TYPE_WATCHDOG2 0x0023 809825ba0f2Srobj 810825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED 0x0001 811825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET 0x0002 812825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN 0x0004 813825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE 0x0008 814825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1 0x0010 815825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2 0x0020 816825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3 0x0040 817825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4 0x0080 818825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT 0x0100 819825ba0f2Srobj 820825ba0f2Srobj #define TOPO_SENSOR_TYPE_ALERT 0x0024 821825ba0f2Srobj 822825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_PAGE 0x0001 823825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT 0x0002 824825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP 0x0004 825825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP 0x0008 826825ba0f2Srobj 827825ba0f2Srobj #define TOPO_SENSOR_TYPE_PRESENCE 0x0025 828825ba0f2Srobj 829825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_PRESENT 0x0001 830825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_ABSENT 0x0002 831825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_DISABLED 0x0004 832825ba0f2Srobj 833825ba0f2Srobj #define TOPO_SENSOR_TYPE_ASIC 0x0026 834825ba0f2Srobj 835825ba0f2Srobj #define TOPO_SENSOR_TYPE_LAN 0x0027 836825ba0f2Srobj 837825ba0f2Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST 0x0001 838825ba0f2Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT 0x0002 839825ba0f2Srobj 840825ba0f2Srobj #define TOPO_SENSOR_TYPE_HEALTH 0x0028 841825ba0f2Srobj 842825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED 0x0001 843825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED 0x0002 844825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE 0x0004 845825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL 0x0008 846825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE 0x0010 847825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE 0x0020 848825ba0f2Srobj 849825ba0f2Srobj #define TOPO_SENSOR_TYPE_BATTERY 0x0029 850825ba0f2Srobj 851825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_LOW 0x0001 852825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_FAILED 0x0002 853825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_PRESENCE 0x0004 854825ba0f2Srobj 855825ba0f2Srobj #define TOPO_SENSOR_TYPE_AUDIT 0x002A 856825ba0f2Srobj 857825ba0f2Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED 0x0001 858825ba0f2Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED 0x0002 859825ba0f2Srobj 860825ba0f2Srobj #define TOPO_SENSOR_TYPE_VERSION 0x002B 861825ba0f2Srobj 862825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE 0x0001 863825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE 0x0002 864825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE 0x0004 865825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE 0x0008 866825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INVAL 0x0010 867825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INVAL 0x0020 868825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS 0x0040 869825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS 0x0080 870825ba0f2Srobj 871825ba0f2Srobj #define TOPO_SENSOR_TYPE_FRU_STATE 0x002C 872825ba0f2Srobj 873825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED 0x0001 874825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_INACTIVE 0x0002 875825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ 0x0004 876825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS 0x0008 877825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACTIVE 0x0010 878825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ 0x0020 879825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS 0x0040 880825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST 0x0080 881825ba0f2Srobj 882825ba0f2Srobj /* 883825ba0f2Srobj * We simplify the IPMI sensor type code defines by combining the generic 884825ba0f2Srobj * and sensor-specific codes into a single range. Because there's overlap 885825ba0f2Srobj * between the two ranges we offset the generic type codes by 0x0100 886825ba0f2Srobj * which allows ample room in the hole for future expansion of the table to 887825ba0f2Srobj * accomodate either additions to the IPMI spec or to support new sensor types 888825ba0f2Srobj * for alternate provider modules. 889825ba0f2Srobj */ 8907793aa8bSEric Schrock #define TOPO_SENSOR_TYPE_THRESHOLD_STATE 0x0101 8917793aa8bSEric Schrock 8920b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT 0x0001 8930b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_CRIT 0x0002 8940b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_NONREC 0x0004 8950b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT 0x0008 8960b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_CRIT 0x0010 8970b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_NONREC 0x0020 898825ba0f2Srobj 899825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_USAGE 0x0102 900825ba0f2Srobj 901825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE 0x0001 902825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE 0x0002 903825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY 0x0004 904825ba0f2Srobj 905825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATE 0x0103 906825ba0f2Srobj 907825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED 0x0001 908825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED 0x0002 909825ba0f2Srobj 910825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PREDFAIL 0x0104 911825ba0f2Srobj 912825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED 0x0001 913825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED 0x0002 914825ba0f2Srobj 915825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_LIMIT 0x0105 916825ba0f2Srobj 917825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED 0x0001 918825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED 0x0002 919825ba0f2Srobj 920825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE 0x0106 921825ba0f2Srobj 922825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET 0x0001 923825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS 0x0002 924825ba0f2Srobj 925825ba0f2Srobj #define TOPO_SENSOR_TYPE_SEVERITY 0x0107 926825ba0f2Srobj 927825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_OK 0x0001 928825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH 0x0002 929825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH 0x0004 930825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH 0x0008 931825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW 0x0010 932825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW 0x0020 933825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW 0x0020 934825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_MONITOR 0x0040 935825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL 0x0080 936825ba0f2Srobj 937825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PRESENCE 0x0108 938825ba0f2Srobj 939825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED 0x0001 940825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED 0x0002 941825ba0f2Srobj 942825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY 0x0109 943825ba0f2Srobj 944825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED 0x0001 945825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED 0x0002 946825ba0f2Srobj 947825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATUS 0x010A 948825ba0f2Srobj 949825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING 0x0001 950825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST 0x0002 951825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF 0x0004 952825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE 0x0008 953825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE 0x0010 954825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY 0x0020 955825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED 0x0040 956825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE 0x0080 957825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR 0x0100 958825ba0f2Srobj 959825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY 0x010B 960825ba0f2Srobj 961825ba0f2Srobj /* 962825ba0f2Srobj * ACPI power state 963825ba0f2Srobj */ 964825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_ACPI 0x010C 965825ba0f2Srobj 966825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D0 0x0001 967825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D1 0x0002 968825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D2 0x0004 969825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D3 0x0008 970825ba0f2Srobj 971e5dcf7beSRobert Johnston /* 972e5dcf7beSRobert Johnston * These sensor types don't exist in the IPMI spec, but allow consumers to 973e5dcf7beSRobert Johnston * associate discrete sensors with component failure. The 'ok' sensor is the 974e5dcf7beSRobert Johnston * inverse of the 'failure' sensor. Note that the values intentionally mimic 975e5dcf7beSRobert Johnston * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors 976e5dcf7beSRobert Johnston * but just change the type to get semantically meaningful behavior. 977e5dcf7beSRobert Johnston */ 978e5dcf7beSRobert Johnston #define TOPO_SENSOR_TYPE_GENERIC_FAILURE 0x010D 979e5dcf7beSRobert Johnston 980e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED 0x0001 981e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV 0x0002 982e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL 0x0004 983e5dcf7beSRobert Johnston 984e5dcf7beSRobert Johnston #define TOPO_SENSOR_TYPE_GENERIC_OK 0x010E 985e5dcf7beSRobert Johnston 986e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED 0x0001 987e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED 0x0002 988e5dcf7beSRobert Johnston 989825ba0f2Srobj /* 990825ba0f2Srobj * Indicator modes and types 991825ba0f2Srobj */ 992825ba0f2Srobj typedef enum topo_led_state { 993825ba0f2Srobj TOPO_LED_STATE_OFF = 0, 994825ba0f2Srobj TOPO_LED_STATE_ON 995825ba0f2Srobj } topo_led_state_t; 996825ba0f2Srobj 997e5dcf7beSRobert Johnston #define TOPO_FAC_TYPE_ANY 0xFFFFFFFF 998e5dcf7beSRobert Johnston 999825ba0f2Srobj /* 1000825ba0f2Srobj * This list is limited to the set of LED's that we're likely to manage through 1001825ba0f2Srobj * FMA. Thus is does not include things like power or activity LED's 1002825ba0f2Srobj */ 1003825ba0f2Srobj typedef enum topo_led_type { 1004825ba0f2Srobj TOPO_LED_TYPE_SERVICE = 0, 1005825ba0f2Srobj TOPO_LED_TYPE_LOCATE, 1006825ba0f2Srobj TOPO_LED_TYPE_OK2RM, 1007825ba0f2Srobj TOPO_LED_TYPE_PRESENT 1008825ba0f2Srobj } topo_led_type_t; 1009825ba0f2Srobj 1010825ba0f2Srobj 10117aec1d6eScindi #ifdef __cplusplus 10127aec1d6eScindi } 10137aec1d6eScindi #endif 10147aec1d6eScindi 10157aec1d6eScindi #endif /* _LIBTOPO_H */ 1016