From 282c27c95c993af054b2d13ccc489e7cc77ea081 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 15 Sep 2025 16:33:10 +0200 Subject: [PATCH] arch/x86/acpi_bert_storage.c: Allow vendor specific BERT entries Add a Kconfg option to allow the SoC to add vendor specific BERT entries, not yet defined in the ACPI spec. The function only has to return the size of payload data and the generic code will allocate space on the BERT table. The caller must fill in all BERT fields since the generic code doesn't know anything about the BERT entry. Change-Id: I361700098ce1a3cc6acae991456a1901d2f07fb6 Signed-off-by: Maximilian Brune Reviewed-on: https://review.coreboot.org/c/coreboot/+/90639 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- src/arch/x86/Kconfig | 7 +++++++ src/arch/x86/acpi_bert_storage.c | 8 ++++++-- src/arch/x86/include/arch/bert_storage.h | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig index d78aa8fa30..b58907e230 100644 --- a/src/arch/x86/Kconfig +++ b/src/arch/x86/Kconfig @@ -459,4 +459,11 @@ config SOC_FILL_CPU_CACHE_INFO default n help SoC selects this if it implements soc_fill_cpu_cache_info. + +config SOC_BERT_SIZEOF_ERROR_SECTION + bool + default n + help + SoC selects this if it implements soc_bert_sizeof_error_section. + endif diff --git a/src/arch/x86/acpi_bert_storage.c b/src/arch/x86/acpi_bert_storage.c index 902ddb7da5..efa1d07849 100644 --- a/src/arch/x86/acpi_bert_storage.c +++ b/src/arch/x86/acpi_bert_storage.c @@ -192,6 +192,11 @@ static size_t sizeof_error_section(guid_t *guid) else if (!guidcmp(guid, &CPER_SEC_FW_ERR_REC_REF_GUID)) return sizeof(cper_fw_err_rec_section_t); /* else if ... sizeof(structures not yet defined) */ + else if (CONFIG(SOC_BERT_SIZEOF_ERROR_SECTION)) { + size_t size = soc_bert_sizeof_error_section(guid); + if (size) + return size; + } printk(BIOS_ERR, "Requested size of unrecognized CPER GUID\n"); return 0; @@ -535,9 +540,8 @@ acpi_generic_error_status_t *bert_new_event(guid_t *guid) r = bert_append_ia32x64(status); else if (!guidcmp(guid, &CPER_SEC_FW_ERR_REC_REF_GUID)) r = bert_append_fw_err(status); - /* else if other types not implemented */ else - r = NULL; + r = bert_append_error_datasection(status, guid); if (r) return status; diff --git a/src/arch/x86/include/arch/bert_storage.h b/src/arch/x86/include/arch/bert_storage.h index eb5db7f9cb..41c4f1c6e5 100644 --- a/src/arch/x86/include/arch/bert_storage.h +++ b/src/arch/x86/include/arch/bert_storage.h @@ -50,6 +50,9 @@ */ void bert_errors_region(void **start, size_t *size); +/* Returns the size for SoC specific GUIDs */ +size_t soc_bert_sizeof_error_section(guid_t *guid); + /* Get amount of available storage left for error info */ size_t bert_storage_remaining(void); /* Find if errors were added, a BERT region is present, and ACPI table needed */