xref: /illumos-gate/usr/src/uts/sun4u/lw8/sys/lw8_impl.h (revision 7ae111d47a973fff4c6e231cc31f271dd9cef473)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_LW8_IMPL_H
28 #define	_SYS_LW8_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * local driver defines and structures
38  */
39 
40 #define	LW8_DEFAULT_MAX_MBOX_WAIT_TIME	30
41 
42 typedef struct lw8_event {
43 	int32_t		event_type;
44 } lw8_event_t;
45 
46 /*
47  * mailbox commands
48  */
49 #define	LW8_MBOX_UPDATE_FW		0
50 #define	LW8_MBOX_GET_INFO		1
51 #define	LW8_MBOX_SET_CTL		2
52 #define	LW8_MBOX_GET_LED		3
53 #define	LW8_MBOX_SET_LED		4
54 #define	LW8_MBOX_GET_EVENTS		5
55 #define	LW8_MBOX_GET_NEXT_MSG		6
56 #define	LW8_MBOX_WDT_GET		7
57 #define	LW8_MBOX_WDT_SET		8
58 
59 /*
60  * mailbox events
61  */
62 #define	LW8_EVENT_REQUESTED_SHUTDOWN	0
63 #define	LW8_EVENT_VOLTAGE_SHUTDOWN	1
64 #define	LW8_EVENT_TEMPERATURE_SHUTDOWN	2
65 #define	LW8_EVENT_FANFAIL_SHUTDOWN	3
66 #define	LW8_EVENT_NO_SCC_SHUTDOWN	4
67 #define	LW8_EVENT_NEW_LOG_MSG		5
68 #define	LW8_EVENT_SC_RESTARTED		6
69 
70 /*
71  * led requests
72  */
73 #define	MAX_LEDS_PER_FRU 9
74 #define	MAX_FRUS 24
75 
76 typedef struct lw8_get_led_payload {
77 	char	value[(3 * (MAX_FRUS - 1)) + MAX_LEDS_PER_FRU];
78 } lw8_get_led_payload_t;
79 
80 typedef struct lw8_set_led_payload {
81 	char	offset;
82 	char	value;
83 } lw8_set_led_payload_t;
84 
85 typedef struct {
86 	int   num; /* no. events requested and no. returned */
87 	int   level; /* level of events requested */
88 } lom_eventreq_t;
89 
90 #define	MAX_EVENTS	128
91 #define	MAX_EVENT_STR	80
92 
93 typedef struct {
94 	int   num; /* no. events requested and no. returned */
95 	int   level; /* level of events requested */
96 	char  string[MAX_EVENTS][MAX_EVENT_STR];
97 } lom_eventresp_t;
98 
99 #define	MAX_MSG_STR	1012
100 typedef struct {
101 	int  level;		/* syslog msg level */
102 	int  msg_valid;		/* 1 if valid, 0 if not valid */
103 	int  num_remaining;	/* num of msg's left to retrieve after this */
104 	char msg[MAX_MSG_STR];	/* the message text */
105 } lw8_logmsg_t;
106 
107 /*
108  * LW8_MBOX_WDT_GET message: SC <-> Solaris
109  *
110  * SC and Solaris use this message to learn what its peer has
111  * as their current state for these watchdog state-machine
112  * variables.
113  */
114 typedef struct {
115 	int	recovery_enabled;	/* 1/0 => {en,dis}abled */
116 	int	watchdog_enabled;	/* 1/0 => {en,dis}abled */
117 	int	timeout;		/* in seconds */
118 } lw8_get_wdt_t;
119 
120 /*
121  * LW8_MBOX_WDT_SET message: SC <- Solaris
122  *
123  * Solaris uses this to update the SC with the latest
124  * 'value' for the specified 'property_id'.
125  *
126  * Eg, to specify that the watchdog state-machine is in
127  * System Mode, <property_id, value> would be set to:
128  *
129  *     <LW8_WDT_PROP_MODE, LW8_PROP_MODE_SWDT>
130  */
131 typedef struct {
132 	int	property_id;
133 	int	value;
134 } lw8_set_wdt_t;
135 
136 /* choices for 'property_id' field: */
137 #define	LW8_WDT_PROP_RECOV	0	/* recovery_enabled */
138 #define	LW8_WDT_PROP_WDT	1	/* watchdog_enabled */
139 #define	LW8_WDT_PROP_TO		2	/* timeout duration */
140 #define	LW8_WDT_PROP_MODE	3	/* mode: AWDT or SWDT */
141 
142 /*
143  * choices for 'value' field (for the specified 'property_id'):
144  */
145 /* LW8_WDT_PROP_RECOV */
146 #define	LW8_PROP_RECOV_ENABLED		1
147 #define	LW8_PROP_RECOV_DISABLED		0
148 
149 /* LW8_WDT_PROP_WDT */
150 #define	LW8_PROP_WDT_ENABLED		1
151 #define	LW8_PROP_WDT_DISABLED		0
152 
153 /* LW8_WDT_PROP_TO:    integral number of seconds */
154 
155 /* LW8_WDT_PROP_MODE */
156 #define	LW8_PROP_MODE_AWDT	1	/* App wdog mode */
157 #define	LW8_PROP_MODE_SWDT	0	/* System wdog mode */
158 
159 #ifdef	__cplusplus
160 }
161 #endif
162 
163 #endif	/* _SYS_LW8_IMPL_H */
164