xref: /illumos-gate/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*06e46062Sjbeloro  * Common Development and Distribution License (the "License").
6*06e46062Sjbeloro  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*06e46062Sjbeloro 
227c478bd9Sstevel@tonic-gate /*
23*06e46062Sjbeloro  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	_PICLENVMON_H
287c478bd9Sstevel@tonic-gate #define	_PICLENVMON_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
317c478bd9Sstevel@tonic-gate extern "C" {
327c478bd9Sstevel@tonic-gate #endif
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * Log message texts
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate #define	EM_INIT_FAILED		gettext("SUNW_piclenvmon: init failed!")
387c478bd9Sstevel@tonic-gate #define	EM_MISSING_NODE		gettext("SUNW_piclenvmon: no %s node!")
397c478bd9Sstevel@tonic-gate #define	EM_SC_NODE_INCOMPLETE	\
407c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: SC node devfs-path property missing")
417c478bd9Sstevel@tonic-gate #define	EM_SC_NODE_MISSING	\
427c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to locate SC device node")
437c478bd9Sstevel@tonic-gate #define	EM_EVREG_FAILED	\
447c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to register for events %x")
457c478bd9Sstevel@tonic-gate #define	EM_NODE_ACCESS		\
467c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: couldn't access \"%s\", " \
477c478bd9Sstevel@tonic-gate 	    "type %d, PICL err %d")
487c478bd9Sstevel@tonic-gate #define	EM_SYS_ERR		gettext("SUNW_piclenvmon: %s: %s")
497c478bd9Sstevel@tonic-gate #define	EM_EV_MISSING_ARG	\
507c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event")
517c478bd9Sstevel@tonic-gate #define	EM_INVALID_COLOR	\
527c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s")
537c478bd9Sstevel@tonic-gate 
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * define for super-user uid - used in credential checking
567c478bd9Sstevel@tonic-gate  */
577c478bd9Sstevel@tonic-gate #define	SUPER_USER		((uid_t)0)
587c478bd9Sstevel@tonic-gate 
597c478bd9Sstevel@tonic-gate /*
607c478bd9Sstevel@tonic-gate  * Constants for distinquishing environmental monitor types
617c478bd9Sstevel@tonic-gate  */
627c478bd9Sstevel@tonic-gate #define	ENVMON_VOLT_SENS	0
637c478bd9Sstevel@tonic-gate #define	ENVMON_VOLT_IND		1
647c478bd9Sstevel@tonic-gate #define	ENVMON_AMP_SENS		2
657c478bd9Sstevel@tonic-gate #define	ENVMON_AMP_IND		3
667c478bd9Sstevel@tonic-gate #define	ENVMON_TEMP_SENS	4
677c478bd9Sstevel@tonic-gate #define	ENVMON_TEMP_IND		5
687c478bd9Sstevel@tonic-gate #define	ENVMON_FAN_SENS		6
697c478bd9Sstevel@tonic-gate #define	ENVMON_FAN_IND		7
707c478bd9Sstevel@tonic-gate #define	ENVMON_LED_IND		8
717c478bd9Sstevel@tonic-gate #define	ENVMON_KEY_SWITCH	9
72*06e46062Sjbeloro #define	ENVMON_CHASSIS		10
73*06e46062Sjbeloro 
74*06e46062Sjbeloro /*
75*06e46062Sjbeloro  * ENVMONTYPES is the total of all the environmental monitor types. Needs
76*06e46062Sjbeloro  * to be incrementee everytime a new type is added.
77*06e46062Sjbeloro  */
78*06e46062Sjbeloro #define	ENVMONTYPES		11
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  * number of key-switches supported
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate #define	N_KEY_SWITCHES		1
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate /*
867c478bd9Sstevel@tonic-gate  * nomenclature names used to identify LED significance
877c478bd9Sstevel@tonic-gate  */
887c478bd9Sstevel@tonic-gate #define	LED_ACT		"ACT"
897c478bd9Sstevel@tonic-gate #define	LED_SERVICE	"SERVICE"
907c478bd9Sstevel@tonic-gate #define	LED_OK2RM	"OK2RM"
917c478bd9Sstevel@tonic-gate #define	LED_LOCATE	"LOCATE"
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	KEYSWITCH_NAME		"keyswitch"
94*06e46062Sjbeloro #define	CHASSIS_SERIAL_NUMBER	"chassis_serial_number"
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  * Config file name
987c478bd9Sstevel@tonic-gate  */
997c478bd9Sstevel@tonic-gate #define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
1027c478bd9Sstevel@tonic-gate typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate typedef struct node_el {
1057c478bd9Sstevel@tonic-gate 	picl_nodehdl_t		nodeh;
1067c478bd9Sstevel@tonic-gate 	struct node_el		*next;
1077c478bd9Sstevel@tonic-gate } node_el_t;
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate typedef struct node_list {
1107c478bd9Sstevel@tonic-gate 	node_el_t	*head;
1117c478bd9Sstevel@tonic-gate 	node_el_t	*tail;
1127c478bd9Sstevel@tonic-gate } node_list_t;
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate /*
1157c478bd9Sstevel@tonic-gate  * index entry for looking up sensor handle
1167c478bd9Sstevel@tonic-gate  */
1177c478bd9Sstevel@tonic-gate typedef struct {
1187c478bd9Sstevel@tonic-gate 	int		maxnum;	/* number of entries in handles array */
1197c478bd9Sstevel@tonic-gate 	int		num;	/* number of entries in being used */
1207c478bd9Sstevel@tonic-gate 	uchar_t		*fru_types;
1217c478bd9Sstevel@tonic-gate 	envmon_handle_t	*envhandles;
1227c478bd9Sstevel@tonic-gate 	picl_prophdl_t	*piclprhdls;
1237c478bd9Sstevel@tonic-gate } handle_array_t;
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1267c478bd9Sstevel@tonic-gate }
1277c478bd9Sstevel@tonic-gate #endif
1287c478bd9Sstevel@tonic-gate 
1297c478bd9Sstevel@tonic-gate #endif	/* _PICLENVMON_H */
130