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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
/*
* 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 1998 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ENVCTRL_GEN_H
#define _SYS_ENVCTRL_GEN_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* envctrl_gen.h
*
* This header file holds the environmental control definitions that
* are common to all workgroup server platforms. Typically, all IOCTLs,
* kstat structures, and the generic constants are defined here.
* The platform specific definitions belong in header files which contain
* the platform name as part of the file name eg. envctrl_ue250.h for the
* UltraEnterprise-250 platform.
*/
#define ENVCTRL_NORMAL_MODE 0x01
#define ENVCTRL_DIAG_MODE 0x02
#define ENVCTRL_CHAR_ZERO 0x00
#define ENVCTRL_PS_550 550
#define ENVCTRL_PS_650 650
#define ENVCTRL_INIT_TEMPR 20
#define ENVCTRL_ULTRA1CPU_STRING "SUNW,UltraSPARC"
#define ENVCTRL_ULTRA2CPU_STRING "SUNW,UltraSPARC-II"
#define ENVCTRL_MAX_CPUS 8
#define ENVCTRL_CPU0 0
#define ENVCTRL_CPU1 1
#define ENVCTRL_CPU2 2
#define ENVCTRL_CPU3 3
#define ENVCTRL_CPU4 4
#define ENVCTRL_CPU5 5
#define ENVCTRL_CPU6 6
#define ENVCTRL_CPU7 7
/*
* I2C Sensor Types
*/
#define ENVCTRL_PCD8584 0x00 /* Bus Controller Master */
#define ENVCTRL_PCF8591 0x01 /* Temp Sensor 8bit A/D, D/A */
#define ENVCTRL_PCF8574 0x02 /* PS, FAN, LED, Fail and Control */
#define ENVCTRL_TDA8444T 0x03 /* Fan Speed Control, 8 bit D/A */
#define ENVCTRL_PCF8574A 0x04 /* 8574A chip */
#define ENVCTRL_PCF8583 0x05 /* PCF8583 clock chip */
#define ENVCTRL_LM75 0x06 /* LM75 chip */
/*
* I2C device address offsets
*/
#define ENVCTRL_DEV0 0x0
#define ENVCTRL_DEV1 0x2
#define ENVCTRL_DEV2 0x4
#define ENVCTRL_DEV3 0x6
#define ENVCTRL_DEV4 0x8
#define ENVCTRL_DEV5 0xA
#define ENVCTRL_DEV6 0xC
#define ENVCTRL_DEV7 0xE
/*
* I2C ports
*/
#define ENVCTRL_PORT0 0x00
#define ENVCTRL_PORT1 0x01
#define ENVCTRL_PORT2 0x02
#define ENVCTRL_PORT3 0x03
#define ENVCTRL_PORT4 0x04
#define ENVCTRL_PORT5 0x05
#define ENVCTRL_PORT6 0x06
#define ENVCTRL_PORT7 0x07
/*
* Max number of a particular
* device on one bus.
*/
#define ENVCTRL_MAX_DEVS 0x10
#define ENVCTRL_I2C_NODEV 0xFF
#define ENVCTRL_INSTANCE_0 0x00
/* Disk Fault bit fields */
#define ENVCTRL_DISK_0 0x01
#define ENVCTRL_DISK_1 0x02
#define ENVCTRL_DISK_2 0x04
#define ENVCTRL_DISK_3 0x08
#define ENVCTRL_DISK_4 0x10
#define ENVCTRL_DISK_5 0x20
#define ENVCTRL_DISK_6 0x40
#define ENVCTRL_DISK_7 0x80
#define ENVCTRL_4SLOT_BACKPLANE 0x0F
#define ENVCTRL_8SLOT_BACKPLANE 0xFF
#define ENVCTRL_DISK4LED_ALLOFF 0xF0
#define ENVCTRL_DISK6LED_ALLOFF 0xFC
#define ENVCTRL_DISK8LED_ALLOFF 0xFF
#define ENVCTRL_MAXSTRLEN 256
/* Kstat Structures and defines */
#define ENVCTRL_FAN_TYPE_CPU 0x00
#define ENVCTRL_FAN_TYPE_PS 0x01
#define ENVCTRL_FAN_TYPE_AFB 0x02
#define ENVCTRL_FAN_TYPE_UE250 0x03
#define ENVCTRL_MODULE_NAME "envctrl"
#define ENVCTRL_KSTAT_NUMPS "envctrl_numps"
#define ENVCTRL_KSTAT_PSNAME "envctrl_pwrsupply"
#define ENVCTRL_KSTAT_PSNAME2 "envctrl_pwrsupply2"
#define ENVCTRL_KSTAT_NUMFANS "envctrl_numfans"
#define ENVCTRL_KSTAT_FANSTAT "envctrl_fanstat"
#define ENVCTRL_KSTAT_NUMENCLS "envctrl_numencls"
#define ENVCTRL_KSTAT_ENCL "envctrl_enclosure"
#define ENVCTRL_KSTAT_TEMPERATURE "envctrl_temp"
#define ENVCTRL_KSTAT_DISK "envctrl_disk"
/*
* Kstat structure definitions (PSARC 1996/159)
*/
typedef struct envctrl_ps {
int instance; /* instance of this type */
ushort_t ps_tempr; /* temperature */
int ps_rating; /* type in watts */
boolean_t ps_ok; /* normal state or not. */
boolean_t curr_share_ok; /* current share imbalance */
boolean_t limit_ok; /* overlimit warning */
} envctrl_ps_t;
typedef struct envctrl_fan {
int instance; /* instance of this type */
int type; /* CPU, PS or AMBIENT fan */
boolean_t fans_ok; /* are the fans okay */
int fanflt_num; /* if not okay, which fan faulted */
uint_t fanspeed; /* chip to set speed of fans */
} envctrl_fan_t;
typedef struct envctrl_encl {
int instance;
int type;
uint_t value;
} envctrl_encl_t;
/*
* Kstat structure defintions (PSARC 1997/245)
*/
typedef struct envctrl_chip {
int type; /* chip type */
uchar_t chip_num; /* chip num */
uchar_t index; /* chip index */
uchar_t val; /* chip reading */
} envctrl_chip_t;
typedef struct envctrl_ps2 {
ushort_t ps_tempr; /* temperature */
int ps_rating; /* type in watts */
boolean_t ps_ok; /* normal state or not */
boolean_t curr_share_ok; /* current share imbalance */
boolean_t limit_ok; /* overlimit warning */
int type; /* power supply type */
int slot; /* power supply slot occupied */
} envctrl_ps2_t;
typedef struct envctrl_temp {
char label[ENVCTRL_MAXSTRLEN]; /* indicates temp. sensor location */
int type; /* Temperature sensor type */
uint_t value; /* temperature value */
uint_t min; /* minimum tolerable temperature */
uint_t warning_threshold; /* warning threshold */
uint_t shutdown_threshold; /* shutdown threshold */
} envctrl_temp_t;
typedef struct envctrl_disk {
int slot; /* slot number of disk */
boolean_t disk_ok; /* disk fault LED off or on */
} envctrl_disk_t;
#define ENVCTRL_PANEL_LEDS_PR "panel-leds-present"
#define ENVCTRL_PANEL_LEDS_STA "panel-leds-state"
#define ENVCTRL_DISK_LEDS_PR "disk-leds-present"
#define ENVCTRL_DISK_LEDS_STA "disk-leds-state"
#define ENVCTRL_LED_BLINK "activity-led-blink?"
/*
* IOCTL defines (PSARC 1996/159)
*/
#define ENVCTRL_IOC_RESETTMPR (int)(_IOW('p', 76, uchar_t))
#define ENVCTRL_IOC_SETMODE (int)(_IOW('p', 77, uchar_t))
#define ENVCTRL_IOC_SETTEMP (int)(_IOW('p', 79, uchar_t))
#define ENVCTRL_IOC_SETFAN (int)(_IOW('p', 80, struct envctrl_tda8444t_chip))
#define ENVCTRL_IOC_SETWDT (int)(_IOW('p', 81, uchar_t))
#define ENVCTRL_IOC_GETFAN (int)(_IOR('p', 81, struct envctrl_tda8444t_chip))
#define ENVCTRL_IOC_GETTEMP (int)(_IOR('p', 82, struct envctrl_pcf8591_chip))
#define ENVCTRL_IOC_GETFANFAIL (int)(_IOR('p', 83, struct envctrl_pcf8574_chip))
#define ENVCTRL_IOC_SETFSP (int)(_IOW('p', 84, uchar_t))
#define ENVCTRL_IOC_SETDSKLED (int)(_IOW('p', 85, struct envctrl_pcf8574_chip))
#define ENVCTRL_IOC_GETDSKLED (int)(_IOR('p', 86, struct envctrl_pcf8574_chip))
/*
* IOCTL defines (PSARC 1997/245)
*/
#define ENVCTRL_IOC_GETMODE (int)(_IOR('p', 87, uchar_t))
#define ENVCTRL_IOC_SETTEMP2 (int)(_IOW('p', 88, struct envctrl_chip))
#define ENVCTRL_IOC_SETFAN2 (int)(_IOW('p', 89, struct envctrl_chip))
#define ENVCTRL_IOC_GETFAN2 (int)(_IOR('p', 90, struct envctrl_chip))
#define ENVCTRL_IOC_GETTEMP2 (int)(_IOR('p', 91, struct envctrl_chip))
#define ENVCTRL_IOC_SETFSP2 (int)(_IOW('p', 92, struct envctrl_chip))
#define ENVCTRL_IOC_GETFSP2 (int)(_IOR('p', 93, struct envctrl_chip))
#define ENVCTRL_IOC_SETDSKLED2 (int)(_IOW('p', 94, struct envctrl_chip))
#define ENVCTRL_IOC_GETDSKLED2 (int)(_IOR('p', 95, struct envctrl_chip))
#define ENVCTRL_IOC_SETRAW (int)(_IOW('p', 96, struct envctrl_chip))
#define ENVCTRL_IOC_GETRAW (int)(_IOR('p', 97, struct envctrl_chip))
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ENVCTRL_GEN_H */
|