xref: /illumos-gate/usr/src/uts/sun4u/sys/rmc_comm_dp_boot.h (revision a386cc11a86ecb60f5a48078d22c1500e2ad003e)
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 2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _RMC_COMM_DP_BOOT_H
28 #define	_RMC_COMM_DP_BOOT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* Boot protocol message types */
37 
38 #define	BP_OBP_TEST		0xC0
39 #define	BP_OBP_INIT		0xC1
40 #define	BP_OBP_ENQUIRE		0xC2
41 #define	BP_OBP_BOOTINIT		0xC3
42 #define	BP_OBP_RESET		0xC4
43 #define	BP_OBP_MACADDR		0xC5
44 #define	BP_OBP_BOOTMODE		0xC6
45 #define	BP_OBP_HOST_MACADDR	0xC7
46 #define	BP_OBP_SOFT_GPIO 	0xC8
47 
48 #define	BP_RSC_TESTACK		0xD0
49 #define	BP_RSC_DIAG		0xD1
50 #define	BP_RSC_OK		0xD2
51 #define	BP_RSC_STATUS		0xD3
52 #define	BP_RSC_MACADDRACK	0xD5
53 #define	BP_RSC_BOOTMODEACK	0xD6
54 #define	BP_RSC_BOOTREQ		0xD8
55 #define	BP_RSC_BOOTACK		0xD9
56 #define	BP_RSC_BOOTFAIL		0xDA
57 #define	BP_RSC_BOOTOK		0xDB
58 #define	BP_RSC_SOFTGPIOACK	0xDD
59 
60 #define	BP_MIN_CMD		0xC0
61 #define	BP_MAX_CMD		0xDF
62 
63 /*
64  * A boot protocol message consists of one (or more) synchronizing
65  * bytes, a command byte, and two data bytes.  The following structure
66  * defines how a boot message is passed around.  Hopefully the C
67  * compiler will be smart enough to pass this in a register...
68  */
69 
70 #define	BP_SYNC		0x80
71 
72 typedef struct bp_msg {
73 	uint8_t pad;	/* make it 4 bytes long */
74 	uint8_t cmd;
75 	uint8_t dat1;
76 	uint8_t dat2;
77 } bp_msg_t;
78 
79 /* Test numbers used in the OBP_TEST message: */
80 #define	BP_DAT1_MIN_TEST	0
81 #define	BP_DAT1_TTYC_ECHO_ON	0
82 #define	BP_DAT1_TTYC_ECHO_OFF	1
83 #define	BP_DAT1_TTYD_ECHO_ON	2
84 #define	BP_DAT1_TTYD_ECHO_OFF	3
85 #define	BP_DAT1_TTYCD_ECHO_ON	4
86 #define	BP_DAT1_TTYCD_ECHO_OFF	5
87 #define	BP_DAT1_ENET_INT_LB	6
88 #define	BP_DAT1_ENET_EXT_LB	7
89 #define	BP_DAT1_TTYU_INT_LB	8
90 #define	BP_DAT1_TTYU_EXT_LB	9
91 #define	BP_DAT1_SEEPROM_CKSUM	10
92 #define	BP_DAT1_DUMMY_TEST	11
93 #define	BP_DAT1_FRU_CKSUM	12
94 #define	BP_DAT1_FLASH_CKSUM	13
95 #define	BP_DAT1_TOD_TEST	14
96 #define	BP_DAT1_MODEM_TEST	15
97 #define	BP_DAT1_MAX_TEST	15
98 
99 /*
100  * This bit should be set in the RSC_STATUS message to indicate to the
101  * host that there is an interesting bootmode.
102  */
103 #define	BP_DAT1_VALID_BOOTMODE	0x40
104 
105 /*
106  * Bit definitions for the OBP_INIT and RSC_OK messages.
107  */
108 
109 #define	BP_DAT1_MENUS	0x80
110 #define	BP_DAT1_MAX	0x40
111 #define	BP_DAT1_MED	0x20
112 #define	BP_DAT1_MIN	0x10
113 #define	BP_DAT1_MBO	0x01
114 
115 #define	BP_DAT2_DIAGSW	0x01
116 
117 /* Bit definitions for OBP_BOOTINIT message. */
118 
119 #define	BP_DAT2_FLASH_PDAT	0x04
120 #define	BP_DAT2_FLASH_MAIN	0x02
121 #define	BP_DAT2_FLASH_BOOT	0x01
122 
123 /*
124  * For bit definitions for the RSC_STATUS message, see the post word bit
125  * definitions in "postword.h".
126  */
127 
128 /* Bit definitions for RSC_BOOTFAIL message. */
129 
130 #define	BP_DAT1_REJECTED	0x40
131 #define	BP_DAT1_RANGE_ERR	0x20
132 #define	BP_DAT1_VERIFY_ERR	0x10
133 #define	BP_DAT1_ERASE_ERR	0x08
134 #define	BP_DAT1_INT_WP_ERR	0x04
135 #define	BP_DAT1_WP_ERR		0x02
136 #define	BP_DAT1_VPP_ERR		0x01
137 
138 /* For lower 8 bits, see the lower 8 bits of the post word in "postword.h". */
139 
140 #define	KANTH_SRECORD_ACK
141 
142 /*
143  * When downloading S-records, a RSC:bootack is sent with the following
144  * value in dat1 to indicate whether the S-record checksum was OK or not.
145  */
146 
147 #define	BP_DAT1_BOOTINIT_ACK	0x00
148 #define	BP_DAT1_SRECORD_ACK	0x01
149 #define	BP_DAT1_SRECORD_NAK	0x02
150 
151 /* Definitions for OBP_BOOTMODE message: */
152 #define	BP_DAT2_BOOTMODE_CLEAR		1
153 
154 /* Definitions for RSC_BOOTMODE message: */
155 #define	BP_BAT1_BOOTMODE_DATAMSB	0x10
156 #define	BP_DAT1_BOOTMODE_OFFSET_MASK	0x07
157 
158 #define	BP_DAT2_BOOTMODE_DATA_MASK	0x7F
159 
160 /* Definitions for RSC_BOOTMODEACK message: */
161 #define	BP_DAT1_BOOTMODE_NORMAL		0
162 #define	BP_DAT1_BOOTMODE_FORTH		1
163 #define	BP_DAT1_BOOTMODE_RESET_NVRAM	2
164 #define	BP_DAT1_BOOTMODE_DIAG		3
165 #define	BP_DAT1_BOOTMODE_SKIP_DIAG	4
166 
167 #define	BP_DAT2_BOOTOPT_CONSOLE_RSC	1
168 
169 /* Definitions for RSC_MACADDRACK message: */
170 #define	BP_DAT2_MACADDRACK_OK		0
171 #define	BP_DAT2_MACADDRACK_DONE		1
172 #define	BP_DAT2_MACADDRACK_BADOFFSET	2
173 #define	BP_DAT2_MACADDRACK_NOTREADY	3
174 #define	BP_DAT2_MACADDRACK_NVERR	4
175 
176 /* Definitions for RSC_SOFTGPIOACK message */
177 #define	BP_DAT2_HOST_TYPE_OK		0
178 #define	BP_DAT2_HOST_TYPE_NVERR		1
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
184 #endif /* _RMC_COMM_DP_BOOT_H */
185