xref: /titanic_50/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h (revision 0bb073995ac5a95bd35f2dd790df1ea3d8c2d507)
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 /*
23  * Copyright 2005 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	ENVMON_CHASSIS		10
75 
76 /*
77  * ENVMONTYPES is the total of all the environmental monitor types. Needs
78  * to be incrementee everytime a new type is added.
79  */
80 #define	ENVMONTYPES		11
81 
82 /*
83  * number of key-switches supported
84  */
85 #define	N_KEY_SWITCHES		1
86 
87 /*
88  * nomenclature names used to identify LED significance
89  */
90 #define	LED_ACT		"ACT"
91 #define	LED_SERVICE	"SERVICE"
92 #define	LED_OK2RM	"OK2RM"
93 #define	LED_LOCATE	"LOCATE"
94 
95 #define	KEYSWITCH_NAME		"keyswitch"
96 #define	CHASSIS_SERIAL_NUMBER	"chassis_serial_number"
97 
98 /*
99  * Config file name
100  */
101 #define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"
102 
103 typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
104 typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);
105 
106 typedef struct node_el {
107 	picl_nodehdl_t		nodeh;
108 	struct node_el		*next;
109 } node_el_t;
110 
111 typedef struct node_list {
112 	node_el_t	*head;
113 	node_el_t	*tail;
114 } node_list_t;
115 
116 /*
117  * index entry for looking up sensor handle
118  */
119 typedef struct {
120 	int		maxnum;	/* number of entries in handles array */
121 	int		num;	/* number of entries in being used */
122 	uchar_t		*fru_types;
123 	envmon_handle_t	*envhandles;
124 	picl_prophdl_t	*piclprhdls;
125 } handle_array_t;
126 
127 #ifdef	__cplusplus
128 }
129 #endif
130 
131 #endif	/* _PICLENVMON_H */
132