1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _ENVD_H 28*0Sstevel@tonic-gate #define _ENVD_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/types.h> 33*0Sstevel@tonic-gate #include <libintl.h> 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #ifdef __cplusplus 36*0Sstevel@tonic-gate extern "C" { 37*0Sstevel@tonic-gate #endif 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate #define SENSOR_POLL_INTERVAL 4 /* in seconds */ 40*0Sstevel@tonic-gate #define WARNING_INTERVAL 30 /* in seconds */ 41*0Sstevel@tonic-gate #define WARNING_DURATION 28 /* in seconds */ 42*0Sstevel@tonic-gate #define SHUTDOWN_INTERVAL 60 /* in seconds */ 43*0Sstevel@tonic-gate #define ENV_CONF_FILE "piclenvd.conf" 44*0Sstevel@tonic-gate #define PM_DEVICE "/dev/pm" 45*0Sstevel@tonic-gate #define SHUTDOWN_CMD "/usr/sbin/shutdown -y -g 60 -i 5" 46*0Sstevel@tonic-gate #define ENVMODEL_CONF_FILE "envmodel.conf" 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate /* 49*0Sstevel@tonic-gate * Macros to fetch 16 and 32 bit data from unaligned address 50*0Sstevel@tonic-gate */ 51*0Sstevel@tonic-gate #define GET_UNALIGN16(addr) \ 52*0Sstevel@tonic-gate (((*(uint8_t *)addr) << 8) | *((uint8_t *)addr+1)) 53*0Sstevel@tonic-gate 54*0Sstevel@tonic-gate #define GET_UNALIGN32(addr) \ 55*0Sstevel@tonic-gate (((*(uint8_t *)addr) << 24) | (*((uint8_t *)addr+1) << 16) | \ 56*0Sstevel@tonic-gate ((*((uint8_t *)addr+2)) << 8) | (*((uint8_t *)addr+3))) 57*0Sstevel@tonic-gate 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate /* 60*0Sstevel@tonic-gate * SEEPROM section header layout and location 61*0Sstevel@tonic-gate */ 62*0Sstevel@tonic-gate typedef struct { 63*0Sstevel@tonic-gate uint8_t header_tag; /* section header tag */ 64*0Sstevel@tonic-gate uint8_t header_version[2]; /* header version (msb) */ 65*0Sstevel@tonic-gate uint8_t header_length; /* header length */ 66*0Sstevel@tonic-gate uint8_t header_crc8; /* crc8 */ 67*0Sstevel@tonic-gate uint8_t segment_count; /* total number of segments */ 68*0Sstevel@tonic-gate } section_layout_t; 69*0Sstevel@tonic-gate 70*0Sstevel@tonic-gate #define SECTION_HDR_OFFSET 0x1800 71*0Sstevel@tonic-gate #define SECTION_HDR_TAG 0x08 72*0Sstevel@tonic-gate #define SECTION_HDR_VER 0x0001 73*0Sstevel@tonic-gate #define SECTION_HDR_LENGTH 0x06 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate /* 77*0Sstevel@tonic-gate * SEEPROM segment header layout 78*0Sstevel@tonic-gate */ 79*0Sstevel@tonic-gate typedef struct { 80*0Sstevel@tonic-gate uint16_t name; /* segment name */ 81*0Sstevel@tonic-gate uint16_t descriptor[2]; /* descriptor (msb) */ 82*0Sstevel@tonic-gate uint16_t offset; /* segment data offset */ 83*0Sstevel@tonic-gate uint16_t length; /* segment length */ 84*0Sstevel@tonic-gate } segment_layout_t; 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate #define ENVSEG_NAME 0x4553 /* environmental segment name */ 87*0Sstevel@tonic-gate #define ENVSEG_VERSION 1 /* environmental segment version */ 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate /* 91*0Sstevel@tonic-gate * SEEPROM environmental segment header layout 92*0Sstevel@tonic-gate */ 93*0Sstevel@tonic-gate typedef struct { 94*0Sstevel@tonic-gate uint16_t sensor_id[2]; /* unique sensor ID (on this FRU) */ 95*0Sstevel@tonic-gate uint16_t offset; /* sensor data record offset */ 96*0Sstevel@tonic-gate } envseg_sensor_t; 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate typedef struct { 99*0Sstevel@tonic-gate uint8_t version; /* envseg version */ 100*0Sstevel@tonic-gate uint8_t sensor_count; /* total number of sensor records */ 101*0Sstevel@tonic-gate envseg_sensor_t sensors[1]; /* sensor table (variable length) */ 102*0Sstevel@tonic-gate } envseg_layout_t; 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate 105*0Sstevel@tonic-gate /* 106*0Sstevel@tonic-gate * SEEPROM environmental segment sensor data layout 107*0Sstevel@tonic-gate */ 108*0Sstevel@tonic-gate #define MAX_POLICY_ENTRIES 6 /* max # policy data entries */ 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate typedef struct { 111*0Sstevel@tonic-gate int8_t observed; /* observed (measured) temperature */ 112*0Sstevel@tonic-gate int8_t expected; /* expected (correct) temperature */ 113*0Sstevel@tonic-gate } envseg_map_t; 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate typedef struct { 116*0Sstevel@tonic-gate int8_t high_power_off; /* high power off threshold */ 117*0Sstevel@tonic-gate int8_t high_shutdown; /* high shutdown threshold */ 118*0Sstevel@tonic-gate int8_t high_warning; /* high warning threshold */ 119*0Sstevel@tonic-gate int8_t low_warning; /* low warning threshold */ 120*0Sstevel@tonic-gate int8_t low_shutdown; /* low shutdown threshold */ 121*0Sstevel@tonic-gate int8_t low_power_off; /* low power off threshold */ 122*0Sstevel@tonic-gate int8_t policy_type; /* policy type */ 123*0Sstevel@tonic-gate int8_t policy_entries; /* #valid entries in policy_data[] */ 124*0Sstevel@tonic-gate int8_t policy_data[MAX_POLICY_ENTRIES]; 125*0Sstevel@tonic-gate uint16_t obs2exp_cnt; /* map entries count */ 126*0Sstevel@tonic-gate envseg_map_t obs2exp_map[1]; /* variable length map table */ 127*0Sstevel@tonic-gate } envseg_sensor_data_t; 128*0Sstevel@tonic-gate 129*0Sstevel@tonic-gate /* policy_type */ 130*0Sstevel@tonic-gate #define POLICY_TARGET_TEMP 1 131*0Sstevel@tonic-gate #define POLICY_LINEAR 2 132*0Sstevel@tonic-gate 133*0Sstevel@tonic-gate /* linear policy data indices */ 134*0Sstevel@tonic-gate #define LOW_NOMINAL_LOC 0 /* linear policy: lower temp index */ 135*0Sstevel@tonic-gate #define HIGH_NOMINAL_LOC 1 /* linear policy: higher temp index */ 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate 138*0Sstevel@tonic-gate /* 139*0Sstevel@tonic-gate * FRU envseg list 140*0Sstevel@tonic-gate */ 141*0Sstevel@tonic-gate typedef struct fruenvseg { 142*0Sstevel@tonic-gate struct fruenvseg *next; /* next entry */ 143*0Sstevel@tonic-gate char *fru; /* FRU SEEPROM path */ 144*0Sstevel@tonic-gate void *envsegbufp; /* envseg data buffer */ 145*0Sstevel@tonic-gate int envseglen; /* envseg length */ 146*0Sstevel@tonic-gate } fruenvseg_t; 147*0Sstevel@tonic-gate 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate /* 150*0Sstevel@tonic-gate * devfs-path and sensor IDs for CPU FRUs 151*0Sstevel@tonic-gate */ 152*0Sstevel@tonic-gate #define CPU0_FRU_DEVFS "/pci@8,700000/ebus@5/i2c@1,30/cpu-fru@0,a0:cpu-fru" 153*0Sstevel@tonic-gate #define CPU1_FRU_DEVFS "/pci@8,700000/ebus@5/i2c@1,30/cpu-fru@0,a2:cpu-fru" 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate #define CPU_FRU_AMB_SENSOR 1 156*0Sstevel@tonic-gate #define CPU_FRU_DIE_SENSOR 2 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate /* 159*0Sstevel@tonic-gate * devfs-path for various fans and their min/max speeds 160*0Sstevel@tonic-gate */ 161*0Sstevel@tonic-gate #define ENV_CPU_FAN_DEVFS \ 162*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/fan-control@0,48:2" 163*0Sstevel@tonic-gate #define ENV_SYSTEM_FAN_DEVFS \ 164*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/fan-control@0,48:0" 165*0Sstevel@tonic-gate #define ENV_PSUPPLY_FAN_DEVFS \ 166*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/fan-control@0,48:4" 167*0Sstevel@tonic-gate 168*0Sstevel@tonic-gate /* 169*0Sstevel@tonic-gate * devfs-path for xcalwd watchdog 170*0Sstevel@tonic-gate */ 171*0Sstevel@tonic-gate #define XCALWD_DEVFS "/devices/pseudo/xcalwd@0:xcalwd" 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate #define CPU_FAN_SPEED_MIN 12 174*0Sstevel@tonic-gate #define CPU_FAN_SPEED_MAX 63 175*0Sstevel@tonic-gate 176*0Sstevel@tonic-gate #define SYSTEM_FAN_SPEED_MIN 12 177*0Sstevel@tonic-gate #define SYSTEM_FAN_SPEED_MAX 63 178*0Sstevel@tonic-gate 179*0Sstevel@tonic-gate #define PSUPPLY_FAN_SPEED_MIN 0 180*0Sstevel@tonic-gate #define PSUPPLY_FAN_SPEED_MAX 31 181*0Sstevel@tonic-gate 182*0Sstevel@tonic-gate 183*0Sstevel@tonic-gate /* 184*0Sstevel@tonic-gate * devfs-path for various temperature sensors and CPU platform path 185*0Sstevel@tonic-gate */ 186*0Sstevel@tonic-gate #define CPU0_DIE_SENSOR_DEVFS \ 187*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/temperature@0,30:die_temp" 188*0Sstevel@tonic-gate #define CPU0_AMB_SENSOR_DEVFS \ 189*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/temperature@0,30:amb_temp" 190*0Sstevel@tonic-gate 191*0Sstevel@tonic-gate #define CPU1_DIE_SENSOR_DEVFS \ 192*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/temperature@0,98:die_temp" 193*0Sstevel@tonic-gate #define CPU1_AMB_SENSOR_DEVFS \ 194*0Sstevel@tonic-gate "/pci@8,700000/ebus@5/i2c@1,30/temperature@0,98:amb_temp" 195*0Sstevel@tonic-gate 196*0Sstevel@tonic-gate /* 197*0Sstevel@tonic-gate * Temperature thresholds structure 198*0Sstevel@tonic-gate */ 199*0Sstevel@tonic-gate typedef int16_t tempr_t; 200*0Sstevel@tonic-gate 201*0Sstevel@tonic-gate typedef struct { 202*0Sstevel@tonic-gate tempr_t low_power_off; /* low power-off temperature */ 203*0Sstevel@tonic-gate tempr_t high_power_off; /* high power-off temperature */ 204*0Sstevel@tonic-gate tempr_t low_shutdown; /* low shutdown temperature */ 205*0Sstevel@tonic-gate tempr_t high_shutdown; /* high shutdown temperature */ 206*0Sstevel@tonic-gate tempr_t low_warning; /* low warning temperature */ 207*0Sstevel@tonic-gate tempr_t high_warning; /* high warning temperature */ 208*0Sstevel@tonic-gate tempr_t min_limit; /* sensor minimum temperature limit */ 209*0Sstevel@tonic-gate tempr_t max_limit; /* sensor maximum temperature limit */ 210*0Sstevel@tonic-gate short policy_type; /* temperature policy */ 211*0Sstevel@tonic-gate short policy_entries; /* # entries in policy_data */ 212*0Sstevel@tonic-gate tempr_t policy_data[MAX_POLICY_ENTRIES]; 213*0Sstevel@tonic-gate } sensor_thresh_t; 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate 217*0Sstevel@tonic-gate #define TEMP_IN_SHUTDOWN_RANGE(val, threshp) \ 218*0Sstevel@tonic-gate ((val) > (threshp)->high_shutdown || (val) < (threshp)->low_shutdown) 219*0Sstevel@tonic-gate 220*0Sstevel@tonic-gate #define TEMP_IN_WARNING_RANGE(val, threshp) \ 221*0Sstevel@tonic-gate ((val) > (threshp)->high_warning || (val) < (threshp)->low_warning) 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate 224*0Sstevel@tonic-gate /* 225*0Sstevel@tonic-gate * MAX1617 sensor min/max temperature limits 226*0Sstevel@tonic-gate */ 227*0Sstevel@tonic-gate #define MAX1617_MIN_TEMP -65 228*0Sstevel@tonic-gate #define MAX1617_MAX_TEMP 127 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate /* 231*0Sstevel@tonic-gate * CPU "die" temperature thresholds 232*0Sstevel@tonic-gate */ 233*0Sstevel@tonic-gate #define CPU_DIE_HIGH_POWER_OFF 110 234*0Sstevel@tonic-gate #define CPU_DIE_HIGH_SHUTDOWN 90 235*0Sstevel@tonic-gate #define CPU_DIE_HIGH_WARNING 88 236*0Sstevel@tonic-gate #define CPU_DIE_NORMAL_TARGET 80 237*0Sstevel@tonic-gate #define CPU_DIE_OTHER_TARGET 65 238*0Sstevel@tonic-gate #define CPU_DIE_LOW_WARNING 0 239*0Sstevel@tonic-gate #define CPU_DIE_LOW_SHUTDOWN -10 240*0Sstevel@tonic-gate #define CPU_DIE_LOW_POWER_OFF -20 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate /* 243*0Sstevel@tonic-gate * CPU ambient temperature thresholds 244*0Sstevel@tonic-gate */ 245*0Sstevel@tonic-gate #define CPU_AMB_HIGH_POWER_OFF 70 246*0Sstevel@tonic-gate #define CPU_AMB_HIGH_SHUTDOWN 60 247*0Sstevel@tonic-gate #define CPU_AMB_HIGH_WARNING 40 248*0Sstevel@tonic-gate #define CPU_AMB_HIGH_NOMINAL 40 249*0Sstevel@tonic-gate #define CPU_AMB_LOW_NOMINAL 25 250*0Sstevel@tonic-gate #define CPU_AMB_LOW_WARNING 0 251*0Sstevel@tonic-gate #define CPU_AMB_LOW_SHUTDOWN -10 252*0Sstevel@tonic-gate #define CPU_AMB_LOW_POWER_OFF -20 253*0Sstevel@tonic-gate 254*0Sstevel@tonic-gate 255*0Sstevel@tonic-gate /* 256*0Sstevel@tonic-gate * Fan names 257*0Sstevel@tonic-gate */ 258*0Sstevel@tonic-gate #define ENV_SYSTEM_FAN "system" 259*0Sstevel@tonic-gate #define ENV_CPU_FAN "cpu" 260*0Sstevel@tonic-gate #define ENV_PSUPPLY_FAN "power-supply" 261*0Sstevel@tonic-gate 262*0Sstevel@tonic-gate /* 263*0Sstevel@tonic-gate * Sensor ids & names 264*0Sstevel@tonic-gate */ 265*0Sstevel@tonic-gate #define SENSOR_CPU0_ID 0 266*0Sstevel@tonic-gate #define SENSOR_CPU0_DIE "cpu0" 267*0Sstevel@tonic-gate #define SENSOR_CPU0_AMB "cpu0-ambient" 268*0Sstevel@tonic-gate #define SENSOR_CPU1_ID 1 269*0Sstevel@tonic-gate #define SENSOR_CPU1_DIE "cpu1" 270*0Sstevel@tonic-gate #define SENSOR_CPU1_AMB "cpu1-ambient" 271*0Sstevel@tonic-gate 272*0Sstevel@tonic-gate /* 273*0Sstevel@tonic-gate * Temperature correction/map strucutre 274*0Sstevel@tonic-gate */ 275*0Sstevel@tonic-gate typedef struct { 276*0Sstevel@tonic-gate tempr_t observed; /* observed temperature */ 277*0Sstevel@tonic-gate tempr_t expected; /* expected temperature */ 278*0Sstevel@tonic-gate } tempr_map_t; 279*0Sstevel@tonic-gate 280*0Sstevel@tonic-gate /* 281*0Sstevel@tonic-gate * Temperature sensor related data structure 282*0Sstevel@tonic-gate */ 283*0Sstevel@tonic-gate typedef struct sensor_pmdev sensor_pmdev_t; 284*0Sstevel@tonic-gate 285*0Sstevel@tonic-gate typedef struct env_sensor { 286*0Sstevel@tonic-gate char *name; /* sensor name */ 287*0Sstevel@tonic-gate char *devfs_path; /* sensor device devfs path */ 288*0Sstevel@tonic-gate sensor_thresh_t *temp_thresh; /* sensor temp threshold */ 289*0Sstevel@tonic-gate char *fru; /* FRU seeprom pathname */ 290*0Sstevel@tonic-gate int fru_sensor; /* FRU sensor ID */ 291*0Sstevel@tonic-gate int flags; /* flags (see below) */ 292*0Sstevel@tonic-gate int fd; /* device file descriptor */ 293*0Sstevel@tonic-gate int error; /* error flag */ 294*0Sstevel@tonic-gate boolean_t present; /* sensor present */ 295*0Sstevel@tonic-gate tempr_t cur_temp; /* current temperature */ 296*0Sstevel@tonic-gate tempr_t target_temp; /* target temperature */ 297*0Sstevel@tonic-gate float avg_temp; /* average temperature */ 298*0Sstevel@tonic-gate float prev_avg_temp; /* prev average temperature */ 299*0Sstevel@tonic-gate time_t warning_tstamp; /* last warning time (secs) */ 300*0Sstevel@tonic-gate time_t shutdown_tstamp; /* shutdown temp time (secs) */ 301*0Sstevel@tonic-gate boolean_t shutdown_initiated; /* shutdown initated */ 302*0Sstevel@tonic-gate sensor_pmdev_t *pmdevp; /* power managed device info */ 303*0Sstevel@tonic-gate float fan_adjustment_rate; /* fan adjustment rate */ 304*0Sstevel@tonic-gate uint_t obs2exp_cnt; /* # mapping entries */ 305*0Sstevel@tonic-gate tempr_map_t *obs2exp_map; /* temperature map entries */ 306*0Sstevel@tonic-gate time_t warning_start; /* warning start time (secs) */ 307*0Sstevel@tonic-gate } env_sensor_t; 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate /* 310*0Sstevel@tonic-gate * Sensor flags 311*0Sstevel@tonic-gate */ 312*0Sstevel@tonic-gate #define SFLAG_TARGET_TEMP 0x01 /* track target temperature */ 313*0Sstevel@tonic-gate #define SFLAG_CPU_AMB_SENSOR 0x10 /* CPU ambient sensor */ 314*0Sstevel@tonic-gate #define SFLAG_CPU_DIE_SENSOR 0x20 /* CPU die snesor */ 315*0Sstevel@tonic-gate 316*0Sstevel@tonic-gate extern env_sensor_t *sensor_lookup(char *sensor_name); 317*0Sstevel@tonic-gate extern int get_temperature(env_sensor_t *, tempr_t *); 318*0Sstevel@tonic-gate 319*0Sstevel@tonic-gate /* 320*0Sstevel@tonic-gate * Fan information data structure 321*0Sstevel@tonic-gate */ 322*0Sstevel@tonic-gate #define SENSORS_PER_FAN 8 /* max sensors per fan */ 323*0Sstevel@tonic-gate typedef uint8_t fanspeed_t; 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate typedef struct env_fan { 326*0Sstevel@tonic-gate char *name; /* fan name */ 327*0Sstevel@tonic-gate char *devfs_path; /* fan device devfs path */ 328*0Sstevel@tonic-gate fanspeed_t speed_min; /* minimum speed */ 329*0Sstevel@tonic-gate fanspeed_t speed_max; /* maximum speed */ 330*0Sstevel@tonic-gate int forced_speed; /* forced (fixed) speed */ 331*0Sstevel@tonic-gate int fd; /* device file descriptor */ 332*0Sstevel@tonic-gate boolean_t present; /* fan present */ 333*0Sstevel@tonic-gate float cur_speed; /* current fan speed */ 334*0Sstevel@tonic-gate float prev_speed; /* previous fan speed */ 335*0Sstevel@tonic-gate int sensor_cnt; /* #sensors in sensors[] */ 336*0Sstevel@tonic-gate env_sensor_t *sensors[SENSORS_PER_FAN]; /* array of sensors */ 337*0Sstevel@tonic-gate } env_fan_t; 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate /* 340*0Sstevel@tonic-gate * LPM/Table data structures 341*0Sstevel@tonic-gate */ 342*0Sstevel@tonic-gate #define LPM_RANGES_PROPERTY "sunw,lpm-ranges" 343*0Sstevel@tonic-gate 344*0Sstevel@tonic-gate typedef struct { 345*0Sstevel@tonic-gate int32_t x; 346*0Sstevel@tonic-gate int32_t y; 347*0Sstevel@tonic-gate } point_t; 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate typedef struct { 350*0Sstevel@tonic-gate int nentries; 351*0Sstevel@tonic-gate point_t *xymap; 352*0Sstevel@tonic-gate } table_t; 353*0Sstevel@tonic-gate 354*0Sstevel@tonic-gate struct lpm_dev { 355*0Sstevel@tonic-gate picl_nodehdl_t nodeh; 356*0Sstevel@tonic-gate table_t *temp_lpm_tbl; 357*0Sstevel@tonic-gate struct lpm_dev *next; 358*0Sstevel@tonic-gate }; 359*0Sstevel@tonic-gate typedef struct lpm_dev lpm_dev_t; 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate extern env_fan_t *fan_lookup(char *fan_name); 362*0Sstevel@tonic-gate extern int get_fan_speed(env_fan_t *, fanspeed_t *); 363*0Sstevel@tonic-gate 364*0Sstevel@tonic-gate extern int env_debug; 365*0Sstevel@tonic-gate extern void envd_log(int pri, const char *fmt, ...); 366*0Sstevel@tonic-gate 367*0Sstevel@tonic-gate /* 368*0Sstevel@tonic-gate * Various messages 369*0Sstevel@tonic-gate */ 370*0Sstevel@tonic-gate #define ENVD_PLUGIN_INIT_FAILED \ 371*0Sstevel@tonic-gate gettext("SUNW_piclenvd: initialization failed!\n") 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate #define ENVD_PICL_SETUP_FAILED \ 374*0Sstevel@tonic-gate gettext("SUNW_piclenvd: PICL setup failed!\n") 375*0Sstevel@tonic-gate 376*0Sstevel@tonic-gate #define PM_THREAD_CREATE_FAILED \ 377*0Sstevel@tonic-gate gettext("SUNW_piclenvd: pmthr thread creation failed!\n") 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate #define PM_THREAD_EXITING \ 380*0Sstevel@tonic-gate gettext("SUNW_piclenvd: pmthr exiting! errno:%d %s\n") 381*0Sstevel@tonic-gate 382*0Sstevel@tonic-gate #define ENV_THREAD_CREATE_FAILED \ 383*0Sstevel@tonic-gate gettext("SUNW_piclenvd: envthr thread creation failed!\n") 384*0Sstevel@tonic-gate 385*0Sstevel@tonic-gate #define ENV_SHUTDOWN_MSG \ 386*0Sstevel@tonic-gate gettext("SUNW_piclenvd: '%s' sensor temperature %d outside safe " \ 387*0Sstevel@tonic-gate "limits (%d...%d). Shutting down the system.\n") 388*0Sstevel@tonic-gate 389*0Sstevel@tonic-gate #define ENV_WARNING_MSG \ 390*0Sstevel@tonic-gate gettext("SUNW_piclenvd: '%s' sensor temperature %d outside safe " \ 391*0Sstevel@tonic-gate "operating limits (%d...%d).\n") 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gate #define ENV_WATCHDOG_INIT_FAIL \ 394*0Sstevel@tonic-gate gettext("SUNW_piclenvd: failed to initialize the watchdog timer " \ 395*0Sstevel@tonic-gate "errno:%d %s\n") 396*0Sstevel@tonic-gate 397*0Sstevel@tonic-gate #define ENV_FAN_OPEN_FAIL \ 398*0Sstevel@tonic-gate gettext("SUNW_piclenvd: can't open '%s' fan path:%s errno:%d %s\n") 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate #define ENV_SENSOR_OPEN_FAIL \ 401*0Sstevel@tonic-gate gettext("SUNW_piclenvd: can't open '%s' sensor path:%s errno:%d %s\n") 402*0Sstevel@tonic-gate 403*0Sstevel@tonic-gate #define ENV_SENSOR_ACCESS_FAIL \ 404*0Sstevel@tonic-gate gettext("SUNW_piclenvd: can't access '%s' sensor errno:%d %s\n") 405*0Sstevel@tonic-gate 406*0Sstevel@tonic-gate #define ENV_SENSOR_ACCESS_OK \ 407*0Sstevel@tonic-gate gettext("SUNW_piclenvd: '%s' sensor is accessible now.\n") 408*0Sstevel@tonic-gate 409*0Sstevel@tonic-gate #define ENV_CONF_INT_EXPECTED \ 410*0Sstevel@tonic-gate gettext("SUNW_piclenvd: file:%s line:%d Invalid syntax or integer " \ 411*0Sstevel@tonic-gate "value outside range for keyword '%s'.\n") 412*0Sstevel@tonic-gate 413*0Sstevel@tonic-gate #define ENV_CONF_STRING_EXPECTED \ 414*0Sstevel@tonic-gate gettext("SUNW_piclenvd: file:%s line:%d Invalid syntax for keyword " \ 415*0Sstevel@tonic-gate "'%s'. Expecting string in double quotes (length < %d).\n") 416*0Sstevel@tonic-gate 417*0Sstevel@tonic-gate #define ENV_CONF_UNSUPPORTED_TYPE \ 418*0Sstevel@tonic-gate gettext("SUNW_piclenvd: file:%s line:%d Unsupported type:%d for " \ 419*0Sstevel@tonic-gate "keyword '%s'.\n") 420*0Sstevel@tonic-gate 421*0Sstevel@tonic-gate #define ENV_CONF_UNSUPPORTED_KEYWORD \ 422*0Sstevel@tonic-gate gettext("SUNW_piclenvd: file:%s line:%d Unsupported keyword '%s'.\n") 423*0Sstevel@tonic-gate 424*0Sstevel@tonic-gate #define ENV_FRU_OPEN_FAIL \ 425*0Sstevel@tonic-gate gettext("SUNW_piclenvd: can't open FRU SEEPROM path:%s errno:%d %s\n") 426*0Sstevel@tonic-gate 427*0Sstevel@tonic-gate #define ENV_FRU_BAD_ENVSEG \ 428*0Sstevel@tonic-gate gettext("SUNW_piclenvd: version mismatch or environmental segment " \ 429*0Sstevel@tonic-gate "header too short in FRU SEEPROM %s\n") 430*0Sstevel@tonic-gate 431*0Sstevel@tonic-gate #define ENV_FRU_BAD_SENSOR_ENTRY \ 432*0Sstevel@tonic-gate gettext("SUNW_piclenvd: discarding bad sensor entry (sensor_id " \ 433*0Sstevel@tonic-gate "%x sensor '%s') in FRU SEEPROM %s\n") 434*0Sstevel@tonic-gate 435*0Sstevel@tonic-gate #define ENV_FRU_SENSOR_MAP_NOMEM \ 436*0Sstevel@tonic-gate gettext("SUNW_piclenvd: out of memory, discarding sensor map for " \ 437*0Sstevel@tonic-gate "sensor_id %x (sensor '%s') in FRU SEEPROM %s\n") 438*0Sstevel@tonic-gate 439*0Sstevel@tonic-gate #define ENV_INVALID_PROPERTY_FORMAT \ 440*0Sstevel@tonic-gate gettext("SUNW_piclenvd: ignoring %s property (invalid format)") 441*0Sstevel@tonic-gate 442*0Sstevel@tonic-gate #ifdef __cplusplus 443*0Sstevel@tonic-gate } 444*0Sstevel@tonic-gate #endif 445*0Sstevel@tonic-gate 446*0Sstevel@tonic-gate #endif /* _ENVD_H */ 447