xref: /titanic_52/usr/src/uts/sun4u/serengeti/sys/sgsbbc_mailbox.h (revision 25c28e83beb90e7c80452a7c818c5e6f73a07dc8)
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_SGSBBC_MAILBOX_H
28 #define	_SYS_SGSBBC_MAILBOX_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/sgsbbc.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Message types - one per client!
40  */
41 #define	SBBC_BROADCAST_MSG		0x0
42 #define	OBP_MBOX			0x1
43 #define	DR_MBOX				0x2
44 #define	WILDCAT_RSM_MBOX		0x3
45 #define	SG_ENV				0x4	/* environmental data */
46 #define	CPCI_MBOX			0x5
47 #define	INFO_MBOX			0x6	/* for passing info to the SC */
48 #define	SGFRU_MBOX			0x7	/* FRUID messages */
49 #define	MBOX_EVENT_GENERIC		0x8
50 #define	MBOX_EVENT_KEY_SWITCH		0x9
51 #define	MBOX_EVENT_PANIC_SHUTDOWN	0xb
52 #define	MBOX_EVENT_ENV			0xc
53 #define	MBOX_EVENT_CPCI_ENUM		0xd
54 #define	LW8_MBOX			0xe
55 #define	MBOX_EVENT_LW8			0xf
56 #define	MBOX_EVENT_DP_ERROR		0x10	/* datapath error */
57 #define	MBOX_EVENT_DP_FAULT		0x11	/* datapath fault */
58 
59 #ifdef	DEBUG
60 #define	DBG_MBOX		0x1f	/* debug messages */
61 #endif	/* DEBUG */
62 
63 /*
64  * INFO_MBOX message sub-types
65  */
66 #define	INFO_MBOX_NODENAME	0x6000	/* for passing nodename to SC */
67 #define	INFO_MBOX_ERROR_NOTICE	0x6001	/* for logging ECC errors to SC */
68 #define	INFO_MBOX_ERROR_ECC	0x6003	/* updated interface for logging */
69 					/* ECC errors to SC */
70 #define	INFO_MBOX_ERROR_INDICT	0x6004	/* for logging ECC indictments to SC */
71 #define	INFO_MBOX_ECC		0x6005	/* new interface for logging */
72 #define	INFO_MBOX_ECC_CAP	0x6006	/* capability message */
73 
74 /*
75  * Message status values returned by the SC to the various mailbox clients.
76  *
77  * These values need to be kept in sync with MailboxProtocol.java
78  * in the SCAPP source code.
79  */
80 #define	SG_MBOX_STATUS_SUCCESS				0
81 #define	SG_MBOX_STATUS_COMMAND_FAILURE			(-1)
82 #define	SG_MBOX_STATUS_HARDWARE_FAILURE			(-2)
83 #define	SG_MBOX_STATUS_ILLEGAL_PARAMETER		(-3)
84 #define	SG_MBOX_STATUS_BOARD_ACCESS_DENIED		(-4)
85 #define	SG_MBOX_STATUS_STALE_CONTENTS			(-5)
86 #define	SG_MBOX_STATUS_STALE_OBJECT			(-6)
87 #define	SG_MBOX_STATUS_NO_SEPROM_SPACE			(-7)
88 #define	SG_MBOX_STATUS_NO_MEMORY			(-8)
89 #define	SG_MBOX_STATUS_NOT_SUPPORTED			(-9)
90 #define	SG_MBOX_STATUS_ILLEGAL_NODE			(-10)
91 #define	SG_MBOX_STATUS_ILLEGAL_SLOT			(-11)
92 
93 
94 /*
95  * Time out values in seconds.
96  *
97  * These definitions should not be used directly except by the
98  * sbbc_mbox_xxx_timeout variables. All clients should then use
99  * these variables to allow running kernels to modify wait times.
100  */
101 #define	MBOX_MIN_TIMEOUT	1	/* min time to wait before timeout */
102 #define	MBOX_DEFAULT_TIMEOUT	30	/* suggested wait time */
103 
104 /*
105  * Timeout variables
106  */
107 extern int	sbbc_mbox_min_timeout;		/* minimum wait time */
108 extern int	sbbc_mbox_default_timeout;	/* suggested wait time */
109 
110 
111 /*
112  * Message type consists of two parts
113  * type - client ID
114  * sub_type - client defined message type
115  */
116 typedef struct {
117 	uint16_t	sub_type;
118 	uint16_t	type;
119 } sbbc_msg_type_t;
120 
121 /*
122  * this struct is used by client programs to request
123  * mailbox message services
124  */
125 typedef struct sbbc_msg {
126 	sbbc_msg_type_t	msg_type;	/* message type */
127 	int	msg_status;		/* message return value */
128 	int	msg_len;		/* size of message buffer */
129 	int	msg_bytes;		/* number of bytes returned */
130 	caddr_t	msg_buf;		/* message buffer */
131 	int32_t	msg_data[2];		/* for junk mail */
132 } sbbc_msg_t;
133 
134 /*
135  * This data structure is used for queueing up ECC event mailbox
136  * messages through the SBBC taskq.
137  */
138 
139 typedef struct sbbc_ecc_mbox {
140 	sbbc_msg_t	ecc_req;	/* request */
141 	sbbc_msg_t	ecc_resp;	/* response */
142 	int		ecc_log_error;	/* Log errors to /var/adm/messages */
143 } sbbc_ecc_mbox_t;
144 
145 /*
146  * ECC event mailbox taskq parameters
147  */
148 #define	ECC_MBOX_TASKQ_MIN	2	/* minimum number of jobs */
149 #define	ECC_MBOX_TASKQ_MAX	512	/* maximum number of jobs */
150 
151 /*
152  * These are used to throttle error messages that may appear if
153  * the attempt to enqueue an ECC event message to the SC fails.
154  * If set to N > 0, then only every Nth message will be output.
155  * Set to 0 or 1 to disable this throttling and allow all error
156  * messages to appear.
157  *
158  * ECC_MBOX_TASKQ_ERR_THROTTLE is the default value for
159  * sbbc_ecc_mbox_err_throttle, which may be overridden in
160  * /etc/system or at run time via debugger.
161  */
162 #define	ECC_MBOX_TASKQ_ERR_THROTTLE	64
163 extern int	sbbc_ecc_mbox_err_throttle;
164 
165 extern int	sbbc_mbox_reg_intr(uint32_t, sbbc_intrfunc_t,
166 		sbbc_msg_t *, uint_t *, kmutex_t *);
167 extern int	sbbc_mbox_unreg_intr(uint32_t, sbbc_intrfunc_t);
168 extern int	sbbc_mbox_request_response(sbbc_msg_t *,
169 		sbbc_msg_t *, time_t);
170 
171 #ifdef	__cplusplus
172 }
173 #endif
174 
175 #endif	/* _SYS_SGSBBC_MAILBOX_H */
176