xref: /onnv-gate/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2002-2003 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate #ifndef	_PICLENVMON_H
28*0Sstevel@tonic-gate #define	_PICLENVMON_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate #ifdef	__cplusplus
33*0Sstevel@tonic-gate extern "C" {
34*0Sstevel@tonic-gate #endif
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate /*
37*0Sstevel@tonic-gate  * Log message texts
38*0Sstevel@tonic-gate  */
39*0Sstevel@tonic-gate #define	EM_INIT_FAILED		gettext("SUNW_piclenvmon: init failed!")
40*0Sstevel@tonic-gate #define	EM_MISSING_NODE		gettext("SUNW_piclenvmon: no %s node!")
41*0Sstevel@tonic-gate #define	EM_SC_NODE_INCOMPLETE	\
42*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: SC node devfs-path property missing")
43*0Sstevel@tonic-gate #define	EM_SC_NODE_MISSING	\
44*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to locate SC device node")
45*0Sstevel@tonic-gate #define	EM_EVREG_FAILED	\
46*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: failed to register for events %x")
47*0Sstevel@tonic-gate #define	EM_NODE_ACCESS		\
48*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: couldn't access \"%s\", " \
49*0Sstevel@tonic-gate 	    "type %d, PICL err %d")
50*0Sstevel@tonic-gate #define	EM_SYS_ERR		gettext("SUNW_piclenvmon: %s: %s")
51*0Sstevel@tonic-gate #define	EM_EV_MISSING_ARG	\
52*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event")
53*0Sstevel@tonic-gate #define	EM_INVALID_COLOR	\
54*0Sstevel@tonic-gate 	gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s")
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate /*
57*0Sstevel@tonic-gate  * define for super-user uid - used in credential checking
58*0Sstevel@tonic-gate  */
59*0Sstevel@tonic-gate #define	SUPER_USER		((uid_t)0)
60*0Sstevel@tonic-gate 
61*0Sstevel@tonic-gate /*
62*0Sstevel@tonic-gate  * Constants for distinquishing environmental monitor types
63*0Sstevel@tonic-gate  */
64*0Sstevel@tonic-gate #define	ENVMON_VOLT_SENS	0
65*0Sstevel@tonic-gate #define	ENVMON_VOLT_IND		1
66*0Sstevel@tonic-gate #define	ENVMON_AMP_SENS		2
67*0Sstevel@tonic-gate #define	ENVMON_AMP_IND		3
68*0Sstevel@tonic-gate #define	ENVMON_TEMP_SENS	4
69*0Sstevel@tonic-gate #define	ENVMON_TEMP_IND		5
70*0Sstevel@tonic-gate #define	ENVMON_FAN_SENS		6
71*0Sstevel@tonic-gate #define	ENVMON_FAN_IND		7
72*0Sstevel@tonic-gate #define	ENVMON_LED_IND		8
73*0Sstevel@tonic-gate #define	ENVMON_KEY_SWITCH	9
74*0Sstevel@tonic-gate #define	ENVMONTYPES		10
75*0Sstevel@tonic-gate 
76*0Sstevel@tonic-gate /*
77*0Sstevel@tonic-gate  * number of key-switches supported
78*0Sstevel@tonic-gate  */
79*0Sstevel@tonic-gate #define	N_KEY_SWITCHES		1
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate /*
82*0Sstevel@tonic-gate  * nomenclature names used to identify LED significance
83*0Sstevel@tonic-gate  */
84*0Sstevel@tonic-gate #define	LED_ACT		"ACT"
85*0Sstevel@tonic-gate #define	LED_SERVICE	"SERVICE"
86*0Sstevel@tonic-gate #define	LED_OK2RM	"OK2RM"
87*0Sstevel@tonic-gate #define	LED_LOCATE	"LOCATE"
88*0Sstevel@tonic-gate 
89*0Sstevel@tonic-gate #define	KEYSWITCH_NAME	"keyswitch"
90*0Sstevel@tonic-gate 
91*0Sstevel@tonic-gate /*
92*0Sstevel@tonic-gate  * Config file name
93*0Sstevel@tonic-gate  */
94*0Sstevel@tonic-gate #define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"
95*0Sstevel@tonic-gate 
96*0Sstevel@tonic-gate typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
97*0Sstevel@tonic-gate typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate typedef struct node_el {
100*0Sstevel@tonic-gate 	picl_nodehdl_t		nodeh;
101*0Sstevel@tonic-gate 	struct node_el		*next;
102*0Sstevel@tonic-gate } node_el_t;
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate typedef struct node_list {
105*0Sstevel@tonic-gate 	node_el_t	*head;
106*0Sstevel@tonic-gate 	node_el_t	*tail;
107*0Sstevel@tonic-gate } node_list_t;
108*0Sstevel@tonic-gate 
109*0Sstevel@tonic-gate /*
110*0Sstevel@tonic-gate  * index entry for looking up sensor handle
111*0Sstevel@tonic-gate  */
112*0Sstevel@tonic-gate typedef struct {
113*0Sstevel@tonic-gate 	int		maxnum;	/* number of entries in handles array */
114*0Sstevel@tonic-gate 	int		num;	/* number of entries in being used */
115*0Sstevel@tonic-gate 	uchar_t		*fru_types;
116*0Sstevel@tonic-gate 	envmon_handle_t	*envhandles;
117*0Sstevel@tonic-gate 	picl_prophdl_t	*piclprhdls;
118*0Sstevel@tonic-gate } handle_array_t;
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate #ifdef	__cplusplus
121*0Sstevel@tonic-gate }
122*0Sstevel@tonic-gate #endif
123*0Sstevel@tonic-gate 
124*0Sstevel@tonic-gate #endif	/* _PICLENVMON_H */
125