7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER START
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * The contents of this file are subject to the terms of the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Common Development and Distribution License (the "License").
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You may not use this file except in compliance with the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * See the License for the specific language governing permissions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * and limitations under the License.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * When distributing Covered Code, include this CDDL HEADER in each
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * If applicable, add the following below this CDDL HEADER, with the
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * fields enclosed by brackets "[]" replaced with your own identifying
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * information: Portions Copyright [yyyy] [name of copyright owner]
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * CDDL HEADER END
8393544efeffe8042bf5273c148010b32fa827e2Hyon Kim * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern "C" {
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define TOPO_VERSION 1 /* Library ABI Interface Version */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The following functions, error codes and data structures are private
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * to libtopo snapshot consumers and enumerator modules.
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern topo_hdl_t *topo_open(int, const char *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * Snapshot walker support
0eb822a1c0c2bea495647510b75f77f0e57633ebcinditypedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi void *, int *);
c93c462eec9d46f84d567abf52eb29a27c2e134bCheng Sean Yeextern di_node_t topo_hdl_devinfo(topo_hdl_t *);
c93c462eec9d46f84d567abf52eb29a27c2e134bCheng Sean Yeextern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Walk status returned from walker
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Types of walks: depth-first (child) or breadth-first (sibling)
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * FMRI helper routines
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *);
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephhextern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
dd566498928f08e7c9a79797a40db893c6a4b9fbvnextern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *);
25c6ff4b77fcddf4097ce78a8277275ca603b46cstephhextern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *);
e4b86885570d77af552e9cf94f142f4d744fb8c8Cheng Sean Yeextern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *);
e4b86885570d77af552e9cf94f142f4d744fb8c8Cheng Sean Yeextern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **,
9dd0f810214fdc8e1af881a9a5c4b6927629ff9ecindiextern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *);
2cb5535af222653abf2eba5c180ded4a7b85d8b6robjextern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *,
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock * Consolidation private utility functions
940d71d237794874e18a0eb72f6564821a823517eschrockextern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern ulong_t topo_fmri_strhash_noauth(topo_hdl_t *, const char *);
940d71d237794874e18a0eb72f6564821a823517eschrockextern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *);
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrockextern boolean_t topo_fmri_strcmp_noauth(topo_hdl_t *, const char *,
069f55e237020c4a4907b235fc38fafc6442ce94Eric Schrock const char *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * Topo node utilities: callable from topo_walk_step() callback or module
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * enumeration, topo_mod_enumerate()
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_node_resource(tnode_t *, nvlist_t **, int *);
e4b86885570d77af552e9cf94f142f4d744fb8c8Cheng Sean Yeextern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_method_invoke(tnode_t *node, const char *, topo_version_t,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern boolean_t topo_method_supported(tnode_t *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *,
1410cb930a3e26032c59c6835837a28c47366b3cJoshua M. Clulowextern int topo_node_child_walk(topo_hdl_t *, tnode_t *, topo_walk_cb_t,
1410cb930a3e26032c59c6835837a28c47366b3cJoshua M. Clulow void *, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Node flags: denotes type of node
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Topo property get functions
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_int32(tnode_t *, const char *, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_int64(tnode_t *, const char *, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_get_double(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj double *, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_string(tnode_t *, const char *, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi char **, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi char ***, uint_t *, int *);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Topo property set functions
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_int64(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, int64_t, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, uint64_t, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_double(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, double, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_string(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, const char *, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, const nvlist_t *, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj int, const char **, uint_t, int *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjextern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi/* Protocol property group and property names */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define TOPO_PGROUP_PROTOCOL "protocol" /* Required property group */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define TOPO_PROP_RESOURCE "resource" /* resource FMRI */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define TOPO_PROP_MOD "module" /* software module FMRI */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#define TOPO_PROP_PKG "package" /* software package FMRI */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi * System property group
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * These enum definitions are used to define a set of error tags associated with
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * libtopo error conditions occuring during the adminstration of
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * properties, invocation of methods and fmri-based queries. The shell script
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * mkerror.sh is used to parse this file and create a corresponding topo_error.c
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * source file.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * If you do something other than add a new error tag here, you may need to
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi * update the mkerror shell script as it is based upon simple regexps.
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ETOPO_PROP_NOENT, /* undefined property or property group */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ETOPO_PROP_DEFD, /* static property already defined */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ETOPO_PROP_NOMEM, /* memory limit exceeded during property allocation */
0eb822a1c0c2bea495647510b75f77f0e57633ebcindi ETOPO_PROP_END /* end of prop errno list (to ease auto-merge) */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_METHOD_VEROLD, /* app is compiled to use obsolete method */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_METHOD_VERNEW, /* app is compiled to use obsolete method */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_METHOD_NOMEM, /* memory limit exceeded during method op */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_FMRI_NVL, /* nvlist allocation failure for FMRI */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_HDL_UNKNOWN = 3300, /* unknown topo handle error */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi ETOPO_HDL_ABIVER, /* handle opened with invalid ABI version */
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern const char *topo_strerror(int);
0eb822a1c0c2bea495647510b75f77f0e57633ebcindiextern void topo_debug_set(topo_hdl_t *, const char *, const char *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * The following functions and data structures to support property
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * observability are private to the fmtopo command.
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Each topology node advertises the name and data stability of each of its
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * modules and properties. (see attributes(5)).
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * Topo stability attributes
c40d7343efa60b18ad1ceb316eb337caeea79046cindi TOPO_STABILITY_UNSTABLE, /* new or rapidly changing */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi TOPO_STABILITY_STABLE, /* mature interface from Sun */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define TOPO_STABILITY_MAX TOPO_STABILITY_STANDARD /* max valid stab */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi topo_stability_t tpi_namestab; /* stability of group name */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi topo_stability_t tpi_datastab; /* stability of all property values */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi topo_version_t tpi_version; /* version of pgroup definition */
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern topo_stability_t topo_name2stability(const char *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern const char *topo_stability2name(topo_stability_t);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern void topo_pgroup_destroy(tnode_t *, const char *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *);
c40d7343efa60b18ad1ceb316eb337caeea79046cinditypedef enum {
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern nvlist_t *topo_prop_getprops(tnode_t *, int *err);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_prop_getprop(tnode_t *, const char *, const char *,
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi int, nvlist_t *, int *);
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *,
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *,
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *,
c40d7343efa60b18ad1ceb316eb337caeea79046cindi/* Property node NVL names used in topo_prop_getprops */
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define TOPO_PROP_GROUP_DSTAB "property-group-data-stability"
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define TOPO_PROP_GROUP_NSTAB "property-group-name-stability"
c40d7343efa60b18ad1ceb316eb337caeea79046cindi#define TOPO_PROP_GROUP_VERSION "property-group-version"
c40d7343efa60b18ad1ceb316eb337caeea79046cindi * ARGS list used in topo property methods
c40d7343efa60b18ad1ceb316eb337caeea79046cindiextern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern void topo_hdl_free(topo_hdl_t *, void *, size_t);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **);
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindiextern char *topo_hdl_strdup(topo_hdl_t *, const char *);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Interfaces for converting sensor/indicator types, units, states, etc to
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * a string
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjvoid topo_sensor_type_name(uint32_t type, char *buf, size_t len);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjvoid topo_sensor_units_name(uint8_t type, char *buf, size_t len);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjvoid topo_led_type_name(uint8_t type, char *buf, size_t len);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjvoid topo_led_state_name(uint8_t type, char *buf, size_t len);
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robjvoid topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf,
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Defines for standard properties for sensors and indicators
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Sensor Classes
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * The "sensor-class" property in the "facility" propgroup on
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * facility nodes of type "sensor" should be set to one of these
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * two values.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Threshold sensors provide an analog sensor reading via the
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * "reading" property in the facility propgroup. They will also
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * provide one or more discrete states via the "state" property
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * in the facility propgroup.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Discrete sensors will not provide an analog reading by will
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * provide one or more discrete states via the "state" property
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * in the facility propgroup.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Sensor unit types. We're using the unit types and corresponding
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * codes described in the IPMI 2.0 spec as a reference as it seems to be a
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * reasonably comprehensive list. This also simplifies the IPMI provider code
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * since the unit type codes will map exactly to what libtopo uses (so no
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * conversion necessary).
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * These defines are used by the topo_method_sensor_failure to indicate
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * whether the source of a sensor failure is believed to be the result of an
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * internal failure, external condition or unknown
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Sensor Types amd the associated sensor-type-specific states
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * These are used to decode the type and state properties in the facility
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * propgroup on facility nodes of type sensor.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Again we're basically using the same defines as for IPMI as it's serves
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * as a good starting point and simplifies the IPMI provider code. Of course
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * other facility providers will need to convert from their native codes
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * to the topo code when they set the type and state properties.
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE 0x0010
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT 0x0080
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT 0x0010
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE 0x0010
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED 0x0080
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF 0x0080
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP 0x0100
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE 0x0400
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS 0x0080
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * We simplify the IPMI sensor type code defines by combining the generic
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * and sensor-specific codes into a single range. Because there's overlap
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * between the two ranges we offset the generic type codes by 0x0100
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * which allows ample room in the hole for future expansion of the table to
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * accomodate either additions to the IPMI spec or to support new sensor types
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * for alternate provider modules.
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT 0x0001
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_LOWER_CRIT 0x0002
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_LOWER_NONREC 0x0004
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT 0x0008
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_UPPER_CRIT 0x0010
0b1b4412cfd6c4ac5467dbe6f4088dcec4f55fe8Eric Schrock#define TOPO_SENSOR_STATE_THRESH_UPPER_NONREC 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH 0x0008
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW 0x0010
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED 0x0001
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF 0x0004
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY 0x0020
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED 0x0040
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE 0x0080
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj#define TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR 0x0100
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * ACPI power state
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * These sensor types don't exist in the IPMI spec, but allow consumers to
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * associate discrete sensors with component failure. The 'ok' sensor is the
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * inverse of the 'failure' sensor. Note that the values intentionally mimic
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston * but just change the type to get semantically meaningful behavior.
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_TYPE_GENERIC_FAILURE 0x010D
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED 0x0001
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV 0x0002
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL 0x0004
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED 0x0001
e5dcf7beb7c949f9234713d5818b581ec3825443Robert Johnston#define TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED 0x0002
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * Indicator modes and types
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * This list is limited to the set of LED's that we're likely to manage through
825ba0f20a74fd9c5d0d1ce2c195da2cc88a7f77robj * FMA. Thus is does not include things like power or activity LED's
7aec1d6e253b21f9e9b7ef68b4d81ab9859b51fecindi#endif /* _LIBTOPO_H */