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