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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_ENVD_H
27 #define	_ENVD_H
28 
29 #include <sys/types.h>
30 #include <libintl.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Chicago Platform Details
38  */
39 #define	MAX_SENSORS		9
40 #define	MAX_FANS		6
41 
42 /*
43  * Fan names and ids
44  */
45 #define	ENV_SYSTEM_FAN0		"system-fan0"
46 #define	ENV_SYSTEM_FAN1		"system-fan1"
47 #define	ENV_SYSTEM_FAN2		"system-fan2"
48 #define	ENV_SYSTEM_FAN3		"system-fan3"
49 #define	ENV_SYSTEM_FAN4		"system-fan4"
50 
51 #define	SYSTEM_FAN0_ID		0
52 #define	SYSTEM_FAN1_ID		1
53 #define	SYSTEM_FAN2_ID		2
54 #define	SYSTEM_FAN3_ID		3
55 #define	SYSTEM_FAN4_ID		4
56 
57 #define	CPU0_FAN_ID		SYSTEM_FAN0_ID
58 #define	CPU1_FAN_ID		SYSTEM_FAN1_ID
59 
60 /*
61  * Sensor names and ids
62  */
63 #define	SENSOR_CPU0		"cpu0"
64 #define	SENSOR_CPU1		"cpu1"
65 #define	SENSOR_MB		"MotherBoard"
66 #define	SENSOR_ADT7462		"ADT7462"
67 #define	SENSOR_LM95221		"LM95221"
68 #define	SENSOR_FIRE		"FireASIC"
69 #define	SENSOR_LSI1064		"LSI1064"
70 #define	SENSOR_FRONT_PANEL	"Front_panel"
71 #define	SENSOR_PSU		"PSU"
72 
73 #define	CPU0_SENSOR_ID		0
74 #define	CPU1_SENSOR_ID		1
75 #define	ADT7462_SENSOR_ID	2
76 #define	MB_SENSOR_ID		3
77 #define	LM95221_SENSOR_ID	4
78 #define	FIRE_SENSOR_ID		5
79 #define	LSI1064_SENSOR_ID	6
80 #define	FRONT_PANEL_SENSOR_ID	7
81 #define	PSU_SENSOR_ID		8
82 
83 /*
84  * Hard disk sensor names and ids
85  */
86 #define	ENV_DISK0		"hard-disk0"
87 #define	ENV_DISK1		"hard-disk1"
88 #define	ENV_DISK2		"hard-disk2"
89 #define	ENV_DISK3		"hard-disk3"
90 
91 #define	DISK0_ID		0
92 #define	DISK1_ID		1
93 #define	DISK2_ID		2
94 #define	DISK3_ID		3
95 
96 /*
97  * Thresholds and other constants
98  */
99 #define	DISK_SCAN_INTERVAL		10
100 #define	DISK_HIGH_WARN_TEMPERATURE	55
101 #define	DISK_LOW_WARN_TEMPERATURE	5
102 #define	DISK_HIGH_SHUTDOWN_TEMPERATURE	60
103 #define	DISK_LOW_SHUTDOWN_TEMPERATURE	0
104 #define	DISK_INVALID_TEMP		0xFFFF
105 #define	LSI1064_VENDOR_ID		0x1000
106 #define	LSI1064_DEVICE_ID		0x50
107 #define	FAN_SCAN_INTERVAL		10
108 #define	SENSOR_SCAN_INTERVAL		2
109 #define	SENSOR_WARNING_DURATION		4
110 #define	SENSOR_WARNING_INTERVAL		30
111 #define	DISK_WARNING_INTERVAL		30
112 #define	DISK_WARNING_DURATION		20
113 #define	SENSOR_SHUTDOWN_INTERVAL	60
114 #define	DISK_SHUTDOWN_INTERVAL		30
115 #define	ENV_CONF_FILE			"envmodel.conf"
116 #define	TUNABLE_CONF_FILE		"piclenvd.conf"
117 #define	PM_DEVICE			"/dev/pm"
118 #define	SHUTDOWN_CMD			"/usr/sbin/shutdown -y -g 60 -i 5"
119 #define	PICL_PLUGINS_NODE		"plugins"
120 #define	PICL_ENVIRONMENTAL_NODE		"environmental"
121 
122 #define	MAX_RETRIES_FOR_FAN_FAULT	10
123 #define	MAX_FAN_RETRIES			14
124 #define	MAX_SENSOR_RETRIES		14
125 
126 #define	TACH_TO_RPM(tach)	(((tach) == 0) ? 0 : (90000 * 60)/(tach))
127 
128 /*
129  * constants used for retrieving SMART data
130  */
131 #define	DEFAULT_SCSI_TIMEOUT		60
132 #define	IEC_PAGE			0x1C
133 #define	HDA_TEMP			0xc2
134 #define	DRIVE_TEMP			0xe7
135 #define	GET_SMART_INFO			0x31
136 #define	SMART_FIELDS			30
137 #define	REPORT_ON_REQUEST		0x6
138 #define	PAGE_FMT			4
139 #define	IEC_PAGE_SIZE			12
140 #define	SMART_FLAG_SIZE			2
141 #define	ATTRIBUTE_DATA_SIZE		8
142 #define	VENDOR_ATTR_SIZE		131
143 #define	SMART_RESERVED_SIZE		10
144 #define	COLLECTION_DATA_SIZE		6
145 
146 #define	DISK0_PHYSPATH	\
147 	"/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@0,0"
148 
149 #define	DISK1_PHYSPATH	\
150 	"/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@1,0"
151 
152 #define	DISK2_PHYSPATH  \
153 	"/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@2,0"
154 
155 #define	DISK3_PHYSPATH  \
156 	"/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@3,0"
157 
158 #define	ENV_DISK0_DEVFS	\
159 "/devices/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@0,0:a,raw"
160 
161 #define	ENV_DISK1_DEVFS	\
162 "/devices/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@1,0:a,raw"
163 
164 #define	ENV_DISK2_DEVFS \
165 "/devices/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@2,0:a,raw"
166 
167 #define	ENV_DISK3_DEVFS \
168 "/devices/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@3,0:a,raw"
169 
170 #define	DISK0_NODE_PATH	\
171 "name:/platform/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@0,0"
172 
173 #define	DISK1_NODE_PATH	\
174 "name:/platform/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@1,0"
175 
176 #define	DISK2_NODE_PATH \
177 "name:/platform/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@2,0"
178 
179 #define	DISK3_NODE_PATH \
180 "name:/platform/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1/sd@3,0"
181 
182 #define	SCSI_CONTROLLER_NODE_PATH	\
183 	"name:/platform/pci@1e,600000/pci@0/pci@9/pci@0/scsi@1"
184 
185 /* CPU Path Names */
186 #define	CPU0_PATH		"_class:/jbus/cpu?ID=0"
187 #define	CPU1_PATH		"_class:/jbus/cpu?ID=1"
188 
189 #define	ENV_MONITOR_DEVFS	"/devices/ebus@1f,464000/env-monitor@3,0"
190 
191 
192 /*
193  * devfs-path for various fans and their min/max speeds
194  */
195 #define	ENV_SYSTEM_FAN0_DEVFS	\
196 	"/devices/ebus@1f,464000/env-monitor@3,0:fan_0"
197 #define	ENV_SYSTEM_FAN1_DEVFS	\
198 	"/devices/ebus@1f,464000/env-monitor@3,0:fan_1"
199 #define	ENV_SYSTEM_FAN2_DEVFS	\
200 	"/devices/ebus@1f,464000/env-monitor@3,0:fan_2"
201 #define	ENV_SYSTEM_FAN3_DEVFS	\
202 	"/devices/ebus@1f,464000/env-monitor@3,0:fan_3"
203 #define	ENV_SYSTEM_FAN4_DEVFS	\
204 	"/devices/ebus@1f,464000/env-monitor@3,0:fan_4"
205 
206 /* MIN and MAX SPEED are in RPM units */
207 
208 #define	CPU_FAN_SPEED_MIN	250
209 #define	CPU_FAN_SPEED_MAX	5000
210 
211 #define	SYSTEM_FAN_SPEED_MIN	250
212 #define	SYSTEM_FAN_SPEED_MAX	5000
213 
214 /*
215  * devfs-path for various temperature sensors and CPU platform path
216  */
217 #define	SENSOR_CPU0_DEVFS	\
218 	"/devices/ebus@1f,464000/env-monitor@3,0:cpu_0"
219 #define	SENSOR_CPU1_DEVFS	\
220 	"/devices/ebus@1f,464000/env-monitor@3,0:cpu_1"
221 #define	SENSOR_MB_DEVFS	\
222 	"/devices/ebus@1f,464000/env-monitor@3,0:mb"
223 #define	SENSOR_ADT7462_DEVFS	\
224 	"/devices/ebus@1f,464000/env-monitor@3,0:adt7462"
225 #define	SENSOR_LM95221_DEVFS	\
226 	"/devices/ebus@1f,464000/env-monitor@3,0:lm95221"
227 #define	SENSOR_FIRE_DEVFS	\
228 	"/devices/ebus@1f,464000/env-monitor@3,0:fire"
229 #define	SENSOR_LSI1064_DEVFS	\
230 	"/devices/ebus@1f,464000/env-monitor@3,0:lsi1064"
231 #define	SENSOR_FRONT_PANEL_DEVFS	\
232 	"/devices/ebus@1f,464000/env-monitor@3,0:front_panel"
233 #define	SENSOR_PSU_DEVFS	\
234 	"/devices/ebus@1f,464000/env-monitor@3,0:psu"
235 
236 /*
237  * Temperature type
238  */
239 typedef int16_t tempr_t;
240 
241 /*
242  *				SEEPROM LAYOUT
243  *
244  *      The layout of environmental segment in the SEEPROM in Chicago is as
245  *      shown below. Note that this is a stripped-down version of the Envseg
246  *      Definition v2.0 (but compatible). In particular, piclenvd in Chicago
247  *      does not use the #FanEntries and the list of FANn_ID/FANn_DOFF
248  *      pairs, and it doesn't use the SensorPolicy and the list of
249  *      Measured/Corrected pairs for the temperature sensor values either.
250  *
251  *
252  *                   0         1         2         3         4         5
253  *		+---------+------------------+----------+---------+---------+
254  *	0x1800:	| HDR_TAG |      HDR_VER     |  HDR_LEN | HDR_CRC |  N_SEGS |
255  *		+---------+---------+--------+----------+---------+---------+
256  *	0x1806:	|     SEG1_NAME	    |	            SEG1_DESC               |
257  *		+-------------------+-------------------+-------------------+
258  *	0x180C:	|     SEG1_OFF	    |	  SEG1_LEN	|      SEG2_NAME    |
259  *		+-------------------+-------------------+-------------------+
260  *		~							    ~
261  *		.							    .
262  *		~							    ~
263  *		+-------------------+-------------------+-------------------+
264  *	0xXXXX:	|     SEGn_OFF	    |	  SEGn_LEN	|
265  *		+-------------------+-------------------+
266  *
267  *
268  *              +---------+---------+---------------------------------------+
269  *  ENVSEG_OFF:	| ESEG_VER| N_SNSRS |            SENSOR1_ID                 |
270  *              +---------+---------+---------------------------------------+
271  *	        |    SNSR1_DOFF     |            SENSOR2_ID                 |
272  *              +-------------------+---------------------------------------+
273  *		~							    ~
274  *		~							    ~
275  *		+-------------------+---------------------------------------+
276  *	        |    SNSRm_DOFF     |
277  *              +-------------------+
278  *
279  *
280  *		+---------+---------+--------+----------+---------+---------+
281  * SNSRk_DOFF:	| HI_POFF | HI_SHUT | HI_WARN| LO_WARN  | LO_SHUT | LO_POFF |
282  *              +-------------------+--------+----------+---------+---------+
283  */
284 
285 #define	I2C_DEVFS		"/devices/ebus@1f,464000/i2c@3,80"
286 #define	IOFRU_DEV		"front-io-fru-prom@0,a4:front-io-fru-prom"
287 #define	FRU_SEEPROM_NAME	"front-io-fru-prom"
288 
289 /*
290  * SEEPROM section header
291  */
292 #define	SSCN_TAG	0x08
293 #define	SSCN_VER	0x0001
294 #define	SSCN_OFFSET	0x1800
295 typedef struct {
296 	uint8_t sscn_tag;		/* section header tag */
297 	uint8_t sscn_ver[2];		/* section header version */
298 	uint8_t sscn_len;		/* section header length */
299 	uint8_t sscn_crc;		/* unused */
300 	uint8_t sscn_nsegs;		/* total number of segments */
301 } seeprom_scn_t;
302 
303 /*
304  * SEEPROM segment header
305  */
306 typedef struct {
307 	uint16_t sseg_name;		/* segment name */
308 	uint16_t sseg_desc[2];		/* segment descriptor */
309 	uint16_t sseg_off;		/* segment data offset */
310 	uint16_t sseg_len;		/* segment length */
311 } seeprom_seg_t;
312 #define	ENVSEG_NAME	0x4553		/* "ES" */
313 
314 /*
315  * Envseg layout V2 (stripped-down version)
316  */
317 typedef struct {
318 	uint8_t esb_high_power_off;
319 	uint8_t esb_high_shutdown;
320 	uint8_t esb_high_warning;
321 	uint8_t esb_low_warning;
322 	uint8_t esb_low_shutdown;
323 	uint8_t esb_low_power_off;
324 } es_sensor_blk_t;
325 
326 typedef struct {
327 	uint16_t ess_id[2];		/* unique sensor id (on this FRU) */
328 	uint16_t ess_off;		/* sensor data blk offset */
329 } es_sensor_t;
330 
331 #define	ENVSEG_VERSION	2
332 typedef struct {
333 	uint8_t esd_ver;		/* envseg version */
334 	uint8_t esd_nsensors;		/* envseg total number of sensor blks */
335 	es_sensor_t esd_sensors[1];	/* sensor table (variable length) */
336 } es_data_t;
337 
338 /*
339  * Macros to fetch 16 and 32 bit msb-to-lsb data from unaligned addresses
340  */
341 #define	GET_UNALIGN16(addr)	\
342 	(((*(uint8_t *)addr) << 8) | *((uint8_t *)addr + 1))
343 #define	GET_UNALIGN32(addr)	\
344 	(GET_UNALIGN16(addr) << 16) | GET_UNALIGN16((uint8_t *)addr + 2)
345 
346 /*
347  * Macros to check sensor/disk temperatures
348  */
349 #define	SENSOR_TEMP_IN_WARNING_RANGE(val, sensorp) \
350 	((val) > (sensorp)->es->esb_high_warning || \
351 	(val) < (char)((sensorp)->es->esb_low_warning))
352 
353 #define	SENSOR_TEMP_IN_SHUTDOWN_RANGE(val, sensorp) \
354 	((val) > (sensorp)->es->esb_high_shutdown || \
355 	(val) < (char)((sensorp)->es->esb_low_shutdown))
356 
357 #define	DISK_TEMP_IN_WARNING_RANGE(val, diskp) \
358 	((val) > (diskp)->high_warning || \
359 	(val) < (char)((diskp)->low_warning))
360 
361 #define	DISK_TEMP_IN_SHUTDOWN_RANGE(val, diskp) \
362 	((val) > (diskp)->high_shutdown || \
363 	(val) < (char)((diskp)->low_shutdown))
364 
365 #define	SENSOR_WARN		1
366 #define	SENSOR_OK		0
367 
368 #define	FAN_FAILED		1
369 #define	FAN_OK			0
370 
371 /*
372  * Default limits for sensors in case environmental segment is absent
373  */
374 #define	CPU0_HIGH_POWER_OFF		105
375 #define	CPU0_HIGH_SHUTDOWN		100
376 #define	CPU0_HIGH_WARNING		95
377 #define	CPU0_LOW_WARNING		5
378 #define	CPU0_LOW_SHUTDOWN		0
379 #define	CPU0_LOW_POWER_OFF		0
380 
381 #define	CPU1_HIGH_POWER_OFF		105
382 #define	CPU1_HIGH_SHUTDOWN		100
383 #define	CPU1_HIGH_WARNING		95
384 #define	CPU1_LOW_WARNING		5
385 #define	CPU1_LOW_SHUTDOWN		0
386 #define	CPU1_LOW_POWER_OFF		0
387 
388 #define	ADT7462_HIGH_POWER_OFF		80
389 #define	ADT7462_HIGH_SHUTDOWN		75
390 #define	ADT7462_HIGH_WARNING		70
391 #define	ADT7462_LOW_WARNING		5
392 #define	ADT7462_LOW_SHUTDOWN		0
393 #define	ADT7462_LOW_POWER_OFF		0
394 
395 #define	MB_HIGH_POWER_OFF		80
396 #define	MB_HIGH_SHUTDOWN		75
397 #define	MB_HIGH_WARNING			70
398 #define	MB_LOW_WARNING			5
399 #define	MB_LOW_SHUTDOWN			0
400 #define	MB_LOW_POWER_OFF		0
401 
402 #define	LM95221_HIGH_POWER_OFF		80
403 #define	LM95221_HIGH_SHUTDOWN		75
404 #define	LM95221_HIGH_WARNING		70
405 #define	LM95221_LOW_WARNING		5
406 #define	LM95221_LOW_SHUTDOWN		0
407 #define	LM95221_LOW_POWER_OFF		0
408 
409 #define	FIRE_HIGH_POWER_OFF		105
410 #define	FIRE_HIGH_SHUTDOWN		100
411 #define	FIRE_HIGH_WARNING		95
412 #define	FIRE_LOW_WARNING		5
413 #define	FIRE_LOW_SHUTDOWN		0
414 #define	FIRE_LOW_POWER_OFF		0
415 
416 #define	LSI1064_HIGH_POWER_OFF		105
417 #define	LSI1064_HIGH_SHUTDOWN		100
418 #define	LSI1064_HIGH_WARNING		95
419 #define	LSI1064_LOW_WARNING		5
420 #define	LSI1064_LOW_SHUTDOWN		0
421 #define	LSI1064_LOW_POWER_OFF		0
422 
423 #define	FRONT_PANEL_HIGH_POWER_OFF	75
424 #define	FRONT_PANEL_HIGH_SHUTDOWN	70
425 #define	FRONT_PANEL_HIGH_WARNING	60
426 #define	FRONT_PANEL_LOW_WARNING		5
427 #define	FRONT_PANEL_LOW_SHUTDOWN	0
428 #define	FRONT_PANEL_LOW_POWER_OFF	0
429 
430 #define	PSU_HIGH_POWER_OFF		95
431 #define	PSU_HIGH_SHUTDOWN		85
432 #define	PSU_HIGH_WARNING		75
433 #define	PSU_LOW_WARNING			5
434 #define	PSU_LOW_SHUTDOWN		0
435 #define	PSU_LOW_POWER_OFF		0
436 
437 /*
438  * Temperature sensor related data structure
439  */
440 typedef struct env_sensor {
441 	char		*name;			/* sensor name */
442 	char		*devfs_path;		/* sensor device devfs path */
443 	int		id;
444 	int		fd;			/* device file descriptor */
445 	es_sensor_blk_t	*es;
446 	int		error;			/* error flag */
447 	boolean_t 	present;		/* sensor present */
448 	tempr_t		cur_temp;		/* current temperature */
449 	time_t		warning_start;		/* warning start time (secs) */
450 	time_t		warning_tstamp;		/* last warning time (secs) */
451 	time_t		shutdown_tstamp;	/* shutdown temp time (secs) */
452 	boolean_t 	shutdown_initiated;	/* shutdown initated */
453 } env_sensor_t;
454 
455 extern	env_sensor_t *sensor_lookup(char *sensor_name);
456 extern	int get_temperature(env_sensor_t *, tempr_t *);
457 
458 typedef struct env_disk {
459 	char		*name;			/* disk name */
460 	char		*devfs_path;	/* disk device devfs path */
461 	char		*physpath;	/* used to be probe for IDLW TIME */
462 	char		*nodepath;	/* used to detect presence of disk */
463 	uchar_t		id;
464 	int		fd;		/* device file descriptor */
465 	boolean_t	present;	/* disk present */
466 	boolean_t	tpage_supported;	/* Temperature page */
467 	boolean_t	smart_supported;
468 	int		current_temp;
469 	int		ref_temp;
470 	int		reliability_temp;
471 	uchar_t  	high_shutdown;
472 	uchar_t  	high_warning;
473 	uchar_t  	low_warning;
474 	uchar_t  	low_shutdown;
475 	time_t		warning_start;		/* warning start time (secs) */
476 	time_t		warning_tstamp;		/* last warning time (secs) */
477 	time_t		shutdown_tstamp;	/* shutdown temp time (secs) */
478 	boolean_t 	shutdown_initiated;	/* shutdown initated */
479 } env_disk_t;
480 
481 extern	env_disk_t *disk_lookup(char *disk_name);
482 extern	int disk_temperature(env_disk_t *, tempr_t *);
483 
484 /*
485  * Fan information data structure
486  */
487 typedef int fanspeed_t;
488 
489 typedef struct env_fan {
490 	char		*name;			/* fan name */
491 	char		*devfs_path;		/* fan device devfs path */
492 	uchar_t		id;
493 	fanspeed_t	speed_min;		/* minimum speed */
494 	fanspeed_t	speed_max;		/* maximum speed */
495 	int		forced_speed;		/* forced (fixed) speed */
496 	int		fd;			/* device file descriptor */
497 	boolean_t	present;		/* fan present */
498 	int		last_status;		/* Fan status */
499 	uint8_t		cspeed;			/* Current speed (tach) */
500 	uint8_t		lspeed;			/* Last speed (tach) */
501 } env_fan_t;
502 
503 /*
504  * Tuneables
505  */
506 typedef struct env_tuneable {
507 	char		*name;
508 	char		type;
509 	void		*value;
510 	int		(*rfunc)(ptree_rarg_t *, void *);
511 	int		(*wfunc)(ptree_warg_t *, const void *);
512 	int		nbytes;
513 	picl_prophdl_t proph;
514 } env_tuneable_t;
515 
516 /*
517  * Smart structures
518  */
519 
520 typedef	struct smart_field {
521 	uint8_t id;
522 	uint8_t flags[SMART_FLAG_SIZE];
523 	uint8_t raw_data[ATTRIBUTE_DATA_SIZE];
524 	uint8_t	reserved;
525 } smart_attribute;
526 
527 typedef struct smart_struct {
528 	uint16_t	revision;		/* SMART version # */
529 	struct smart_field attribute[SMART_FIELDS];
530 			/* offline collection information */
531 	uint8_t		collection_status[COLLECTION_DATA_SIZE];
532 	uint16_t	capability;		/* SMART capability */
533 	uint8_t		reserved[SMART_RESERVED_SIZE];
534 	uint8_t		vendor_specific[VENDOR_ATTR_SIZE];
535 	uint8_t		checksum;		/* page checksum */
536 } smart_structure;
537 
538 extern	env_fan_t *fan_lookup(char *fan_name);
539 extern	int get_fan_speed(env_fan_t *, fanspeed_t *);
540 extern	int set_fan_speed(env_fan_t *, fanspeed_t);
541 
542 extern int env_debug;
543 extern void envd_log(int pri, const char *fmt, ...);
544 
545 /*
546  * Various messages
547  */
548 #define	ENVD_PLUGIN_INIT_FAILED		\
549 	gettext("SUNW_piclenvd: initialization failed!\n")
550 
551 #define	ENVD_PICL_SETUP_FAILED		\
552 	gettext("SUNW_piclenvd: PICL setup failed!\n")
553 
554 #define	PM_THREAD_CREATE_FAILED		\
555 	gettext("SUNW_piclenvd: pmthr thread creation failed!\n")
556 
557 #define	PM_THREAD_EXITING		\
558 	gettext("SUNW_piclenvd: pmthr exiting! errno:%d %s\n")
559 
560 #define	DISK_TEMP_THREAD_EXITING		\
561 	gettext("SUNW_piclenvd: Disk temp thread exiting."	\
562 	" Disk temperature will not be monitored. errno:%d %s\n")
563 
564 #define	ENVTHR_THREAD_CREATE_FAILED	\
565 	gettext("SUNW_piclenvd: envthr thread creation failed!\n")
566 
567 #define	ENV_SHUTDOWN_MSG		\
568 	gettext("SUNW_piclenvd: '%s' sensor temperature %d outside safe " \
569 	"limits (%d...%d). Shutting down the system.\n")
570 
571 #define	ENV_WARNING_MSG			\
572 	gettext("SUNW_piclenvd: '%s' sensor temperature %d outside safe " \
573 	"operating limits (%d...%d).\n")
574 
575 #define	ENV_FAN_OPEN_FAIL		\
576 	gettext("SUNW_piclenvd: can't open '%s' fan path:%s errno:%d %s\n")
577 
578 #define	ENV_SENSOR_OPEN_FAIL		\
579 	gettext("SUNW_piclenvd: can't open '%s' sensor path:%s errno:%d %s\n")
580 
581 #define	ENV_SENSOR_ACCESS_FAIL		\
582 	gettext("SUNW_piclenvd: can't access '%s' sensor errno:%d %s\n")
583 
584 #define	ENV_SENSOR_ACCESS_OK		\
585 	gettext("SUNW_piclenvd: '%s' sensor is accessible now.\n")
586 
587 #define	ENV_FAN_FAILURE_WARNING_MSG		\
588 	gettext("SUNW_piclenvd: %s has Failed.\n"	\
589 	"(rpm = %s status = %s)\n")
590 
591 #define	ENV_FAN_OK_MSG		\
592 	gettext("SUNW_piclenvd: %s is OKAY.\n")
593 
594 #define	ENV_FRU_OPEN_FAIL		\
595 	gettext("SUNW_piclenvd: can't open FRU SEEPROM path:%s errno:%d\n")
596 
597 #define	ENV_FRU_BAD_ENVSEG		\
598 	gettext("SUNW_piclenvd: version mismatch or environmental segment " \
599 		"header too short in FRU SEEPROM %s\n")
600 
601 #define	ENV_FRU_BAD_SCNHDR		\
602 	gettext("SUNW_piclenvd: invalid section header tag:%x version:%x\n")
603 
604 #define	ENV_FRU_NOMEM_FOR_SEG		\
605 	gettext("SUNW_piclenvd: cannot allocate %d bytes for env seg memory\n")
606 
607 #define	ENV_DEFAULT_LIMITS		\
608 	gettext("SUNW_piclenvd: error reading ES segment, using defaults\n")
609 
610 #ifdef	__cplusplus
611 }
612 #endif
613 
614 #endif	/* _ENVD_H */
615