Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 2 | |
| 3 | #include <arch/romstage.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 4 | #include <intelblocks/rtc.h> |
| 5 | #include <console/console.h> |
Andrey Petrov | 662da6c | 2020-03-16 22:46:57 -0700 | [diff] [blame] | 6 | #include <fsp/util.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 7 | #include <soc/romstage.h> |
Andrey Petrov | 662da6c | 2020-03-16 22:46:57 -0700 | [diff] [blame] | 8 | #include <soc/util.h> |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 9 | |
Arthur Heymans | 1410224 | 2020-10-22 14:13:14 +0200 | [diff] [blame] | 10 | void mainboard_romstage_entry(void) |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 11 | { |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 12 | rtc_init(); |
Jingle Hsu | e07ea4c | 2020-07-01 18:26:49 +0800 | [diff] [blame] | 13 | if (soc_get_rtc_failed()) |
| 14 | mainboard_rtc_failed(); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 15 | |
| 16 | fsp_memory_init(false); |
| 17 | printk(BIOS_DEBUG, "coreboot fsp_memory_init finished...\n"); |
Johnny Lin | 491f66e | 2022-04-07 09:16:32 +0800 | [diff] [blame] | 18 | mainboard_ewl_check(); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 19 | |
Tim Chu | d5bd8d5 | 2022-12-14 11:37:55 +0000 | [diff] [blame] | 20 | if (CONFIG(ENABLE_FSP_ERROR_INFO)) { |
| 21 | if (fsp_display_error_info()) { |
| 22 | mainboard_fsp_error_handle(); |
| 23 | die("ERROR: FSP reported an error(s) after running!"); |
| 24 | } |
| 25 | } |
| 26 | |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 27 | unlock_pam_regions(); |
| 28 | |
Johnny Lin | 7581352 | 2020-09-28 22:38:31 +0800 | [diff] [blame] | 29 | save_dimm_info(); |
Jonathan Zhang | 8f89549 | 2020-01-16 11:16:45 -0800 | [diff] [blame] | 30 | } |
Andrey Petrov | 6d9dc24 | 2020-04-20 17:16:53 -0700 | [diff] [blame] | 31 | |
| 32 | __weak void mainboard_memory_init_params(FSPM_UPD *mupd) |
| 33 | { |
| 34 | printk(BIOS_SPEW, "WARNING: using default FSP-M parameters!\n"); |
| 35 | } |
Jingle Hsu | e07ea4c | 2020-07-01 18:26:49 +0800 | [diff] [blame] | 36 | |
| 37 | __weak void mainboard_rtc_failed(void) |
| 38 | { |
Jingle Hsu | e07ea4c | 2020-07-01 18:26:49 +0800 | [diff] [blame] | 39 | } |
Johnny Lin | 7581352 | 2020-09-28 22:38:31 +0800 | [diff] [blame] | 40 | __weak void save_dimm_info(void) { } |
Johnny Lin | 491f66e | 2022-04-07 09:16:32 +0800 | [diff] [blame] | 41 | __weak void mainboard_ewl_check(void) { } |
Tim Chu | d5bd8d5 | 2022-12-14 11:37:55 +0000 | [diff] [blame] | 42 | |
| 43 | /* mainboard can override this function for their own handling, such as writing a BMC SEL. */ |
| 44 | __weak void mainboard_fsp_error_handle(void) { } |