4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
30 #pragma ident "%Z%%M% %I% %E% SMI"
33 * I/O header file for LOMlite Driver.
40 #include <sys/ioccom.h>
42 /* ioctls for the TSalarm card */
45 * commands to access the alarm monitor node
48 #define TSIOCNBMON _IOR('a', 1, int)
49 #define TSIOCWTMON _IOWR('a', 2, int)
50 #define TSIOCGETMASK _IOR('a', 3, int)
53 * commands to manipulate the control node
56 #define TSIOCALCTL _IOW('a', 4, ts_aldata_t)
57 #define TSIOCALSTATE _IOWR('a', 5, ts_aldata_t)
58 #define TSIOCDOGSTATE _IOR('a', 6, ts_dogstate_t)
59 #define TSIOCDOGCTL _IOW('a', 7, ts_dogctl_t)
60 #define TSIOCDOGTIME _IOW('a', 8, uint_t)
61 #define TSIOCDOGPAT _IO('a', 9)
62 #define TSIOCUNLOCK _IO('a', 10)
65 * Defines for the number of the three alarms
73 * command to tell the driver to output debug information. This information
75 * - the hardware monitor port (R/O)
76 * - in-core monitor status byte
77 * - the in-core control port
78 * - the watchdog timeout setting
80 #define TSIOCDUMP _IO('a', 11)
81 #define TSIOCDBCTL _IOW('a', 12, ts_dbctl_t)
84 * typedefs used in alarm ioctl definitions
115 #define NUM_EVENTS 10
119 * Defines for the lom_ctl_t events/fault led flag.
126 * Defines for a3mode.
129 #define WATCHDOG 0x02
133 * Defines for PSUSTATE
135 #define LOM_PSU_NOACCESS 0x20
137 /* ioctls for the LOMlite card */
140 * old commands to access the monitor node
143 #define LOMIOCNBMON TSIOCNBMON
144 #define LOMIOCWTMON TSIOCWTMON
145 #define LOMIOCGETMASK TSIOCGETMASK
148 * old commands to manipulate the control node
151 #define LOMIOCALCTL TSIOCALCTL
152 #define LOMIOCALSTATE TSIOCALSTATE
153 #define LOMIOCDOGSTATE TSIOCDOGSTATE
154 #define LOMIOCDOGCTL TSIOCDOGCTL
155 #define LOMIOCDOGTIME TSIOCDOGTIME
156 #define LOMIOCDOGPAT TSIOCDOGPAT
157 #define LOMIOCUNLOCK TSIOCUNLOCK
160 * new commands to access the monitor node
163 #define LOMIOCPSUSTATE _IOR('a', 21, lom_psudata_t)
164 #define LOMIOCEVENTLOG _IOR('a', 22, lom_eventlog_t)
165 #define LOMIOCFANSTATE _IOR('a', 23, lom_fandata_t)
166 #define LOMIOCFLEDSTATE _IOR('a', 24, lom_fled_info_t)
167 #define LOMIOCINFO _IOR('a', 25, lom_info_t)
170 * new commands to manipulate the control node
173 #define LOMIOCCLEARLOG _IO('a', 26)
174 #define LOMIOCCTL _IOW('a', 27, lom_ctl_t)
175 #define LOMIOCPROG _IOWR('a', 28, lom_prog_t)
176 #define LOMIOCDAEMON _IOWR('a', 29, int)
177 #define LOMIOCDMON _IOWR('a', 30, int)
180 * Command to read general purpose LOMlite inputs.
181 * There are only 3 bits to general purpose inputs.
184 #define LOMIOCGPINPUTS _IOWR('a', 31, int)
187 * Manufacture programming command.
190 #define LOMIOCMPROG _IOW('a', 32, lom_mprog_t)
191 #define LOMIOCMREAD _IOR('a', 33, lom_mprog_t)
193 #define LOMIOCLEDSTATE _IOR('a', 34, lom_led_state_t)
196 * command to tell the driver to output debug information. This information
198 * - the hardware monitor port (R/O)
199 * - in-core monitor status byte
200 * - the in-core control port
201 * - the watchdog timeout setting
203 #define LOMIOCDUMP TSIOCDUMP
204 #define LOMIOCDBCTL TSIOCDBCTL
207 * typedefs used in LOMlite ioctl definitions
239 int fitted
[MAX_PSUS
];
240 int output
[MAX_PSUS
];
241 int supplya
[MAX_PSUS
];
242 int supplyb
[MAX_PSUS
];
243 int standby
[MAX_PSUS
];
248 int fitted
[MAX_FANS
];
250 int minspeed
[MAX_FANS
];
255 int events
[NUM_EVENTS
];
260 * The event codes as used in lom_eventlog_t are coded as described here:
262 * Event codes encode, in a single byte, the source and type
263 * of event/failure in the system.
265 * There are two types of failure - fan and PSU.
267 * Other events need to be stored but do not constitue faults.
269 #define LOM_EVENT_NONE 0x00 /* No fault */
270 #define LOM_EVENT_LOST 0x01 /* Event lost due to buffer overflow */
271 #define LOM_EVENT_RESET 0x02 /* Reset is asserted by the LOM */
272 #define LOM_EVENT_PWR_ON 0x03 /* Power is turned on by the LOM */
273 #define LOM_EVENT_PWR_OFF 0x04 /* Power is turned off by the LOM */
274 #define LOM_EVENT_WDOG_ON 0x05 /* Host watchdog enabled */
275 #define LOM_EVENT_WDOG_OFF 0x06 /* Host watchdog disabled */
276 #define LOM_EVENT_WDOG_TRIG 0x07 /* Host watchdog triggered */
277 #define LOM_EVENT_LOM_RESET 0x08 /* LOMlite has been reset */
278 #define LOM_EVENT_CHECKSUM 0x09 /* ROM checksum failure */
279 #define LOM_EVENT_BUSY 0x0a /* Event not ready yet (being read) */
284 #define LOM_EVENT_FAULT 0x20 /* Fault events - codes 0x20-0x2f */
285 #define LOM_EVENT_FAULT_MASK 0xf0 /* Fault events - codes 0x20-0x2f */
288 * Fault LED events are encoded thus
291 * ----------------------------
292 * | 0010 | Fault LED frequency |
293 * ----------------------------
295 * The "Fault LED frequency" is a 4 bit code allowing for LED
296 * falshing rates of 0 to 14 Hz with a rate of 15 signifying off.
298 * For example the event code for the assertion of a fault LED rate of 2Hz is:
299 * LOM_EVENT_FAULT_ENCODE(2);
301 #define LOM_EVENT_FAULT_ENCODE(faultRate) \
302 (LOM_EVENT_FAULT | ((faultRate)&0xf))
307 #define LOM_EVENT_ALARM 0x30 /* Alarm events - codes 0x30-0x3f */
308 #define LOM_EVENT_ALARM_MASK 0xf0 /* Alarm events - codes 0x30-0x3f */
311 * Alarm events are encoded thus
314 * --------------------------
315 * | 0011 | Alarm number | On |
316 * --------------------------
318 * The "Alarm number" is a 3 bit code allowing for up to 8 alarms
320 * For example the event code for the assertion of alarm 2 is:
321 * LOM_EVENT_ALARM_ENCODE(2, 1);
323 #define LOM_EVENT_ALARM_ENCODE(alarmNum, alarmOn) \
324 (LOM_EVENT_ALARM | (alarmNum<<1) | ((alarmOn)&0x1))
327 * These alarms are considered fatal errors
330 #define LOM_EVENT_FAN 0x40 /* Fan failure - codes 0x40-0x7f */
331 #define LOM_EVENT_FAN_MASK 0xc0 /* Fan failure - codes 0x40-0x7f */
334 * Fan events are encoded thus
337 * --------------------------
338 * | 01 | Fan number | Status |
339 * --------------------------
341 * The "Fan number" is a 3 bit code allowing for up to 8 fans
343 * As yet there are no defined fan statuses.
345 * For example the event code for a failure on fan 3 is:
346 * LOM_EVENT_FAN_ENCODE(3, 0);
348 #define LOM_EVENT_FAN_ENCODE(fanNum, fanStatus) \
349 (LOM_EVENT_FAN | (fanNum<<3) | ((fanStatus)&0x7))
351 #define LOM_EVENT_PSU 0x80 /* PSU failure - codes 0x80-0xbf */
352 #define LOM_EVENT_PSU_MASK 0xc0 /* PSU failure - codes 0x80-0xbf */
355 * These definitions will be picked up elsewhere in embedded code
357 #ifndef LOM_PSU_PRESENT
361 #define LOM_PSU_PRESENT 0x08
362 #define LOM_PSU_INPUT_A_OK 0x01
363 #define LOM_PSU_INPUT_B_OK 0x02
364 #define LOM_PSU_OUTPUT_OK 0x04
365 #define LOM_PSU_STATUS_MASK (LOM_PSU_INPUT_A_OK | LOM_PSU_INPUT_B_OK | \
370 * PSU events are encoded thus
373 * -------------------------------------------------------------------
374 * | 10 | PSU number | Output Status | Input B Status | Input A Status |
375 * -------------------------------------------------------------------
377 * The PSU number is a 3 bit code allowing for up to 8 PSUs
379 * The PSU status is derived from the LOM_PSU... definitions.
381 * For example the event code for an "Input B" failure on PSU 2 is:
382 * LOM_EVENT_PSU_ENCODE(2, LOM_PSU_INPUT_A_OK | LOM_PSU_OUTPUT_OK);
384 #define LOM_EVENT_PSU_ENCODE(psuNum, psuStatus) \
385 (LOM_EVENT_PSU | (psuNum<<3) | ((psuStatus)&0x7))
387 #define MAX_LOM2_NAME_STR 16
389 #define LOM_LED_STATE_OFF 0x00
390 #define LOM_LED_STATE_ON_STEADY 0x01
391 #define LOM_LED_STATE_ON_FLASHING 0x02
392 #define LOM_LED_STATE_ON_SLOWFLASH 0x03
393 #define LOM_LED_STATE_INACCESSIBLE 0xfd
394 #define LOM_LED_STATE_STANDBY 0xfe
395 #define LOM_LED_STATE_NOT_PRESENT 0xff
398 LOM_LED_OUTOFRANGE
= -3,
399 LOM_LED_NOT_IMPLEMENTED
,
400 LOM_LED_ACCESS_ERROR
,
407 LOM_LED_COLOUR_NONE
= -1,
409 LOM_LED_COLOUR_WHITE
,
411 LOM_LED_COLOUR_GREEN
,
426 char label
[MAX_LOM2_NAME_STR
];
450 * in mprog, config is:
454 * bit 1 set to stop fault LED flashing
455 * bit 0 set if DC PSUs fitted
457 * fanhz is hz for 100% and fanmin is min speed as %.
471 int index
; /* top bit should be set if last buffer */
477 * LOMlite2 specific support.
480 #define LOMIOCCTL2 _IOW('a', 40, lom_ctl2_t)
484 char escape_chars
[6];
488 #define LOM_EVENT_NOREP 0
489 #define LOM_EVENT_FATAL 1
490 #define LOM_EVENT_WARN 2
491 #define LOM_EVENT_INFO 3
492 #define LOM_EVENT_USER 4
493 #define LOM_SER_EVENTS_ON 0x100
494 #define LOM_SER_EVENTS_OFF 0x200
495 #define LOM_SER_EVENTS_DEF 0x300
496 #define DEFAULT_NUM_EVENTS 10
498 #define LOMIOCVOLTS _IOR('a', 41, lom_volts_t)
503 int num
; /* No. of voltage lines being monitored on that system */
504 char name
[MAX_VOLTS
][MAX_LOM2_NAME_STR
];
505 int status
[MAX_VOLTS
]; /* 0=ok 1=faulty */
506 int shutdown_enabled
[MAX_VOLTS
];
509 /* status flags (circuit breakers) */
511 #define LOMIOCSTATS _IOR('a', 42, lom_sflags_t)
516 int num
; /* No. of status flags being monitored on that system */
517 char name
[MAX_STATS
][MAX_LOM2_NAME_STR
];
518 int status
[MAX_STATS
]; /* 0=ok 1=faulty */
521 #define LOMIOCTEMP _IOR('a', 43, lom_temp_t)
526 int num
; /* No. of temps being monitored on that system */
527 char name
[MAX_TEMPS
][MAX_LOM2_NAME_STR
];
528 int temp
[MAX_TEMPS
]; /* degrees C */
529 int warning
[MAX_TEMPS
]; /* degrees C - zero if not enabled */
530 int shutdown
[MAX_TEMPS
]; /* degrees C - zero if not enabled */
531 int num_ov
; /* No. of overtemp sensors being monitored */
532 char name_ov
[MAX_TEMPS
][MAX_LOM2_NAME_STR
];
533 int status_ov
[MAX_TEMPS
]; /* 0=ok 1=faulty */
536 #define LOMIOCCONS _IOR('a', 44, lom_cbuf_t)
537 #define CONS_BUF_SIZE 256
541 char lrbuf
[CONS_BUF_SIZE
];
544 #define LOMIOCEVENTLOG2 _IOWR('a', 45, lom_eventlog2_t)
545 #define MAX_EVENTS 128
546 #define MAX_EVENT_STR 80
549 * NB no need for 1st fatal as the ioctl can ask for ONLY fatal events.
550 * The driver will return the whole event string, but include the code
551 * and time for mgmt applications.
556 int num
; /* no. events requested and no. returned */
557 int level
; /* level of events requested */
558 int code
[MAX_EVENTS
];
559 char string
[MAX_EVENTS
][MAX_EVENT_STR
];
560 int time
[MAX_EVENTS
];
563 #define LOMIOCINFO2 _IOWR('a', 46, lom2_info_t)
566 * We may not display all these properties by default, but add them all
567 * into IOCTL structure to cover future enhancements.
572 char escape_chars
[6];
573 int serial_events
; /* as defined for LOMIOCCTL2 */
579 int serial_config
; /* security, timeout, etc */
581 int serial_hw_config
; /* stop bit, parity etc */
582 int phone_home_config
; /* TRUE is enabled */
583 char phone_home_script
[128];
584 char fan_names
[MAX_FANS
][MAX_LOM2_NAME_STR
];
587 /* serial_config defn - bottom 8bits are serial return timeout */
588 #define LOM_SER_SECURITY 0x10000
589 #define LOM_SER_RETURN 0x20000
590 #define LOM_DISABLE_WDOG_BREAK 0x40000
593 * For test ioctl low byte is test number and 2nd byte is the argument supplied
594 * with the test. Usually, it indicates the number of iterations to perform.
595 * The result is returned in the low byte.
597 #define BSCV_LED_TEST 0x06
598 #define BSCV_LED_TEST_FLASH_ALL 0x01
599 #define BSCV_LED_TEST_SVC_REQD 0x02
600 #define BSCV_LED_TEST_DONE 0x00
601 #define LOMIOCTEST _IOWR('a', 47, uint32_t)
603 #define LOMIOCMPROG2 _IOW('a', 48, lom2_mprog_t)
604 #define LOMIOCMREAD2 _IOR('a', 49, lom2_mprog_t)
612 #define LOMIOCEVNT _IOWR('a', 50, int)
615 * Due to poll being broken in S8su2 add in ioctl to sleep for arg microsecs
618 #define LOMIOCSLEEP _IOWR('a', 51, int)
621 * IOCTL defines for lomp - LOMlite field programming driver.
624 #define LOMPIOCRESON _IO('p', 1)
625 #define LOMPIOCRESOFF _IO('p', 2)
626 #define LOMPIOCFVPPON _IO('p', 3)
627 #define LOMPIOCFVPPOFF _IO('p', 4)
635 #endif /* _SYS_LOM_IO_H */