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