6b13f685e
김민수
BSP 최초 추가
|
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
#ifndef __MXSSB_H__
#define __MXSSB_H__
#include <stdint.h>
#include <arpa/inet.h>
#define SB_BLOCK_SIZE 16
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
struct sb_boot_image_version {
uint16_t major;
uint16_t pad0;
uint16_t minor;
uint16_t pad1;
uint16_t revision;
uint16_t pad2;
};
struct sb_boot_image_header {
union {
uint8_t digest[20];
struct {
uint8_t iv[16];
uint8_t extra[4];
};
};
uint8_t signature1[4];
uint8_t major_version;
uint8_t minor_version;
uint16_t flags;
uint32_t image_blocks;
uint32_t first_boot_tag_block;
uint32_t first_boot_section_id;
uint16_t key_count;
uint16_t key_dictionary_block;
uint16_t header_blocks;
uint16_t section_count;
uint16_t section_header_size;
uint8_t padding0[2];
uint8_t signature2[4];
uint64_t timestamp_us;
struct sb_boot_image_version
product_version;
struct sb_boot_image_version
component_version;
uint16_t drive_tag;
uint8_t padding1[6];
};
#define SB_VERSION_MAJOR 1
#define SB_VERSION_MINOR 1
#define SB_IMAGE_FLAG_DISPLAY_PROGRESS (1 << 0)
#define SB_IMAGE_FLAGS_MASK SB_IMAGE_FLAG_DISPLAY_PROGRESS
struct sb_key_dictionary_key {
uint8_t cbc_mac[SB_BLOCK_SIZE];
uint8_t key[SB_BLOCK_SIZE];
};
struct sb_ivt_header {
uint32_t header;
uint32_t entry;
uint32_t reserved1;
uint32_t dcd;
uint32_t boot_data;
uint32_t self;
uint32_t csf;
uint32_t reserved2;
};
#define SB_HAB_IVT_TAG 0xd1UL
#define SB_HAB_DCD_TAG 0xd2UL
#define SB_HAB_VERSION 0x40UL
static inline uint32_t sb_hab_ivt_header(void)
{
uint32_t ret = 0;
ret |= SB_HAB_IVT_TAG << 24;
ret |= sizeof(struct sb_ivt_header) << 16;
ret |= SB_HAB_VERSION;
return htonl(ret);
}
struct sb_sections_header {
uint32_t section_number;
uint32_t section_offset;
uint32_t section_size;
uint32_t section_flags;
};
#define SB_SECTION_FLAG_BOOTABLE (1 << 0)
struct sb_command {
struct {
uint8_t checksum;
uint8_t tag;
uint16_t flags;
#define ROM_TAG_CMD_FLAG_ROM_LAST_TAG 0x1
#define ROM_LOAD_CMD_FLAG_DCD_LOAD 0x1 /* MX28 only */
#define ROM_JUMP_CMD_FLAG_HAB 0x1 /* MX28 only */
#define ROM_CALL_CMD_FLAG_HAB 0x1 /* MX28 only */
} header;
union {
struct {
uint32_t reserved[3];
} nop;
struct {
uint32_t section_number;
uint32_t section_length;
uint32_t section_flags;
} tag;
struct {
uint32_t address;
uint32_t count;
uint32_t crc32;
} load;
struct {
uint32_t address;
uint32_t count;
uint32_t pattern;
} fill;
struct {
uint32_t address;
uint32_t reserved;
uint32_t argument;
} jump;
struct {
uint32_t address;
uint32_t reserved;
uint32_t argument;
} call;
struct {
uint32_t reserved1;
uint32_t reserved2;
uint32_t mode;
} mode;
};
};
static const struct {
const char *name;
const char *altname;
const uint8_t mode;
} modetable[] = {
{ "USB", NULL, 0x00 },
{ "I2C", NULL, 0x01 },
{ "SPI2_FLASH", "SPI1_FLASH", 0x02 },
{ "SPI3_FLASH", "SPI2_FLASH", 0x03 },
{ "NAND_BCH", NULL, 0x04 },
{ "JTAG", NULL, 0x06 },
{ "SPI3_EEPROM", "SPI2_EEPROM", 0x08 },
{ "SD_SSP0", NULL, 0x09 },
{ "SD_SSP1", NULL, 0x0A }
};
enum sb_tag {
ROM_NOP_CMD = 0x00,
ROM_TAG_CMD = 0x01,
ROM_LOAD_CMD = 0x02,
ROM_FILL_CMD = 0x03,
ROM_JUMP_CMD = 0x04,
ROM_CALL_CMD = 0x05,
ROM_MODE_CMD = 0x06
};
struct sb_source_entry {
uint8_t tag;
uint32_t address;
uint32_t flags;
char *filename;
};
#endif /* __MXSSB_H__ */
|