10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*1103Sjbeloro * Common Development and Distribution License (the "License"). 6*1103Sjbeloro * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*1103Sjbeloro 220Sstevel@tonic-gate /* 23*1103Sjbeloro * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _PICLENVMON_H 280Sstevel@tonic-gate #define _PICLENVMON_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #ifdef __cplusplus 330Sstevel@tonic-gate extern "C" { 340Sstevel@tonic-gate #endif 350Sstevel@tonic-gate 360Sstevel@tonic-gate /* 370Sstevel@tonic-gate * Log message texts 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate #define EM_INIT_FAILED gettext("SUNW_piclenvmon: init failed!") 400Sstevel@tonic-gate #define EM_MISSING_NODE gettext("SUNW_piclenvmon: no %s node!") 410Sstevel@tonic-gate #define EM_SC_NODE_INCOMPLETE \ 420Sstevel@tonic-gate gettext("SUNW_piclenvmon: SC node devfs-path property missing") 430Sstevel@tonic-gate #define EM_SC_NODE_MISSING \ 440Sstevel@tonic-gate gettext("SUNW_piclenvmon: failed to locate SC device node") 450Sstevel@tonic-gate #define EM_EVREG_FAILED \ 460Sstevel@tonic-gate gettext("SUNW_piclenvmon: failed to register for events %x") 470Sstevel@tonic-gate #define EM_NODE_ACCESS \ 480Sstevel@tonic-gate gettext("SUNW_piclenvmon: couldn't access \"%s\", " \ 490Sstevel@tonic-gate "type %d, PICL err %d") 500Sstevel@tonic-gate #define EM_SYS_ERR gettext("SUNW_piclenvmon: %s: %s") 510Sstevel@tonic-gate #define EM_EV_MISSING_ARG \ 520Sstevel@tonic-gate gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event") 530Sstevel@tonic-gate #define EM_INVALID_COLOR \ 540Sstevel@tonic-gate gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s") 550Sstevel@tonic-gate 560Sstevel@tonic-gate /* 570Sstevel@tonic-gate * define for super-user uid - used in credential checking 580Sstevel@tonic-gate */ 590Sstevel@tonic-gate #define SUPER_USER ((uid_t)0) 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * Constants for distinquishing environmental monitor types 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate #define ENVMON_VOLT_SENS 0 650Sstevel@tonic-gate #define ENVMON_VOLT_IND 1 660Sstevel@tonic-gate #define ENVMON_AMP_SENS 2 670Sstevel@tonic-gate #define ENVMON_AMP_IND 3 680Sstevel@tonic-gate #define ENVMON_TEMP_SENS 4 690Sstevel@tonic-gate #define ENVMON_TEMP_IND 5 700Sstevel@tonic-gate #define ENVMON_FAN_SENS 6 710Sstevel@tonic-gate #define ENVMON_FAN_IND 7 720Sstevel@tonic-gate #define ENVMON_LED_IND 8 730Sstevel@tonic-gate #define ENVMON_KEY_SWITCH 9 74*1103Sjbeloro #define ENVMON_CHASSIS 10 75*1103Sjbeloro 76*1103Sjbeloro /* 77*1103Sjbeloro * ENVMONTYPES is the total of all the environmental monitor types. Needs 78*1103Sjbeloro * to be incrementee everytime a new type is added. 79*1103Sjbeloro */ 80*1103Sjbeloro #define ENVMONTYPES 11 810Sstevel@tonic-gate 820Sstevel@tonic-gate /* 830Sstevel@tonic-gate * number of key-switches supported 840Sstevel@tonic-gate */ 850Sstevel@tonic-gate #define N_KEY_SWITCHES 1 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* 880Sstevel@tonic-gate * nomenclature names used to identify LED significance 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate #define LED_ACT "ACT" 910Sstevel@tonic-gate #define LED_SERVICE "SERVICE" 920Sstevel@tonic-gate #define LED_OK2RM "OK2RM" 930Sstevel@tonic-gate #define LED_LOCATE "LOCATE" 940Sstevel@tonic-gate 95*1103Sjbeloro #define KEYSWITCH_NAME "keyswitch" 96*1103Sjbeloro #define CHASSIS_SERIAL_NUMBER "chassis_serial_number" 970Sstevel@tonic-gate 980Sstevel@tonic-gate /* 990Sstevel@tonic-gate * Config file name 1000Sstevel@tonic-gate */ 1010Sstevel@tonic-gate #define ENVMON_CONFFILE_NAME "piclenvmon.conf" 1020Sstevel@tonic-gate 1030Sstevel@tonic-gate typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf); 1040Sstevel@tonic-gate typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf); 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate typedef struct node_el { 1070Sstevel@tonic-gate picl_nodehdl_t nodeh; 1080Sstevel@tonic-gate struct node_el *next; 1090Sstevel@tonic-gate } node_el_t; 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate typedef struct node_list { 1120Sstevel@tonic-gate node_el_t *head; 1130Sstevel@tonic-gate node_el_t *tail; 1140Sstevel@tonic-gate } node_list_t; 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate /* 1170Sstevel@tonic-gate * index entry for looking up sensor handle 1180Sstevel@tonic-gate */ 1190Sstevel@tonic-gate typedef struct { 1200Sstevel@tonic-gate int maxnum; /* number of entries in handles array */ 1210Sstevel@tonic-gate int num; /* number of entries in being used */ 1220Sstevel@tonic-gate uchar_t *fru_types; 1230Sstevel@tonic-gate envmon_handle_t *envhandles; 1240Sstevel@tonic-gate picl_prophdl_t *piclprhdls; 1250Sstevel@tonic-gate } handle_array_t; 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate #ifdef __cplusplus 1280Sstevel@tonic-gate } 1290Sstevel@tonic-gate #endif 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate #endif /* _PICLENVMON_H */ 132