xref: /aosp_15_r20/external/coreboot/src/soc/cavium/common/bootblock.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <arch/exception.h>
4 #include <console/console.h>
5 #include <delay.h>
6 #include <program_loading.h>
7 #include <symbols.h>
8 #include <timestamp.h>
9 #include <soc/bootblock.h>
10 
bootblock_mainboard_early_init(void)11 __weak void bootblock_mainboard_early_init(void) { /* no-op */ }
bootblock_soc_early_init(void)12 __weak void bootblock_soc_early_init(void) { /* do nothing */ }
bootblock_soc_init(void)13 __weak void bootblock_soc_init(void) { /* do nothing */ }
bootblock_mainboard_init(void)14 __weak void bootblock_mainboard_init(void) { /* do nothing */ }
15 
16 /* C code entry point for the boot block */
bootblock_main(const uint64_t reg_x0,const uint64_t reg_pc)17 void bootblock_main(const uint64_t reg_x0,
18 		    const uint64_t reg_pc)
19 {
20 	init_timer();
21 
22 	/* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */
23 	if (CONFIG(COLLECT_TIMESTAMPS) && REGION_SIZE(timestamp) > 0)
24 		timestamp_init(timestamp_get());
25 
26 	bootblock_soc_early_init();
27 	bootblock_mainboard_early_init();
28 
29 	if (CONFIG(BOOTBLOCK_CONSOLE)) {
30 		console_init();
31 		exception_init();
32 
33 		if (reg_x0)
34 			printk(BIOS_ERR,
35 			       "BOOTBLOCK: RST Boot Failure Code %lld\n",
36 			       reg_x0);
37 	}
38 
39 	bootblock_soc_init();
40 	bootblock_mainboard_init();
41 
42 	run_romstage();
43 }
44