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