17aec1d6eScindi /* 27aec1d6eScindi * CDDL HEADER START 37aec1d6eScindi * 47aec1d6eScindi * The contents of this file are subject to the terms of the 57aec1d6eScindi * Common Development and Distribution License (the "License"). 67aec1d6eScindi * You may not use this file except in compliance with the License. 77aec1d6eScindi * 87aec1d6eScindi * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97aec1d6eScindi * or http://www.opensolaris.org/os/licensing. 107aec1d6eScindi * See the License for the specific language governing permissions 117aec1d6eScindi * and limitations under the License. 127aec1d6eScindi * 137aec1d6eScindi * When distributing Covered Code, include this CDDL HEADER in each 147aec1d6eScindi * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157aec1d6eScindi * If applicable, add the following below this CDDL HEADER, with the 167aec1d6eScindi * fields enclosed by brackets "[]" replaced with your own identifying 177aec1d6eScindi * information: Portions Copyright [yyyy] [name of copyright owner] 187aec1d6eScindi * 197aec1d6eScindi * CDDL HEADER END 207aec1d6eScindi */ 217aec1d6eScindi 227aec1d6eScindi /* 238393544eSHyon Kim * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 247aec1d6eScindi */ 25208e1562SRob Johnston /* 263c6ffbabSRob Johnston * Copyright 2020 Joyent, Inc. 276158a8b5SRobert Mustacchi * Copyright 2023 Oxide Computer Company 28208e1562SRob Johnston */ 297aec1d6eScindi 307aec1d6eScindi #ifndef _LIBTOPO_H 317aec1d6eScindi #define _LIBTOPO_H 327aec1d6eScindi 337aec1d6eScindi #include <sys/nvpair.h> 340eb822a1Scindi #include <stdio.h> 35*9c994d58SRobert Mustacchi #include <stdarg.h> 36c93c462eSCheng Sean Ye #include <libdevinfo.h> 377aec1d6eScindi 387aec1d6eScindi #ifdef __cplusplus 397aec1d6eScindi extern "C" { 407aec1d6eScindi #endif 417aec1d6eScindi 427aec1d6eScindi #define TOPO_VERSION 1 /* Library ABI Interface Version */ 437aec1d6eScindi 447aec1d6eScindi typedef struct topo_hdl topo_hdl_t; 457aec1d6eScindi typedef struct topo_node tnode_t; 467aec1d6eScindi typedef struct topo_walk topo_walk_t; 476158a8b5SRobert Mustacchi typedef struct topo_schema_walk topo_schema_walk_t; 48c5591576SRob Johnston typedef uint64_t topo_instance_t; 497aec1d6eScindi typedef uint32_t topo_version_t; 507aec1d6eScindi 51825ba0f2Srobj typedef struct topo_list { 52825ba0f2Srobj struct topo_list *l_prev; 53825ba0f2Srobj struct topo_list *l_next; 54825ba0f2Srobj } topo_list_t; 55825ba0f2Srobj 56825ba0f2Srobj typedef struct topo_faclist { 57825ba0f2Srobj topo_list_t tf_list; 58825ba0f2Srobj tnode_t *tf_node; 59825ba0f2Srobj } topo_faclist_t; 60825ba0f2Srobj 61c5591576SRob Johnston typedef struct topo_digraph topo_digraph_t; 62c5591576SRob Johnston typedef struct topo_vertex topo_vertex_t; 63c5591576SRob Johnston typedef struct topo_edge topo_edge_t; 64c5591576SRob Johnston 65c5591576SRob Johnston typedef struct topo_path { 66c5591576SRob Johnston const char *tsp_fmristr; 67c5591576SRob Johnston nvlist_t *tsp_fmri; 68c5591576SRob Johnston topo_list_t tsp_components; 69c5591576SRob Johnston } topo_path_t; 70c5591576SRob Johnston 71c5591576SRob Johnston typedef struct topo_path_component { 72c5591576SRob Johnston topo_list_t tspc_link; 73c5591576SRob Johnston topo_vertex_t *tspc_vertex; 74c5591576SRob Johnston } topo_path_component_t; 75c5591576SRob Johnston 767aec1d6eScindi /* 77c40d7343Scindi * The following functions, error codes and data structures are private 78c40d7343Scindi * to libtopo snapshot consumers and enumerator modules. 797aec1d6eScindi */ 807aec1d6eScindi extern topo_hdl_t *topo_open(int, const char *, int *); 817aec1d6eScindi extern void topo_close(topo_hdl_t *); 827aec1d6eScindi extern char *topo_snap_hold(topo_hdl_t *, const char *, int *); 837aec1d6eScindi extern void topo_snap_release(topo_hdl_t *); 840eb822a1Scindi 850eb822a1Scindi /* 860eb822a1Scindi * Snapshot walker support 870eb822a1Scindi */ 880eb822a1Scindi typedef int (*topo_walk_cb_t)(topo_hdl_t *, tnode_t *, void *); 890eb822a1Scindi 907aec1d6eScindi extern topo_walk_t *topo_walk_init(topo_hdl_t *, const char *, topo_walk_cb_t, 917aec1d6eScindi void *, int *); 927aec1d6eScindi extern int topo_walk_step(topo_walk_t *, int); 937aec1d6eScindi extern void topo_walk_fini(topo_walk_t *); 94c93c462eSCheng Sean Ye extern di_node_t topo_hdl_devinfo(topo_hdl_t *); 95c93c462eSCheng Sean Ye extern di_prom_handle_t topo_hdl_prominfo(topo_hdl_t *); 967aec1d6eScindi 97c40d7343Scindi /* 98c40d7343Scindi * Walk status returned from walker 99c40d7343Scindi */ 1007aec1d6eScindi #define TOPO_WALK_ERR -1 1017aec1d6eScindi #define TOPO_WALK_NEXT 0 1027aec1d6eScindi #define TOPO_WALK_TERMINATE 1 1037aec1d6eScindi 104c40d7343Scindi /* 105c40d7343Scindi * Types of walks: depth-first (child) or breadth-first (sibling) 106c40d7343Scindi */ 1077aec1d6eScindi #define TOPO_WALK_CHILD 0x0001 1087aec1d6eScindi #define TOPO_WALK_SIBLING 0x0002 1097aec1d6eScindi 1106158a8b5SRobert Mustacchi /* 1116158a8b5SRobert Mustacchi * Snapshot scheme walker support. 1126158a8b5SRobert Mustacchi */ 1136158a8b5SRobert Mustacchi 1146158a8b5SRobert Mustacchi typedef enum topo_scheme_type { 1156158a8b5SRobert Mustacchi TOPO_SCHEME_TREE, 1166158a8b5SRobert Mustacchi TOPO_SCHEME_DIGRAPH 1176158a8b5SRobert Mustacchi } topo_scheme_type_t; 1186158a8b5SRobert Mustacchi 1196158a8b5SRobert Mustacchi /* 1206158a8b5SRobert Mustacchi * Callers should not copy this structure. It should be assumed that it will 1216158a8b5SRobert Mustacchi * grow in the future. 1226158a8b5SRobert Mustacchi */ 1236158a8b5SRobert Mustacchi typedef struct topo_scheme_info { 1246158a8b5SRobert Mustacchi const char *tsi_scheme; 1256158a8b5SRobert Mustacchi topo_scheme_type_t tsi_type; 1266158a8b5SRobert Mustacchi } topo_scheme_info_t; 1276158a8b5SRobert Mustacchi 1286158a8b5SRobert Mustacchi typedef int (*topo_scheme_walk_cb_f)(topo_hdl_t *, const topo_scheme_info_t *, 1296158a8b5SRobert Mustacchi void *); 1306158a8b5SRobert Mustacchi extern int topo_scheme_walk(topo_hdl_t *, topo_scheme_walk_cb_f, void *); 1316158a8b5SRobert Mustacchi 1320eb822a1Scindi /* 1330eb822a1Scindi * FMRI helper routines 1340eb822a1Scindi */ 1357aec1d6eScindi extern int topo_fmri_present(topo_hdl_t *, nvlist_t *, int *); 13625c6ff4bSstephh extern int topo_fmri_replaced(topo_hdl_t *, nvlist_t *, int *); 1377aec1d6eScindi extern int topo_fmri_contains(topo_hdl_t *, nvlist_t *, nvlist_t *, int *); 138dd566498Svn extern int topo_fmri_expand(topo_hdl_t *, nvlist_t *, int *); 1397aec1d6eScindi extern int topo_fmri_unusable(topo_hdl_t *, nvlist_t *, int *); 14025c6ff4bSstephh extern int topo_fmri_service_state(topo_hdl_t *, nvlist_t *, int *); 141e4b86885SCheng Sean Ye extern int topo_fmri_retire(topo_hdl_t *, nvlist_t *, int *); 142e4b86885SCheng Sean Ye extern int topo_fmri_unretire(topo_hdl_t *, nvlist_t *, int *); 1437aec1d6eScindi extern int topo_fmri_nvl2str(topo_hdl_t *, nvlist_t *, char **, int *); 1447aec1d6eScindi extern int topo_fmri_str2nvl(topo_hdl_t *, const char *, nvlist_t **, int *); 1457aec1d6eScindi extern int topo_fmri_asru(topo_hdl_t *, nvlist_t *, nvlist_t **, int *); 1467aec1d6eScindi extern int topo_fmri_fru(topo_hdl_t *, nvlist_t *, nvlist_t **, 1477aec1d6eScindi int *); 1489dd0f810Scindi extern int topo_fmri_label(topo_hdl_t *, nvlist_t *, char **, int *); 1492cb5535aSrobj extern int topo_fmri_serial(topo_hdl_t *, nvlist_t *, char **, int *); 1507aec1d6eScindi extern int topo_fmri_compare(topo_hdl_t *, nvlist_t *, nvlist_t *, int *); 151825ba0f2Srobj extern int topo_fmri_facility(topo_hdl_t *, nvlist_t *, const char *, 152825ba0f2Srobj uint32_t, topo_walk_cb_t, void *, int *); 1537aec1d6eScindi 154940d71d2Seschrock /* 155069f55e2SEric Schrock * Consolidation private utility functions 156940d71d2Seschrock */ 157940d71d2Seschrock extern ulong_t topo_fmri_strhash(topo_hdl_t *, const char *); 158069f55e2SEric Schrock extern ulong_t topo_fmri_strhash_noauth(topo_hdl_t *, const char *); 159940d71d2Seschrock extern boolean_t topo_fmri_strcmp(topo_hdl_t *, const char *, const char *); 160069f55e2SEric Schrock extern boolean_t topo_fmri_strcmp_noauth(topo_hdl_t *, const char *, 161069f55e2SEric Schrock const char *); 162940d71d2Seschrock 1637aec1d6eScindi /* 1647aec1d6eScindi * Topo node utilities: callable from topo_walk_step() callback or module 1657aec1d6eScindi * enumeration, topo_mod_enumerate() 1667aec1d6eScindi */ 1677aec1d6eScindi extern char *topo_node_name(tnode_t *); 1687aec1d6eScindi extern topo_instance_t topo_node_instance(tnode_t *); 1694557a2a1Srobj extern tnode_t *topo_node_parent(tnode_t *); 1707aec1d6eScindi extern void *topo_node_private(tnode_t *); 171825ba0f2Srobj extern int topo_node_flags(tnode_t *); 1727aec1d6eScindi extern int topo_node_asru(tnode_t *, nvlist_t **, nvlist_t *, int *); 1737aec1d6eScindi extern int topo_node_fru(tnode_t *, nvlist_t **, nvlist_t *, int *); 1747aec1d6eScindi extern int topo_node_resource(tnode_t *, nvlist_t **, int *); 1757aec1d6eScindi extern int topo_node_label(tnode_t *, char **, int *); 176e4b86885SCheng Sean Ye extern tnode_t *topo_node_lookup(tnode_t *, const char *, topo_instance_t); 1777aec1d6eScindi extern int topo_method_invoke(tnode_t *node, const char *, topo_version_t, 1787aec1d6eScindi nvlist_t *, nvlist_t **, int *); 179825ba0f2Srobj extern boolean_t topo_method_supported(tnode_t *, const char *, 180825ba0f2Srobj topo_version_t); 181825ba0f2Srobj extern int topo_node_facility(topo_hdl_t *, tnode_t *, const char *, 182825ba0f2Srobj uint32_t, topo_faclist_t *, int *); 1831410cb93SJoshua M. Clulow extern int topo_node_child_walk(topo_hdl_t *, tnode_t *, topo_walk_cb_t, 1841410cb93SJoshua M. Clulow void *, int *); 1858abca89fSRob Johnston extern int topo_node_occupied(tnode_t *, boolean_t *); 186825ba0f2Srobj 187825ba0f2Srobj /* 188825ba0f2Srobj * Node flags: denotes type of node 189825ba0f2Srobj */ 190825ba0f2Srobj #define TOPO_NODE_DEFAULT 0 191825ba0f2Srobj #define TOPO_NODE_FACILITY 1 1927aec1d6eScindi 193825ba0f2Srobj #define TOPO_FAC_TYPE_SENSOR "sensor" 194825ba0f2Srobj #define TOPO_FAC_TYPE_INDICATOR "indicator" 195825ba0f2Srobj 196825ba0f2Srobj /* 197825ba0f2Srobj * Topo property get functions 198825ba0f2Srobj */ 1997aec1d6eScindi extern int topo_prop_get_int32(tnode_t *, const char *, const char *, 2007aec1d6eScindi int32_t *, int *); 2017aec1d6eScindi extern int topo_prop_get_uint32(tnode_t *, const char *, const char *, 2027aec1d6eScindi uint32_t *, int *); 2037aec1d6eScindi extern int topo_prop_get_int64(tnode_t *, const char *, const char *, 2047aec1d6eScindi int64_t *, int *); 2057aec1d6eScindi extern int topo_prop_get_uint64(tnode_t *, const char *, const char *, 2067aec1d6eScindi uint64_t *, int *); 207825ba0f2Srobj extern int topo_prop_get_double(tnode_t *, const char *, const char *, 208825ba0f2Srobj double *, int *); 2097aec1d6eScindi extern int topo_prop_get_string(tnode_t *, const char *, const char *, 2107aec1d6eScindi char **, int *); 2117aec1d6eScindi extern int topo_prop_get_fmri(tnode_t *, const char *, const char *, 2127aec1d6eScindi nvlist_t **, int *); 2130eb822a1Scindi extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *, 2140eb822a1Scindi int32_t **, uint_t *, int *); 2150eb822a1Scindi extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *, 2160eb822a1Scindi uint32_t **, uint_t *, int *); 2170eb822a1Scindi extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *, 2180eb822a1Scindi int64_t **, uint_t *, int *); 2190eb822a1Scindi extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *, 2200eb822a1Scindi uint64_t **, uint_t *, int *); 2210eb822a1Scindi extern int topo_prop_get_string_array(tnode_t *, const char *, const char *, 2220eb822a1Scindi char ***, uint_t *, int *); 2230eb822a1Scindi extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *, 2240eb822a1Scindi nvlist_t ***, uint_t *, int *); 2257aec1d6eScindi 226825ba0f2Srobj /* 227825ba0f2Srobj * Topo property set functions 228825ba0f2Srobj */ 229825ba0f2Srobj extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int, 230825ba0f2Srobj int32_t, int *); 231825ba0f2Srobj extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int, 232825ba0f2Srobj uint32_t, int *); 233825ba0f2Srobj extern int topo_prop_set_int64(tnode_t *, const char *, const char *, 234825ba0f2Srobj int, int64_t, int *); 235825ba0f2Srobj extern int topo_prop_set_uint64(tnode_t *, const char *, const char *, 236825ba0f2Srobj int, uint64_t, int *); 237825ba0f2Srobj extern int topo_prop_set_double(tnode_t *, const char *, const char *, 238825ba0f2Srobj int, double, int *); 239825ba0f2Srobj extern int topo_prop_set_string(tnode_t *, const char *, const char *, 240825ba0f2Srobj int, const char *, int *); 241825ba0f2Srobj extern int topo_prop_set_fmri(tnode_t *, const char *, const char *, 242825ba0f2Srobj int, const nvlist_t *, int *); 243825ba0f2Srobj extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int, 244825ba0f2Srobj int32_t *, uint_t, int *); 245825ba0f2Srobj extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *, 246825ba0f2Srobj int, uint32_t *, uint_t, int *); 247825ba0f2Srobj extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *, 248825ba0f2Srobj int, int64_t *, uint_t, int *); 249825ba0f2Srobj extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *, 250825ba0f2Srobj int, uint64_t *, uint_t, int *); 251825ba0f2Srobj extern int topo_prop_set_string_array(tnode_t *, const char *, const char *, 252825ba0f2Srobj int, const char **, uint_t, int *); 253825ba0f2Srobj extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *, 254825ba0f2Srobj int, const nvlist_t **, uint_t, int *); 255825ba0f2Srobj 2560eb822a1Scindi #define TOPO_PROP_IMMUTABLE 0 257e5dcf7beSRobert Johnston #define TOPO_PROP_MUTABLE 0x01 258e5dcf7beSRobert Johnston #define TOPO_PROP_NONVOLATILE 0x02 2597aec1d6eScindi 2607aec1d6eScindi /* Protocol property group and property names */ 2617aec1d6eScindi #define TOPO_PGROUP_PROTOCOL "protocol" /* Required property group */ 2627aec1d6eScindi #define TOPO_PROP_RESOURCE "resource" /* resource FMRI */ 2637aec1d6eScindi #define TOPO_PROP_ASRU "ASRU" /* ASRU FMRI */ 2647aec1d6eScindi #define TOPO_PROP_FRU "FRU" /* FRU FMRI */ 2657aec1d6eScindi #define TOPO_PROP_MOD "module" /* software module FMRI */ 2667aec1d6eScindi #define TOPO_PROP_PKG "package" /* software package FMRI */ 2677aec1d6eScindi #define TOPO_PROP_LABEL "label" /* property LABEL */ 2687aec1d6eScindi 269825ba0f2Srobj #define TOPO_METH_FAC_ENUM "fac_enum" 270825ba0f2Srobj 2717aec1d6eScindi /* 2727aec1d6eScindi * System property group 2737aec1d6eScindi */ 2747aec1d6eScindi #define TOPO_PGROUP_SYSTEM "system" 2757aec1d6eScindi #define TOPO_PROP_ISA "isa" 2767aec1d6eScindi #define TOPO_PROP_MACHINE "machine" 2777aec1d6eScindi 27888045cffSRobert Johnston #define TOPO_PGROUP_IPMI "ipmi" 27988045cffSRobert Johnston 2800eb822a1Scindi /* 281c40d7343Scindi * These enum definitions are used to define a set of error tags associated with 282c40d7343Scindi * libtopo error conditions occuring during the adminstration of 283c40d7343Scindi * properties, invocation of methods and fmri-based queries. The shell script 284c40d7343Scindi * mkerror.sh is used to parse this file and create a corresponding topo_error.c 285c40d7343Scindi * source file. 286c40d7343Scindi * 2870eb822a1Scindi * If you do something other than add a new error tag here, you may need to 2880eb822a1Scindi * update the mkerror shell script as it is based upon simple regexps. 2890eb822a1Scindi */ 2900eb822a1Scindi typedef enum topo_prop_errno { 2910eb822a1Scindi ETOPO_PROP_UNKNOWN = 3000, /* unknown topo prop error */ 2920eb822a1Scindi ETOPO_PROP_NOENT, /* undefined property or property group */ 2930eb822a1Scindi ETOPO_PROP_DEFD, /* static property already defined */ 2940eb822a1Scindi ETOPO_PROP_NOMEM, /* memory limit exceeded during property allocation */ 2950eb822a1Scindi ETOPO_PROP_TYPE, /* invalid property type */ 296c40d7343Scindi ETOPO_PROP_NAME, /* invalid property name */ 2970eb822a1Scindi ETOPO_PROP_NOINHERIT, /* can not inherit property */ 2980eb822a1Scindi ETOPO_PROP_NVL, /* malformed property nvlist */ 299c40d7343Scindi ETOPO_PROP_METHOD, /* get property method failed */ 3000eb822a1Scindi ETOPO_PROP_END /* end of prop errno list (to ease auto-merge) */ 3010eb822a1Scindi } topo_prop_errno_t; 3027aec1d6eScindi 303dd566498Svn typedef enum topo_method_errno { 304c40d7343Scindi ETOPO_METHOD_UNKNOWN = 3100, /* unknown topo method error */ 305c40d7343Scindi ETOPO_METHOD_INVAL, /* invalid method registration */ 306c40d7343Scindi ETOPO_METHOD_NOTSUP, /* method not supported */ 307c40d7343Scindi ETOPO_METHOD_FAIL, /* method failed */ 308c40d7343Scindi ETOPO_METHOD_VEROLD, /* app is compiled to use obsolete method */ 309c40d7343Scindi ETOPO_METHOD_VERNEW, /* app is compiled to use obsolete method */ 310c40d7343Scindi ETOPO_METHOD_NOMEM, /* memory limit exceeded during method op */ 311c40d7343Scindi ETOPO_METHOD_DEFD, /* method op already defined */ 312c40d7343Scindi ETOPO_METHOD_END /* end of method errno list */ 313dd566498Svn } topo_method_errno_t; 314dd566498Svn 315c40d7343Scindi typedef enum topo_fmri_errno { 316c40d7343Scindi ETOPO_FMRI_UNKNOWN = 3200, /* unknown topo fmri error */ 317c40d7343Scindi ETOPO_FMRI_NVL, /* nvlist allocation failure for FMRI */ 318c40d7343Scindi ETOPO_FMRI_VERSION, /* invalid FMRI scheme version */ 319c40d7343Scindi ETOPO_FMRI_MALFORM, /* malformed FMRI */ 320c40d7343Scindi ETOPO_FMRI_NOMEM, /* memory limit exceeded */ 321c40d7343Scindi ETOPO_FMRI_END /* end of fmri errno list */ 322c40d7343Scindi } topo_fmri_errno_t; 323c40d7343Scindi 324c40d7343Scindi typedef enum topo_hdl_errno { 325c40d7343Scindi ETOPO_HDL_UNKNOWN = 3300, /* unknown topo handle error */ 326c40d7343Scindi ETOPO_HDL_ABIVER, /* handle opened with invalid ABI version */ 327c40d7343Scindi ETOPO_HDL_SNAP, /* snapshot already taken */ 328c40d7343Scindi ETOPO_HDL_INVAL, /* invalid argument specified */ 329c40d7343Scindi ETOPO_HDL_UUID, /* uuid already set */ 330c40d7343Scindi ETOPO_HDL_NOMEM, /* memory limit exceeded */ 331c40d7343Scindi ETOPO_HDL_END /* end of handle errno list */ 332c40d7343Scindi } topo_hdl_errno_t; 333dd566498Svn 3347aec1d6eScindi extern const char *topo_strerror(int); 335c40d7343Scindi extern void topo_hdl_strfree(topo_hdl_t *, char *); 336e2336878SRob Johnston extern void topo_hdl_strfreev(topo_hdl_t *, char **, uint_t); 3370eb822a1Scindi extern void topo_debug_set(topo_hdl_t *, const char *, const char *); 338c40d7343Scindi 339c40d7343Scindi /* 340c40d7343Scindi * The following functions and data structures to support property 341c40d7343Scindi * observability are private to the fmtopo command. 342c40d7343Scindi */ 343c40d7343Scindi 344c40d7343Scindi /* 345c40d7343Scindi * Each topology node advertises the name and data stability of each of its 346bbf21555SRichard Lowe * modules and properties. (see attributes(7)). 347c40d7343Scindi */ 348c40d7343Scindi 349c40d7343Scindi /* 350c40d7343Scindi * Topo stability attributes 351c40d7343Scindi */ 352c40d7343Scindi typedef enum topo_stability { 353c40d7343Scindi TOPO_STABILITY_UNKNOWN = 0, /* private to libtopo */ 354c40d7343Scindi TOPO_STABILITY_INTERNAL, /* private to libtopo */ 355c40d7343Scindi TOPO_STABILITY_PRIVATE, /* private to Sun */ 356c40d7343Scindi TOPO_STABILITY_OBSOLETE, /* scheduled for removal */ 357c40d7343Scindi TOPO_STABILITY_EXTERNAL, /* not controlled by Sun */ 358c40d7343Scindi TOPO_STABILITY_UNSTABLE, /* new or rapidly changing */ 359c40d7343Scindi TOPO_STABILITY_EVOLVING, /* less rapidly changing */ 360c40d7343Scindi TOPO_STABILITY_STABLE, /* mature interface from Sun */ 361c40d7343Scindi TOPO_STABILITY_STANDARD /* industry standard */ 362c40d7343Scindi } topo_stability_t; 363c40d7343Scindi 364c40d7343Scindi #define TOPO_STABILITY_MAX TOPO_STABILITY_STANDARD /* max valid stab */ 365c40d7343Scindi 366c40d7343Scindi typedef struct topo_pgroup_info { 367c40d7343Scindi const char *tpi_name; /* property group name */ 368c40d7343Scindi topo_stability_t tpi_namestab; /* stability of group name */ 369c40d7343Scindi topo_stability_t tpi_datastab; /* stability of all property values */ 370c40d7343Scindi topo_version_t tpi_version; /* version of pgroup definition */ 371c40d7343Scindi } topo_pgroup_info_t; 372c40d7343Scindi 373c40d7343Scindi extern topo_stability_t topo_name2stability(const char *); 374c40d7343Scindi extern const char *topo_stability2name(topo_stability_t); 375c40d7343Scindi extern void topo_pgroup_destroy(tnode_t *, const char *); 376c40d7343Scindi extern topo_pgroup_info_t *topo_pgroup_info(tnode_t *, const char *, int *); 377c40d7343Scindi 378c40d7343Scindi typedef enum { 379c40d7343Scindi TOPO_TYPE_INVALID = 0, 380c40d7343Scindi TOPO_TYPE_BOOLEAN, /* boolean */ 381c40d7343Scindi TOPO_TYPE_INT32, /* int32_t */ 382c40d7343Scindi TOPO_TYPE_UINT32, /* uint32_t */ 383c40d7343Scindi TOPO_TYPE_INT64, /* int64_t */ 384c40d7343Scindi TOPO_TYPE_UINT64, /* uint64_t */ 385c40d7343Scindi TOPO_TYPE_STRING, /* const char* */ 386c40d7343Scindi TOPO_TYPE_TIME, /* uint64_t */ 387c40d7343Scindi TOPO_TYPE_SIZE, /* uint64_t */ 388c40d7343Scindi TOPO_TYPE_FMRI, /* nvlist_t */ 389c40d7343Scindi TOPO_TYPE_INT32_ARRAY, /* array of int32_t */ 390c40d7343Scindi TOPO_TYPE_UINT32_ARRAY, /* array of uint32_t */ 391c40d7343Scindi TOPO_TYPE_INT64_ARRAY, /* array of int64_t */ 392c40d7343Scindi TOPO_TYPE_UINT64_ARRAY, /* array of uint64_t */ 393c40d7343Scindi TOPO_TYPE_STRING_ARRAY, /* array of const char* */ 394825ba0f2Srobj TOPO_TYPE_FMRI_ARRAY, /* array of nvlist_t */ 395825ba0f2Srobj TOPO_TYPE_DOUBLE /* double */ 396c40d7343Scindi } topo_type_t; 397c40d7343Scindi 398c40d7343Scindi extern nvlist_t *topo_prop_getprops(tnode_t *, int *err); 399c40d7343Scindi extern int topo_prop_getprop(tnode_t *, const char *, const char *, 400c40d7343Scindi nvlist_t *, nvlist_t **, int *); 401c40d7343Scindi extern int topo_prop_getpgrp(tnode_t *, const char *, nvlist_t **, int *); 402c40d7343Scindi extern int topo_prop_setprop(tnode_t *, const char *, nvlist_t *, 403c40d7343Scindi int, nvlist_t *, int *); 404c40d7343Scindi extern int topo_fmri_getprop(topo_hdl_t *, nvlist_t *, const char *, 405c40d7343Scindi const char *, nvlist_t *, nvlist_t **, int *); 406c40d7343Scindi extern int topo_fmri_getpgrp(topo_hdl_t *, nvlist_t *, const char *, 407c40d7343Scindi nvlist_t **, int *); 408c40d7343Scindi extern int topo_fmri_setprop(topo_hdl_t *, nvlist_t *, const char *, 409c40d7343Scindi nvlist_t *, int, nvlist_t *, int *); 4108522c52aSRob Johnston extern void topo_pgroup_hcset(tnode_t *, nvlist_t *); 411c40d7343Scindi 412c40d7343Scindi /* Property node NVL names used in topo_prop_getprops */ 413c40d7343Scindi #define TOPO_PROP_GROUP "property-group" 414c40d7343Scindi #define TOPO_PROP_GROUP_NAME "property-group-name" 415c40d7343Scindi #define TOPO_PROP_GROUP_DSTAB "property-group-data-stability" 416c40d7343Scindi #define TOPO_PROP_GROUP_NSTAB "property-group-name-stability" 417c40d7343Scindi #define TOPO_PROP_GROUP_VERSION "property-group-version" 418c40d7343Scindi #define TOPO_PROP_VAL "property" 419c40d7343Scindi #define TOPO_PROP_VAL_NAME "property-name" 420c40d7343Scindi #define TOPO_PROP_VAL_VAL "property-value" 421c40d7343Scindi #define TOPO_PROP_VAL_TYPE "property-type" 422c40d7343Scindi #define TOPO_PROP_FLAG "property-flag" 423c40d7343Scindi 424c40d7343Scindi /* 425c40d7343Scindi * ARGS list used in topo property methods 426c40d7343Scindi */ 427c40d7343Scindi #define TOPO_PROP_ARGS "args" 428c40d7343Scindi #define TOPO_PROP_PARGS "private-args" 429c40d7343Scindi 430c40d7343Scindi extern int topo_xml_print(topo_hdl_t *, FILE *, const char *scheme, int *); 431c40d7343Scindi 4327aec1d6eScindi extern void *topo_hdl_alloc(topo_hdl_t *, size_t); 4337aec1d6eScindi extern void *topo_hdl_zalloc(topo_hdl_t *, size_t); 4347aec1d6eScindi extern void topo_hdl_free(topo_hdl_t *, void *, size_t); 4357aec1d6eScindi extern int topo_hdl_nvalloc(topo_hdl_t *, nvlist_t **, uint_t); 4367aec1d6eScindi extern int topo_hdl_nvdup(topo_hdl_t *, nvlist_t *, nvlist_t **); 4377aec1d6eScindi extern char *topo_hdl_strdup(topo_hdl_t *, const char *); 438*9c994d58SRobert Mustacchi extern int topo_hdl_vasprintf(topo_hdl_t *, char **, const char *, 439*9c994d58SRobert Mustacchi va_list) __VPRINTFLIKE(3); 440*9c994d58SRobert Mustacchi extern int topo_hdl_asprintf(topo_hdl_t *, char **, const char *, 441*9c994d58SRobert Mustacchi ...) __PRINTFLIKE(3); 4427aec1d6eScindi 443c5591576SRob Johnston /* 444c5591576SRob Johnston * Interfaces for interacting with directed graph topologies 445c5591576SRob Johnston */ 446c5591576SRob Johnston extern topo_digraph_t *topo_digraph_get(topo_hdl_t *, const char *); 447c5591576SRob Johnston extern int topo_vertex_iter(topo_hdl_t *, topo_digraph_t *, 448c5591576SRob Johnston int (*)(topo_hdl_t *, topo_vertex_t *, boolean_t, void *), void *); 449c5591576SRob Johnston extern tnode_t *topo_vertex_node(topo_vertex_t *); 450c5591576SRob Johnston extern int topo_edge_iter(topo_hdl_t *, topo_vertex_t *, 451c5591576SRob Johnston int (*)(topo_hdl_t *, topo_edge_t *, boolean_t, void *), void *); 452c5591576SRob Johnston extern int topo_digraph_paths(topo_hdl_t *, topo_digraph_t *, 453c5591576SRob Johnston topo_vertex_t *, topo_vertex_t *, topo_path_t ***, uint_t *); 454c5591576SRob Johnston extern void topo_path_destroy(topo_hdl_t *, topo_path_t *); 455c5591576SRob Johnston extern int topo_digraph_serialize(topo_hdl_t *, topo_digraph_t *, FILE *); 456c5591576SRob Johnston extern topo_digraph_t *topo_digraph_deserialize(topo_hdl_t *, const char *, 457c5591576SRob Johnston size_t); 458c5591576SRob Johnston extern topo_vertex_t *topo_node_vertex(tnode_t *); 459c5591576SRob Johnston 460825ba0f2Srobj /* 461825ba0f2Srobj * Interfaces for converting sensor/indicator types, units, states, etc to 462825ba0f2Srobj * a string 463825ba0f2Srobj */ 464825ba0f2Srobj void topo_sensor_type_name(uint32_t type, char *buf, size_t len); 465825ba0f2Srobj void topo_sensor_units_name(uint8_t type, char *buf, size_t len); 466825ba0f2Srobj void topo_led_type_name(uint8_t type, char *buf, size_t len); 467825ba0f2Srobj void topo_led_state_name(uint8_t type, char *buf, size_t len); 468825ba0f2Srobj void topo_sensor_state_name(uint32_t sensor_type, uint8_t state, char *buf, 469825ba0f2Srobj size_t len); 470825ba0f2Srobj 471825ba0f2Srobj /* 472825ba0f2Srobj * Defines for standard properties for sensors and indicators 473825ba0f2Srobj */ 474825ba0f2Srobj #define TOPO_PGROUP_FACILITY "facility" 475825ba0f2Srobj 476825ba0f2Srobj #define TOPO_SENSOR_READING "reading" 477825ba0f2Srobj #define TOPO_SENSOR_STATE "state" 478825ba0f2Srobj #define TOPO_SENSOR_CLASS "sensor-class" 479825ba0f2Srobj #define TOPO_FACILITY_TYPE "type" 480825ba0f2Srobj #define TOPO_SENSOR_UNITS "units" 481825ba0f2Srobj #define TOPO_LED_MODE "mode" 482825ba0f2Srobj 483208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LNC "threshold-lower-non-critical" 484208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LCR "threshold-lower-critical" 485208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_LNR "threshold-lower-non-recoverable" 486208e1562SRob Johnston 487208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UNC "threshold-upper-non-critical" 488208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UCR "threshold-upper-critical" 489208e1562SRob Johnston #define TOPO_PROP_THRESHOLD_UNR "threshold-upper-non-recoverable" 490208e1562SRob Johnston 491825ba0f2Srobj /* 492825ba0f2Srobj * Sensor Classes 493825ba0f2Srobj * 494825ba0f2Srobj * The "sensor-class" property in the "facility" propgroup on 495825ba0f2Srobj * facility nodes of type "sensor" should be set to one of these 496825ba0f2Srobj * two values. 497825ba0f2Srobj * 498825ba0f2Srobj * Threshold sensors provide an analog sensor reading via the 499825ba0f2Srobj * "reading" property in the facility propgroup. They will also 500825ba0f2Srobj * provide one or more discrete states via the "state" property 501825ba0f2Srobj * in the facility propgroup. 502825ba0f2Srobj * 503825ba0f2Srobj * Discrete sensors will not provide an analog reading by will 504825ba0f2Srobj * provide one or more discrete states via the "state" property 505825ba0f2Srobj * in the facility propgroup. 506825ba0f2Srobj */ 507825ba0f2Srobj #define TOPO_SENSOR_CLASS_THRESHOLD "threshold" 508825ba0f2Srobj #define TOPO_SENSOR_CLASS_DISCRETE "discrete" 509825ba0f2Srobj 510825ba0f2Srobj /* 511825ba0f2Srobj * Sensor unit types. We're using the unit types and corresponding 51291e105c6SRob Johnston * codes described in section 43.17 of the IPMI 2.0 as a reference as it seems 51391e105c6SRob Johnston * to be a reasonably comprehensive list. This also simplifies the IPMI 51491e105c6SRob Johnston * facility provider code since the unit type codes will map exactly to what 51591e105c6SRob Johnston * libtopo uses (so no conversion necessary). To allow for future growth if 51691e105c6SRob Johnston * new unit types are added to IPMI in the future, while still allowing unit 51791e105c6SRob Johnston * types not supported by IPMI to be represented, we include a gap between 51891e105c6SRob Johnston * the last IPMI unit type and the first non-IPMI unit type. 519825ba0f2Srobj */ 520825ba0f2Srobj typedef enum topo_sensor_unit { 521825ba0f2Srobj TOPO_SENSOR_UNITS_UNSPECIFIED = 0, 522825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_C, 523825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_F, 524825ba0f2Srobj TOPO_SENSOR_UNITS_DEGREES_K, 525825ba0f2Srobj TOPO_SENSOR_UNITS_VOLTS, 526825ba0f2Srobj TOPO_SENSOR_UNITS_AMPS, 527825ba0f2Srobj TOPO_SENSOR_UNITS_WATTS, 528825ba0f2Srobj TOPO_SENSOR_UNITS_JOULES, 529825ba0f2Srobj TOPO_SENSOR_UNITS_COULOMBS, 530825ba0f2Srobj TOPO_SENSOR_UNITS_VA, 531825ba0f2Srobj TOPO_SENSOR_UNITS_NITS, 532825ba0f2Srobj TOPO_SENSOR_UNITS_LUMEN, 533825ba0f2Srobj TOPO_SENSOR_UNITS_LUX, 534825ba0f2Srobj TOPO_SENSOR_UNITS_CANDELA, 535825ba0f2Srobj TOPO_SENSOR_UNITS_KPA, 536825ba0f2Srobj TOPO_SENSOR_UNITS_PSI, 537825ba0f2Srobj 538825ba0f2Srobj TOPO_SENSOR_UNITS_NEWTON, 539825ba0f2Srobj TOPO_SENSOR_UNITS_CFM, 540825ba0f2Srobj TOPO_SENSOR_UNITS_RPM, 541825ba0f2Srobj TOPO_SENSOR_UNITS_HZ, 542825ba0f2Srobj TOPO_SENSOR_UNITS_MICROSEC, 543825ba0f2Srobj TOPO_SENSOR_UNITS_MILLISEC, 544825ba0f2Srobj TOPO_SENSOR_UNITS_SECS, 545825ba0f2Srobj TOPO_SENSOR_UNITS_MIN, 546825ba0f2Srobj TOPO_SENSOR_UNITS_HOUR, 547825ba0f2Srobj TOPO_SENSOR_UNITS_DAY, 548825ba0f2Srobj TOPO_SENSOR_UNITS_WEEK, 549825ba0f2Srobj TOPO_SENSOR_UNITS_MIL, 550825ba0f2Srobj TOPO_SENSOR_UNITS_INCHES, 551825ba0f2Srobj TOPO_SENSOR_UNITS_FEET, 552825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_INCH, 553825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_FEET, 554825ba0f2Srobj 555825ba0f2Srobj TOPO_SENSOR_UNITS_MM, 556825ba0f2Srobj TOPO_SENSOR_UNITS_CM, 557825ba0f2Srobj TOPO_SENSOR_UNITS_METERS, 558825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_CM, 559825ba0f2Srobj TOPO_SENSOR_UNITS_CUB_METER, 560825ba0f2Srobj TOPO_SENSOR_UNITS_LITERS, 561825ba0f2Srobj TOPO_SENSOR_UNITS_FLUID_OUNCE, 562825ba0f2Srobj TOPO_SENSOR_UNITS_RADIANS, 563825ba0f2Srobj TOPO_SENSOR_UNITS_STERADIANS, 564825ba0f2Srobj TOPO_SENSOR_UNITS_REVOLUTIONS, 565825ba0f2Srobj TOPO_SENSOR_UNITS_CYCLES, 566825ba0f2Srobj TOPO_SENSOR_UNITS_GRAVITIES, 567825ba0f2Srobj TOPO_SENSOR_UNITS_OUNCE, 568825ba0f2Srobj TOPO_SENSOR_UNITS_POUND, 569825ba0f2Srobj TOPO_SENSOR_UNITS_FOOT_POUND, 570825ba0f2Srobj TOPO_SENSOR_UNITS_OZ_INCH, 571825ba0f2Srobj 572825ba0f2Srobj TOPO_SENSOR_UNITS_GAUSS, 573825ba0f2Srobj TOPO_SENSOR_UNITS_GILBERTS, 574825ba0f2Srobj TOPO_SENSOR_UNITS_HENRY, 575825ba0f2Srobj TOPO_SENSOR_UNITS_MILHENRY, 576825ba0f2Srobj TOPO_SENSOR_UNITS_FARAD, 577825ba0f2Srobj TOPO_SENSOR_UNITS_MICROFARAD, 578825ba0f2Srobj TOPO_SENSOR_UNITS_OHMS, 579825ba0f2Srobj TOPO_SENSOR_UNITS_SIEMENS, 580825ba0f2Srobj TOPO_SENSOR_UNITS_MOLE, 581825ba0f2Srobj TOPO_SENSOR_UNITS_BECQUEREL, 582825ba0f2Srobj TOPO_SENSOR_UNITS_PPM, 583825ba0f2Srobj TOPO_SENSOR_UNITS_RESERVED1, 584825ba0f2Srobj TOPO_SENSOR_UNITS_DECIBELS, 585825ba0f2Srobj TOPO_SENSOR_UNITS_DBA, 586825ba0f2Srobj TOPO_SENSOR_UNITS_DBC, 587825ba0f2Srobj TOPO_SENSOR_UNITS_GRAY, 588825ba0f2Srobj 589825ba0f2Srobj TOPO_SENSOR_UNITS_SIEVERT, 590825ba0f2Srobj TOPO_SENSOR_UNITS_COLOR_TEMP_K, 591825ba0f2Srobj TOPO_SENSOR_UNITS_BIT, 592825ba0f2Srobj TOPO_SENSOR_UNITS_KILOBIT, 593825ba0f2Srobj TOPO_SENSOR_UNITS_MEGABIT, 594825ba0f2Srobj TOPO_SENSOR_UNITS_GIGABIT, 595825ba0f2Srobj TOPO_SENSOR_UNITS_BYTE, 596825ba0f2Srobj TOPO_SENSOR_UNITS_KILOBYTE, 597825ba0f2Srobj TOPO_SENSOR_UNITS_MEGABYTE, 598825ba0f2Srobj TOPO_SENSOR_UNITS_GIGABYTE, 599825ba0f2Srobj TOPO_SENSOR_UNITS_WORD, 600825ba0f2Srobj TOPO_SENSOR_UNITS_DWORD, 601825ba0f2Srobj TOPO_SENSOR_UNITS_QWORD, 602825ba0f2Srobj TOPO_SENSOR_UNITS_MEMLINE, 603825ba0f2Srobj TOPO_SENSOR_UNITS_HIT, 604825ba0f2Srobj TOPO_SENSOR_UNITS_MISS, 605825ba0f2Srobj 606825ba0f2Srobj TOPO_SENSOR_UNITS_RETRY, 607825ba0f2Srobj TOPO_SENSOR_UNITS_RESET, 608825ba0f2Srobj TOPO_SENSOR_UNITS_OVERFLOW, 609825ba0f2Srobj TOPO_SENSOR_UNITS_UNDERRUN, 610825ba0f2Srobj TOPO_SENSOR_UNITS_COLLISION, 611825ba0f2Srobj TOPO_SENSOR_UNITS_PACKETS, 612825ba0f2Srobj TOPO_SENSOR_UNITS_MESSAGES, 613825ba0f2Srobj TOPO_SENSOR_UNITS_CHARACTERS, 614825ba0f2Srobj TOPO_SENSOR_UNITS_ERROR, 615825ba0f2Srobj TOPO_SENSOR_UNITS_CE, 616825ba0f2Srobj TOPO_SENSOR_UNITS_UE, 617825ba0f2Srobj TOPO_SENSOR_UNITS_FATAL_ERROR, 61891e105c6SRob Johnston TOPO_SENSOR_UNITS_GRAMS, 61991e105c6SRob Johnston 62091e105c6SRob Johnston TOPO_SENSOR_UNITS_PERCENT = 512 621825ba0f2Srobj } topo_sensor_unit_t; 622825ba0f2Srobj 623e5dcf7beSRobert Johnston /* 624e5dcf7beSRobert Johnston * These defines are used by the topo_method_sensor_failure to indicate 625e5dcf7beSRobert Johnston * whether the source of a sensor failure is believed to be the result of an 626e5dcf7beSRobert Johnston * internal failure, external condition or unknown 627e5dcf7beSRobert Johnston */ 628e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_UNKNOWN 0 629e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_INTERNAL 1 630e5dcf7beSRobert Johnston #define TOPO_SENSOR_ERRSRC_EXTERNAL 2 631e5dcf7beSRobert Johnston 632825ba0f2Srobj /* 633825ba0f2Srobj * Sensor Types amd the associated sensor-type-specific states 634825ba0f2Srobj * 635825ba0f2Srobj * These are used to decode the type and state properties in the facility 636825ba0f2Srobj * propgroup on facility nodes of type sensor. 637825ba0f2Srobj * 63891e105c6SRob Johnston * Again we're basically using the same defines as listed in the IPMI 63991e105c6SRob Johnston * specification (see section 42) as it's serves as a good starting point and 64091e105c6SRob Johnston * simplifies the IPMI provider code. Of course other facility providers will 64191e105c6SRob Johnston * need to convert from their native codes to the topo code when they set the 64291e105c6SRob Johnston * type and state properties. 643825ba0f2Srobj */ 644825ba0f2Srobj #define TOPO_SENSOR_TYPE_RESERVED 0x0000 645825ba0f2Srobj #define TOPO_SENSOR_TYPE_TEMP 0x0001 646825ba0f2Srobj #define TOPO_SENSOR_TYPE_VOLTAGE 0x0002 647825ba0f2Srobj #define TOPO_SENSOR_TYPE_CURRENT 0x0003 648825ba0f2Srobj #define TOPO_SENSOR_TYPE_FAN 0x0004 649825ba0f2Srobj #define TOPO_SENSOR_TYPE_PHYSICAL 0x0005 650825ba0f2Srobj 651825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_GENERAL 0x0001 652825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_BAY 0x0002 653825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_CARD 0x0004 654825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_PROCESSOR 0x0008 655825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_LAN 0x0010 656825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_DOCK 0x0020 657825ba0f2Srobj #define TOPO_SENSOR_STATE_PHYSICAL_FAN 0x0040 658825ba0f2Srobj 659825ba0f2Srobj #define TOPO_SENSOR_TYPE_PLATFORM 0x0006 660825ba0f2Srobj 661825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_SECURE 0x0001 662825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_USER_PASS 0x0002 663825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_SETUP_PASS 0x0004 664825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_NETWORK_PASS 0x0008 665825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_OTHER_PASS 0x0010 666825ba0f2Srobj #define TOPO_SENSOR_STATE_PLATFORM_OUT_OF_BAND 0x0020 667825ba0f2Srobj 668825ba0f2Srobj #define TOPO_SENSOR_TYPE_PROCESSOR 0x0007 669825ba0f2Srobj 670825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_IERR 0x0001 671825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THERMAL 0x0002 672825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB1 0x0004 673825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB2 0x0008 674825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_FRB3 0x0010 675825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_CONFIG 0x0020 676825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_SMBIOS 0x0040 677825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_PRESENT 0x0080 678825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_DISABLED 0x0100 679825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_TERMINATOR 0x0200 680825ba0f2Srobj #define TOPO_SENSOR_STATE_PROCESSOR_THROTTLED 0x0400 681825ba0f2Srobj 682825ba0f2Srobj #define TOPO_SENSOR_TYPE_POWER_SUPPLY 0x0008 683825ba0f2Srobj 684825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PRESENT 0x0001 685825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_FAILURE 0x0002 686825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_PREDFAIL 0x0004 687825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_LOST 0x0008 688825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE 0x0010 689825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_INPUT_RANGE_PRES 0x0020 690825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_SUPPLY_CONFIG_ERR 0x0040 691825ba0f2Srobj 692825ba0f2Srobj #define TOPO_SENSOR_TYPE_POWER_UNIT 0x0009 693825ba0f2Srobj 694825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_OFF 0x0001 695825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_CYCLE 0x0002 696825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_240_DOWN 0x0004 697825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_INTERLOCK_DOWN 0x0008 698825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_AC_LOST 0x0010 699825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_SOFT_FAILURE 0x0020 700825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_FAIL 0x0040 701825ba0f2Srobj #define TOPO_SENSOR_STATE_POWER_UNIT_PREDFAIL 0x0080 702825ba0f2Srobj 703825ba0f2Srobj #define TOPO_SENSOR_TYPE_COOLING 0x000A 704825ba0f2Srobj #define TOPO_SENSOR_TYPE_OTHER 0x000B 705825ba0f2Srobj 706825ba0f2Srobj #define TOPO_SENSOR_TYPE_MEMORY 0x000C 707825ba0f2Srobj 708825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CE 0x0001 709825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_UE 0x0002 710825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_PARITY 0x0004 711825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_SCRUB_FAIL 0x0008 712825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_DISABLED 0x0010 713825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CE_LOG_LIMIT 0x0020 714825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_PRESENT 0x0040 715825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_CONFIG_ERR 0x0080 716825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_SPARE 0x0100 717825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_THROTTLED 0x0200 718825ba0f2Srobj #define TOPO_SENSOR_STATE_MEMORY_OVERTEMP 0x0400 719825ba0f2Srobj 720825ba0f2Srobj #define TOPO_SENSOR_TYPE_BAY 0x000D 721825ba0f2Srobj 722825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_PRESENT 0x0001 723825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_FAULT 0x0002 724825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_PREDFAIL 0x0004 725825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_SPARE 0x0008 726825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_CHECK 0x0010 727825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_CRITICAL 0x0020 728825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_FAILED 0x0040 729825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_REBUILDING 0x0080 730825ba0f2Srobj #define TOPO_SENSOR_STATE_BAY_ABORTED 0x0100 731825ba0f2Srobj 732825ba0f2Srobj #define TOPO_SENSOR_TYPE_POST_RESIZE 0x000E 733825ba0f2Srobj 734825ba0f2Srobj #define TOPO_SENSOR_TYPE_FIRMWARE 0x000F 735825ba0f2Srobj 736825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_ERROR 0x0001 737825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_HANG 0x0002 738825ba0f2Srobj #define TOPO_SENSOR_STATE_FIRMWARE_PROGRESS 0x0004 739825ba0f2Srobj 740825ba0f2Srobj #define TOPO_SENSOR_TYPE_EVENT_LOG 0x0010 741825ba0f2Srobj 742825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_CE 0x0001 743825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_TYPE 0x0002 744825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_RESET 0x0004 745825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALL 0x0008 746825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_FULL 0x0010 747825ba0f2Srobj #define TOPO_SENSOR_STATE_EVENT_LOG_ALMOST_FULL 0x0020 748825ba0f2Srobj 749825ba0f2Srobj #define TOPO_SENSOR_TYPE_WATCHDOG1 0x0011 750825ba0f2Srobj 751825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_BIOS_RESET 0x0001 752825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_RESET 0x0002 753825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_SHUTDOWN 0x0004 754825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_DOWN 0x0008 755825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_PWR_CYCLE 0x0010 756825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_OS_NMI_DIAG 0x0020 757825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_EXPIRED 0x0040 758825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG_PRE_TIMEOUT_INT 0x0080 759825ba0f2Srobj 760825ba0f2Srobj #define TOPO_SENSOR_TYPE_SYSTEM 0x0012 761825ba0f2Srobj 762825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_RECONF 0x0001 763825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_BOOT 0x0002 764825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_UNKNOWN_HW_FAILURE 0x0004 765825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_AUX_LOG_UPDATED 0x0008 766825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_PEF_ACTION 0x0010 767825ba0f2Srobj #define TOPO_SENSOR_STATE_SYSTEM_TIMETAMP_CLOCKSYNC 0x0020 768825ba0f2Srobj 769825ba0f2Srobj #define TOPO_SENSOR_TYPE_CRITICAL 0x0013 770825ba0f2Srobj 771825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_EXT_NMI 0x0001 772825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_TIMEOUT 0x0002 773825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_IO_NMI 0x0004 774825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_SW_NMI 0x0008 775825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_PERR 0x0010 776825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_PCI_SERR 0x0020 777825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_EISA_FAILSAFE 0x0040 778825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_CE 0x0080 779825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_UE 0x0100 780825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_FATAL_NMI 0x0200 781825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_FATAL_ERR 0x0400 782825ba0f2Srobj #define TOPO_SENSOR_STATE_CRITICAL_BUS_DEGRADED 0x0800 783825ba0f2Srobj 784825ba0f2Srobj #define TOPO_SENSOR_TYPE_BUTTON 0x0014 785825ba0f2Srobj 786825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_PWR 0x0001 787825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_SLEEP 0x0002 788825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_RESET 0x0004 789825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_LATCH 0x0008 790825ba0f2Srobj #define TOPO_SENSOR_STATE_BUTTON_FRU_SERVICE 0x0010 791825ba0f2Srobj 792825ba0f2Srobj #define TOPO_SENSOR_TYPE_MODULE 0x0015 793825ba0f2Srobj #define TOPO_SENSOR_TYPE_MICROCONTROLLER 0x0016 794825ba0f2Srobj #define TOPO_SENSOR_TYPE_CARD 0x0017 795825ba0f2Srobj #define TOPO_SENSOR_TYPE_CHASSIS 0x0018 796825ba0f2Srobj 797825ba0f2Srobj #define TOPO_SENSOR_TYPE_CHIPSET 0x0019 798825ba0f2Srobj 799825ba0f2Srobj #define TOPO_SENSOR_STATE_CHIPSET_PWR_CTL_FAIL 0x0001 800825ba0f2Srobj 801825ba0f2Srobj #define TOPO_SENSOR_TYPE_FRU 0x001A 802825ba0f2Srobj 803825ba0f2Srobj #define TOPO_SENSOR_TYPE_CABLE 0x001B 804825ba0f2Srobj 805825ba0f2Srobj #define TOPO_SENSOR_STATE_CABLE_CONNECTED 0x0001 806825ba0f2Srobj #define TOPO_SENSOR_STATE_CABLE_CONFIG_ERR 0x0002 807825ba0f2Srobj 808825ba0f2Srobj #define TOPO_SENSOR_TYPE_TERMINATOR 0x001C 809825ba0f2Srobj 810825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_STATE 0x001D 811825ba0f2Srobj 812825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_PWR_UP 0x0001 813825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_HARD_RESET 0x0002 814825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_BIOS_WARM_RESET 0x0004 815825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_PXE_BOOT 0x0008 816825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_DIAG_BOOT 0x0010 817825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_HARD_RESET 0x0020 818825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_OS_WARM_RESET 0x0040 819825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_STATE_SYS_RESTART 0x0080 820825ba0f2Srobj 821825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_ERROR 0x001E 822825ba0f2Srobj 823825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NOMEDIA 0x0001 824825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NON_BOOTABLE_DISK 0x0002 825825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_NO_PXE_SERVER 0x0004 826825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_INV_BOOT_SECT 0x0008 827825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_ERROR_USR_SELECT_TIMEOUT 0x0010 828825ba0f2Srobj 829825ba0f2Srobj #define TOPO_SENSOR_TYPE_BOOT_OS 0x001F 830825ba0f2Srobj 831825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_A_DRV_BOOT_COMPLETE 0x0001 832825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_C_DRV_BOOT_COMPLETE 0x0002 833825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_PXE_BOOT_COMPLETE 0x0004 834825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_DIAG_BOOT_COMPLETE 0x0008 835825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_CDROM_BOOT_COMPLETE 0x0010 836825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_ROM_BOOT_COMPLETE 0x0020 837825ba0f2Srobj #define TOPO_SENSOR_STATE_BOOT_OS_UNSPEC_BOOT_COMPLETE 0x0040 838825ba0f2Srobj 839825ba0f2Srobj #define TOPO_SENSOR_TYPE_OS_SHUTDOWN 0x0020 840825ba0f2Srobj 841825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_LOADING 0x0001 842825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_CRASH 0x0002 843825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_STOP_GRACEFUL 0x0004 844825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_GRACEFUL 0x0008 845825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_PEF 0x0010 846825ba0f2Srobj #define TOPO_SENSOR_STATE_OS_SHUTDOWN_BMC 0x0020 847825ba0f2Srobj 848825ba0f2Srobj #define TOPO_SENSOR_TYPE_SLOT 0x0021 849825ba0f2Srobj 850825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_FAULT_ASSERTED 0x0001 851825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_IDENTIFY_ASSERTED 0x0002 852825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_CONNECTED 0x0004 853825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_INSTALL_READY 0x0008 854825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVE_READY 0x0010 855825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_PWR_OFF 0x0020 856825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_REMOVED 0x0040 857825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_INTERLOCK_ASSERTED 0x0080 858825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_DISABLED 0x0100 859825ba0f2Srobj #define TOPO_SENSOR_STATE_SLOT_SPARE_DEVICE 0x0200 860825ba0f2Srobj 861825ba0f2Srobj #define TOPO_SENSOR_TYPE_ACPI 0x0022 862825ba0f2Srobj 863825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S0_G0 0x0001 864825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1 0x0002 865825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S2 0x0004 866825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S3 0x0008 867825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4 0x0010 868825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_G2_SOFT_OFF 0x0020 869825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S4_S5_SOFT_OFF 0x0040 870825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSATTE_G3_MECH_OFF 0x0080 871825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S1_S2_S3_SLEEP 0x0100 872825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_G1_SLEEP 0x0200 873825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_S5_OVERRIDE 0x0400 874825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_ON 0x0800 875825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_LEGACY_OFF 0x1000 876825ba0f2Srobj #define TOPO_SENSOR_STATE_ACPI_PSTATE_UNKNOWN 0x2000 877825ba0f2Srobj 878825ba0f2Srobj #define TOPO_SENSOR_TYPE_WATCHDOG2 0x0023 879825ba0f2Srobj 880825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_EXPIRED 0x0001 881825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_HARD_RESET 0x0002 882825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_DOWN 0x0004 883825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_PWR_CYCLE 0x0008 884825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED1 0x0010 885825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED2 0x0020 886825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED3 0x0040 887825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_RESERVED4 0x0080 888825ba0f2Srobj #define TOPO_SENSOR_STATE_WATCHDOG2_TIMEOUT_INT 0x0100 889825ba0f2Srobj 890825ba0f2Srobj #define TOPO_SENSOR_TYPE_ALERT 0x0024 891825ba0f2Srobj 892825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_PAGE 0x0001 893825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_LAN_ALERT 0x0002 894825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_EVT_TRAP 0x0004 895825ba0f2Srobj #define TOPO_SENSOR_STATE_ALERT_PLAT_SNMP_TRAP 0x0008 896825ba0f2Srobj 897825ba0f2Srobj #define TOPO_SENSOR_TYPE_PRESENCE 0x0025 898825ba0f2Srobj 899825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_PRESENT 0x0001 900825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_ABSENT 0x0002 901825ba0f2Srobj #define TOPO_SENSOR_STATE_PRESENCE_DISABLED 0x0004 902825ba0f2Srobj 903825ba0f2Srobj #define TOPO_SENSOR_TYPE_ASIC 0x0026 904825ba0f2Srobj 905825ba0f2Srobj #define TOPO_SENSOR_TYPE_LAN 0x0027 906825ba0f2Srobj 907825ba0f2Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT_LOST 0x0001 908825ba0f2Srobj #define TOPO_SENSOR_STATE_LAN_HEARTBEAT 0x0002 909825ba0f2Srobj 910825ba0f2Srobj #define TOPO_SENSOR_TYPE_HEALTH 0x0028 911825ba0f2Srobj 912825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_ACC_DEGRADED 0x0001 913825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_ACC_DEGRADED 0x0002 914825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_OFFLINE 0x0004 915825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_CNTLR_UNAVAIL 0x0008 916825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_SENSOR_FAILURE 0x0010 917825ba0f2Srobj #define TOPO_SENSOR_STATE_HEALTH_FRU_FAILURE 0x0020 918825ba0f2Srobj 919825ba0f2Srobj #define TOPO_SENSOR_TYPE_BATTERY 0x0029 920825ba0f2Srobj 921825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_LOW 0x0001 922825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_FAILED 0x0002 923825ba0f2Srobj #define TOPO_SENSOR_STATE_BATTERY_PRESENCE 0x0004 924825ba0f2Srobj 925825ba0f2Srobj #define TOPO_SENSOR_TYPE_AUDIT 0x002A 926825ba0f2Srobj 927825ba0f2Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_ACTIVATED 0x0001 928825ba0f2Srobj #define TOPO_SENSOR_STATE_AUDIT_SESSION_DEACTIVATED 0x0002 929825ba0f2Srobj 930825ba0f2Srobj #define TOPO_SENSOR_TYPE_VERSION 0x002B 931825ba0f2Srobj 932825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE 0x0001 933825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE 0x0002 934825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INCOMPATIBLE 0x0004 935825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INCOMPATIBLE 0x0008 936825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_INVAL 0x0010 937825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_INVAL 0x0020 938825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_HW_CHANGE_SUCCESS 0x0040 939825ba0f2Srobj #define TOPO_SENSOR_STATE_VERSION_SW_CHANGE_SUCCESS 0x0080 940825ba0f2Srobj 941825ba0f2Srobj #define TOPO_SENSOR_TYPE_FRU_STATE 0x002C 942825ba0f2Srobj 943825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_NOT_INSTALLED 0x0001 944825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_INACTIVE 0x0002 945825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_REQ 0x0004 946825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACT_INPROGRESS 0x0008 947825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_ACTIVE 0x0010 948825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_REQ 0x0020 949825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_DEACT_INPROGRESS 0x0040 950825ba0f2Srobj #define TOPO_SENSOR_STATE_FRU_STATE_COMM_LOST 0x0080 951825ba0f2Srobj 952825ba0f2Srobj /* 953825ba0f2Srobj * We simplify the IPMI sensor type code defines by combining the generic 954825ba0f2Srobj * and sensor-specific codes into a single range. Because there's overlap 955825ba0f2Srobj * between the two ranges we offset the generic type codes by 0x0100 956825ba0f2Srobj * which allows ample room in the hole for future expansion of the table to 957825ba0f2Srobj * accomodate either additions to the IPMI spec or to support new sensor types 958825ba0f2Srobj * for alternate provider modules. 959825ba0f2Srobj */ 9607793aa8bSEric Schrock #define TOPO_SENSOR_TYPE_THRESHOLD_STATE 0x0101 9617793aa8bSEric Schrock 9620b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_NONCRIT 0x0001 9630b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_CRIT 0x0002 9640b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_LOWER_NONREC 0x0004 9650b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_NONCRIT 0x0008 9660b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_CRIT 0x0010 9670b1b4412SEric Schrock #define TOPO_SENSOR_STATE_THRESH_UPPER_NONREC 0x0020 968825ba0f2Srobj 969825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_USAGE 0x0102 970825ba0f2Srobj 971825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_IDLE 0x0001 972825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_ACTIVE 0x0002 973825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_USAGE_BUSY 0x0004 974825ba0f2Srobj 975825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATE 0x0103 976825ba0f2Srobj 977825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_DEASSERTED 0x0001 978825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATE_ASSERTED 0x0002 979825ba0f2Srobj 980825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PREDFAIL 0x0104 981825ba0f2Srobj 982825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_DEASSERTED 0x0001 983825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_ASSERTED 0x0002 984825ba0f2Srobj 985825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_LIMIT 0x0105 986825ba0f2Srobj 987825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_NOT_EXCEEDED 0x0001 988825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_LIMIT_EXCEEDED 0x0002 989825ba0f2Srobj 990825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PERFORMANCE 0x0106 991825ba0f2Srobj 992825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_MET 0x0001 993825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_LAGS 0x0002 994825ba0f2Srobj 995825ba0f2Srobj #define TOPO_SENSOR_TYPE_SEVERITY 0x0107 996825ba0f2Srobj 997825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_OK 0x0001 998825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_HIGH 0x0002 999825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_HIGH 0x0004 1000825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_HIGH 0x0008 1001825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONCRIT_GOING_LOW 0x0010 1002825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_CRIT_GOING_LOW 0x0020 1003825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_NONREC_GOING_LOW 0x0020 1004825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_MONITOR 0x0040 1005825ba0f2Srobj #define TOPO_SENSOR_STATE_SEVERITY_INFORMATIONAL 0x0080 1006825ba0f2Srobj 1007825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_PRESENCE 0x0108 1008825ba0f2Srobj 1009825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_DEASSERTED 0x0001 1010825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_PRESENCE_ASSERTED 0x0002 1011825ba0f2Srobj 1012825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_AVAILABILITY 0x0109 1013825ba0f2Srobj 1014825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_DEASSERTED 0x0001 1015825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_AVAIL_ASSERTED 0x0002 1016825ba0f2Srobj 1017825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_STATUS 0x010A 1018825ba0f2Srobj 1019825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_RUNNING 0x0001 1020825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_IN_TEST 0x0002 1021825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_OFF 0x0004 1022825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_ONLINE 0x0008 1023825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFFLINE 0x0010 1024825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_OFF_DUTY 0x0020 1025825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_DEGRADED 0x0040 1026825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_POWER_SAVE 0x0080 1027825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_STATUS_INSTALL_ERR 0x0100 1028825ba0f2Srobj 1029825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_REDUNDANCY 0x010B 1030825ba0f2Srobj 1031825ba0f2Srobj /* 1032825ba0f2Srobj * ACPI power state 1033825ba0f2Srobj */ 1034825ba0f2Srobj #define TOPO_SENSOR_TYPE_GENERIC_ACPI 0x010C 1035825ba0f2Srobj 1036825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D0 0x0001 1037825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D1 0x0002 1038825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D2 0x0004 1039825ba0f2Srobj #define TOPO_SENSOR_STATE_GENERIC_ACPI_D3 0x0008 1040825ba0f2Srobj 1041e5dcf7beSRobert Johnston /* 1042e5dcf7beSRobert Johnston * These sensor types don't exist in the IPMI spec, but allow consumers to 1043e5dcf7beSRobert Johnston * associate discrete sensors with component failure. The 'ok' sensor is the 1044e5dcf7beSRobert Johnston * inverse of the 'failure' sensor. Note that the values intentionally mimic 1045e5dcf7beSRobert Johnston * TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors 1046e5dcf7beSRobert Johnston * but just change the type to get semantically meaningful behavior. 1047e5dcf7beSRobert Johnston */ 1048e5dcf7beSRobert Johnston #define TOPO_SENSOR_TYPE_GENERIC_FAILURE 0x010D 1049e5dcf7beSRobert Johnston 1050e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_DEASSERTED 0x0001 1051e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_NONRECOV 0x0002 1052e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_FAIL_CRITICAL 0x0004 1053e5dcf7beSRobert Johnston 1054e5dcf7beSRobert Johnston #define TOPO_SENSOR_TYPE_GENERIC_OK 0x010E 1055e5dcf7beSRobert Johnston 1056e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_OK_DEASSERTED 0x0001 1057e5dcf7beSRobert Johnston #define TOPO_SENSOR_STATE_GENERIC_OK_ASSERTED 0x0002 1058e5dcf7beSRobert Johnston 1059825ba0f2Srobj /* 1060825ba0f2Srobj * Indicator modes and types 1061825ba0f2Srobj */ 1062825ba0f2Srobj typedef enum topo_led_state { 1063825ba0f2Srobj TOPO_LED_STATE_OFF = 0, 1064825ba0f2Srobj TOPO_LED_STATE_ON 1065825ba0f2Srobj } topo_led_state_t; 1066825ba0f2Srobj 1067e5dcf7beSRobert Johnston #define TOPO_FAC_TYPE_ANY 0xFFFFFFFF 1068e5dcf7beSRobert Johnston 1069825ba0f2Srobj /* 1070825ba0f2Srobj * This list is limited to the set of LED's that we're likely to manage through 1071825ba0f2Srobj * FMA. Thus is does not include things like power or activity LED's 1072825ba0f2Srobj */ 1073825ba0f2Srobj typedef enum topo_led_type { 1074825ba0f2Srobj TOPO_LED_TYPE_SERVICE = 0, 1075825ba0f2Srobj TOPO_LED_TYPE_LOCATE, 1076825ba0f2Srobj TOPO_LED_TYPE_OK2RM, 1077825ba0f2Srobj TOPO_LED_TYPE_PRESENT 1078825ba0f2Srobj } topo_led_type_t; 1079825ba0f2Srobj 10806d65bee7SRob Johnston typedef enum topo_slot_type { 1081508a0e8cSRob Johnston TOPO_SLOT_TYPE_DIMM = 1, 10823c6ffbabSRob Johnston TOPO_SLOT_TYPE_UFM, 10833c6ffbabSRob Johnston TOPO_SLOT_TYPE_M2 10846d65bee7SRob Johnston } topo_slot_type_t; 10856d65bee7SRob Johnston 1086508a0e8cSRob Johnston /* 1087508a0e8cSRob Johnston * Read permission indicates that we can read the raw firmware image in this 1088508a0e8cSRob Johnston * slot off of the device. 1089508a0e8cSRob Johnston * 1090508a0e8cSRob Johnston * Write permission indicates that we can write a firmware image into this 1091508a0e8cSRob Johnston * slot. 1092508a0e8cSRob Johnston * 1093508a0e8cSRob Johnston * These permission are orthogonal to the ability to simply report information 1094508a0e8cSRob Johnston * about the firmware image in a slot. 1095508a0e8cSRob Johnston */ 1096508a0e8cSRob Johnston typedef enum topo_ufm_slot_mode { 1097508a0e8cSRob Johnston TOPO_UFM_SLOT_MODE_NONE = 1, 1098508a0e8cSRob Johnston TOPO_UFM_SLOT_MODE_RO, 1099508a0e8cSRob Johnston TOPO_UFM_SLOT_MODE_WO, 1100508a0e8cSRob Johnston TOPO_UFM_SLOT_MODE_RW 1101508a0e8cSRob Johnston } topo_ufm_slot_mode_t; 1102508a0e8cSRob Johnston 1103508a0e8cSRob Johnston typedef struct topo_ufm_slot_info { 1104508a0e8cSRob Johnston uint32_t usi_slotid; 1105508a0e8cSRob Johnston topo_ufm_slot_mode_t usi_mode; 1106508a0e8cSRob Johnston const char *usi_version; 1107508a0e8cSRob Johnston boolean_t usi_active; 1108508a0e8cSRob Johnston nvlist_t *usi_extra; 1109508a0e8cSRob Johnston } topo_ufm_slot_info_t; 1110825ba0f2Srobj 11117aec1d6eScindi #ifdef __cplusplus 11127aec1d6eScindi } 11137aec1d6eScindi #endif 11147aec1d6eScindi 11157aec1d6eScindi #endif /* _LIBTOPO_H */ 1116