summaryrefslogtreecommitdiff
path: root/usr/src/uts/sun4u/sys/rmc_comm_dp_boot.h
blob: b79dc3e6aa41187136f43107c54f7192e83767a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _RMC_COMM_DP_BOOT_H
#define	_RMC_COMM_DP_BOOT_H

#pragma ident	"%Z%%M%	%I%	%E% SMI"

#ifdef __cplusplus
extern "C" {
#endif

/* Boot protocol message types */

#define	BP_OBP_TEST		0xC0
#define	BP_OBP_INIT		0xC1
#define	BP_OBP_ENQUIRE		0xC2
#define	BP_OBP_BOOTINIT		0xC3
#define	BP_OBP_RESET		0xC4
#define	BP_OBP_MACADDR		0xC5
#define	BP_OBP_BOOTMODE		0xC6
#define	BP_OBP_HOST_MACADDR	0xC7
#define	BP_OBP_SOFT_GPIO 	0xC8

#define	BP_RSC_TESTACK		0xD0
#define	BP_RSC_DIAG		0xD1
#define	BP_RSC_OK		0xD2
#define	BP_RSC_STATUS		0xD3
#define	BP_RSC_MACADDRACK	0xD5
#define	BP_RSC_BOOTMODEACK	0xD6
#define	BP_RSC_BOOTREQ		0xD8
#define	BP_RSC_BOOTACK		0xD9
#define	BP_RSC_BOOTFAIL		0xDA
#define	BP_RSC_BOOTOK		0xDB
#define	BP_RSC_SOFTGPIOACK	0xDD

#define	BP_MIN_CMD		0xC0
#define	BP_MAX_CMD		0xDF

/*
 * A boot protocol message consists of one (or more) synchronizing
 * bytes, a command byte, and two data bytes.  The following structure
 * defines how a boot message is passed around.  Hopefully the C
 * compiler will be smart enough to pass this in a register...
 */

#define	BP_SYNC		0x80

typedef struct bp_msg {
	uint8_t pad;	/* make it 4 bytes long */
	uint8_t cmd;
	uint8_t dat1;
	uint8_t dat2;
} bp_msg_t;

/* Test numbers used in the OBP_TEST message: */
#define	BP_DAT1_MIN_TEST	0
#define	BP_DAT1_TTYC_ECHO_ON	0
#define	BP_DAT1_TTYC_ECHO_OFF	1
#define	BP_DAT1_TTYD_ECHO_ON	2
#define	BP_DAT1_TTYD_ECHO_OFF	3
#define	BP_DAT1_TTYCD_ECHO_ON	4
#define	BP_DAT1_TTYCD_ECHO_OFF	5
#define	BP_DAT1_ENET_INT_LB	6
#define	BP_DAT1_ENET_EXT_LB	7
#define	BP_DAT1_TTYU_INT_LB	8
#define	BP_DAT1_TTYU_EXT_LB	9
#define	BP_DAT1_SEEPROM_CKSUM	10
#define	BP_DAT1_DUMMY_TEST	11
#define	BP_DAT1_FRU_CKSUM	12
#define	BP_DAT1_FLASH_CKSUM	13
#define	BP_DAT1_TOD_TEST	14
#define	BP_DAT1_MODEM_TEST	15
#define	BP_DAT1_MAX_TEST	15

/*
 * This bit should be set in the RSC_STATUS message to indicate to the
 * host that there is an interesting bootmode.
 */
#define	BP_DAT1_VALID_BOOTMODE	0x40

/*
 * Bit definitions for the OBP_INIT and RSC_OK messages.
 */

#define	BP_DAT1_MENUS	0x80
#define	BP_DAT1_MAX	0x40
#define	BP_DAT1_MED	0x20
#define	BP_DAT1_MIN	0x10
#define	BP_DAT1_MBO	0x01

#define	BP_DAT2_DIAGSW	0x01

/* Bit definitions for OBP_BOOTINIT message. */

#define	BP_DAT2_FLASH_PDAT	0x04
#define	BP_DAT2_FLASH_MAIN	0x02
#define	BP_DAT2_FLASH_BOOT	0x01

/*
 * For bit definitions for the RSC_STATUS message, see the post word bit
 * definitions in "postword.h".
 */

/* Bit definitions for RSC_BOOTFAIL message. */

#define	BP_DAT1_REJECTED	0x40
#define	BP_DAT1_RANGE_ERR	0x20
#define	BP_DAT1_VERIFY_ERR	0x10
#define	BP_DAT1_ERASE_ERR	0x08
#define	BP_DAT1_INT_WP_ERR	0x04
#define	BP_DAT1_WP_ERR		0x02
#define	BP_DAT1_VPP_ERR		0x01

/* For lower 8 bits, see the lower 8 bits of the post word in "postword.h". */

#define	KANTH_SRECORD_ACK

/*
 * When downloading S-records, a RSC:bootack is sent with the following
 * value in dat1 to indicate whether the S-record checksum was OK or not.
 */

#define	BP_DAT1_BOOTINIT_ACK	0x00
#define	BP_DAT1_SRECORD_ACK	0x01
#define	BP_DAT1_SRECORD_NAK	0x02

/* Definitions for OBP_BOOTMODE message: */
#define	BP_DAT2_BOOTMODE_CLEAR		1

/* Definitions for RSC_BOOTMODE message: */
#define	BP_BAT1_BOOTMODE_DATAMSB	0x10
#define	BP_DAT1_BOOTMODE_OFFSET_MASK	0x07

#define	BP_DAT2_BOOTMODE_DATA_MASK	0x7F

/* Definitions for RSC_BOOTMODEACK message: */
#define	BP_DAT1_BOOTMODE_NORMAL		0
#define	BP_DAT1_BOOTMODE_FORTH		1
#define	BP_DAT1_BOOTMODE_RESET_NVRAM	2
#define	BP_DAT1_BOOTMODE_DIAG		3
#define	BP_DAT1_BOOTMODE_SKIP_DIAG	4

#define	BP_DAT2_BOOTOPT_CONSOLE_RSC	1

/* Definitions for RSC_MACADDRACK message: */
#define	BP_DAT2_MACADDRACK_OK		0
#define	BP_DAT2_MACADDRACK_DONE		1
#define	BP_DAT2_MACADDRACK_BADOFFSET	2
#define	BP_DAT2_MACADDRACK_NOTREADY	3
#define	BP_DAT2_MACADDRACK_NVERR	4

/* Definitions for RSC_SOFTGPIOACK message */
#define	BP_DAT2_HOST_TYPE_OK		0
#define	BP_DAT2_HOST_TYPE_NVERR		1

#ifdef __cplusplus
}
#endif

#endif /* _RMC_COMM_DP_BOOT_H */