/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LIBTOPO_H
#define _LIBTOPO_H
#include <stdio.h>
#include <libdevinfo.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct topo_list {
} topo_list_t;
typedef struct topo_faclist {
/*
* The following functions, error codes and data structures are private
* to libtopo snapshot consumers and enumerator modules.
*/
extern topo_hdl_t *topo_open(int, const char *, int *);
extern void topo_close(topo_hdl_t *);
extern char *topo_snap_hold(topo_hdl_t *, const char *, int *);
extern void topo_snap_release(topo_hdl_t *);
/*
* Snapshot walker support
*/
void *, int *);
extern int topo_walk_step(topo_walk_t *, int);
extern void topo_walk_fini(topo_walk_t *);
/*
* Walk status returned from walker
*/
#define TOPO_WALK_NEXT 0
/*
* Types of walks: depth-first (child) or breadth-first (sibling)
*/
/*
* FMRI helper routines
*/
int *);
uint32_t, topo_walk_cb_t, void *, int *);
/*
* Consolidation private utility functions
*/
const char *);
/*
* Topo node utilities: callable from topo_walk_step() callback or module
* enumeration, topo_mod_enumerate()
*/
extern char *topo_node_name(tnode_t *);
extern void *topo_node_private(tnode_t *);
extern int topo_node_flags(tnode_t *);
extern int topo_node_label(tnode_t *, char **, int *);
uint32_t, topo_faclist_t *, int *);
void *, int *);
/*
* Node flags: denotes type of node
*/
#define TOPO_NODE_DEFAULT 0
/*
* Topo property get functions
*/
extern int topo_prop_get_int32(tnode_t *, const char *, const char *,
int32_t *, int *);
extern int topo_prop_get_uint32(tnode_t *, const char *, const char *,
uint32_t *, int *);
extern int topo_prop_get_int64(tnode_t *, const char *, const char *,
int64_t *, int *);
extern int topo_prop_get_uint64(tnode_t *, const char *, const char *,
uint64_t *, int *);
extern int topo_prop_get_double(tnode_t *, const char *, const char *,
double *, int *);
extern int topo_prop_get_string(tnode_t *, const char *, const char *,
char **, int *);
extern int topo_prop_get_fmri(tnode_t *, const char *, const char *,
nvlist_t **, int *);
extern int topo_prop_get_int32_array(tnode_t *, const char *, const char *,
extern int topo_prop_get_uint32_array(tnode_t *, const char *, const char *,
extern int topo_prop_get_int64_array(tnode_t *, const char *, const char *,
extern int topo_prop_get_uint64_array(tnode_t *, const char *, const char *,
extern int topo_prop_get_string_array(tnode_t *, const char *, const char *,
char ***, uint_t *, int *);
extern int topo_prop_get_fmri_array(tnode_t *, const char *, const char *,
/*
* Topo property set functions
*/
extern int topo_prop_set_int32(tnode_t *, const char *, const char *, int,
int32_t, int *);
extern int topo_prop_set_uint32(tnode_t *, const char *, const char *, int,
uint32_t, int *);
extern int topo_prop_set_int64(tnode_t *, const char *, const char *,
int, int64_t, int *);
extern int topo_prop_set_uint64(tnode_t *, const char *, const char *,
int, uint64_t, int *);
extern int topo_prop_set_double(tnode_t *, const char *, const char *,
int, double, int *);
extern int topo_prop_set_string(tnode_t *, const char *, const char *,
int, const char *, int *);
extern int topo_prop_set_fmri(tnode_t *, const char *, const char *,
int, const nvlist_t *, int *);
extern int topo_prop_set_int32_array(tnode_t *, const char *, const char *, int,
extern int topo_prop_set_uint32_array(tnode_t *, const char *, const char *,
extern int topo_prop_set_int64_array(tnode_t *, const char *, const char *,
extern int topo_prop_set_uint64_array(tnode_t *, const char *, const char *,
extern int topo_prop_set_string_array(tnode_t *, const char *, const char *,
int, const char **, uint_t, int *);
extern int topo_prop_set_fmri_array(tnode_t *, const char *, const char *,
#define TOPO_PROP_IMMUTABLE 0
/* Protocol property group and property names */
/*
* System property group
*/
/*
* These enum definitions are used to define a set of error tags associated with
* libtopo error conditions occuring during the adminstration of
* properties, invocation of methods and fmri-based queries. The shell script
* mkerror.sh is used to parse this file and create a corresponding topo_error.c
* source file.
*
* If you do something other than add a new error tag here, you may need to
* update the mkerror shell script as it is based upon simple regexps.
*/
typedef enum topo_prop_errno {
typedef enum topo_method_errno {
typedef enum topo_fmri_errno {
typedef enum topo_hdl_errno {
extern const char *topo_strerror(int);
extern void topo_hdl_strfree(topo_hdl_t *, char *);
extern void topo_debug_set(topo_hdl_t *, const char *, const char *);
/*
* The following functions and data structures to support property
* observability are private to the fmtopo command.
*/
/*
* Each topology node advertises the name and data stability of each of its
* modules and properties. (see attributes(5)).
*/
/*
* Topo stability attributes
*/
typedef enum topo_stability {
typedef struct topo_pgroup_info {
extern topo_stability_t topo_name2stability(const char *);
extern const char *topo_stability2name(topo_stability_t);
extern void topo_pgroup_destroy(tnode_t *, const char *);
typedef enum {
TOPO_TYPE_INVALID = 0,
} topo_type_t;
extern int topo_prop_getprop(tnode_t *, const char *, const char *,
int, nvlist_t *, int *);
nvlist_t **, int *);
/* Property node NVL names used in topo_prop_getprops */
/*
* ARGS list used in topo property methods
*/
extern char *topo_hdl_strdup(topo_hdl_t *, const char *);
/*
* a string
*/
/*
* Defines for standard properties for sensors and indicators
*/
/*
* Sensor Classes
*
* The "sensor-class" property in the "facility" propgroup on
* facility nodes of type "sensor" should be set to one of these
* two values.
*
* Threshold sensors provide an analog sensor reading via the
* "reading" property in the facility propgroup. They will also
* provide one or more discrete states via the "state" property
* in the facility propgroup.
*
* Discrete sensors will not provide an analog reading by will
* provide one or more discrete states via the "state" property
* in the facility propgroup.
*/
/*
* Sensor unit types. We're using the unit types and corresponding
* codes described in the IPMI 2.0 spec as a reference as it seems to be a
* reasonably comprehensive list. This also simplifies the IPMI provider code
* since the unit type codes will map exactly to what libtopo uses (so no
* conversion necessary).
*/
typedef enum topo_sensor_unit {
/*
* These defines are used by the topo_method_sensor_failure to indicate
* whether the source of a sensor failure is believed to be the result of an
* internal failure, external condition or unknown
*/
#define TOPO_SENSOR_ERRSRC_UNKNOWN 0
/*
* Sensor Types amd the associated sensor-type-specific states
*
* These are used to decode the type and state properties in the facility
* propgroup on facility nodes of type sensor.
*
* Again we're basically using the same defines as for IPMI as it's serves
* as a good starting point and simplifies the IPMI provider code. Of course
* other facility providers will need to convert from their native codes
* to the topo code when they set the type and state properties.
*/
/*
* We simplify the IPMI sensor type code defines by combining the generic
* and sensor-specific codes into a single range. Because there's overlap
* between the two ranges we offset the generic type codes by 0x0100
* which allows ample room in the hole for future expansion of the table to
* accomodate either additions to the IPMI spec or to support new sensor types
* for alternate provider modules.
*/
/*
* ACPI power state
*/
/*
* These sensor types don't exist in the IPMI spec, but allow consumers to
* associate discrete sensors with component failure. The 'ok' sensor is the
* inverse of the 'failure' sensor. Note that the values intentionally mimic
* TOPO_SENSOR_TYPE_GENERIC_STATE, so that you can use existing IPMI sensors
* but just change the type to get semantically meaningful behavior.
*/
/*
* Indicator modes and types
*/
typedef enum topo_led_state {
TOPO_LED_STATE_OFF = 0,
/*
* This list is limited to the set of LED's that we're likely to manage through
* FMA. Thus is does not include things like power or activity LED's
*/
typedef enum topo_led_type {
#ifdef __cplusplus
}
#endif
#endif /* _LIBTOPO_H */