Commit e0343ea466a651ee574e5ceeb5c522fdcb6116ab
1 parent
40f95bfc01
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
4 other branches
MA-14318-1 Support dual bootloader for xen
Trusty is not supported for xen so we don't need to check the keyslot package or rollback index in spl. Reassign the dram address for spl and u-boot to avoid conflicts. Support serial init functions to enable debug console in spl when xen is running. Test: Boot and A/B slot switch on imx8qm_mek. Change-Id: If6829252f1ec2e32255f951715c8747181951fd0 Signed-off-by: Ji Luo <ji.luo@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
Showing 4 changed files with 65 additions and 3 deletions Side-by-side Diff
drivers/serial/serial.c
... | ... | @@ -136,6 +136,7 @@ |
136 | 136 | serial_initfunc(mpc85xx_serial_initialize); |
137 | 137 | serial_initfunc(mpc8xx_serial_initialize); |
138 | 138 | serial_initfunc(mxc_serial_initialize); |
139 | +serial_initfunc(xen_serial_initialize); | |
139 | 140 | serial_initfunc(serial_lpuart_initialize); |
140 | 141 | serial_initfunc(mxs_auart_initialize); |
141 | 142 | serial_initfunc(ns16550_serial_initialize); |
... | ... | @@ -225,6 +226,7 @@ |
225 | 226 | mpc85xx_serial_initialize(); |
226 | 227 | mpc8xx_serial_initialize(); |
227 | 228 | mxc_serial_initialize(); |
229 | + xen_serial_initialize(); | |
228 | 230 | serial_lpuart_initialize(); |
229 | 231 | mxs_auart_initialize(); |
230 | 232 | ns16550_serial_initialize(); |
drivers/serial/serial_xen.c
... | ... | @@ -182,9 +182,43 @@ |
182 | 182 | .flags = DM_FLAG_PRE_RELOC, |
183 | 183 | }; |
184 | 184 | #else |
185 | +static void xen_serial_putc(const char c) | |
186 | +{ | |
187 | + (void)HYPERVISOR_console_io(CONSOLEIO_write, 1, &c); | |
188 | +} | |
189 | + | |
190 | +static void xen_serial_puts(const char *str) | |
191 | +{ | |
192 | + (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(str), str); | |
193 | +} | |
194 | + | |
195 | +static int xen_serial_tstc(void) | |
196 | +{ | |
197 | + return 0; | |
198 | +} | |
199 | + | |
200 | +static int xen_serial_init(void) | |
201 | +{ | |
202 | +} | |
203 | + | |
204 | +static void xen_serial_setbrg(void) | |
205 | +{ | |
206 | +} | |
207 | + | |
208 | +static struct serial_device xen_serial_drv = { | |
209 | + .name = "xen_serial", | |
210 | + .start = xen_serial_init, | |
211 | + .stop = NULL, | |
212 | + .setbrg = xen_serial_setbrg, | |
213 | + .getc = NULL, | |
214 | + .putc = xen_serial_putc, | |
215 | + .puts = xen_serial_puts, | |
216 | + .tstc = xen_serial_tstc, | |
217 | +}; | |
218 | + | |
185 | 219 | __weak struct serial_device *default_serial_console(void) |
186 | 220 | { |
187 | - return NULL; | |
221 | + return &xen_serial_drv; | |
188 | 222 | } |
189 | 223 | |
190 | 224 | #endif |
include/configs/imx8qm_mek_android_auto_xen.h
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | #undef CONFIG_LOADADDR |
25 | 25 | #define CONFIG_LOADADDR 0x80080000 |
26 | 26 | #undef CONFIG_SYS_INIT_SP_ADDR |
27 | -#define CONFIG_SYS_INIT_SP_ADDR 0x80200000 | |
27 | +#define CONFIG_SYS_INIT_SP_ADDR 0x81200000 | |
28 | 28 | |
29 | 29 | #undef CONFIG_REQUIRE_SERIAL_CONSOLE |
30 | 30 | #undef CONFIG_IMX_SMMU |
... | ... | @@ -37,6 +37,22 @@ |
37 | 37 | #undef SC_IPC_CH |
38 | 38 | #endif |
39 | 39 | #define SC_IPC_CH 0x5d1d0000 |
40 | + | |
41 | +#ifdef CONFIG_SPL_BUILD | |
42 | +#undef CONFIG_SPL_BSS_START_ADDR | |
43 | +#undef CONFIG_SYS_SPL_MALLOC_START | |
44 | +#undef CONFIG_MALLOC_F_ADDR | |
45 | +#undef CONFIG_SPL_TEXT_BASE | |
46 | +#undef CONFIG_SPL_STACK | |
47 | + | |
48 | +#define CONFIG_SPL_TEXT_BASE 0x80080000 | |
49 | +#define CONFIG_MALLOC_F_ADDR 0x80100000 | |
50 | +#define CONFIG_SYS_SPL_MALLOC_START 0x80200000 | |
51 | +#define CONFIG_SPL_BSS_START_ADDR 0x80300000 | |
52 | +#define CONFIG_SPL_STACK 0x80400000 | |
53 | + | |
54 | +#define CONFIG_SYS_SPL_PTE_RAM_BASE 0x80500000 | |
55 | +#endif | |
40 | 56 | |
41 | 57 | #define AVB_AB_I_UNDERSTAND_LIBAVB_AB_IS_DEPRECATED |
42 | 58 |
lib/avb/fsl/fsl_avb_ab_flow.c
... | ... | @@ -214,6 +214,7 @@ |
214 | 214 | } |
215 | 215 | } |
216 | 216 | |
217 | +#ifndef CONFIG_XEN | |
217 | 218 | static int spl_verify_rbidx(struct mmc *mmc, AvbABSlotData *slot, |
218 | 219 | struct spl_image_info *spl_image) |
219 | 220 | { |
... | ... | @@ -273,6 +274,7 @@ |
273 | 274 | } |
274 | 275 | |
275 | 276 | } |
277 | +#endif /* CONFIG_XEN */ | |
276 | 278 | |
277 | 279 | #ifdef CONFIG_PARSE_CONTAINER |
278 | 280 | int mmc_load_image_parse_container_dual_uboot( |
279 | 281 | |
... | ... | @@ -284,7 +286,9 @@ |
284 | 286 | struct blk_desc *dev_desc; |
285 | 287 | AvbABData ab_data, ab_data_orig; |
286 | 288 | size_t slot_index_to_boot, target_slot; |
289 | +#ifndef CONFIG_XEN | |
287 | 290 | struct keyslot_package kp; |
291 | +#endif | |
288 | 292 | |
289 | 293 | /* Check if gpt is valid */ |
290 | 294 | dev_desc = mmc_get_blk_desc(mmc); |
... | ... | @@ -298,7 +302,8 @@ |
298 | 302 | return -1; |
299 | 303 | } |
300 | 304 | |
301 | - /* Read RPMB keyslot package */ | |
305 | +#ifndef CONFIG_XEN | |
306 | + /* Read RPMB keyslot package, xen won't check this. */ | |
302 | 307 | read_keyslot_package(&kp); |
303 | 308 | if (strcmp(kp.magic, KEYPACK_MAGIC)) { |
304 | 309 | if (rpmbkey_is_set()) { |
... | ... | @@ -313,6 +318,8 @@ |
313 | 318 | return -1; |
314 | 319 | } |
315 | 320 | } |
321 | +#endif | |
322 | + | |
316 | 323 | /* Load AB metadata from misc partition */ |
317 | 324 | if (fsl_load_metadata_dual_uboot(dev_desc, &ab_data, |
318 | 325 | &ab_data_orig)) { |
... | ... | @@ -342,6 +349,8 @@ |
342 | 349 | } else { |
343 | 350 | ret = mmc_load_image_parse_container(spl_image, mmc, info.start); |
344 | 351 | |
352 | + /* Don't need to check rollback index for xen. */ | |
353 | +#ifndef CONFIG_XEN | |
345 | 354 | /* Image loaded successfully, go to verify rollback index */ |
346 | 355 | if (!ret && rpmbkey_is_set()) |
347 | 356 | ret = spl_verify_rbidx(mmc, &ab_data.slots[target_slot], spl_image); |
... | ... | @@ -349,6 +358,7 @@ |
349 | 358 | /* Copy rpmb keyslot to secure memory. */ |
350 | 359 | if (!ret) |
351 | 360 | fill_secure_keyslot_package(&kp); |
361 | +#endif | |
352 | 362 | } |
353 | 363 | |
354 | 364 | /* Set current slot to unbootable if load/verify fail. */ |