Patrick Georgi | 11f0079 | 2020-03-04 15:10:45 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 3 | |
Kyösti Mälkki | a963acd | 2019-08-16 20:34:25 +0300 | [diff] [blame] | 4 | #include <arch/romstage.h> |
Aaron Durbin | 1e9a914 | 2016-09-16 16:23:21 -0500 | [diff] [blame] | 5 | #include <cbmem.h> |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 6 | #include <console/console.h> |
Nico Huber | d67edca | 2018-11-13 19:28:07 +0100 | [diff] [blame] | 7 | #include <cpu/x86/mtrr.h> |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 8 | #include <main_decl.h> |
| 9 | #include <program_loading.h> |
Subrata Banik | 4f42eea | 2019-03-05 16:45:14 +0530 | [diff] [blame] | 10 | #include <timestamp.h> |
Marshall Dawson | a102a02 | 2017-08-10 15:17:26 -0600 | [diff] [blame] | 11 | |
| 12 | /* |
| 13 | * Systems without a native coreboot cache-as-ram teardown may implement |
| 14 | * this to use an alternate method. |
| 15 | */ |
Aaron Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 16 | __weak void late_car_teardown(void) { /* do nothing */ } |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 17 | |
| 18 | void main(void) |
| 19 | { |
Marshall Dawson | a102a02 | 2017-08-10 15:17:26 -0600 | [diff] [blame] | 20 | late_car_teardown(); |
Brenton Dong | 0a5971c | 2016-10-18 11:35:15 -0700 | [diff] [blame] | 21 | |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 22 | console_init(); |
| 23 | |
Kyösti Mälkki | 8b93689 | 2019-09-12 13:45:15 +0300 | [diff] [blame] | 24 | /* |
| 25 | * CBMEM needs to be recovered because timestamps rely on |
| 26 | * the cbmem infrastructure being around. Explicitly recover it. |
| 27 | */ |
Aaron Durbin | 1e9a914 | 2016-09-16 16:23:21 -0500 | [diff] [blame] | 28 | cbmem_initialize(); |
| 29 | |
Subrata Banik | 4f42eea | 2019-03-05 16:45:14 +0530 | [diff] [blame] | 30 | timestamp_add_now(TS_START_POSTCAR); |
| 31 | |
Nico Huber | d67edca | 2018-11-13 19:28:07 +0100 | [diff] [blame] | 32 | display_mtrrs(); |
Aaron Durbin | 6b0cebc | 2016-09-16 16:15:14 -0500 | [diff] [blame] | 33 | |
| 34 | /* Load and run ramstage. */ |
| 35 | run_ramstage(); |
| 36 | } |