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 <maximilian.brune@9elements.com>
Change-Id: I7721dfe4d287b2274a383bb7e5337b85a0f3f148
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90830
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
This commit is contained in:
Maximilian Brune 2026-01-20 17:06:18 +01:00
commit 71296476a8
4 changed files with 21 additions and 6 deletions

View file

@ -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);
/*

View file

@ -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);

View file

@ -29,11 +29,6 @@
#if CONFIG(USE_OPTION_TABLE)
#include <option_table.h>
#endif
#if CONFIG(PLATFORM_USES_FSP2_0)
#include <fsp/util.h>
#else
void lb_string_platform_blob_version(struct lb_header *header);
#endif
__weak enum cb_err fill_lb_pcie(struct lb_pcie *pcie)
{

View file

@ -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);
}