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