From 99cfad508a49993beb4826097cce9d772c778c92 Mon Sep 17 00:00:00 2001 From: Filip Brozovic Date: Tue, 21 Jan 2025 11:59:11 +0100 Subject: [PATCH] CFR: Add version field to root struct Add a version field to the CFR root struct so parsers can check compatibility when parsing structs. Change-Id: Ifcb950f1bdedc0ab925f3841befb7e7001c0f7f4 Signed-off-by: Filip Brozovic Reviewed-on: https://review.coreboot.org/c/coreboot/+/86080 Tested-by: build bot (Jenkins) Reviewed-by: Matt DeVillier Reviewed-by: Angel Pons --- src/commonlib/include/commonlib/cfr.h | 2 ++ src/commonlib/include/commonlib/coreboot_tables.h | 1 + src/drivers/option/cfr.c | 1 + 3 files changed, 4 insertions(+) diff --git a/src/commonlib/include/commonlib/cfr.h b/src/commonlib/include/commonlib/cfr.h index cc8431a2db..5d8b37bf56 100644 --- a/src/commonlib/include/commonlib/cfr.h +++ b/src/commonlib/include/commonlib/cfr.h @@ -49,6 +49,8 @@ * */ +#define CFR_VERSION 0x00000000 + enum cfr_tags { CFR_TAG_OPTION_FORM = 1, CFR_TAG_ENUM_VALUE = 2, diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index def48b7797..78dbe8ef4c 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -602,6 +602,7 @@ struct lb_efi_fw_info { struct lb_cfr { uint32_t tag; uint32_t size; + uint32_t version; uint32_t checksum; /* Checksum of the variable payload. */ /* struct lb_cfr_option_form forms[] */ }; diff --git a/src/drivers/option/cfr.c b/src/drivers/option/cfr.c index e833d7bdba..15c4fd9b4e 100644 --- a/src/drivers/option/cfr.c +++ b/src/drivers/option/cfr.c @@ -307,6 +307,7 @@ void cfr_write_setup_menu(struct lb_cfr *cfr_root, struct sm_obj_form *sm_root[] cfr_root->tag = LB_TAG_CFR_ROOT; cfr_root->size = sizeof(*cfr_root); + cfr_root->version = CFR_VERSION; current += cfr_root->size; while (sm_root && sm_root[i])