From 65b7219bd3383d7b92afa1f081d46531077e1c14 Mon Sep 17 00:00:00 2001 From: "Ray Han Lim, Ng" Date: Fri, 21 Jan 2022 14:33:11 +0800 Subject: drivers/intel/fsp2_0: Add support for FSP_ERROR_INFO_HOB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a new Kconfig CONFIG_ENABLE_FSP_ERROR_INFO option to enable retrieval of FSP_ERROR_INFO_HOB from HobList created by FSP. Such a HOB could be generated by Intel SPR-SP FSP. This HOB data is defined in Intel®Firmware Support Package External Architecture Specification v2.1 Doc#611786-2.1. Change-Id: I812d1c22c1bbe5146630948ca6ca12c46ffd5504 Signed-off-by: Ray Han Lim, Ng Signed-off-by: Johnny Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/71949 Tested-by: build bot (Jenkins) Reviewed-by: Lean Sheng Tan --- src/drivers/intel/fsp2_0/Kconfig.debug_blob | 10 ++++++++++ src/drivers/intel/fsp2_0/Makefile.inc | 2 ++ src/drivers/intel/fsp2_0/fsp_error_info_hob.c | 14 +++++++++++++ src/drivers/intel/fsp2_0/hand_off_block.c | 23 ++++++++++++++++++++++ src/drivers/intel/fsp2_0/include/fsp/soc_binding.h | 4 ++++ src/drivers/intel/fsp2_0/include/fsp/util.h | 2 ++ 6 files changed, 55 insertions(+) create mode 100644 src/drivers/intel/fsp2_0/fsp_error_info_hob.c (limited to 'src/drivers/intel') diff --git a/src/drivers/intel/fsp2_0/Kconfig.debug_blob b/src/drivers/intel/fsp2_0/Kconfig.debug_blob index e9e6053c64..3436c06e56 100644 --- a/src/drivers/intel/fsp2_0/Kconfig.debug_blob +++ b/src/drivers/intel/fsp2_0/Kconfig.debug_blob @@ -45,6 +45,16 @@ config DISPLAY_FSP_VERSION_INFO_2 Select this option to display Firmware version information using new header 'FirmwareVersionInfo.h'. +config ENABLE_FSP_ERROR_INFO + bool "Enable FSP Error Information" + default n + depends on PLATFORM_USES_FSP2_1 + help + Select this option to enable FSP Error information. FSP detects certain errors + and notifies coreboot of a fatal error occurring during the execution of the FSP. + Although it's defined in FSP v2.1 but has only been verified on Intel Xeon-SP + Sapphire Rapids. + config HAVE_GPIO_SNAPSHOT_VERIFY_SUPPORT bool default n diff --git a/src/drivers/intel/fsp2_0/Makefile.inc b/src/drivers/intel/fsp2_0/Makefile.inc index f11ebee102..ae82833fc2 100644 --- a/src/drivers/intel/fsp2_0/Makefile.inc +++ b/src/drivers/intel/fsp2_0/Makefile.inc @@ -15,6 +15,7 @@ romstage-y += util.c romstage-y += memory_init.c romstage-$(CONFIG_MMA) += mma_core.c romstage-y += cbmem.c +romstage-$(CONFIG_ENABLE_FSP_ERROR_INFO) += fsp_error_info_hob.c ramstage-y += debug.c ramstage-$(CONFIG_FSP_USES_CB_DEBUG_EVENT_HANDLER) += fsp_debug_event.c @@ -31,6 +32,7 @@ ramstage-$(CONFIG_DISPLAY_UPD_DATA) += upd_display.c ramstage-y += util.c ramstage-$(CONFIG_CACHE_MRC_SETTINGS) += save_mrc_data.c ramstage-$(CONFIG_MMA) += mma_core.c +ramstage-$(CONFIG_ENABLE_FSP_ERROR_INFO) += fsp_error_info_hob.c ifneq ($(CONFIG_NO_FSP_TEMP_RAM_EXIT),y) postcar-$(CONFIG_FSP_CAR) += temp_ram_exit.c diff --git a/src/drivers/intel/fsp2_0/fsp_error_info_hob.c b/src/drivers/intel/fsp2_0/fsp_error_info_hob.c new file mode 100644 index 0000000000..9c27ec7246 --- /dev/null +++ b/src/drivers/intel/fsp2_0/fsp_error_info_hob.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include +#include + +void display_fsp_error_info_hob(const void *hob) +{ + const FSP_ERROR_INFO_HOB *fsp_error_info_hob = (FSP_ERROR_INFO_HOB *)hob; + printk(BIOS_ERR, "FspErrorInfoHob->CallerId = "); + fsp_print_guid(BIOS_CRIT, &fsp_error_info_hob->CallerId); + printk(BIOS_ERR, "\nFspErrorInfoHob->ErrorType = "); + fsp_print_guid(BIOS_CRIT, &fsp_error_info_hob->ErrorType); + printk(BIOS_ERR, "\nFspErrorInfoHob->Status = %x\n", fsp_error_info_hob->Status); +} diff --git a/src/drivers/intel/fsp2_0/hand_off_block.c b/src/drivers/intel/fsp2_0/hand_off_block.c index aae1ff8fad..f6af894877 100644 --- a/src/drivers/intel/fsp2_0/hand_off_block.c +++ b/src/drivers/intel/fsp2_0/hand_off_block.c @@ -32,6 +32,11 @@ const uint8_t fsp_nv_storage_guid[16] = { 0xb3, 0xdc, 0x27, 0x0b, 0x7b, 0xa9, 0xe4, 0xb0 }; +const uint8_t fsp_error_info_guid[16] = { + 0x88, 0x6a, 0x1e, 0x61, 0xb7, 0xad, 0x01, 0x43, + 0x93, 0xff, 0xe4, 0x73, 0x04, 0xb4, 0x3d, 0xa6 +}; + static const uint8_t uuid_fv_info[16] = { 0x2e, 0x72, 0x8e, 0x79, 0xb2, 0x15, 0x13, 0x4e, 0x8a, 0xe9, 0x6b, 0xa3, 0x0f, 0xf7, 0xf1, 0x67 @@ -356,3 +361,21 @@ void fsp_find_bootloader_tolum(struct range_entry *re) if (fsp_find_range_hob(re, fsp_bootloader_tolum_guid)) die("9.3: FSP_BOOTLOADER_TOLUM_HOB missing!\n"); } + +bool fsp_display_error_info(void) +{ + if (!CONFIG(ENABLE_FSP_ERROR_INFO)) + return false; + + const struct hob_header *hob; + size_t size; + + hob = (const struct hob_header *)fsp_find_extension_hob_by_guid( + fsp_error_info_guid, &size); + if (hob != NULL) { + display_fsp_error_info_hob(hob); + return true; + } + + return false; +} diff --git a/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h index 8392a03adc..02cd4e04e5 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h +++ b/src/drivers/intel/fsp2_0/include/fsp/soc_binding.h @@ -33,6 +33,10 @@ #include #endif +#if CONFIG(ENABLE_FSP_ERROR_INFO) +#include +#endif + #pragma pack(pop) #endif diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index 566fad99f4..5ff5814642 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -137,6 +137,8 @@ const struct hob_resource *fsp_hob_header_to_resource( const struct hob_header *fsp_next_hob(const struct hob_header *parent); bool fsp_guid_compare(const uint8_t guid1[16], const uint8_t guid2[16]); void fsp_find_bootloader_tolum(struct range_entry *re); +bool fsp_display_error_info(void); +void display_fsp_error_info_hob(const void *hob); void fsp_get_version(char *buf); /* fsp_verify_upd_header_signature calls die() on signature mismatch */ void fsp_verify_upd_header_signature(uint64_t upd_signature, uint64_t expected_signature); -- cgit v1.2.3