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 2004 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	_PICLSENSORS_H
28*0Sstevel@tonic-gate #define	_PICLSENSORS_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #define	CPU_SENSOR		"CPU-sensor"
37*0Sstevel@tonic-gate #define	EEPROM_WARNING_CMD 	"eeprom warning-temperature=%d"
38*0Sstevel@tonic-gate #define	EEPROM_SHUTDOWN_CMD	"eeprom critical-temperature=%d"
39*0Sstevel@tonic-gate #define	EEPROM_POWEROFF_CMD	"eeprom shutdown-temperature=%d"
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate #define	ENV_TEMP_MONITOR_TIME	60	/* 60 secs */
42*0Sstevel@tonic-gate 
43*0Sstevel@tonic-gate #define	NUM_OF_THRESHOLDS	6
44*0Sstevel@tonic-gate #define	MAX_POWEROFF_TEMP	84
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate typedef struct {
47*0Sstevel@tonic-gate uint8_t sensor_no;
48*0Sstevel@tonic-gate 	int8_t  curr_temp;
49*0Sstevel@tonic-gate 	int8_t  hi_poweroff;
50*0Sstevel@tonic-gate 	int8_t  hi_shutdown;
51*0Sstevel@tonic-gate 	int8_t  hi_warning;
52*0Sstevel@tonic-gate 	int8_t  lo_poweroff;
53*0Sstevel@tonic-gate 	int8_t  lo_shutdown;
54*0Sstevel@tonic-gate 	int8_t  lo_warning;
55*0Sstevel@tonic-gate 	char    state[20];
56*0Sstevel@tonic-gate } env_temp_sensor_t;
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate typedef enum {
59*0Sstevel@tonic-gate 	NORMAL_THRESHOLD = 0x0,		/* temp is within thresholds */
60*0Sstevel@tonic-gate 	LOW_WARNING_THRESHOLD = 0x1,
61*0Sstevel@tonic-gate 	LOW_SHUTDOWN_THRESHOLD = 0x2,
62*0Sstevel@tonic-gate 	LOW_POWEROFF_THRESHOLD = 0x3,
63*0Sstevel@tonic-gate 	HIGH_WARNING_THRESHOLD = 0x4,
64*0Sstevel@tonic-gate 	HIGH_SHUTDOWN_THRESHOLD = 0x5,
65*0Sstevel@tonic-gate 	HIGH_POWEROFF_THRESHOLD = 0x6
66*0Sstevel@tonic-gate } env_temp_threshold_t;
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate #define	LOW_WARNING_BIT(_X)		(BIT_0(_X))
69*0Sstevel@tonic-gate #define	LOW_SHUTDOWN_BIT(_X)		(BIT_1(_X))
70*0Sstevel@tonic-gate #define	LOW_POWEROFF_BIT(_X)		(BIT_2(_X))
71*0Sstevel@tonic-gate #define	HIGH_WARNING_BIT(_X)		(BIT_3(_X))
72*0Sstevel@tonic-gate #define	HIGH_SHUTDOWN_BIT(_X)		(BIT_4(_X))
73*0Sstevel@tonic-gate #define	HIGH_POWEROFF_BIT(_X)		(BIT_5(_X))
74*0Sstevel@tonic-gate 
75*0Sstevel@tonic-gate #define	THRESHOLD_TYPE			0x1
76*0Sstevel@tonic-gate 
77*0Sstevel@tonic-gate #define	SMC_GET_SENSOR_READING_FAILED \
78*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting sensor reading, "\
79*0Sstevel@tonic-gate 	"sensor = %d, errno = %d\n")
80*0Sstevel@tonic-gate #define	SMC_GET_SENSOR_THRES_FAILED \
81*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting sensor threshold, "\
82*0Sstevel@tonic-gate 	"sensor = %d, errno = %d\n")
83*0Sstevel@tonic-gate #define	SMC_SET_SENSOR_THRES_FAILED \
84*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting sensor threshold, "\
85*0Sstevel@tonic-gate 	"sensor = %d, errno = %d\n")
86*0Sstevel@tonic-gate #define	SMC_GET_LWT_FAILED \
87*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting low warning threshold")
88*0Sstevel@tonic-gate #define	SMC_GET_LST_FAILED \
89*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting low shutdown threshold")
90*0Sstevel@tonic-gate #define	SMC_GET_LPT_FAILED \
91*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting low poweroff threshold")
92*0Sstevel@tonic-gate #define	SMC_GET_HWT_FAILED \
93*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting high warning threshold")
94*0Sstevel@tonic-gate #define	SMC_GET_HST_FAILED \
95*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting high shutdown threshold")
96*0Sstevel@tonic-gate #define	SMC_GET_HPT_FAILED \
97*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in getting high poweroff threshold")
98*0Sstevel@tonic-gate #define	SMC_SET_LWT_FAILED \
99*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting low warning threshold")
100*0Sstevel@tonic-gate #define	SMC_SET_LST_FAILED \
101*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting low shutdown threshold")
102*0Sstevel@tonic-gate #define	SMC_SET_LPT_FAILED \
103*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting low poweroff threshold")
104*0Sstevel@tonic-gate #define	SMC_SET_HWT_FAILED \
105*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting high warning threshold")
106*0Sstevel@tonic-gate #define	SMC_SET_HST_FAILED \
107*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting high shutdown threshold")
108*0Sstevel@tonic-gate #define	SMC_SET_HPT_FAILED \
109*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in setting high poweroff threshold")
110*0Sstevel@tonic-gate #define	SMC_ENABLE_SENSOR_EVENT_FAILED \
111*0Sstevel@tonic-gate 	gettext("SUNW_envmond: Error in enabling sesnor events, error = %d")
112*0Sstevel@tonic-gate #define	SMC_GET_EXCLUSIVE_ERR \
113*0Sstevel@tonic-gate 	gettext("SUNW_envmond:Error in getting exclusive access to set "\
114*0Sstevel@tonic-gate 		"temperature sensor thresholds")
115*0Sstevel@tonic-gate #ifdef	__cplusplus
116*0Sstevel@tonic-gate }
117*0Sstevel@tonic-gate #endif
118*0Sstevel@tonic-gate 
119*0Sstevel@tonic-gate #endif	/* _PICLSENSORS_H */
120