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