1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/exception.h>
4 #include <bootblock_common.h>
5 #include <console/console.h>
9 #include <program_loading.h>
11 #include <timestamp.h>
13 __weak
void bootblock_mainboard_early_init(void) { /* no-op */ }
14 __weak
void bootblock_soc_early_init(void) { /* do nothing */ }
15 __weak
void bootblock_soc_init(void) { /* do nothing */ }
16 __weak
void bootblock_mainboard_init(void) { /* do nothing */ }
19 * This is a the same as the bootblock main(), with the difference that it does
20 * not collect a timestamp. Instead it accepts the initial timestamp and
21 * possibly additional timestamp entries as arguments. This can be used in cases
22 * where earlier stamps are available. Note that this function is designed to be
23 * entered from C code. This function assumes that the timer has already been
24 * initialized, so it does not call init_timer().
26 void bootblock_main_with_timestamp(uint64_t base_timestamp
,
27 struct timestamp_entry
*timestamps
, size_t num_timestamps
)
29 /* Initialize timestamps if we have TIMESTAMP region in memlayout.ld. */
30 if (CONFIG(COLLECT_TIMESTAMPS
) &&
31 REGION_SIZE(timestamp
) > 0) {
33 timestamp_init(base_timestamp
);
34 for (i
= 0; i
< num_timestamps
; i
++)
35 timestamp_add(timestamps
[i
].entry_id
,
36 timestamps
[i
].entry_stamp
);
39 timestamp_add_now(TS_START_BOOTBLOCK
);
41 bootblock_soc_early_init();
42 bootblock_mainboard_early_init();
44 if (CONFIG(USE_OPTION_TABLE
))
47 if (CONFIG(CMOS_POST
))
50 if (CONFIG(BOOTBLOCK_CONSOLE
)) {
56 bootblock_mainboard_init();
58 timestamp_add_now(TS_END_BOOTBLOCK
);
63 void bootblock_main_with_basetime(uint64_t base_timestamp
)
65 bootblock_main_with_timestamp(base_timestamp
, NULL
, 0);
70 uint64_t base_timestamp
= 0;
74 if (CONFIG(COLLECT_TIMESTAMPS
))
75 base_timestamp
= timestamp_get();
77 bootblock_main_with_timestamp(base_timestamp
, NULL
, 0);
80 #if CONFIG(COMPRESS_BOOTBLOCK)
82 * This is the bootblock entry point when it is run after a decompressor stage.
83 * For non-decompressor builds, _start is generally defined in architecture-
84 * specific assembly code. In decompressor builds that architecture
85 * initialization code already ran in the decompressor, so the bootblock can
86 * start straight into common code with a C environment.
88 void _start(struct bootblock_arg
*arg
);
89 void _start(struct bootblock_arg
*arg
)
91 bootblock_main_with_timestamp(arg
->base_timestamp
, arg
->timestamps
,