1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _PICLSENSORS_H 28 #define _PICLSENSORS_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 #define CPU_SENSOR "CPU-sensor" 37 #define EEPROM_WARNING_CMD "eeprom warning-temperature=%d" 38 #define EEPROM_SHUTDOWN_CMD "eeprom critical-temperature=%d" 39 #define EEPROM_POWEROFF_CMD "eeprom shutdown-temperature=%d" 40 41 #define ENV_TEMP_MONITOR_TIME 60 /* 60 secs */ 42 43 #define NUM_OF_THRESHOLDS 6 44 #define MAX_POWEROFF_TEMP 84 45 46 typedef struct { 47 uint8_t sensor_no; 48 int8_t curr_temp; 49 int8_t hi_poweroff; 50 int8_t hi_shutdown; 51 int8_t hi_warning; 52 int8_t lo_poweroff; 53 int8_t lo_shutdown; 54 int8_t lo_warning; 55 char state[20]; 56 } env_temp_sensor_t; 57 58 typedef enum { 59 NORMAL_THRESHOLD = 0x0, /* temp is within thresholds */ 60 LOW_WARNING_THRESHOLD = 0x1, 61 LOW_SHUTDOWN_THRESHOLD = 0x2, 62 LOW_POWEROFF_THRESHOLD = 0x3, 63 HIGH_WARNING_THRESHOLD = 0x4, 64 HIGH_SHUTDOWN_THRESHOLD = 0x5, 65 HIGH_POWEROFF_THRESHOLD = 0x6 66 } env_temp_threshold_t; 67 68 #define LOW_WARNING_BIT(_X) (BIT_0(_X)) 69 #define LOW_SHUTDOWN_BIT(_X) (BIT_1(_X)) 70 #define LOW_POWEROFF_BIT(_X) (BIT_2(_X)) 71 #define HIGH_WARNING_BIT(_X) (BIT_3(_X)) 72 #define HIGH_SHUTDOWN_BIT(_X) (BIT_4(_X)) 73 #define HIGH_POWEROFF_BIT(_X) (BIT_5(_X)) 74 75 #define THRESHOLD_TYPE 0x1 76 77 #define SMC_GET_SENSOR_READING_FAILED \ 78 gettext("SUNW_envmond: Error in getting sensor reading, "\ 79 "sensor = %d, errno = %d\n") 80 #define SMC_GET_SENSOR_THRES_FAILED \ 81 gettext("SUNW_envmond: Error in getting sensor threshold, "\ 82 "sensor = %d, errno = %d\n") 83 #define SMC_SET_SENSOR_THRES_FAILED \ 84 gettext("SUNW_envmond: Error in setting sensor threshold, "\ 85 "sensor = %d, errno = %d\n") 86 #define SMC_GET_LWT_FAILED \ 87 gettext("SUNW_envmond: Error in getting low warning threshold") 88 #define SMC_GET_LST_FAILED \ 89 gettext("SUNW_envmond: Error in getting low shutdown threshold") 90 #define SMC_GET_LPT_FAILED \ 91 gettext("SUNW_envmond: Error in getting low poweroff threshold") 92 #define SMC_GET_HWT_FAILED \ 93 gettext("SUNW_envmond: Error in getting high warning threshold") 94 #define SMC_GET_HST_FAILED \ 95 gettext("SUNW_envmond: Error in getting high shutdown threshold") 96 #define SMC_GET_HPT_FAILED \ 97 gettext("SUNW_envmond: Error in getting high poweroff threshold") 98 #define SMC_SET_LWT_FAILED \ 99 gettext("SUNW_envmond: Error in setting low warning threshold") 100 #define SMC_SET_LST_FAILED \ 101 gettext("SUNW_envmond: Error in setting low shutdown threshold") 102 #define SMC_SET_LPT_FAILED \ 103 gettext("SUNW_envmond: Error in setting low poweroff threshold") 104 #define SMC_SET_HWT_FAILED \ 105 gettext("SUNW_envmond: Error in setting high warning threshold") 106 #define SMC_SET_HST_FAILED \ 107 gettext("SUNW_envmond: Error in setting high shutdown threshold") 108 #define SMC_SET_HPT_FAILED \ 109 gettext("SUNW_envmond: Error in setting high poweroff threshold") 110 #define SMC_ENABLE_SENSOR_EVENT_FAILED \ 111 gettext("SUNW_envmond: Error in enabling sesnor events, error = %d") 112 #define SMC_GET_EXCLUSIVE_ERR \ 113 gettext("SUNW_envmond:Error in getting exclusive access to set "\ 114 "temperature sensor thresholds") 115 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* _PICLSENSORS_H */ 120