xref: /onnv-gate/usr/src/uts/common/sys/lom_io.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 1999-2002 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	_SYS_LOM_IO_H
28*0Sstevel@tonic-gate #define	_SYS_LOM_IO_H
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*0Sstevel@tonic-gate 
32*0Sstevel@tonic-gate /*
33*0Sstevel@tonic-gate  * I/O header file for LOMlite Driver.
34*0Sstevel@tonic-gate  */
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #ifdef __cplusplus
37*0Sstevel@tonic-gate extern "C" {
38*0Sstevel@tonic-gate #endif
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #include <sys/ioccom.h>
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate /* ioctls for the TSalarm card */
43*0Sstevel@tonic-gate 
44*0Sstevel@tonic-gate /*
45*0Sstevel@tonic-gate  * commands to access the alarm monitor node
46*0Sstevel@tonic-gate  */
47*0Sstevel@tonic-gate 
48*0Sstevel@tonic-gate #define	TSIOCNBMON	_IOR('a', 1, int)
49*0Sstevel@tonic-gate #define	TSIOCWTMON	_IOWR('a', 2, int)
50*0Sstevel@tonic-gate #define	TSIOCGETMASK	_IOR('a', 3, int)
51*0Sstevel@tonic-gate 
52*0Sstevel@tonic-gate /*
53*0Sstevel@tonic-gate  * commands to manipulate the control node
54*0Sstevel@tonic-gate  */
55*0Sstevel@tonic-gate 
56*0Sstevel@tonic-gate #define	TSIOCALCTL	_IOW('a', 4, ts_aldata_t)
57*0Sstevel@tonic-gate #define	TSIOCALSTATE	_IOWR('a', 5, ts_aldata_t)
58*0Sstevel@tonic-gate #define	TSIOCDOGSTATE	_IOR('a', 6, ts_dogstate_t)
59*0Sstevel@tonic-gate #define	TSIOCDOGCTL	_IOW('a', 7, ts_dogctl_t)
60*0Sstevel@tonic-gate #define	TSIOCDOGTIME	_IOW('a', 8, uint_t)
61*0Sstevel@tonic-gate #define	TSIOCDOGPAT	_IO('a', 9)
62*0Sstevel@tonic-gate #define	TSIOCUNLOCK	_IO('a', 10)
63*0Sstevel@tonic-gate 
64*0Sstevel@tonic-gate /*
65*0Sstevel@tonic-gate  * Defines for the number of the three alarms
66*0Sstevel@tonic-gate  */
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate #define	ALARM_NUM_1	1
69*0Sstevel@tonic-gate #define	ALARM_NUM_2	2
70*0Sstevel@tonic-gate #define	ALARM_NUM_3	3
71*0Sstevel@tonic-gate 
72*0Sstevel@tonic-gate /*
73*0Sstevel@tonic-gate  * command to tell the driver to output debug information. This information
74*0Sstevel@tonic-gate  * includes :
75*0Sstevel@tonic-gate  * - the hardware monitor port (R/O)
76*0Sstevel@tonic-gate  * - in-core monitor status byte
77*0Sstevel@tonic-gate  * - the in-core control port
78*0Sstevel@tonic-gate  * - the watchdog timeout setting
79*0Sstevel@tonic-gate  */
80*0Sstevel@tonic-gate #define	TSIOCDUMP	_IO('a', 11)
81*0Sstevel@tonic-gate #define	TSIOCDBCTL	_IOW('a', 12, ts_dbctl_t)
82*0Sstevel@tonic-gate 
83*0Sstevel@tonic-gate /*
84*0Sstevel@tonic-gate  * typedefs used in alarm ioctl definitions
85*0Sstevel@tonic-gate  */
86*0Sstevel@tonic-gate 
87*0Sstevel@tonic-gate typedef
88*0Sstevel@tonic-gate struct {
89*0Sstevel@tonic-gate 	int alarm_no;
90*0Sstevel@tonic-gate 	int alarm_state;
91*0Sstevel@tonic-gate } ts_aldata_t;
92*0Sstevel@tonic-gate 
93*0Sstevel@tonic-gate typedef
94*0Sstevel@tonic-gate struct {
95*0Sstevel@tonic-gate 	int reset_enable;
96*0Sstevel@tonic-gate 	int dog_enable;
97*0Sstevel@tonic-gate } ts_dogctl_t;
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate typedef
100*0Sstevel@tonic-gate struct {
101*0Sstevel@tonic-gate 	int reset_enable;
102*0Sstevel@tonic-gate 	int dog_enable;
103*0Sstevel@tonic-gate 	uint_t dog_timeout;
104*0Sstevel@tonic-gate } ts_dogstate_t;
105*0Sstevel@tonic-gate 
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate typedef
108*0Sstevel@tonic-gate struct {
109*0Sstevel@tonic-gate 	int db_timing;
110*0Sstevel@tonic-gate 	int db_debug;
111*0Sstevel@tonic-gate } ts_dbctl_t;
112*0Sstevel@tonic-gate 
113*0Sstevel@tonic-gate #define	MAX_PSUS	3
114*0Sstevel@tonic-gate #define	MAX_FANS	4
115*0Sstevel@tonic-gate #define	NUM_EVENTS	10
116*0Sstevel@tonic-gate #define	NUM_ALARMS	3
117*0Sstevel@tonic-gate 
118*0Sstevel@tonic-gate /*
119*0Sstevel@tonic-gate  * Defines for the lom_ctl_t events/fault led flag.
120*0Sstevel@tonic-gate  */
121*0Sstevel@tonic-gate 
122*0Sstevel@tonic-gate #define	OFF	1
123*0Sstevel@tonic-gate #define	ON	2
124*0Sstevel@tonic-gate 
125*0Sstevel@tonic-gate /*
126*0Sstevel@tonic-gate  * Defines for a3mode.
127*0Sstevel@tonic-gate  */
128*0Sstevel@tonic-gate 
129*0Sstevel@tonic-gate #define	WATCHDOG	0x02
130*0Sstevel@tonic-gate #define	USER		0x01
131*0Sstevel@tonic-gate 
132*0Sstevel@tonic-gate /*
133*0Sstevel@tonic-gate  * Defines for PSUSTATE
134*0Sstevel@tonic-gate  */
135*0Sstevel@tonic-gate #define	LOM_PSU_NOACCESS	0x20
136*0Sstevel@tonic-gate 
137*0Sstevel@tonic-gate /* ioctls for the LOMlite card */
138*0Sstevel@tonic-gate 
139*0Sstevel@tonic-gate /*
140*0Sstevel@tonic-gate  * old commands to access the monitor node
141*0Sstevel@tonic-gate  */
142*0Sstevel@tonic-gate 
143*0Sstevel@tonic-gate #define	LOMIOCNBMON	TSIOCNBMON
144*0Sstevel@tonic-gate #define	LOMIOCWTMON	TSIOCWTMON
145*0Sstevel@tonic-gate #define	LOMIOCGETMASK	TSIOCGETMASK
146*0Sstevel@tonic-gate 
147*0Sstevel@tonic-gate /*
148*0Sstevel@tonic-gate  * old commands to manipulate the control node
149*0Sstevel@tonic-gate  */
150*0Sstevel@tonic-gate 
151*0Sstevel@tonic-gate #define	LOMIOCALCTL	TSIOCALCTL
152*0Sstevel@tonic-gate #define	LOMIOCALSTATE	TSIOCALSTATE
153*0Sstevel@tonic-gate #define	LOMIOCDOGSTATE	TSIOCDOGSTATE
154*0Sstevel@tonic-gate #define	LOMIOCDOGCTL	TSIOCDOGCTL
155*0Sstevel@tonic-gate #define	LOMIOCDOGTIME	TSIOCDOGTIME
156*0Sstevel@tonic-gate #define	LOMIOCDOGPAT	TSIOCDOGPAT
157*0Sstevel@tonic-gate #define	LOMIOCUNLOCK	TSIOCUNLOCK
158*0Sstevel@tonic-gate 
159*0Sstevel@tonic-gate /*
160*0Sstevel@tonic-gate  * new commands to access the monitor node
161*0Sstevel@tonic-gate  */
162*0Sstevel@tonic-gate 
163*0Sstevel@tonic-gate #define	LOMIOCPSUSTATE	_IOR('a', 21, lom_psudata_t)
164*0Sstevel@tonic-gate #define	LOMIOCEVENTLOG	_IOR('a', 22, lom_eventlog_t)
165*0Sstevel@tonic-gate #define	LOMIOCFANSTATE	_IOR('a', 23, lom_fandata_t)
166*0Sstevel@tonic-gate #define	LOMIOCFLEDSTATE _IOR('a', 24, lom_fled_info_t)
167*0Sstevel@tonic-gate #define	LOMIOCINFO	_IOR('a', 25, lom_info_t)
168*0Sstevel@tonic-gate 
169*0Sstevel@tonic-gate /*
170*0Sstevel@tonic-gate  * new commands to manipulate the control node
171*0Sstevel@tonic-gate  */
172*0Sstevel@tonic-gate 
173*0Sstevel@tonic-gate #define	LOMIOCCLEARLOG	_IO('a', 26)
174*0Sstevel@tonic-gate #define	LOMIOCCTL	_IOW('a', 27, lom_ctl_t)
175*0Sstevel@tonic-gate #define	LOMIOCPROG	_IOWR('a', 28, lom_prog_t)
176*0Sstevel@tonic-gate #define	LOMIOCDAEMON	_IOWR('a', 29, int)
177*0Sstevel@tonic-gate #define	LOMIOCDMON	_IOWR('a', 30, int)
178*0Sstevel@tonic-gate 
179*0Sstevel@tonic-gate /*
180*0Sstevel@tonic-gate  * Command to read general purpose LOMlite inputs.
181*0Sstevel@tonic-gate  * There are only 3 bits to general purpose inputs.
182*0Sstevel@tonic-gate  */
183*0Sstevel@tonic-gate 
184*0Sstevel@tonic-gate #define	LOMIOCGPINPUTS	_IOWR('a', 31, int)
185*0Sstevel@tonic-gate 
186*0Sstevel@tonic-gate /*
187*0Sstevel@tonic-gate  * Manufacture programming command.
188*0Sstevel@tonic-gate  */
189*0Sstevel@tonic-gate 
190*0Sstevel@tonic-gate #define	LOMIOCMPROG	_IOW('a', 32, lom_mprog_t)
191*0Sstevel@tonic-gate #define	LOMIOCMREAD	_IOR('a', 33, lom_mprog_t)
192*0Sstevel@tonic-gate 
193*0Sstevel@tonic-gate #define	LOMIOCLEDSTATE 	_IOR('a', 34, lom_led_state_t)
194*0Sstevel@tonic-gate 
195*0Sstevel@tonic-gate /*
196*0Sstevel@tonic-gate  * command to tell the driver to output debug information. This information
197*0Sstevel@tonic-gate  * includes :
198*0Sstevel@tonic-gate  * - the hardware monitor port (R/O)
199*0Sstevel@tonic-gate  * - in-core monitor status byte
200*0Sstevel@tonic-gate  * - the in-core control port
201*0Sstevel@tonic-gate  * - the watchdog timeout setting
202*0Sstevel@tonic-gate  */
203*0Sstevel@tonic-gate #define	LOMIOCDUMP	TSIOCDUMP
204*0Sstevel@tonic-gate #define	LOMIOCDBCTL	TSIOCDBCTL
205*0Sstevel@tonic-gate 
206*0Sstevel@tonic-gate /*
207*0Sstevel@tonic-gate  * typedefs used in LOMlite ioctl definitions
208*0Sstevel@tonic-gate  */
209*0Sstevel@tonic-gate 
210*0Sstevel@tonic-gate typedef
211*0Sstevel@tonic-gate struct {
212*0Sstevel@tonic-gate 	int alarm_no;
213*0Sstevel@tonic-gate 	int state;
214*0Sstevel@tonic-gate } lom_aldata_t;
215*0Sstevel@tonic-gate 
216*0Sstevel@tonic-gate typedef
217*0Sstevel@tonic-gate struct {
218*0Sstevel@tonic-gate 	int reset_enable;
219*0Sstevel@tonic-gate 	int dog_enable;
220*0Sstevel@tonic-gate } lom_dogctl_t;
221*0Sstevel@tonic-gate 
222*0Sstevel@tonic-gate typedef
223*0Sstevel@tonic-gate struct {
224*0Sstevel@tonic-gate 	int reset_enable;
225*0Sstevel@tonic-gate 	int dog_enable;
226*0Sstevel@tonic-gate 	uint_t dog_timeout;
227*0Sstevel@tonic-gate } lom_dogstate_t;
228*0Sstevel@tonic-gate 
229*0Sstevel@tonic-gate 
230*0Sstevel@tonic-gate typedef
231*0Sstevel@tonic-gate struct {
232*0Sstevel@tonic-gate 	int db_timing;
233*0Sstevel@tonic-gate 	int db_debug;
234*0Sstevel@tonic-gate } lom_dbctl_t;
235*0Sstevel@tonic-gate 
236*0Sstevel@tonic-gate 
237*0Sstevel@tonic-gate typedef
238*0Sstevel@tonic-gate struct {
239*0Sstevel@tonic-gate 	int fitted[MAX_PSUS];
240*0Sstevel@tonic-gate 	int output[MAX_PSUS];
241*0Sstevel@tonic-gate 	int supplya[MAX_PSUS];
242*0Sstevel@tonic-gate 	int supplyb[MAX_PSUS];
243*0Sstevel@tonic-gate 	int standby[MAX_PSUS];
244*0Sstevel@tonic-gate } lom_psudata_t;
245*0Sstevel@tonic-gate 
246*0Sstevel@tonic-gate typedef
247*0Sstevel@tonic-gate struct {
248*0Sstevel@tonic-gate 	int fitted[MAX_FANS];
249*0Sstevel@tonic-gate 	int speed[MAX_FANS];
250*0Sstevel@tonic-gate 	int minspeed[MAX_FANS];
251*0Sstevel@tonic-gate } lom_fandata_t;
252*0Sstevel@tonic-gate 
253*0Sstevel@tonic-gate typedef
254*0Sstevel@tonic-gate struct {
255*0Sstevel@tonic-gate 	int events[NUM_EVENTS];
256*0Sstevel@tonic-gate 	int fatalevent;
257*0Sstevel@tonic-gate } lom_eventlog_t;
258*0Sstevel@tonic-gate 
259*0Sstevel@tonic-gate /*
260*0Sstevel@tonic-gate  * The event codes as used in lom_eventlog_t are coded as described here:
261*0Sstevel@tonic-gate  *
262*0Sstevel@tonic-gate  * Event codes encode, in a single byte, the source and type
263*0Sstevel@tonic-gate  * of event/failure in the system.
264*0Sstevel@tonic-gate  *
265*0Sstevel@tonic-gate  * There are two types of failure - fan and PSU.
266*0Sstevel@tonic-gate  *
267*0Sstevel@tonic-gate  * Other events need to be stored but do not constitue faults.
268*0Sstevel@tonic-gate  */
269*0Sstevel@tonic-gate #define	LOM_EVENT_NONE		0x00	/* No fault */
270*0Sstevel@tonic-gate #define	LOM_EVENT_LOST		0x01	/* Event lost due to buffer overflow */
271*0Sstevel@tonic-gate #define	LOM_EVENT_RESET		0x02	/* Reset is asserted by the LOM */
272*0Sstevel@tonic-gate #define	LOM_EVENT_PWR_ON	0x03	/* Power is turned on by the LOM */
273*0Sstevel@tonic-gate #define	LOM_EVENT_PWR_OFF	0x04	/* Power is turned off by the LOM */
274*0Sstevel@tonic-gate #define	LOM_EVENT_WDOG_ON	0x05	/* Host watchdog enabled */
275*0Sstevel@tonic-gate #define	LOM_EVENT_WDOG_OFF	0x06	/* Host watchdog disabled */
276*0Sstevel@tonic-gate #define	LOM_EVENT_WDOG_TRIG	0x07	/* Host watchdog triggered */
277*0Sstevel@tonic-gate #define	LOM_EVENT_LOM_RESET	0x08	/* LOMlite has been reset */
278*0Sstevel@tonic-gate #define	LOM_EVENT_CHECKSUM	0x09	/* ROM checksum failure */
279*0Sstevel@tonic-gate #define	LOM_EVENT_BUSY		0x0a	/* Event not ready yet (being read) */
280*0Sstevel@tonic-gate 
281*0Sstevel@tonic-gate /*
282*0Sstevel@tonic-gate  * Fault LED events
283*0Sstevel@tonic-gate  */
284*0Sstevel@tonic-gate #define	LOM_EVENT_FAULT		0x20	/* Fault events - codes 0x20-0x2f */
285*0Sstevel@tonic-gate #define	LOM_EVENT_FAULT_MASK	0xf0	/* Fault events - codes 0x20-0x2f */
286*0Sstevel@tonic-gate 
287*0Sstevel@tonic-gate /*
288*0Sstevel@tonic-gate  * Fault LED events are encoded thus
289*0Sstevel@tonic-gate  *
290*0Sstevel@tonic-gate  *  7	 4 3		       0
291*0Sstevel@tonic-gate  *  ----------------------------
292*0Sstevel@tonic-gate  * | 0010 | Fault LED frequency |
293*0Sstevel@tonic-gate  *  ----------------------------
294*0Sstevel@tonic-gate  *
295*0Sstevel@tonic-gate  * The "Fault LED frequency" is a 4 bit code allowing for LED
296*0Sstevel@tonic-gate  * falshing rates of 0 to 14 Hz with a rate of 15 signifying off.
297*0Sstevel@tonic-gate  *
298*0Sstevel@tonic-gate  * For example the event code for the assertion of a fault LED rate of 2Hz is:
299*0Sstevel@tonic-gate  *    LOM_EVENT_FAULT_ENCODE(2);
300*0Sstevel@tonic-gate  */
301*0Sstevel@tonic-gate #define	LOM_EVENT_FAULT_ENCODE(faultRate) \
302*0Sstevel@tonic-gate 	(LOM_EVENT_FAULT | ((faultRate)&0xf))
303*0Sstevel@tonic-gate 
304*0Sstevel@tonic-gate /*
305*0Sstevel@tonic-gate  * Alarm events
306*0Sstevel@tonic-gate  */
307*0Sstevel@tonic-gate #define	LOM_EVENT_ALARM		0x30	/* Alarm events - codes 0x30-0x3f */
308*0Sstevel@tonic-gate #define	LOM_EVENT_ALARM_MASK	0xf0	/* Alarm events - codes 0x30-0x3f */
309*0Sstevel@tonic-gate 
310*0Sstevel@tonic-gate /*
311*0Sstevel@tonic-gate  * Alarm events are encoded thus
312*0Sstevel@tonic-gate  *
313*0Sstevel@tonic-gate  *  7	 4 3		1    0
314*0Sstevel@tonic-gate  *  --------------------------
315*0Sstevel@tonic-gate  * | 0011 | Alarm number | On |
316*0Sstevel@tonic-gate  *  --------------------------
317*0Sstevel@tonic-gate  *
318*0Sstevel@tonic-gate  * The "Alarm number" is a 3 bit code allowing for up to 8 alarms
319*0Sstevel@tonic-gate  *
320*0Sstevel@tonic-gate  * For example the event code for the assertion of alarm 2 is:
321*0Sstevel@tonic-gate  *    LOM_EVENT_ALARM_ENCODE(2, 1);
322*0Sstevel@tonic-gate  */
323*0Sstevel@tonic-gate #define	LOM_EVENT_ALARM_ENCODE(alarmNum, alarmOn) \
324*0Sstevel@tonic-gate 	(LOM_EVENT_ALARM | (alarmNum<<1) | ((alarmOn)&0x1))
325*0Sstevel@tonic-gate 
326*0Sstevel@tonic-gate /*
327*0Sstevel@tonic-gate  * These alarms are considered fatal errors
328*0Sstevel@tonic-gate  */
329*0Sstevel@tonic-gate 
330*0Sstevel@tonic-gate #define	LOM_EVENT_FAN		0x40	/* Fan failure - codes 0x40-0x7f */
331*0Sstevel@tonic-gate #define	LOM_EVENT_FAN_MASK	0xc0	/* Fan failure - codes 0x40-0x7f */
332*0Sstevel@tonic-gate 
333*0Sstevel@tonic-gate /*
334*0Sstevel@tonic-gate  * Fan events are encoded thus
335*0Sstevel@tonic-gate  *
336*0Sstevel@tonic-gate  *  7  6 5	    3 2	     0
337*0Sstevel@tonic-gate  *  --------------------------
338*0Sstevel@tonic-gate  * | 01 | Fan number | Status |
339*0Sstevel@tonic-gate  *  --------------------------
340*0Sstevel@tonic-gate  *
341*0Sstevel@tonic-gate  * The "Fan number" is a 3 bit code allowing for up to 8 fans
342*0Sstevel@tonic-gate  *
343*0Sstevel@tonic-gate  * As yet there are no defined fan statuses.
344*0Sstevel@tonic-gate  *
345*0Sstevel@tonic-gate  * For example the event code for a failure on fan 3 is:
346*0Sstevel@tonic-gate  *    LOM_EVENT_FAN_ENCODE(3, 0);
347*0Sstevel@tonic-gate  */
348*0Sstevel@tonic-gate #define	LOM_EVENT_FAN_ENCODE(fanNum, fanStatus) \
349*0Sstevel@tonic-gate 	(LOM_EVENT_FAN | (fanNum<<3) | ((fanStatus)&0x7))
350*0Sstevel@tonic-gate 
351*0Sstevel@tonic-gate #define	LOM_EVENT_PSU		0x80	/* PSU failure - codes 0x80-0xbf */
352*0Sstevel@tonic-gate #define	LOM_EVENT_PSU_MASK	0xc0	/* PSU failure - codes 0x80-0xbf */
353*0Sstevel@tonic-gate 
354*0Sstevel@tonic-gate /*
355*0Sstevel@tonic-gate  * These definitions will be picked up elsewhere in embedded code
356*0Sstevel@tonic-gate  */
357*0Sstevel@tonic-gate #ifndef LOM_PSU_PRESENT
358*0Sstevel@tonic-gate /*
359*0Sstevel@tonic-gate  * PSU status flags
360*0Sstevel@tonic-gate  */
361*0Sstevel@tonic-gate #define	LOM_PSU_PRESENT		0x08
362*0Sstevel@tonic-gate #define	LOM_PSU_INPUT_A_OK	0x01
363*0Sstevel@tonic-gate #define	LOM_PSU_INPUT_B_OK	0x02
364*0Sstevel@tonic-gate #define	LOM_PSU_OUTPUT_OK	0x04
365*0Sstevel@tonic-gate #define	LOM_PSU_STATUS_MASK	(LOM_PSU_INPUT_A_OK | LOM_PSU_INPUT_B_OK | \
366*0Sstevel@tonic-gate 				LOM_PSU_OUTPUT_OK)
367*0Sstevel@tonic-gate #endif
368*0Sstevel@tonic-gate 
369*0Sstevel@tonic-gate /*
370*0Sstevel@tonic-gate  * PSU events are encoded thus
371*0Sstevel@tonic-gate  *
372*0Sstevel@tonic-gate  *  7  6 5	    3		    2		     1		      0
373*0Sstevel@tonic-gate  *  -------------------------------------------------------------------
374*0Sstevel@tonic-gate  * | 10 | PSU number | Output Status | Input B Status | Input A Status |
375*0Sstevel@tonic-gate  *  -------------------------------------------------------------------
376*0Sstevel@tonic-gate  *
377*0Sstevel@tonic-gate  * The PSU number is a 3 bit code allowing for up to 8 PSUs
378*0Sstevel@tonic-gate  *
379*0Sstevel@tonic-gate  * The PSU status is derived from the LOM_PSU... definitions.
380*0Sstevel@tonic-gate  *
381*0Sstevel@tonic-gate  * For example the event code for an "Input B" failure on PSU 2 is:
382*0Sstevel@tonic-gate  *    LOM_EVENT_PSU_ENCODE(2, LOM_PSU_INPUT_A_OK | LOM_PSU_OUTPUT_OK);
383*0Sstevel@tonic-gate  */
384*0Sstevel@tonic-gate #define	LOM_EVENT_PSU_ENCODE(psuNum, psuStatus) \
385*0Sstevel@tonic-gate 	(LOM_EVENT_PSU | (psuNum<<3) | ((psuStatus)&0x7))
386*0Sstevel@tonic-gate 
387*0Sstevel@tonic-gate #define	MAX_LOM2_NAME_STR	16
388*0Sstevel@tonic-gate 
389*0Sstevel@tonic-gate #define	LOM_LED_STATE_OFF		0x00
390*0Sstevel@tonic-gate #define	LOM_LED_STATE_ON_STEADY		0x01
391*0Sstevel@tonic-gate #define	LOM_LED_STATE_ON_FLASHING	0x02
392*0Sstevel@tonic-gate #define	LOM_LED_STATE_ON_SLOWFLASH	0x03
393*0Sstevel@tonic-gate #define	LOM_LED_STATE_INACCESSIBLE	0xfd
394*0Sstevel@tonic-gate #define	LOM_LED_STATE_STANDBY		0xfe
395*0Sstevel@tonic-gate #define	LOM_LED_STATE_NOT_PRESENT	0xff
396*0Sstevel@tonic-gate 
397*0Sstevel@tonic-gate enum states {
398*0Sstevel@tonic-gate 	LOM_LED_OUTOFRANGE = -3,
399*0Sstevel@tonic-gate 	LOM_LED_NOT_IMPLEMENTED,
400*0Sstevel@tonic-gate 	LOM_LED_ACCESS_ERROR,
401*0Sstevel@tonic-gate 	LOM_LED_OFF,
402*0Sstevel@tonic-gate 	LOM_LED_ON,
403*0Sstevel@tonic-gate 	LOM_LED_BLINKING
404*0Sstevel@tonic-gate };
405*0Sstevel@tonic-gate 
406*0Sstevel@tonic-gate enum colours {
407*0Sstevel@tonic-gate 	LOM_LED_COLOUR_NONE = -1,
408*0Sstevel@tonic-gate 	LOM_LED_COLOUR_ANY,
409*0Sstevel@tonic-gate 	LOM_LED_COLOUR_WHITE,
410*0Sstevel@tonic-gate 	LOM_LED_COLOUR_BLUE,
411*0Sstevel@tonic-gate 	LOM_LED_COLOUR_GREEN,
412*0Sstevel@tonic-gate 	LOM_LED_COLOUR_AMBER
413*0Sstevel@tonic-gate };
414*0Sstevel@tonic-gate 
415*0Sstevel@tonic-gate 
416*0Sstevel@tonic-gate typedef
417*0Sstevel@tonic-gate struct {
418*0Sstevel@tonic-gate 	int on;
419*0Sstevel@tonic-gate } lom_fled_info_t;
420*0Sstevel@tonic-gate 
421*0Sstevel@tonic-gate typedef
422*0Sstevel@tonic-gate struct {
423*0Sstevel@tonic-gate 	int16_t index;
424*0Sstevel@tonic-gate 	int8_t state;
425*0Sstevel@tonic-gate 	int8_t colour;
426*0Sstevel@tonic-gate 	char label[MAX_LOM2_NAME_STR];
427*0Sstevel@tonic-gate } lom_led_state_t;
428*0Sstevel@tonic-gate 
429*0Sstevel@tonic-gate typedef
430*0Sstevel@tonic-gate struct {
431*0Sstevel@tonic-gate 	char ser_char;
432*0Sstevel@tonic-gate 	int a3mode;
433*0Sstevel@tonic-gate 	int fver;
434*0Sstevel@tonic-gate 	int fchksum;
435*0Sstevel@tonic-gate 	int prod_rev;
436*0Sstevel@tonic-gate 	char prod_id[12];
437*0Sstevel@tonic-gate 	int events;
438*0Sstevel@tonic-gate } lom_info_t;
439*0Sstevel@tonic-gate 
440*0Sstevel@tonic-gate typedef
441*0Sstevel@tonic-gate struct {
442*0Sstevel@tonic-gate 	char ser_char;
443*0Sstevel@tonic-gate 	int a3mode;
444*0Sstevel@tonic-gate 	int fault_led;
445*0Sstevel@tonic-gate 	int events;
446*0Sstevel@tonic-gate 	int check;
447*0Sstevel@tonic-gate } lom_ctl_t;
448*0Sstevel@tonic-gate 
449*0Sstevel@tonic-gate /*
450*0Sstevel@tonic-gate  * in mprog, config is:
451*0Sstevel@tonic-gate  *  bits 5-7 no. fans
452*0Sstevel@tonic-gate  *  bits 3-4 no.psus
453*0Sstevel@tonic-gate  *  bit 2 tty_con
454*0Sstevel@tonic-gate  *  bit 1 set to stop fault LED flashing
455*0Sstevel@tonic-gate  *  bit 0 set if DC PSUs fitted
456*0Sstevel@tonic-gate  *
457*0Sstevel@tonic-gate  * fanhz is hz for 100% and fanmin is min speed as %.
458*0Sstevel@tonic-gate  */
459*0Sstevel@tonic-gate 
460*0Sstevel@tonic-gate typedef
461*0Sstevel@tonic-gate struct {
462*0Sstevel@tonic-gate 	char mod_id[12];
463*0Sstevel@tonic-gate 	int mod_rev;
464*0Sstevel@tonic-gate 	int config;
465*0Sstevel@tonic-gate 	int fanhz[4];
466*0Sstevel@tonic-gate 	int fanmin[4];
467*0Sstevel@tonic-gate } lom_mprog_t;
468*0Sstevel@tonic-gate 
469*0Sstevel@tonic-gate typedef
470*0Sstevel@tonic-gate struct {
471*0Sstevel@tonic-gate 	int index;	    /* top bit should be set if last buffer */
472*0Sstevel@tonic-gate 	uint8_t data[0x400];
473*0Sstevel@tonic-gate 	int size;
474*0Sstevel@tonic-gate } lom_prog_t;
475*0Sstevel@tonic-gate 
476*0Sstevel@tonic-gate /*
477*0Sstevel@tonic-gate  * LOMlite2 specific support.
478*0Sstevel@tonic-gate  */
479*0Sstevel@tonic-gate 
480*0Sstevel@tonic-gate #define	LOMIOCCTL2	_IOW('a', 40, lom_ctl2_t)
481*0Sstevel@tonic-gate 
482*0Sstevel@tonic-gate typedef
483*0Sstevel@tonic-gate struct {
484*0Sstevel@tonic-gate 	char  escape_chars[6];
485*0Sstevel@tonic-gate 	int   serial_events;
486*0Sstevel@tonic-gate } lom_ctl2_t;
487*0Sstevel@tonic-gate 
488*0Sstevel@tonic-gate #define	LOM_EVENT_NOREP	0
489*0Sstevel@tonic-gate #define	LOM_EVENT_FATAL	1
490*0Sstevel@tonic-gate #define	LOM_EVENT_WARN	2
491*0Sstevel@tonic-gate #define	LOM_EVENT_INFO	3
492*0Sstevel@tonic-gate #define	LOM_EVENT_USER	4
493*0Sstevel@tonic-gate #define	LOM_SER_EVENTS_ON	0x100
494*0Sstevel@tonic-gate #define	LOM_SER_EVENTS_OFF	0x200
495*0Sstevel@tonic-gate #define	LOM_SER_EVENTS_DEF	0x300
496*0Sstevel@tonic-gate #define	DEFAULT_NUM_EVENTS	10
497*0Sstevel@tonic-gate 
498*0Sstevel@tonic-gate #define	LOMIOCVOLTS	_IOR('a', 41, lom_volts_t)
499*0Sstevel@tonic-gate #define	MAX_VOLTS	16
500*0Sstevel@tonic-gate 
501*0Sstevel@tonic-gate typedef
502*0Sstevel@tonic-gate struct {
503*0Sstevel@tonic-gate 	int   num;  /* No. of voltage lines being monitored on that system */
504*0Sstevel@tonic-gate 	char  name[MAX_VOLTS][MAX_LOM2_NAME_STR];
505*0Sstevel@tonic-gate 	int   status[MAX_VOLTS]; /* 0=ok 1=faulty */
506*0Sstevel@tonic-gate 	int   shutdown_enabled[MAX_VOLTS];
507*0Sstevel@tonic-gate } lom_volts_t;
508*0Sstevel@tonic-gate 
509*0Sstevel@tonic-gate /* status flags (circuit breakers) */
510*0Sstevel@tonic-gate 
511*0Sstevel@tonic-gate #define	LOMIOCSTATS	_IOR('a', 42, lom_sflags_t)
512*0Sstevel@tonic-gate #define	MAX_STATS	8
513*0Sstevel@tonic-gate 
514*0Sstevel@tonic-gate typedef
515*0Sstevel@tonic-gate struct {
516*0Sstevel@tonic-gate 	int   num;  /* No. of status flags being monitored on that system */
517*0Sstevel@tonic-gate 	char  name[MAX_STATS][MAX_LOM2_NAME_STR];
518*0Sstevel@tonic-gate 	int   status[MAX_STATS]; /* 0=ok 1=faulty */
519*0Sstevel@tonic-gate } lom_sflags_t;
520*0Sstevel@tonic-gate 
521*0Sstevel@tonic-gate #define	LOMIOCTEMP	_IOR('a', 43, lom_temp_t)
522*0Sstevel@tonic-gate #define	MAX_TEMPS	8
523*0Sstevel@tonic-gate 
524*0Sstevel@tonic-gate typedef
525*0Sstevel@tonic-gate struct {
526*0Sstevel@tonic-gate 	int   num;  /* No. of temps being monitored on that system */
527*0Sstevel@tonic-gate 	char  name[MAX_TEMPS][MAX_LOM2_NAME_STR];
528*0Sstevel@tonic-gate 	int   temp[MAX_TEMPS]; /* degrees C */
529*0Sstevel@tonic-gate 	int   warning[MAX_TEMPS]; /* degrees C - zero if not enabled */
530*0Sstevel@tonic-gate 	int   shutdown[MAX_TEMPS]; /* degrees C - zero if not enabled */
531*0Sstevel@tonic-gate 	int   num_ov;  /* No. of overtemp sensors being monitored */
532*0Sstevel@tonic-gate 	char  name_ov[MAX_TEMPS][MAX_LOM2_NAME_STR];
533*0Sstevel@tonic-gate 	int   status_ov[MAX_TEMPS]; /* 0=ok 1=faulty */
534*0Sstevel@tonic-gate } lom_temp_t;
535*0Sstevel@tonic-gate 
536*0Sstevel@tonic-gate #define	LOMIOCCONS	_IOR('a', 44, lom_cbuf_t)
537*0Sstevel@tonic-gate #define	CONS_BUF_SIZE	256
538*0Sstevel@tonic-gate 
539*0Sstevel@tonic-gate typedef
540*0Sstevel@tonic-gate struct {
541*0Sstevel@tonic-gate 	char  lrbuf[CONS_BUF_SIZE];
542*0Sstevel@tonic-gate } lom_cbuf_t;
543*0Sstevel@tonic-gate 
544*0Sstevel@tonic-gate #define	LOMIOCEVENTLOG2	_IOWR('a', 45, lom_eventlog2_t)
545*0Sstevel@tonic-gate #define	MAX_EVENTS	128
546*0Sstevel@tonic-gate #define	MAX_EVENT_STR	80
547*0Sstevel@tonic-gate 
548*0Sstevel@tonic-gate /*
549*0Sstevel@tonic-gate  * NB no need for 1st fatal as the ioctl can ask for ONLY fatal events.
550*0Sstevel@tonic-gate  * The driver will return the whole event string, but include the code
551*0Sstevel@tonic-gate  * and time for mgmt applications.
552*0Sstevel@tonic-gate  */
553*0Sstevel@tonic-gate 
554*0Sstevel@tonic-gate typedef
555*0Sstevel@tonic-gate struct {
556*0Sstevel@tonic-gate 	int   num; /* no. events requested and no. returned */
557*0Sstevel@tonic-gate 	int   level; /* level of events requested */
558*0Sstevel@tonic-gate 	int   code[MAX_EVENTS];
559*0Sstevel@tonic-gate 	char  string[MAX_EVENTS][MAX_EVENT_STR];
560*0Sstevel@tonic-gate 	int   time[MAX_EVENTS];
561*0Sstevel@tonic-gate } lom_eventlog2_t;
562*0Sstevel@tonic-gate 
563*0Sstevel@tonic-gate #define	LOMIOCINFO2	_IOWR('a', 46, lom2_info_t)
564*0Sstevel@tonic-gate 
565*0Sstevel@tonic-gate /*
566*0Sstevel@tonic-gate  * We may not display all these properties by default, but add them all
567*0Sstevel@tonic-gate  * into IOCTL structure to cover future enhancements.
568*0Sstevel@tonic-gate  */
569*0Sstevel@tonic-gate 
570*0Sstevel@tonic-gate typedef
571*0Sstevel@tonic-gate struct {
572*0Sstevel@tonic-gate 	char escape_chars[6];
573*0Sstevel@tonic-gate 	int  serial_events; /* as defined for LOMIOCCTL2 */
574*0Sstevel@tonic-gate 	int a3mode;
575*0Sstevel@tonic-gate 	int fver;
576*0Sstevel@tonic-gate 	int fchksum;
577*0Sstevel@tonic-gate 	int prod_rev;
578*0Sstevel@tonic-gate 	char prod_id[12];
579*0Sstevel@tonic-gate 	int serial_config; /* security, timeout, etc */
580*0Sstevel@tonic-gate 	int baud_rate;
581*0Sstevel@tonic-gate 	int serial_hw_config; /* stop bit, parity etc */
582*0Sstevel@tonic-gate 	int phone_home_config; /* TRUE is enabled */
583*0Sstevel@tonic-gate 	char phone_home_script[128];
584*0Sstevel@tonic-gate 	char fan_names[MAX_FANS][MAX_LOM2_NAME_STR];
585*0Sstevel@tonic-gate } lom2_info_t;
586*0Sstevel@tonic-gate 
587*0Sstevel@tonic-gate /* serial_config defn - bottom 8bits are serial return timeout */
588*0Sstevel@tonic-gate #define	LOM_SER_SECURITY 0x10000
589*0Sstevel@tonic-gate #define	LOM_SER_RETURN	 0x20000
590*0Sstevel@tonic-gate #define	LOM_DISABLE_WDOG_BREAK 0x40000
591*0Sstevel@tonic-gate 
592*0Sstevel@tonic-gate /*
593*0Sstevel@tonic-gate  * For test ioctl low byte is test number and 2nd byte is the argument supplied
594*0Sstevel@tonic-gate  * with the test.  Usually, it indicates the number of iterations to perform.
595*0Sstevel@tonic-gate  * The result is returned in the low byte.
596*0Sstevel@tonic-gate  */
597*0Sstevel@tonic-gate #define	BSCV_LED_TEST			0x06
598*0Sstevel@tonic-gate #define	BSCV_LED_TEST_FLASH_ALL		0x01
599*0Sstevel@tonic-gate #define	BSCV_LED_TEST_SVC_REQD		0x02
600*0Sstevel@tonic-gate #define	BSCV_LED_TEST_DONE		0x00
601*0Sstevel@tonic-gate #define	LOMIOCTEST	_IOWR('a', 47, uint32_t)
602*0Sstevel@tonic-gate 
603*0Sstevel@tonic-gate #define	LOMIOCMPROG2	_IOW('a', 48, lom2_mprog_t)
604*0Sstevel@tonic-gate #define	LOMIOCMREAD2	_IOR('a', 49, lom2_mprog_t)
605*0Sstevel@tonic-gate 
606*0Sstevel@tonic-gate typedef
607*0Sstevel@tonic-gate struct {
608*0Sstevel@tonic-gate 	int   addr_space;
609*0Sstevel@tonic-gate 	uint8_t	data[255];
610*0Sstevel@tonic-gate } lom2_mprog_t;
611*0Sstevel@tonic-gate 
612*0Sstevel@tonic-gate #define	LOMIOCEVNT	_IOWR('a', 50, int)
613*0Sstevel@tonic-gate 
614*0Sstevel@tonic-gate /*
615*0Sstevel@tonic-gate  * Due to poll being broken in S8su2 add in ioctl to sleep for arg microsecs
616*0Sstevel@tonic-gate  */
617*0Sstevel@tonic-gate 
618*0Sstevel@tonic-gate #define	LOMIOCSLEEP	_IOWR('a', 51, int)
619*0Sstevel@tonic-gate 
620*0Sstevel@tonic-gate /*
621*0Sstevel@tonic-gate  * IOCTL defines for lomp - LOMlite field programming driver.
622*0Sstevel@tonic-gate  */
623*0Sstevel@tonic-gate 
624*0Sstevel@tonic-gate #define	LOMPIOCRESON	_IO('p', 1)
625*0Sstevel@tonic-gate #define	LOMPIOCRESOFF	_IO('p', 2)
626*0Sstevel@tonic-gate #define	LOMPIOCFVPPON	_IO('p', 3)
627*0Sstevel@tonic-gate #define	LOMPIOCFVPPOFF	_IO('p', 4)
628*0Sstevel@tonic-gate 
629*0Sstevel@tonic-gate 
630*0Sstevel@tonic-gate 
631*0Sstevel@tonic-gate #ifdef __cplusplus
632*0Sstevel@tonic-gate }
633*0Sstevel@tonic-gate #endif
634*0Sstevel@tonic-gate 
635*0Sstevel@tonic-gate #endif	/* _SYS_LOM_IO_H */
636