xref: /titanic_44/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h (revision 8eea8e29cc4374d1ee24c25a07f45af132db3499)
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 2002-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PICLENVMON_H
28 #define	_PICLENVMON_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * Log message texts
38  */
39 #define	EM_INIT_FAILED		gettext("SUNW_piclenvmon: init failed!")
40 #define	EM_MISSING_NODE		gettext("SUNW_piclenvmon: no %s node!")
41 #define	EM_SC_NODE_INCOMPLETE	\
42 	gettext("SUNW_piclenvmon: SC node devfs-path property missing")
43 #define	EM_SC_NODE_MISSING	\
44 	gettext("SUNW_piclenvmon: failed to locate SC device node")
45 #define	EM_EVREG_FAILED	\
46 	gettext("SUNW_piclenvmon: failed to register for events %x")
47 #define	EM_NODE_ACCESS		\
48 	gettext("SUNW_piclenvmon: couldn't access \"%s\", " \
49 	    "type %d, PICL err %d")
50 #define	EM_SYS_ERR		gettext("SUNW_piclenvmon: %s: %s")
51 #define	EM_EV_MISSING_ARG	\
52 	gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event")
53 #define	EM_INVALID_COLOR	\
54 	gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s")
55 
56 /*
57  * define for super-user uid - used in credential checking
58  */
59 #define	SUPER_USER		((uid_t)0)
60 
61 /*
62  * Constants for distinquishing environmental monitor types
63  */
64 #define	ENVMON_VOLT_SENS	0
65 #define	ENVMON_VOLT_IND		1
66 #define	ENVMON_AMP_SENS		2
67 #define	ENVMON_AMP_IND		3
68 #define	ENVMON_TEMP_SENS	4
69 #define	ENVMON_TEMP_IND		5
70 #define	ENVMON_FAN_SENS		6
71 #define	ENVMON_FAN_IND		7
72 #define	ENVMON_LED_IND		8
73 #define	ENVMON_KEY_SWITCH	9
74 #define	ENVMONTYPES		10
75 
76 /*
77  * number of key-switches supported
78  */
79 #define	N_KEY_SWITCHES		1
80 
81 /*
82  * nomenclature names used to identify LED significance
83  */
84 #define	LED_ACT		"ACT"
85 #define	LED_SERVICE	"SERVICE"
86 #define	LED_OK2RM	"OK2RM"
87 #define	LED_LOCATE	"LOCATE"
88 
89 #define	KEYSWITCH_NAME	"keyswitch"
90 
91 /*
92  * Config file name
93  */
94 #define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"
95 
96 typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
97 typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);
98 
99 typedef struct node_el {
100 	picl_nodehdl_t		nodeh;
101 	struct node_el		*next;
102 } node_el_t;
103 
104 typedef struct node_list {
105 	node_el_t	*head;
106 	node_el_t	*tail;
107 } node_list_t;
108 
109 /*
110  * index entry for looking up sensor handle
111  */
112 typedef struct {
113 	int		maxnum;	/* number of entries in handles array */
114 	int		num;	/* number of entries in being used */
115 	uchar_t		*fru_types;
116 	envmon_handle_t	*envhandles;
117 	picl_prophdl_t	*piclprhdls;
118 } handle_array_t;
119 
120 #ifdef	__cplusplus
121 }
122 #endif
123 
124 #endif	/* _PICLENVMON_H */
125