summaryrefslogtreecommitdiff
path: root/usr/src/cmd/picl/plugins/sun4u/envmon/piclenvmon.h
blob: 86c07f486e6a03bd74077d9de315e88fcb6e32cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_PICLENVMON_H
#define	_PICLENVMON_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef	__cplusplus
extern "C" {
#endif

/*
 * Log message texts
 */
#define	EM_INIT_FAILED		gettext("SUNW_piclenvmon: init failed!")
#define	EM_MISSING_NODE		gettext("SUNW_piclenvmon: no %s node!")
#define	EM_SC_NODE_INCOMPLETE	\
	gettext("SUNW_piclenvmon: SC node devfs-path property missing")
#define	EM_SC_NODE_MISSING	\
	gettext("SUNW_piclenvmon: failed to locate SC device node")
#define	EM_EVREG_FAILED	\
	gettext("SUNW_piclenvmon: failed to register for events %x")
#define	EM_NODE_ACCESS		\
	gettext("SUNW_piclenvmon: couldn't access \"%s\", " \
	    "type %d, PICL err %d")
#define	EM_SYS_ERR		gettext("SUNW_piclenvmon: %s: %s")
#define	EM_EV_MISSING_ARG	\
	gettext("SUNW_piclenvmon: missing %s in ADD_FRU/REMOVE_FRU event")
#define	EM_INVALID_COLOR	\
	gettext("SUNW_piclenvmon: invalid LED color 0x%x returned for %s")

/*
 * define for super-user uid - used in credential checking
 */
#define	SUPER_USER		((uid_t)0)

/*
 * Constants for distinquishing environmental monitor types
 */
#define	ENVMON_VOLT_SENS	0
#define	ENVMON_VOLT_IND		1
#define	ENVMON_AMP_SENS		2
#define	ENVMON_AMP_IND		3
#define	ENVMON_TEMP_SENS	4
#define	ENVMON_TEMP_IND		5
#define	ENVMON_FAN_SENS		6
#define	ENVMON_FAN_IND		7
#define	ENVMON_LED_IND		8
#define	ENVMON_KEY_SWITCH	9
#define	ENVMON_CHASSIS		10

/*
 * ENVMONTYPES is the total of all the environmental monitor types. Needs
 * to be incrementee everytime a new type is added.
 */
#define	ENVMONTYPES		11

/*
 * number of key-switches supported
 */
#define	N_KEY_SWITCHES		1

/*
 * nomenclature names used to identify LED significance
 */
#define	LED_ACT		"ACT"
#define	LED_SERVICE	"SERVICE"
#define	LED_OK2RM	"OK2RM"
#define	LED_LOCATE	"LOCATE"

#define	KEYSWITCH_NAME		"keyswitch"
#define	CHASSIS_SERIAL_NUMBER	"chassis_serial_number"

/*
 * Config file name
 */
#define	ENVMON_CONFFILE_NAME	"piclenvmon.conf"

typedef int (*ptree_vol_rdfunc_t)(ptree_rarg_t *arg, void *buf);
typedef int (*ptree_vol_wrfunc_t)(ptree_warg_t *arg, const void *buf);

typedef struct node_el {
	picl_nodehdl_t		nodeh;
	struct node_el		*next;
} node_el_t;

typedef struct node_list {
	node_el_t	*head;
	node_el_t	*tail;
} node_list_t;

/*
 * index entry for looking up sensor handle
 */
typedef struct {
	int		maxnum;	/* number of entries in handles array */
	int		num;	/* number of entries in being used */
	uchar_t		*fru_types;
	envmon_handle_t	*envhandles;
	picl_prophdl_t	*piclprhdls;
} handle_array_t;

#ifdef	__cplusplus
}
#endif

#endif	/* _PICLENVMON_H */