blob: b07b512c56dc786b374604573ee313846f1c1265 [file] [log] [blame]
Patrick Georgi11f00792020-03-04 15:10:45 +01001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin6b0cebc2016-09-16 16:15:14 -05002
Kyösti Mälkkia963acd2019-08-16 20:34:25 +03003#include <arch/romstage.h>
Aaron Durbin1e9a9142016-09-16 16:23:21 -05004#include <cbmem.h>
Aaron Durbin6b0cebc2016-09-16 16:15:14 -05005#include <console/console.h>
Nico Huberd67edca2018-11-13 19:28:07 +01006#include <cpu/x86/mtrr.h>
Aaron Durbin6b0cebc2016-09-16 16:15:14 -05007#include <main_decl.h>
8#include <program_loading.h>
Subrata Banik4f42eea2019-03-05 16:45:14 +05309#include <timestamp.h>
Marshall Dawsona102a022017-08-10 15:17:26 -060010
11/*
12 * Systems without a native coreboot cache-as-ram teardown may implement
13 * this to use an alternate method.
14 */
Aaron Durbin64031672018-04-21 14:45:32 -060015__weak void late_car_teardown(void) { /* do nothing */ }
Aaron Durbin6b0cebc2016-09-16 16:15:14 -050016
17void main(void)
18{
Marshall Dawsona102a022017-08-10 15:17:26 -060019 late_car_teardown();
Brenton Dong0a5971c2016-10-18 11:35:15 -070020
Aaron Durbin6b0cebc2016-09-16 16:15:14 -050021 console_init();
22
Kyösti Mälkki8b936892019-09-12 13:45:15 +030023 /*
24 * CBMEM needs to be recovered because timestamps rely on
25 * the cbmem infrastructure being around. Explicitly recover it.
Frans Hendriks6f468a52021-01-18 14:42:00 +010026 *
27 * On some platforms CBMEM needs to be initialized earlier.
28 * Use cbmem_online() to avoid init CBMEM twice.
Kyösti Mälkki8b936892019-09-12 13:45:15 +030029 */
Frans Hendriks6f468a52021-01-18 14:42:00 +010030 if (!cbmem_online())
31 cbmem_initialize();
Aaron Durbin1e9a9142016-09-16 16:23:21 -050032
Jakub Czapigaad6157e2022-02-15 11:50:31 +010033 timestamp_add_now(TS_POSTCAR_START);
Subrata Banik4f42eea2019-03-05 16:45:14 +053034
Nico Huberd67edca2018-11-13 19:28:07 +010035 display_mtrrs();
Aaron Durbin6b0cebc2016-09-16 16:15:14 -050036
37 /* Load and run ramstage. */
38 run_ramstage();
39}