11414Scindi /* 21414Scindi * CDDL HEADER START 31414Scindi * 41414Scindi * The contents of this file are subject to the terms of the 51541Stimh * Common Development and Distribution License (the "License"). 61541Stimh * 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 */ 211541Stimh 221414Scindi /* 23*13131SHyon.Kim@Sun.COM * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. 241414Scindi */ 251414Scindi 261414Scindi #ifndef _TOPO_SUBR_H 271414Scindi #define _TOPO_SUBR_H 281414Scindi 291414Scindi #include <fm/libtopo.h> 301414Scindi #include <topo_list.h> 311414Scindi 321414Scindi #include <pthread.h> 331414Scindi #include <stdarg.h> 341414Scindi 351414Scindi #ifdef __cplusplus 361414Scindi extern "C" { 371414Scindi #endif 381414Scindi 391414Scindi typedef struct topo_debug_mode { 401414Scindi char *tdm_name; /* mode name */ 411414Scindi char *tdm_desc; /* mode description */ 421414Scindi int tdm_mode; /* mode: See below */ 431414Scindi } topo_debug_mode_t; 441414Scindi 451414Scindi #define TOPO_DBOUT_STDERR 0 /* Debug messages to stderr */ 461414Scindi #define TOPO_DBOUT_SYSLOG 1 /* Debug messages to syslog */ 471414Scindi 483062Scindi #define TOPO_DBG_ERR 0x0001 /* enable error handling debug messages */ 493062Scindi #define TOPO_DBG_MOD 0x0002 /* enable module debug messages */ 503062Scindi #define TOPO_DBG_MODSVC 0x0004 /* enable module services debug messages */ 513062Scindi #define TOPO_DBG_WALK 0x0008 /* enable walker debug messages */ 523062Scindi #define TOPO_DBG_XML 0x0010 /* enable xml parsing debug messages */ 53*13131SHyon.Kim@Sun.COM #define TOPO_DBG_FORCE 0x0020 /* use DINFOFORCE snapshot for topology */ 543062Scindi #define TOPO_DBG_ALL 0xffff /* enable all debug modes */ 553062Scindi 563062Scindi #define TOPO_STABSTR_INTERNAL "Internal" /* private to libtopo */ 573062Scindi #define TOPO_STABSTR_PRIVATE "Private" /* private to Sun */ 583062Scindi #define TOPO_STABSTR_OBSOLETE "Obsolete" /* scheduled for removal */ 593062Scindi #define TOPO_STABSTR_EXTERNAL "External" /* not controlled by Sun */ 603062Scindi #define TOPO_STABSTR_UNSTABLE "Unstable" /* new or rapidly changing */ 613062Scindi #define TOPO_STABSTR_EVOLVING "Evolving" /* less rapidly changing */ 623062Scindi #define TOPO_STABSTR_STABLE "Stable" /* mature interface from Sun */ 633062Scindi #define TOPO_STABSTR_STANDARD "Standard" /* industry standard */ 643062Scindi #define TOPO_STABSTR_UNKNOWN "Unknown" /* stability unknown */ 653062Scindi 667243Srobj typedef struct topo_name_trans { 677243Srobj uint32_t int_value; 687243Srobj const char *int_name; 697243Srobj } topo_name_trans_t; 707243Srobj 717243Srobj extern topo_name_trans_t topo_sensor_type_table[]; 727243Srobj extern topo_name_trans_t topo_units_type_table[]; 737243Srobj extern topo_name_trans_t topo_led_type_table[]; 747243Srobj extern topo_name_trans_t topo_led_states_table[]; 757243Srobj extern topo_name_trans_t topo_sensor_states_physical_table[]; 767243Srobj extern topo_name_trans_t topo_sensor_states_platform_table[]; 777243Srobj extern topo_name_trans_t topo_sensor_states_processor_table[]; 787243Srobj extern topo_name_trans_t topo_sensor_states_power_supply_table[]; 797243Srobj extern topo_name_trans_t topo_sensor_states_power_unit_table[]; 807243Srobj extern topo_name_trans_t topo_sensor_states_memory_table[]; 817243Srobj extern topo_name_trans_t topo_sensor_states_bay_table[]; 827243Srobj extern topo_name_trans_t topo_sensor_states_firmware_table[]; 837243Srobj extern topo_name_trans_t topo_sensor_states_event_log_table[]; 847243Srobj extern topo_name_trans_t topo_sensor_states_watchdog1_table[]; 857243Srobj extern topo_name_trans_t topo_sensor_states_system_table[]; 867243Srobj extern topo_name_trans_t topo_sensor_states_critical_table[]; 877243Srobj extern topo_name_trans_t topo_sensor_states_button_table[]; 887243Srobj extern topo_name_trans_t topo_sensor_states_cable_table[]; 897243Srobj extern topo_name_trans_t topo_sensor_states_boot_state_table[]; 907243Srobj extern topo_name_trans_t topo_sensor_states_boot_error_table[]; 917243Srobj extern topo_name_trans_t topo_sensor_states_boot_os_table[]; 927243Srobj extern topo_name_trans_t topo_sensor_states_os_table[]; 937243Srobj extern topo_name_trans_t topo_sensor_states_slot_table[]; 947243Srobj extern topo_name_trans_t topo_sensor_states_acpi_table[]; 957243Srobj extern topo_name_trans_t topo_sensor_states_watchdog2_table[]; 967243Srobj extern topo_name_trans_t topo_sensor_states_alert_table[]; 977243Srobj extern topo_name_trans_t topo_sensor_states_presence_table[]; 987243Srobj extern topo_name_trans_t topo_sensor_states_lan_table[]; 997243Srobj extern topo_name_trans_t topo_sensor_states_health_table[]; 1007243Srobj extern topo_name_trans_t topo_sensor_states_battery_table[]; 1017243Srobj extern topo_name_trans_t topo_sensor_states_audit_table[]; 1027243Srobj extern topo_name_trans_t topo_sensor_states_version_table[]; 1037243Srobj extern topo_name_trans_t topo_sensor_states_fru_state_table[]; 1047243Srobj extern topo_name_trans_t topo_sensor_states_thresh_table[]; 1057243Srobj extern topo_name_trans_t topo_sensor_states_generic_usage_table[]; 1067243Srobj extern topo_name_trans_t topo_sensor_states_generic_state_table[]; 1077243Srobj extern topo_name_trans_t topo_sensor_states_generic_predfail_table[]; 1087243Srobj extern topo_name_trans_t topo_sensor_states_generic_limit_table[]; 1097243Srobj extern topo_name_trans_t topo_sensor_states_generic_perf_table[]; 1107243Srobj extern topo_name_trans_t topo_sensor_states_generic_presence_table[]; 1117243Srobj extern topo_name_trans_t topo_sensor_states_severity_table[]; 1127243Srobj extern topo_name_trans_t topo_sensor_states_generic_avail_table[]; 1137243Srobj extern topo_name_trans_t topo_sensor_states_generic_status_table[]; 1147243Srobj extern topo_name_trans_t topo_sensor_states_generic_acpi_pwr_table[]; 1158526SRobert.Johnston@Sun.COM extern topo_name_trans_t topo_sensor_states_generic_failure_table[]; 1168526SRobert.Johnston@Sun.COM extern topo_name_trans_t topo_sensor_states_generic_ok_table[]; 1173062Scindi 1181414Scindi extern void topo_hdl_lock(topo_hdl_t *); 1191414Scindi extern void topo_hdl_unlock(topo_hdl_t *); 1201414Scindi 1211414Scindi extern const char *topo_stability_name(topo_stability_t); 1221414Scindi extern char *topo_version_num2str(topo_version_t, char *, size_t); 1231414Scindi extern int topo_version_str2num(const char *, topo_version_t); 1241414Scindi extern int topo_version_defined(topo_version_t); 1251414Scindi 1263062Scindi extern void topo_dprintf(topo_hdl_t *, int, const char *, ...); 1273062Scindi extern void topo_vdprintf(topo_hdl_t *, int, const char *, const char *, 1283062Scindi va_list); 1291414Scindi 1301414Scindi extern tnode_t *topo_hdl_root(topo_hdl_t *, const char *); 1313062Scindi extern char *topo_search_path(topo_mod_t *, const char *, const char *); 1321414Scindi 1331541Stimh extern void topo_fmristr_build(ssize_t *, char *, size_t, char *, char *, 1341541Stimh char *); 1351541Stimh 1364087Scindi extern int topo_walk_byid(topo_walk_t *wp, const char *name, topo_instance_t); 1376341Scy152378 extern int topo_walk_bysibling(topo_walk_t *wp, const char *name, 1386341Scy152378 topo_instance_t); 1394087Scindi 1407349SAdrian.Frost@Sun.COM extern char *topo_cleanup_auth_str(topo_hdl_t *, const char *); 1414198Seschrock 1421414Scindi #ifdef __cplusplus 1431414Scindi } 1441414Scindi #endif 1451414Scindi 1461414Scindi #endif /* _TOPO_SUBR_H */ 147