11414Scindi /* 21414Scindi * CDDL HEADER START 31414Scindi * 41414Scindi * The contents of this file are subject to the terms of the 51414Scindi * Common Development and Distribution License (the "License"). 61414Scindi * You may not use this file except in compliance with the License. 71414Scindi * 81414Scindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 91414Scindi * or http://www.opensolaris.org/os/licensing. 101414Scindi * See the License for the specific language governing permissions 111414Scindi * and limitations under the License. 121414Scindi * 131414Scindi * When distributing Covered Code, include this CDDL HEADER in each 141414Scindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 151414Scindi * If applicable, add the following below this CDDL HEADER, with the 161414Scindi * fields enclosed by brackets "[]" replaced with your own identifying 171414Scindi * information: Portions Copyright [yyyy] [name of copyright owner] 181414Scindi * 191414Scindi * CDDL HEADER END 201414Scindi */ 211414Scindi 221414Scindi /* 23*13131SHyon.Kim@Sun.COM * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 241414Scindi */ 251414Scindi 261414Scindi #ifndef _LIBTOPO_H 271414Scindi #define _LIBTOPO_H 281414Scindi 291414Scindi #include <sys/nvpair.h> 303062Scindi #include <stdio.h> 318740SSean.Ye@Sun.COM #include <libdevinfo.h> 321414Scindi 331414Scindi #ifdef __cplusplus 341414Scindi extern "C" { 351414Scindi #endif 361414Scindi 371414Scindi #define TOPO_VERSION 1 /* Library ABI Interface Version */ 381414Scindi 391414Scindi typedef struct topo_hdl topo_hdl_t; 401414Scindi typedef struct topo_node tnode_t; 411414Scindi typedef struct topo_walk topo_walk_t; 421414Scindi typedef int32_t topo_instance_t; 431414Scindi typedef uint32_t topo_version_t; 441414Scindi 457243Srobj typedef struct topo_list { 467243Srobj struct topo_list *l_prev; 477243Srobj struct topo_list *l_next; 487243Srobj } topo_list_t; 497243Srobj 507243Srobj typedef struct topo_faclist { 517243Srobj topo_list_t tf_list; 527243Srobj tnode_t *tf_node; 537243Srobj } topo_faclist_t; 547243Srobj 551414Scindi /* 564087Scindi * The following functions, error codes and data structures are private 574087Scindi * to libtopo snapshot consumers and enumerator modules. 581414Scindi */ 591414Scindi extern topo_hdl_t *topo_open(int, const char *, int *); 601414Scindi extern void topo_close(topo_hdl_t *); 611414Scindi extern char *topo_snap_hold(topo_hdl_t *, const char *, int *); 621414Scindi extern void topo_snap_release(topo_hdl_t *); 633062Scindi 643062Scindi /* 653062Scindi * Snapshot walker support 663062Scindi */ 673062Scindi typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *); 683062Scindi 691414Scindi extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t, 701414Scindi void *, int *); 711414Scindi extern int topo_walk_step(topo_walk_t *, int); 721414Scindi extern void topo_walk_fini(topo_walk_t *); 738740SSean.Ye@Sun.COM extern di_node_t topo_hdl_devinfo(topo_hdl_t *); 748740SSean.Ye@Sun.COM extern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *); 751414Scindi 764087Scindi /* 774087Scindi * Walk status returned from walker 784087Scindi */ 791414Scindi #define TOPO_WALK_ERR -1 801414Scindi #define TOPO_WALK_NEXT 0 811414Scindi #define TOPO_WALK_TERMINATE 1 821414Scindi 834087Scindi /* 844087Scindi * Types of walks: depth-first (child) or breadth-first (sibling) 854087Scindi */ 861414Scindi #define TOPO_WALK_CHILD 0x0001 871414Scindi #define TOPO_WALK_SIBLING 0x0002 881414Scindi 893062Scindi /* 903062Scindi * FMRI helper routines 913062Scindi */ 921414Scindi extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *); 937275Sstephh extern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *); 941414Scindi extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *); 953681Svn83148 extern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *); 961414Scindi extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *); 977275Sstephh extern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *); 987532SSean.Ye@Sun.COM extern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *); 997532SSean.Ye@Sun.COM extern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *); 1001414Scindi extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *); 1011414Scindi extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *); 1021414Scindi extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *); 1031414Scindi extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **, 1041414Scindi int *); 1053323Scindi extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *); 1066292Srobj extern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *); 1071414Scindi extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *); 1087243Srobj extern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *, 1097243Srobj uint32_t, topo_walk_cb_t, void *, int *); 1101414Scindi 1111414Scindi /* 11210817SEric.Schrock@Sun.COM * Consolidation private utility functions 1136869Seschrock */ 1146869Seschrock extern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *); 11510817SEric.Schrock@Sun.COM extern ulong_t topo_fmri_strhash_noauth(topo_hdl_t *, const char *); 1166869Seschrock extern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *); 11710817SEric.Schrock@Sun.COM extern boolean_t topo_fmri_strcmp_noauth(topo_hdl_t *, const char *, 11810817SEric.Schrock@Sun.COM const char *); 1196869Seschrock 1206869Seschrock /* 1211414Scindi * Topo node utilities: callable from topo_walk_step() callback or module 1221414Scindi * enumeration, topo_mod_enumerate() 1231414Scindi */ 1241414Scindi extern char *topo_node_name(tnode_t *); 1251414Scindi extern topo_instance_t topo_node_instance(tnode_t *); 1265068Srobj extern tnode_t *topo_node_parent(tnode_t *); 1271414Scindi extern void *topo_node_private(tnode_t *); 1287243Srobj extern int topo_node_flags(tnode_t *); 1291414Scindi extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *); 1301414Scindi extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *); 1311414Scindi extern int topo_node_resource(tnode_t *, nvlist_t **, int *); 1321414Scindi extern int topo_node_label(tnode_t *, char **, int *); 1337532SSean.Ye@Sun.COM extern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t); 1341414Scindi extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t, 1351414Scindi nvlist_t *, nvlist_t **, int *); 1367243Srobj extern boolean_t topo_method_supported(tnode_t *, const char *, 1377243Srobj topo_version_t); 1387243Srobj extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *, 1397243Srobj uint32_t, topo_faclist_t *, int *); 1401414Scindi 1417243Srobj /* 1427243Srobj * Node flags: denotes type of node 1437243Srobj */ 1447243Srobj #define TOPO_NODE_DEFAULT 0 1457243Srobj #define TOPO_NODE_FACILITY 1 1467243Srobj 1477243Srobj #define TOPO_FAC_TYPE_SENSOR "sensor" 1487243Srobj #define TOPO_FAC_TYPE_INDICATOR "indicator" 1497243Srobj 1507243Srobj /* 1517243Srobj * Topo property get functions 1527243Srobj */ 1531414Scindi extern int topo_prop_get_int32(tnode_t *, const char *, const char *, 1541414Scindi int32_t *, int *); 1551414Scindi extern int topo_prop_get_uint32(tnode_t *, const char *, const char *, 1561414Scindi uint32_t *, int *); 1571414Scindi extern int topo_prop_get_int64(tnode_t *, const char *, const char *, 1581414Scindi int64_t *, int *); 1591414Scindi extern int topo_prop_get_uint64(tnode_t *, const char *, const char *, 1601414Scindi uint64_t *, int *); 1617243Srobj extern int topo_prop_get_double(tnode_t *, const char *, const char *, 1627243Srobj double *, int *); 1631414Scindi extern int topo_prop_get_string(tnode_t *, const char *, const char *, 1641414Scindi char **, int *); 1651414Scindi extern int topo_prop_get_fmri(tnode_t *, const char *, const char *, 1661414Scindi nvlist_t **, int *); 1673062Scindi extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *, 1683062Scindi int32_t **, uint_t *, int *); 1693062Scindi extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *, 1703062Scindi uint32_t **, uint_t *, int *); 1713062Scindi extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *, 1723062Scindi int64_t **, uint_t *, int *); 1733062Scindi extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *, 1743062Scindi uint64_t **, uint_t *, int *); 1753062Scindi extern int topo_prop_get_string_array(tnode_t *, const char *, const char *, 1763062Scindi char ***, uint_t *, int *); 1773062Scindi extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *, 1783062Scindi nvlist_t ***, uint_t *, int *); 1791414Scindi 1807243Srobj /* 1817243Srobj * Topo property set functions 1827243Srobj */ 1837243Srobj extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int, 1847243Srobj int32_t, int *); 1857243Srobj extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int, 1867243Srobj uint32_t, int *); 1877243Srobj extern int topo_prop_set_int64(tnode_t *, const char *, const char *, 1887243Srobj int, int64_t, int *); 1897243Srobj extern int topo_prop_set_uint64(tnode_t *, const char *, const char *, 1907243Srobj int, uint64_t, int *); 1917243Srobj extern int topo_prop_set_double(tnode_t *, const char *, const char *, 1927243Srobj int, double, int *); 1937243Srobj extern int topo_prop_set_string(tnode_t *, const char *, const char *, 1947243Srobj int, const char *, int *); 1957243Srobj extern int topo_prop_set_fmri(tnode_t *, const char *, const char *, 1967243Srobj int, const nvlist_t *, int *); 1977243Srobj extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int, 1987243Srobj int32_t *, uint_t, int *); 1997243Srobj extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *, 2007243Srobj int, uint32_t *, uint_t, int *); 2017243Srobj extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *, 2027243Srobj int, int64_t *, uint_t, int *); 2037243Srobj extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *, 2047243Srobj int, uint64_t *, uint_t, int *); 2057243Srobj extern int topo_prop_set_string_array(tnode_t *, const char *, const char *, 2067243Srobj int, const char **, uint_t, int *); 2077243Srobj extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *, 2087243Srobj int, const nvlist_t **, uint_t, int *); 2097243Srobj 2103062Scindi #define TOPO_PROP_IMMUTABLE 0 2118526SRobert.Johnston@Sun.COM #define TOPO_PROP_MUTABLE 0x01 2128526SRobert.Johnston@Sun.COM #define TOPO_PROP_NONVOLATILE 0x02 2131414Scindi 2141414Scindi /* Protocol property group and property names */ 2151414Scindi #define TOPO_PGROUP_PROTOCOL "protocol" /* Required property group */ 2161414Scindi #define TOPO_PROP_RESOURCE "resource" /* resource FMRI */ 2171414Scindi #define TOPO_PROP_ASRU "ASRU" /* ASRU FMRI */ 2181414Scindi #define TOPO_PROP_FRU "FRU" /* FRU FMRI */ 2191414Scindi #define TOPO_PROP_MOD "module" /* software module FMRI */ 2201414Scindi #define TOPO_PROP_PKG "package" /* software package FMRI */ 2211414Scindi #define TOPO_PROP_LABEL "label" /* property LABEL */ 2221414Scindi 2237243Srobj #define TOPO_METH_FAC_ENUM "fac_enum" 2247243Srobj 2251414Scindi /* 2261414Scindi * System property group 2271414Scindi */ 2281414Scindi #define TOPO_PGROUP_SYSTEM "system" 2291414Scindi #define TOPO_PROP_ISA "isa" 2301414Scindi #define TOPO_PROP_MACHINE "machine" 2311414Scindi 23210234SRobert.Johnston@Sun.COM #define TOPO_PGROUP_IPMI "ipmi" 23310234SRobert.Johnston@Sun.COM 2344087Scindi /* 2354087Scindi * These enum definitions are used to define a set of error tags associated with 2364087Scindi * libtopo error conditions occuring during the adminstration of 2374087Scindi * properties, invocation of methods and fmri-based queries. The shell script 2384087Scindi * mkerror.sh is used to parse this file and create a corresponding topo_error.c 2394087Scindi * source file. 2404087Scindi * 2414087Scindi * If you do something other than add a new error tag here, you may need to 2424087Scindi * update the mkerror shell script as it is based upon simple regexps. 2434087Scindi */ 2444087Scindi typedef enum topo_prop_errno { 2454087Scindi ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */ 2464087Scindi ETOPO_PROP_NOENT, /* undefined property or property group */ 2474087Scindi ETOPO_PROP_DEFD, /* static property already defined */ 2484087Scindi ETOPO_PROP_NOMEM, /* memory limit exceeded during property allocation */ 2494087Scindi ETOPO_PROP_TYPE, /* invalid property type */ 2504087Scindi ETOPO_PROP_NAME, /* invalid property name */ 2514087Scindi ETOPO_PROP_NOINHERIT, /* can not inherit property */ 2524087Scindi ETOPO_PROP_NVL, /* malformed property nvlist */ 2534087Scindi ETOPO_PROP_METHOD, /* get property method failed */ 2544087Scindi ETOPO_PROP_END /* end of prop errno list (to ease auto-merge) */ 2554087Scindi } topo_prop_errno_t; 2564087Scindi 2574087Scindi typedef enum topo_method_errno { 2584087Scindi ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */ 2594087Scindi ETOPO_METHOD_INVAL, /* invalid method registration */ 2604087Scindi ETOPO_METHOD_NOTSUP, /* method not supported */ 2614087Scindi ETOPO_METHOD_FAIL, /* method failed */ 2624087Scindi ETOPO_METHOD_VEROLD, /* app is compiled to use obsolete method */ 2634087Scindi ETOPO_METHOD_VERNEW, /* app is compiled to use obsolete method */ 2644087Scindi ETOPO_METHOD_NOMEM, /* memory limit exceeded during method op */ 2654087Scindi ETOPO_METHOD_DEFD, /* method op already defined */ 2664087Scindi ETOPO_METHOD_END /* end of method errno list */ 2674087Scindi } topo_method_errno_t; 2684087Scindi 2694087Scindi typedef enum topo_fmri_errno { 2704087Scindi ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */ 2714087Scindi ETOPO_FMRI_NVL, /* nvlist allocation failure for FMRI */ 2724087Scindi ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */ 2734087Scindi ETOPO_FMRI_MALFORM, /* malformed FMRI */ 2744087Scindi ETOPO_FMRI_NOMEM, /* memory limit exceeded */ 2754087Scindi ETOPO_FMRI_END /* end of fmri errno list */ 2764087Scindi } topo_fmri_errno_t; 2774087Scindi 2784087Scindi typedef enum topo_hdl_errno { 2794087Scindi ETOPO_HDL_UNKNOWN = 3300, /* unknown topo handle error */ 2804087Scindi ETOPO_HDL_ABIVER, /* handle opened with invalid ABI version */ 2814087Scindi ETOPO_HDL_SNAP, /* snapshot already taken */ 2824087Scindi ETOPO_HDL_INVAL, /* invalid argument specified */ 2834087Scindi ETOPO_HDL_UUID, /* uuid already set */ 2844087Scindi ETOPO_HDL_NOMEM, /* memory limit exceeded */ 2854087Scindi ETOPO_HDL_END /* end of handle errno list */ 2864087Scindi } topo_hdl_errno_t; 2874087Scindi 2884087Scindi extern const char *topo_strerror(int); 2894087Scindi extern void topo_hdl_strfree(topo_hdl_t *, char *); 2904087Scindi extern void topo_debug_set(topo_hdl_t *, const char *, const char *); 2914087Scindi 2924087Scindi /* 2934087Scindi * The following functions and data structures to support property 2944087Scindi * observability are private to the fmtopo command. 2954087Scindi */ 2964087Scindi 2974087Scindi /* 2984087Scindi * Each topology node advertises the name and data stability of each of its 2994087Scindi * modules and properties. (see attributes(5)). 3004087Scindi */ 3014087Scindi 3024087Scindi /* 3034087Scindi * Topo stability attributes 3044087Scindi */ 3054087Scindi typedef enum topo_stability { 3064087Scindi TOPO_STABILITY_UNKNOWN = 0, /* private to libtopo */ 3074087Scindi TOPO_STABILITY_INTERNAL, /* private to libtopo */ 3084087Scindi TOPO_STABILITY_PRIVATE, /* private to Sun */ 3094087Scindi TOPO_STABILITY_OBSOLETE, /* scheduled for removal */ 3104087Scindi TOPO_STABILITY_EXTERNAL, /* not controlled by Sun */ 3114087Scindi TOPO_STABILITY_UNSTABLE, /* new or rapidly changing */ 3124087Scindi TOPO_STABILITY_EVOLVING, /* less rapidly changing */ 3134087Scindi TOPO_STABILITY_STABLE, /* mature interface from Sun */ 3144087Scindi TOPO_STABILITY_STANDARD /* industry standard */ 3154087Scindi } topo_stability_t; 3164087Scindi 3174087Scindi #define TOPO_STABILITY_MAX TOPO_STABILITY_STANDARD /* max valid stab */ 3184087Scindi 3194087Scindi typedef struct topo_pgroup_info { 3204087Scindi const char *tpi_name; /* property group name */ 3214087Scindi topo_stability_t tpi_namestab; /* stability of group name */ 3224087Scindi topo_stability_t tpi_datastab; /* stability of all property values */ 3234087Scindi topo_version_t tpi_version; /* version of pgroup definition */ 3244087Scindi } topo_pgroup_info_t; 3254087Scindi 3264087Scindi extern topo_stability_t topo_name2stability(const char *); 3274087Scindi extern const char *topo_stability2name(topo_stability_t); 3284087Scindi extern void topo_pgroup_destroy(tnode_t *, const char *); 3294087Scindi extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *); 3304087Scindi 3314087Scindi typedef enum { 3324087Scindi TOPO_TYPE_INVALID = 0, 3334087Scindi TOPO_TYPE_BOOLEAN, /* boolean */ 3344087Scindi TOPO_TYPE_INT32, /* int32_t */ 3354087Scindi TOPO_TYPE_UINT32, /* uint32_t */ 3364087Scindi TOPO_TYPE_INT64, /* int64_t */ 3374087Scindi TOPO_TYPE_UINT64, /* uint64_t */ 3384087Scindi TOPO_TYPE_STRING, /* const char* */ 3394087Scindi TOPO_TYPE_TIME, /* uint64_t */ 3404087Scindi TOPO_TYPE_SIZE, /* uint64_t */ 3414087Scindi TOPO_TYPE_FMRI, /* nvlist_t */ 3424087Scindi TOPO_TYPE_INT32_ARRAY, /* array of int32_t */ 3434087Scindi TOPO_TYPE_UINT32_ARRAY, /* array of uint32_t */ 3444087Scindi TOPO_TYPE_INT64_ARRAY, /* array of int64_t */ 3454087Scindi TOPO_TYPE_UINT64_ARRAY, /* array of uint64_t */ 3464087Scindi TOPO_TYPE_STRING_ARRAY, /* array of const char* */ 3477243Srobj TOPO_TYPE_FMRI_ARRAY, /* array of nvlist_t */ 3487243Srobj TOPO_TYPE_DOUBLE /* double */ 3494087Scindi } topo_type_t; 3504087Scindi 3514087Scindi extern nvlist_t *topo_prop_getprops(tnode_t *, int *err); 3524087Scindi extern int topo_prop_getprop(tnode_t *, const char *, const char *, 3534087Scindi nvlist_t *, nvlist_t **, int *); 3544087Scindi extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *); 3554087Scindi extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *, 3564087Scindi int, nvlist_t *, int *); 3574087Scindi extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *, 3584087Scindi const char *, nvlist_t *, nvlist_t **, int *); 3594087Scindi extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *, 3604087Scindi nvlist_t **, int *); 3614087Scindi extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *, 3624087Scindi nvlist_t *, int, nvlist_t *, int *); 3634087Scindi 3643062Scindi /* Property node NVL names used in topo_prop_getprops */ 3651414Scindi #define TOPO_PROP_GROUP "property-group" 3661414Scindi #define TOPO_PROP_GROUP_NAME "property-group-name" 3673062Scindi #define TOPO_PROP_GROUP_DSTAB "property-group-data-stability" 3683062Scindi #define TOPO_PROP_GROUP_NSTAB "property-group-name-stability" 3693062Scindi #define TOPO_PROP_GROUP_VERSION "property-group-version" 3701414Scindi #define TOPO_PROP_VAL "property" 3711414Scindi #define TOPO_PROP_VAL_NAME "property-name" 3721414Scindi #define TOPO_PROP_VAL_VAL "property-value" 3733062Scindi #define TOPO_PROP_VAL_TYPE "property-type" 3744087Scindi #define TOPO_PROP_FLAG "property-flag" 3753062Scindi 3763062Scindi /* 3774087Scindi * ARGS list used in topo property methods 3783062Scindi */ 3794087Scindi #define TOPO_PROP_ARGS "args" 3804087Scindi #define TOPO_PROP_PARGS "private-args" 3811414Scindi 3824087Scindi extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *); 3833681Svn83148 3841414Scindi extern void *topo_hdl_alloc(topo_hdl_t *, size_t); 3851414Scindi extern void *topo_hdl_zalloc(topo_hdl_t *, size_t); 3861414Scindi extern void topo_hdl_free(topo_hdl_t *, void *, size_t); 3871414Scindi extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t); 3881414Scindi extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **); 3891414Scindi extern char *topo_hdl_strdup(topo_hdl_t *, const char *); 3901414Scindi 3917243Srobj /* 3927243Srobj * Interfaces for converting sensor/indicator types, units, states, etc to 3937243Srobj * a string 3947243Srobj */ 3957243Srobj void topo_sensor_type_name(uint32_t type, char *buf, size_t len); 3967243Srobj void topo_sensor_units_name(uint8_t type, char *buf, size_t len); 3977243Srobj void topo_led_type_name(uint8_t type, char *buf, size_t len); 3987243Srobj void topo_led_state_name(uint8_t type, char *buf, size_t len); 3997243Srobj void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf, 4007243Srobj size_t len); 4017243Srobj 4027243Srobj /* 4037243Srobj * Defines for standard properties for sensors and indicators 4047243Srobj */ 4057243Srobj #define TOPO_PGROUP_FACILITY "facility" 4067243Srobj 4077243Srobj #define TOPO_SENSOR_READING "reading" 4087243Srobj #define TOPO_SENSOR_STATE "state" 4097243Srobj #define TOPO_SENSOR_CLASS "sensor-class" 4107243Srobj #define TOPO_FACILITY_TYPE "type" 4117243Srobj #define TOPO_SENSOR_UNITS "units" 4127243Srobj #define TOPO_LED_MODE "mode" 4137243Srobj 4147243Srobj /* 4157243Srobj * Sensor Classes 4167243Srobj * 4177243Srobj * The "sensor-class" property in the "facility" propgroup on 4187243Srobj * facility nodes of type "sensor" should be set to one of these 4197243Srobj * two values. 4207243Srobj * 4217243Srobj * Threshold sensors provide an analog sensor reading via the 4227243Srobj * "reading" property in the facility propgroup. They will also 4237243Srobj * provide one or more discrete states via the "state" property 4247243Srobj * in the facility propgroup. 4257243Srobj * 4267243Srobj * Discrete sensors will not provide an analog reading by will 4277243Srobj * provide one or more discrete states via the "state" property 4287243Srobj * in the facility propgroup. 4297243Srobj */ 4307243Srobj #define TOPO_SENSOR_CLASS_THRESHOLD "threshold" 4317243Srobj #define TOPO_SENSOR_CLASS_DISCRETE "discrete" 4327243Srobj 4337243Srobj /* 4347243Srobj * Sensor unit types. We're using the unit types and corresponding 4357243Srobj * codes described in the IPMI 2.0 spec as a reference as it seems to be a 4367243Srobj * reasonably comprehensive list. This also simplifies the IPMI provider code 4377243Srobj * since the unit type codes will map exactly to what libtopo uses (so no 4387243Srobj * conversion necessary). 4397243Srobj */ 4407243Srobj typedef enum topo_sensor_unit { 4417243Srobj TOPO_SENSOR_UNITS_UNSPECIFIED = 0, 4427243Srobj TOPO_SENSOR_UNITS_DEGREES_C, 4437243Srobj TOPO_SENSOR_UNITS_DEGREES_F, 4447243Srobj TOPO_SENSOR_UNITS_DEGREES_K, 4457243Srobj TOPO_SENSOR_UNITS_VOLTS, 4467243Srobj TOPO_SENSOR_UNITS_AMPS, 4477243Srobj TOPO_SENSOR_UNITS_WATTS, 4487243Srobj TOPO_SENSOR_UNITS_JOULES, 4497243Srobj TOPO_SENSOR_UNITS_COULOMBS, 4507243Srobj TOPO_SENSOR_UNITS_VA, 4517243Srobj TOPO_SENSOR_UNITS_NITS, 4527243Srobj TOPO_SENSOR_UNITS_LUMEN, 4537243Srobj TOPO_SENSOR_UNITS_LUX, 4547243Srobj TOPO_SENSOR_UNITS_CANDELA, 4557243Srobj TOPO_SENSOR_UNITS_KPA, 4567243Srobj TOPO_SENSOR_UNITS_PSI, 4577243Srobj 4587243Srobj TOPO_SENSOR_UNITS_NEWTON, 4597243Srobj TOPO_SENSOR_UNITS_CFM, 4607243Srobj TOPO_SENSOR_UNITS_RPM, 4617243Srobj TOPO_SENSOR_UNITS_HZ, 4627243Srobj TOPO_SENSOR_UNITS_MICROSEC, 4637243Srobj TOPO_SENSOR_UNITS_MILLISEC, 4647243Srobj TOPO_SENSOR_UNITS_SECS, 4657243Srobj TOPO_SENSOR_UNITS_MIN, 4667243Srobj TOPO_SENSOR_UNITS_HOUR, 4677243Srobj TOPO_SENSOR_UNITS_DAY, 4687243Srobj TOPO_SENSOR_UNITS_WEEK, 4697243Srobj TOPO_SENSOR_UNITS_MIL, 4707243Srobj TOPO_SENSOR_UNITS_INCHES, 4717243Srobj TOPO_SENSOR_UNITS_FEET, 4727243Srobj TOPO_SENSOR_UNITS_CUB_INCH, 4737243Srobj TOPO_SENSOR_UNITS_CUB_FEET, 4747243Srobj 4757243Srobj TOPO_SENSOR_UNITS_MM, 4767243Srobj TOPO_SENSOR_UNITS_CM, 4777243Srobj TOPO_SENSOR_UNITS_METERS, 4787243Srobj TOPO_SENSOR_UNITS_CUB_CM, 4797243Srobj TOPO_SENSOR_UNITS_CUB_METER, 4807243Srobj TOPO_SENSOR_UNITS_LITERS, 4817243Srobj TOPO_SENSOR_UNITS_FLUID_OUNCE, 4827243Srobj TOPO_SENSOR_UNITS_RADIANS, 4837243Srobj TOPO_SENSOR_UNITS_STERADIANS, 4847243Srobj TOPO_SENSOR_UNITS_REVOLUTIONS, 4857243Srobj TOPO_SENSOR_UNITS_CYCLES, 4867243Srobj TOPO_SENSOR_UNITS_GRAVITIES, 4877243Srobj TOPO_SENSOR_UNITS_OUNCE, 4887243Srobj TOPO_SENSOR_UNITS_POUND, 4897243Srobj TOPO_SENSOR_UNITS_FOOT_POUND, 4907243Srobj TOPO_SENSOR_UNITS_OZ_INCH, 4917243Srobj 4927243Srobj TOPO_SENSOR_UNITS_GAUSS, 4937243Srobj TOPO_SENSOR_UNITS_GILBERTS, 4947243Srobj TOPO_SENSOR_UNITS_HENRY, 4957243Srobj TOPO_SENSOR_UNITS_MILHENRY, 4967243Srobj TOPO_SENSOR_UNITS_FARAD, 4977243Srobj TOPO_SENSOR_UNITS_MICROFARAD, 4987243Srobj TOPO_SENSOR_UNITS_OHMS, 4997243Srobj TOPO_SENSOR_UNITS_SIEMENS, 5007243Srobj TOPO_SENSOR_UNITS_MOLE, 5017243Srobj TOPO_SENSOR_UNITS_BECQUEREL, 5027243Srobj TOPO_SENSOR_UNITS_PPM, 5037243Srobj TOPO_SENSOR_UNITS_RESERVED1, 5047243Srobj TOPO_SENSOR_UNITS_DECIBELS, 5057243Srobj TOPO_SENSOR_UNITS_DBA, 5067243Srobj TOPO_SENSOR_UNITS_DBC, 5077243Srobj TOPO_SENSOR_UNITS_GRAY, 5087243Srobj 5097243Srobj TOPO_SENSOR_UNITS_SIEVERT, 5107243Srobj TOPO_SENSOR_UNITS_COLOR_TEMP_K, 5117243Srobj TOPO_SENSOR_UNITS_BIT, 5127243Srobj TOPO_SENSOR_UNITS_KILOBIT, 5137243Srobj TOPO_SENSOR_UNITS_MEGABIT, 5147243Srobj TOPO_SENSOR_UNITS_GIGABIT, 5157243Srobj TOPO_SENSOR_UNITS_BYTE, 5167243Srobj TOPO_SENSOR_UNITS_KILOBYTE, 5177243Srobj TOPO_SENSOR_UNITS_MEGABYTE, 5187243Srobj TOPO_SENSOR_UNITS_GIGABYTE, 5197243Srobj TOPO_SENSOR_UNITS_WORD, 5207243Srobj TOPO_SENSOR_UNITS_DWORD, 5217243Srobj TOPO_SENSOR_UNITS_QWORD, 5227243Srobj TOPO_SENSOR_UNITS_MEMLINE, 5237243Srobj TOPO_SENSOR_UNITS_HIT, 5247243Srobj TOPO_SENSOR_UNITS_MISS, 5257243Srobj 5267243Srobj TOPO_SENSOR_UNITS_RETRY, 5277243Srobj TOPO_SENSOR_UNITS_RESET, 5287243Srobj TOPO_SENSOR_UNITS_OVERFLOW, 5297243Srobj TOPO_SENSOR_UNITS_UNDERRUN, 5307243Srobj TOPO_SENSOR_UNITS_COLLISION, 5317243Srobj TOPO_SENSOR_UNITS_PACKETS, 5327243Srobj TOPO_SENSOR_UNITS_MESSAGES, 5337243Srobj TOPO_SENSOR_UNITS_CHARACTERS, 5347243Srobj TOPO_SENSOR_UNITS_ERROR, 5357243Srobj TOPO_SENSOR_UNITS_CE, 5367243Srobj TOPO_SENSOR_UNITS_UE, 5377243Srobj TOPO_SENSOR_UNITS_FATAL_ERROR, 5387243Srobj TOPO_SENSOR_UNITS_GRAMS 5397243Srobj } topo_sensor_unit_t; 5407243Srobj 5417243Srobj /* 5428526SRobert.Johnston@Sun.COM * These defines are used by the topo_method_sensor_failure to indicate 5438526SRobert.Johnston@Sun.COM * whether the source of a sensor failure is believed to be the result of an 5448526SRobert.Johnston@Sun.COM * internal failure, external condition or unknown 5458526SRobert.Johnston@Sun.COM */ 5468526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_ERRSRC_UNKNOWN 0 5478526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_ERRSRC_INTERNAL 1 5488526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_ERRSRC_EXTERNAL 2 5498526SRobert.Johnston@Sun.COM 5508526SRobert.Johnston@Sun.COM /* 5517243Srobj * Sensor Types amd the associated sensor-type-specific states 5527243Srobj * 5537243Srobj * These are used to decode the type and state properties in the facility 5547243Srobj * propgroup on facility nodes of type sensor. 5557243Srobj * 5567243Srobj * Again we're basically using the same defines as for IPMI as it's serves 5577243Srobj * as a good starting point and simplifies the IPMI provider code. Of course 5587243Srobj * other facility providers will need to convert from their native codes 5597243Srobj * to the topo code when they set the type and state properties. 5607243Srobj */ 5617243Srobj #define TOPO_SENSOR_TYPE_RESERVED 0x0000 5627243Srobj #define TOPO_SENSOR_TYPE_TEMP 0x0001 5637243Srobj #define TOPO_SENSOR_TYPE_VOLTAGE 0x0002 5647243Srobj #define TOPO_SENSOR_TYPE_CURRENT 0x0003 5657243Srobj #define TOPO_SENSOR_TYPE_FAN 0x0004 5667243Srobj #define TOPO_SENSOR_TYPE_PHYSICAL 0x0005 5677243Srobj 5687243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_GENERAL 0x0001 5697243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_BAY 0x0002 5707243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_CARD 0x0004 5717243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR 0x0008 5727243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_LAN 0x0010 5737243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_DOCK 0x0020 5747243Srobj #define TOPO_SENSOR_STATE_PHYSICAL_FAN 0x0040 5757243Srobj 5767243Srobj #define TOPO_SENSOR_TYPE_PLATFORM 0x0006 5777243Srobj 5787243Srobj #define TOPO_SENSOR_STATE_PLATFORM_SECURE 0x0001 5797243Srobj #define TOPO_SENSOR_STATE_PLATFORM_USER_PASS 0x0002 5807243Srobj #define TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS 0x0004 5817243Srobj #define TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS 0x0008 5827243Srobj #define TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS 0x0010 5837243Srobj #define TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND 0x0020 5847243Srobj 5857243Srobj #define TOPO_SENSOR_TYPE_PROCESSOR 0x0007 5867243Srobj 5877243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_IERR 0x0001 5887243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THERMAL 0x0002 5897243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB1 0x0004 5907243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB2 0x0008 5917243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB3 0x0010 5927243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_CONFIG 0x0020 5937243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_SMBIOS 0x0040 5947243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_PRESENT 0x0080 5957243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_DISABLED 0x0100 5967243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR 0x0200 5977243Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THROTTLED 0x0400 5987243Srobj 5997243Srobj #define TOPO_SENSOR_TYPE_POWER_SUPPLY 0x0008 6007243Srobj 6017243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT 0x0001 6027243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE 0x0002 6037243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL 0x0004 6047243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST 0x0008 6057243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE 0x0010 6067243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES 0x0020 6077243Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR 0x0040 6087243Srobj 6097243Srobj #define TOPO_SENSOR_TYPE_POWER_UNIT 0x0009 6107243Srobj 6117243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_OFF 0x0001 6127243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_CYCLE 0x0002 6137243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN 0x0004 6147243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN 0x0008 6157243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST 0x0010 6167243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE 0x0020 6177243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_FAIL 0x0040 6187243Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL 0x0080 6197243Srobj 6207243Srobj #define TOPO_SENSOR_TYPE_COOLING 0x000A 6217243Srobj #define TOPO_SENSOR_TYPE_OTHER 0x000B 6227243Srobj 6237243Srobj #define TOPO_SENSOR_TYPE_MEMORY 0x000C 6247243Srobj 6257243Srobj #define TOPO_SENSOR_STATE_MEMORY_CE 0x0001 6267243Srobj #define TOPO_SENSOR_STATE_MEMORY_UE 0x0002 6277243Srobj #define TOPO_SENSOR_STATE_MEMORY_PARITY 0x0004 6287243Srobj #define TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL 0x0008 6297243Srobj #define TOPO_SENSOR_STATE_MEMORY_DISABLED 0x0010 6307243Srobj #define TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT 0x0020 6317243Srobj #define TOPO_SENSOR_STATE_MEMORY_PRESENT 0x0040 6327243Srobj #define TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR 0x0080 6337243Srobj #define TOPO_SENSOR_STATE_MEMORY_SPARE 0x0100 6347243Srobj #define TOPO_SENSOR_STATE_MEMORY_THROTTLED 0x0200 6357243Srobj #define TOPO_SENSOR_STATE_MEMORY_OVERTEMP 0x0400 6367243Srobj 6377243Srobj #define TOPO_SENSOR_TYPE_BAY 0x000D 6387243Srobj 6397243Srobj #define TOPO_SENSOR_STATE_BAY_PRESENT 0x0001 6407243Srobj #define TOPO_SENSOR_STATE_BAY_FAULT 0x0002 6417243Srobj #define TOPO_SENSOR_STATE_BAY_PREDFAIL 0x0004 6427243Srobj #define TOPO_SENSOR_STATE_BAY_SPARE 0x0008 6437243Srobj #define TOPO_SENSOR_STATE_BAY_CHECK 0x0010 6447243Srobj #define TOPO_SENSOR_STATE_BAY_CRITICAL 0x0020 6457243Srobj #define TOPO_SENSOR_STATE_BAY_FAILED 0x0040 6467243Srobj #define TOPO_SENSOR_STATE_BAY_REBUILDING 0x0080 6477243Srobj #define TOPO_SENSOR_STATE_BAY_ABORTED 0x0100 6487243Srobj 6497243Srobj #define TOPO_SENSOR_TYPE_POST_RESIZE 0x000E 6507243Srobj 6517243Srobj #define TOPO_SENSOR_TYPE_FIRMWARE 0x000F 6527243Srobj 6537243Srobj #define TOPO_SENSOR_STATE_FIRMWARE_ERROR 0x0001 6547243Srobj #define TOPO_SENSOR_STATE_FIRMWARE_HANG 0x0002 6557243Srobj #define TOPO_SENSOR_STATE_FIRMWARE_PROGRESS 0x0004 6567243Srobj 6577243Srobj #define TOPO_SENSOR_TYPE_EVENT_LOG 0x0010 6587243Srobj 6597243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_CE 0x0001 6607243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_TYPE 0x0002 6617243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_RESET 0x0004 6627243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALL 0x0008 6637243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_FULL 0x0010 6647243Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL 0x0020 6657243Srobj 6667243Srobj #define TOPO_SENSOR_TYPE_WATCHDOG1 0x0011 6677243Srobj 6687243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET 0x0001 6697243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_RESET 0x0002 6707243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN 0x0004 6717243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN 0x0008 6727243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE 0x0010 6737243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG 0x0020 6747243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_EXPIRED 0x0040 6757243Srobj #define TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT 0x0080 6767243Srobj 6777243Srobj #define TOPO_SENSOR_TYPE_SYSTEM 0x0012 6787243Srobj 6797243Srobj #define TOPO_SENSOR_STATE_SYSTEM_RECONF 0x0001 6807243Srobj #define TOPO_SENSOR_STATE_SYSTEM_BOOT 0x0002 6817243Srobj #define TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE 0x0004 6827243Srobj #define TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED 0x0008 6837243Srobj #define TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION 0x0010 6847243Srobj #define TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC 0x0020 6857243Srobj 6867243Srobj #define TOPO_SENSOR_TYPE_CRITICAL 0x0013 6877243Srobj 6887243Srobj #define TOPO_SENSOR_STATE_CRITICAL_EXT_NMI 0x0001 6897243Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT 0x0002 6907243Srobj #define TOPO_SENSOR_STATE_CRITICAL_IO_NMI 0x0004 6917243Srobj #define TOPO_SENSOR_STATE_CRITICAL_SW_NMI 0x0008 6927243Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_PERR 0x0010 6937243Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_SERR 0x0020 6947243Srobj #define TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE 0x0040 6957243Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_CE 0x0080 6967243Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_UE 0x0100 6977243Srobj #define TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI 0x0200 6987243Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR 0x0400 6997243Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED 0x0800 7007243Srobj 7017243Srobj #define TOPO_SENSOR_TYPE_BUTTON 0x0014 7027243Srobj 7037243Srobj #define TOPO_SENSOR_STATE_BUTTON_PWR 0x0001 7047243Srobj #define TOPO_SENSOR_STATE_BUTTON_SLEEP 0x0002 7057243Srobj #define TOPO_SENSOR_STATE_BUTTON_RESET 0x0004 7067243Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_LATCH 0x0008 7077243Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE 0x0010 7087243Srobj 7097243Srobj #define TOPO_SENSOR_TYPE_MODULE 0x0015 7107243Srobj #define TOPO_SENSOR_TYPE_MICROCONTROLLER 0x0016 7117243Srobj #define TOPO_SENSOR_TYPE_CARD 0x0017 7127243Srobj #define TOPO_SENSOR_TYPE_CHASSIS 0x0018 7137243Srobj 7147243Srobj #define TOPO_SENSOR_TYPE_CHIPSET 0x0019 7157243Srobj 7167243Srobj #define TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL 0x0001 7177243Srobj 7187243Srobj #define TOPO_SENSOR_TYPE_FRU 0x001A 7197243Srobj 7207243Srobj #define TOPO_SENSOR_TYPE_CABLE 0x001B 7217243Srobj 7227243Srobj #define TOPO_SENSOR_STATE_CABLE_CONNECTED 0x0001 7237243Srobj #define TOPO_SENSOR_STATE_CABLE_CONFIG_ERR 0x0002 7247243Srobj 7257243Srobj #define TOPO_SENSOR_TYPE_TERMINATOR 0x001C 7267243Srobj 7277243Srobj #define TOPO_SENSOR_TYPE_BOOT_STATE 0x001D 7287243Srobj 7297243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP 0x0001 7307243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET 0x0002 7317243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET 0x0004 7327243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT 0x0008 7337243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT 0x0010 7347243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET 0x0020 7357243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET 0x0040 7367243Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART 0x0080 7377243Srobj 7387243Srobj #define TOPO_SENSOR_TYPE_BOOT_ERROR 0x001E 7397243Srobj 7407243Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA 0x0001 7417243Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK 0x0002 7427243Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER 0x0004 7437243Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT 0x0008 7447243Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT 0x0010 7457243Srobj 7467243Srobj #define TOPO_SENSOR_TYPE_BOOT_OS 0x001F 7477243Srobj 7487243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE 0x0001 7497243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE 0x0002 7507243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE 0x0004 7517243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE 0x0008 7527243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE 0x0010 7537243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE 0x0020 7547243Srobj #define TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE 0x0040 7557243Srobj 7567243Srobj #define TOPO_SENSOR_TYPE_OS_SHUTDOWN 0x0020 7577243Srobj 7587243Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING 0x0001 7597243Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH 0x0002 7607243Srobj #define TOPO_SENSOR_STATE_OS_STOP_GRACEFUL 0x0004 7617243Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL 0x0008 7627243Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF 0x0010 7637243Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC 0x0020 7647243Srobj 7657243Srobj #define TOPO_SENSOR_TYPE_SLOT 0x0021 7667243Srobj 7677243Srobj #define TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED 0x0001 7687243Srobj #define TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED 0x0002 7697243Srobj #define TOPO_SENSOR_STATE_SLOT_CONNECTED 0x0004 7707243Srobj #define TOPO_SENSOR_STATE_SLOT_INSTALL_READY 0x0008 7717243Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVE_READY 0x0010 7727243Srobj #define TOPO_SENSOR_STATE_SLOT_PWR_OFF 0x0020 7737243Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVED 0x0040 7747243Srobj #define TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED 0x0080 7757243Srobj #define TOPO_SENSOR_STATE_SLOT_DISABLED 0x0100 7767243Srobj #define TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE 0x0200 7777243Srobj 7787243Srobj #define TOPO_SENSOR_TYPE_ACPI 0x0022 7797243Srobj 7807243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0 0x0001 7817243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1 0x0002 7827243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S2 0x0004 7837243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S3 0x0008 7847243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4 0x0010 7857243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF 0x0020 7867243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF 0x0040 7877243Srobj #define TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF 0x0080 7887243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP 0x0100 7897243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP 0x0200 7907243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE 0x0400 7917243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON 0x0800 7927243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF 0x1000 7937243Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN 0x2000 7947243Srobj 7957243Srobj #define TOPO_SENSOR_TYPE_WATCHDOG2 0x0023 7967243Srobj 7977243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED 0x0001 7987243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET 0x0002 7997243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN 0x0004 8007243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE 0x0008 8017243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1 0x0010 8027243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2 0x0020 8037243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3 0x0040 8047243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4 0x0080 8057243Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT 0x0100 8067243Srobj 8077243Srobj #define TOPO_SENSOR_TYPE_ALERT 0x0024 8087243Srobj 8097243Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_PAGE 0x0001 8107243Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT 0x0002 8117243Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP 0x0004 8127243Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP 0x0008 8137243Srobj 8147243Srobj #define TOPO_SENSOR_TYPE_PRESENCE 0x0025 8157243Srobj 8167243Srobj #define TOPO_SENSOR_STATE_PRESENCE_PRESENT 0x0001 8177243Srobj #define TOPO_SENSOR_STATE_PRESENCE_ABSENT 0x0002 8187243Srobj #define TOPO_SENSOR_STATE_PRESENCE_DISABLED 0x0004 8197243Srobj 8207243Srobj #define TOPO_SENSOR_TYPE_ASIC 0x0026 8217243Srobj 8227243Srobj #define TOPO_SENSOR_TYPE_LAN 0x0027 8237243Srobj 8247243Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST 0x0001 8257243Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT 0x0002 8267243Srobj 8277243Srobj #define TOPO_SENSOR_TYPE_HEALTH 0x0028 8287243Srobj 8297243Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED 0x0001 8307243Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED 0x0002 8317243Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE 0x0004 8327243Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL 0x0008 8337243Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE 0x0010 8347243Srobj #define TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE 0x0020 8357243Srobj 8367243Srobj #define TOPO_SENSOR_TYPE_BATTERY 0x0029 8377243Srobj 8387243Srobj #define TOPO_SENSOR_STATE_BATTERY_LOW 0x0001 8397243Srobj #define TOPO_SENSOR_STATE_BATTERY_FAILED 0x0002 8407243Srobj #define TOPO_SENSOR_STATE_BATTERY_PRESENCE 0x0004 8417243Srobj 8427243Srobj #define TOPO_SENSOR_TYPE_AUDIT 0x002A 8437243Srobj 8447243Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED 0x0001 8457243Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED 0x0002 8467243Srobj 8477243Srobj #define TOPO_SENSOR_TYPE_VERSION 0x002B 8487243Srobj 8497243Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE 0x0001 8507243Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE 0x0002 8517243Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE 0x0004 8527243Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE 0x0008 8537243Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INVAL 0x0010 8547243Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INVAL 0x0020 8557243Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS 0x0040 8567243Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS 0x0080 8577243Srobj 8587243Srobj #define TOPO_SENSOR_TYPE_FRU_STATE 0x002C 8597243Srobj 8607243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED 0x0001 8617243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_INACTIVE 0x0002 8627243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ 0x0004 8637243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS 0x0008 8647243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACTIVE 0x0010 8657243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ 0x0020 8667243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS 0x0040 8677243Srobj #define TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST 0x0080 8687243Srobj 8697243Srobj /* 8707243Srobj * We simplify the IPMI sensor type code defines by combining the generic 8717243Srobj * and sensor-specific codes into a single range. Because there's overlap 8727243Srobj * between the two ranges we offset the generic type codes by 0x0100 8737243Srobj * which allows ample room in the hole for future expansion of the table to 8747243Srobj * accomodate either additions to the IPMI spec or to support new sensor types 8757243Srobj * for alternate provider modules. 8767243Srobj */ 8777419SEric.Schrock@Sun.COM #define TOPO_SENSOR_TYPE_THRESHOLD_STATE 0x0101 8787243Srobj 8797462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT 0x0001 8807462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_LOWER_CRIT 0x0002 8817462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_LOWER_NONREC 0x0004 8827462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT 0x0008 8837462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_UPPER_CRIT 0x0010 8847462SEric.Schrock@Sun.COM #define TOPO_SENSOR_STATE_THRESH_UPPER_NONREC 0x0020 8857243Srobj 8867243Srobj #define TOPO_SENSOR_TYPE_GENERIC_USAGE 0x0102 8877243Srobj 8887243Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE 0x0001 8897243Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE 0x0002 8907243Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY 0x0004 8917243Srobj 8927243Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATE 0x0103 8937243Srobj 8947243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED 0x0001 8957243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED 0x0002 8967243Srobj 8977243Srobj #define TOPO_SENSOR_TYPE_GENERIC_PREDFAIL 0x0104 8987243Srobj 8997243Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED 0x0001 9007243Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED 0x0002 9017243Srobj 9027243Srobj #define TOPO_SENSOR_TYPE_GENERIC_LIMIT 0x0105 9037243Srobj 9047243Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED 0x0001 9057243Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED 0x0002 9067243Srobj 9077243Srobj #define TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE 0x0106 9087243Srobj 9097243Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET 0x0001 9107243Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS 0x0002 9117243Srobj 9127243Srobj #define TOPO_SENSOR_TYPE_SEVERITY 0x0107 9137243Srobj 9147243Srobj #define TOPO_SENSOR_STATE_SEVERITY_OK 0x0001 9157243Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH 0x0002 9167243Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH 0x0004 9177243Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH 0x0008 9187243Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW 0x0010 9197243Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW 0x0020 9207243Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW 0x0020 9217243Srobj #define TOPO_SENSOR_STATE_SEVERITY_MONITOR 0x0040 9227243Srobj #define TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL 0x0080 9237243Srobj 9247243Srobj #define TOPO_SENSOR_TYPE_GENERIC_PRESENCE 0x0108 9257243Srobj 9267243Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED 0x0001 9277243Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED 0x0002 9287243Srobj 9297243Srobj #define TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY 0x0109 9307243Srobj 9317243Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED 0x0001 9327243Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED 0x0002 9337243Srobj 9347243Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATUS 0x010A 9357243Srobj 9367243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING 0x0001 9377243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST 0x0002 9387243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF 0x0004 9397243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE 0x0008 9407243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE 0x0010 9417243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY 0x0020 9427243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED 0x0040 9437243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE 0x0080 9447243Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR 0x0100 9457243Srobj 9467243Srobj #define TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY 0x010B 9477243Srobj 9487243Srobj /* 9497243Srobj * ACPI power state 9507243Srobj */ 9517243Srobj #define TOPO_SENSOR_TYPE_GENERIC_ACPI 0x010C 9527243Srobj 9537243Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D0 0x0001 9547243Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D1 0x0002 9557243Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D2 0x0004 9567243Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D3 0x0008 9577243Srobj 9587243Srobj /* 9598526SRobert.Johnston@Sun.COM * These sensor types don't exist in the IPMI spec, but allow consumers to 9608526SRobert.Johnston@Sun.COM * associate discrete sensors with component failure. The 'ok' sensor is the 9618526SRobert.Johnston@Sun.COM * inverse of the 'failure' sensor. Note that the values intentionally mimic 9628526SRobert.Johnston@Sun.COM * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors 9638526SRobert.Johnston@Sun.COM * but just change the type to get semantically meaningful behavior. 9648526SRobert.Johnston@Sun.COM */ 9658526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_TYPE_GENERIC_FAILURE 0x010D 9668526SRobert.Johnston@Sun.COM 9678526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED 0x0001 9688526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV 0x0002 9698526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL 0x0004 9708526SRobert.Johnston@Sun.COM 9718526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_TYPE_GENERIC_OK 0x010E 9728526SRobert.Johnston@Sun.COM 9738526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED 0x0001 9748526SRobert.Johnston@Sun.COM #define TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED 0x0002 9758526SRobert.Johnston@Sun.COM 9768526SRobert.Johnston@Sun.COM /* 9777243Srobj * Indicator modes and types 9787243Srobj */ 9797243Srobj typedef enum topo_led_state { 9807243Srobj TOPO_LED_STATE_OFF = 0, 9817243Srobj TOPO_LED_STATE_ON 9827243Srobj } topo_led_state_t; 9837243Srobj 9848526SRobert.Johnston@Sun.COM #define TOPO_FAC_TYPE_ANY 0xFFFFFFFF 9858526SRobert.Johnston@Sun.COM 9867243Srobj /* 9877243Srobj * This list is limited to the set of LED's that we're likely to manage through 9887243Srobj * FMA. Thus is does not include things like power or activity LED's 9897243Srobj */ 9907243Srobj typedef enum topo_led_type { 9917243Srobj TOPO_LED_TYPE_SERVICE = 0, 9927243Srobj TOPO_LED_TYPE_LOCATE, 9937243Srobj TOPO_LED_TYPE_OK2RM, 9947243Srobj TOPO_LED_TYPE_PRESENT 9957243Srobj } topo_led_type_t; 9967243Srobj 9977243Srobj 9981414Scindi #ifdef __cplusplus 9991414Scindi } 10001414Scindi #endif 10011414Scindi 10021414Scindi #endif /* _LIBTOPO_H */ 1003