From 71296476a84a43f0ca872ccda5a063e8432aa9e1 Mon Sep 17 00:00:00 2001 From: Maximilian Brune Date: Tue, 20 Jan 2026 17:06:18 +0100 Subject: [PATCH] tests/lib/coreboot_table-test.c: Add lb_string_platform_blob_version A later patch changes the .config file which we use for our tests. However that causes the PLATFORM_USES_FSP2_0 option to be enabled, which in turn causes build errors in our tests, because the function is obviously not defined in our tests. Create a stub function of sorts like we do for other coreboot table entries. It also moves the declaration of the `lb_string_platform_blob_version` function to coreboot_tables.h, since it doesn't belong in the FSP header file. Because of that we can also remove the `if (CONFIG_PLATFORM_USES_FSP2_0)` check, which makes the code a bit cleaner. Signed-off-by: Maximilian Brune Change-Id: I7721dfe4d287b2274a383bb7e5337b85a0f3f148 Reviewed-on: https://review.coreboot.org/c/coreboot/+/90830 Tested-by: build bot (Jenkins) Reviewed-by: Jakub "Kuba" Czapiga --- src/drivers/intel/fsp2_0/include/fsp/util.h | 1 - src/include/boot/coreboot_tables.h | 2 ++ src/lib/coreboot_table.c | 5 ----- tests/lib/coreboot_table-test.c | 19 +++++++++++++++++++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/drivers/intel/fsp2_0/include/fsp/util.h b/src/drivers/intel/fsp2_0/include/fsp/util.h index ce6666a453..88b0b6a22c 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/util.h +++ b/src/drivers/intel/fsp2_0/include/fsp/util.h @@ -166,7 +166,6 @@ 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); -void lb_string_platform_blob_version(struct lb_header *header); void report_fspt_output(void); void soc_validate_fspm_header(const struct fsp_header *hdr); /* diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h index 3a5e31651c..ec56c15923 100644 --- a/src/include/boot/coreboot_tables.h +++ b/src/include/boot/coreboot_tables.h @@ -24,6 +24,8 @@ void lb_add_console(uint16_t consoletype, void *data); enum cb_err fill_lb_pcie(struct lb_pcie *pcie); +void lb_string_platform_blob_version(struct lb_header *header); + /* Define this in mainboard.c to add board-specific table entries. */ void lb_board(struct lb_header *header); diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 6218784adc..5aa0e92d15 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -29,11 +29,6 @@ #if CONFIG(USE_OPTION_TABLE) #include #endif -#if CONFIG(PLATFORM_USES_FSP2_0) -#include -#else -void lb_string_platform_blob_version(struct lb_header *header); -#endif __weak enum cb_err fill_lb_pcie(struct lb_pcie *pcie) { diff --git a/tests/lib/coreboot_table-test.c b/tests/lib/coreboot_table-test.c index 9547ee07a6..2197b95631 100644 --- a/tests/lib/coreboot_table-test.c +++ b/tests/lib/coreboot_table-test.c @@ -176,6 +176,8 @@ const unsigned int coreboot_minor_revision = 13; const char coreboot_compile_time[] = "13:58:22"; const char coreboot_dmi_date[] = "03/31/2021"; +const uint8_t platform_blob_version[] = "3.2.1"; + const struct bcd_date coreboot_build_date = { .century = 0x20, .year = 0x20, @@ -228,6 +230,18 @@ enum cb_err fill_lb_serial(struct lb_serial *serial) return CB_SUCCESS; } +void lb_string_platform_blob_version(struct lb_header *header) +{ + struct lb_string *rec; + size_t len; + + rec = (struct lb_string *)lb_new_record(header); + rec->tag = LB_TAG_PLATFORM_BLOB_VERSION; + len = sizeof(platform_blob_version); + rec->size = ALIGN_UP(sizeof(*rec) + len, 8); + memcpy(rec->string, platform_blob_version, len); +} + struct cbfs_boot_device cbfs_boot_dev = { .rdev = REGION_DEV_INIT(NULL, 0, 0x1000), .mcache = (void *)0x1000, @@ -464,6 +478,11 @@ static void test_write_tables(void **state) const struct lb_acpi_rsdp *acpi_rsdp = (struct lb_acpi_rsdp *)record; assert_int_equal(ebda_base, acpi_rsdp->rsdp_pointer); break; + case LB_TAG_PLATFORM_BLOB_VERSION: + uint32_t platform_blob_version_size = + ALIGN_UP(sizeof(struct lb_string) + sizeof(platform_blob_version), 8); + assert_int_equal(platform_blob_version_size, record->size); + break; default: fail_msg("Unexpected tag found in record. Tag ID: 0x%x", record->tag); }