xref: /titanic_41/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h (revision 06e46062ef4f5f4b687cbafb4518fb123fe23920)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * Log message texts
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate #define	EM_INIT_FAILED		gettext("SUNW_piclenvmon: init failed!")
407c478bd9Sstevel@tonic-gate #define	EM_MISSING_NODE		gettext("SUNW_piclenvmon: no %s node!")
417c478bd9Sstevel@tonic-gate #define	EM_SC_NODE_INCOMPLETE	\
427c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: SC node devfs-path property missing")
437c478bd9Sstevel@tonic-gate #define	EM_SC_NODE_MISSING	\
447c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to locate SC device node")
457c478bd9Sstevel@tonic-gate #define	EM_EVREG_FAILED	\
467c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to register for events %x")
477c478bd9Sstevel@tonic-gate #define	EM_NODE_ACCESS		\
487c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: couldn't access \"%s\", " \
497c478bd9Sstevel@tonic-gate 	    "type %d, PICL err %d")
507c478bd9Sstevel@tonic-gate #define	EM_SYS_ERR		gettext("SUNW_piclenvmon: %s: %s")
517c478bd9Sstevel@tonic-gate #define	EM_EV_MISSING_ARG	\
527c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event")
537c478bd9Sstevel@tonic-gate #define	EM_INVALID_COLOR	\
547c478bd9Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s")
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate /*
577c478bd9Sstevel@tonic-gate  * define for super-user uid - used in credential checking
587c478bd9Sstevel@tonic-gate  */
597c478bd9Sstevel@tonic-gate #define	SUPER_USER		((uid_t)0)
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /*
627c478bd9Sstevel@tonic-gate  * Constants for distinquishing environmental monitor types
637c478bd9Sstevel@tonic-gate  */
647c478bd9Sstevel@tonic-gate #define	ENVMON_VOLT_SENS	0
657c478bd9Sstevel@tonic-gate #define	ENVMON_VOLT_IND		1
667c478bd9Sstevel@tonic-gate #define	ENVMON_AMP_SENS		2
677c478bd9Sstevel@tonic-gate #define	ENVMON_AMP_IND		3
687c478bd9Sstevel@tonic-gate #define	ENVMON_TEMP_SENS	4
697c478bd9Sstevel@tonic-gate #define	ENVMON_TEMP_IND		5
707c478bd9Sstevel@tonic-gate #define	ENVMON_FAN_SENS		6
717c478bd9Sstevel@tonic-gate #define	ENVMON_FAN_IND		7
727c478bd9Sstevel@tonic-gate #define	ENVMON_LED_IND		8
737c478bd9Sstevel@tonic-gate #define	ENVMON_KEY_SWITCH	9
74*06e46062Sjbeloro #define	ENVMON_CHASSIS		10
75*06e46062Sjbeloro 
76*06e46062Sjbeloro /*
77*06e46062Sjbeloro  * ENVMONTYPES is the total of all the environmental monitor types. Needs
78*06e46062Sjbeloro  * to be incrementee everytime a new type is added.
79*06e46062Sjbeloro  */
80*06e46062Sjbeloro #define	ENVMONTYPES		11
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate /*
837c478bd9Sstevel@tonic-gate  * number of key-switches supported
847c478bd9Sstevel@tonic-gate  */
857c478bd9Sstevel@tonic-gate #define	N_KEY_SWITCHES		1
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  * nomenclature names used to identify LED significance
897c478bd9Sstevel@tonic-gate  */
907c478bd9Sstevel@tonic-gate #define	LED_ACT		"ACT"
917c478bd9Sstevel@tonic-gate #define	LED_SERVICE	"SERVICE"
927c478bd9Sstevel@tonic-gate #define	LED_OK2RM	"OK2RM"
937c478bd9Sstevel@tonic-gate #define	LED_LOCATE	"LOCATE"
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate #define	KEYSWITCH_NAME		"keyswitch"
96*06e46062Sjbeloro #define	CHASSIS_SERIAL_NUMBER	"chassis_serial_number"
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate /*
997c478bd9Sstevel@tonic-gate  * Config file name
1007c478bd9Sstevel@tonic-gate  */
1017c478bd9Sstevel@tonic-gate #define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"
1027c478bd9Sstevel@tonic-gate 
1037c478bd9Sstevel@tonic-gate typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
1047c478bd9Sstevel@tonic-gate typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate typedef struct node_el {
1077c478bd9Sstevel@tonic-gate 	picl_nodehdl_t		nodeh;
1087c478bd9Sstevel@tonic-gate 	struct node_el		*next;
1097c478bd9Sstevel@tonic-gate } node_el_t;
1107c478bd9Sstevel@tonic-gate 
1117c478bd9Sstevel@tonic-gate typedef struct node_list {
1127c478bd9Sstevel@tonic-gate 	node_el_t	*head;
1137c478bd9Sstevel@tonic-gate 	node_el_t	*tail;
1147c478bd9Sstevel@tonic-gate } node_list_t;
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * index entry for looking up sensor handle
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate typedef struct {
1207c478bd9Sstevel@tonic-gate 	int		maxnum;	/* number of entries in handles array */
1217c478bd9Sstevel@tonic-gate 	int		num;	/* number of entries in being used */
1227c478bd9Sstevel@tonic-gate 	uchar_t		*fru_types;
1237c478bd9Sstevel@tonic-gate 	envmon_handle_t	*envhandles;
1247c478bd9Sstevel@tonic-gate 	picl_prophdl_t	*piclprhdls;
1257c478bd9Sstevel@tonic-gate } handle_array_t;
1267c478bd9Sstevel@tonic-gate 
1277c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1287c478bd9Sstevel@tonic-gate }
1297c478bd9Sstevel@tonic-gate #endif
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate #endif	/* _PICLENVMON_H */
132