soc/intel/tigerlake: Utilize vbt data size Kconfig option
[coreboot.git] / src / lib / bootblock.c
blob1509c8cb59946745e193796b2806c40c9b5dd121
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/exception.h>
4 #include <bootblock_common.h>
5 #include <console/console.h>
6 #include <delay.h>
7 #include <option.h>
8 #include <post.h>
9 #include <program_loading.h>
10 #include <symbols.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) {
32 int i;
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))
45 sanitize_cmos();
47 if (CONFIG(CMOS_POST))
48 cmos_post_init();
50 if (CONFIG(BOOTBLOCK_CONSOLE)) {
51 console_init();
52 exception_init();
55 bootblock_soc_init();
56 bootblock_mainboard_init();
58 timestamp_add_now(TS_END_BOOTBLOCK);
60 run_romstage();
63 void bootblock_main_with_basetime(uint64_t base_timestamp)
65 bootblock_main_with_timestamp(base_timestamp, NULL, 0);
68 void main(void)
70 uint64_t base_timestamp = 0;
72 init_timer();
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,
92 arg->num_timestamps);
95 #endif