fsp1_1: Verify FSP_IMAGE_ID/_REV against headers
FSP_IMAGE_ID and FSP_IMAGE_REV are defined in `FspUpdVpd.h`. Check
against these to avoid mismatching definitions in coreboot and the
FSP blob.
Change-Id: Ic86229e7f0c2d0525b8a79add292c6c81a349aa6
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/19635
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/drivers/intel/fsp1_1/fsp_util.c b/src/drivers/intel/fsp1_1/fsp_util.c
index 0d09483..8b23c4a 100644
--- a/src/drivers/intel/fsp1_1/fsp_util.c
+++ b/src/drivers/intel/fsp1_1/fsp_util.c
@@ -32,14 +32,8 @@
EFI_RAW_SECTION *rs;
u32 u32;
} fsp_ptr;
- static const union {
- char str_id[8];
- u32 int_id[2];
- } fsp_id = {
- .str_id = CONFIG_FSP_IMAGE_ID_STRING
- };
- u32 *image_id;
+ u64 *image_id;
/* Get the FSP binary base address in CBFS */
fsp_ptr.u32 = fsp_base_address;
@@ -79,11 +73,14 @@
return (FSP_INFO_HEADER *)ERROR_INFO_HEAD_SIG_MISMATCH;
/* Verify the FSP ID */
- image_id = (u32 *)&fsp_ptr.fih->ImageId[0];
- if ((image_id[0] != fsp_id.int_id[0])
- || (image_id[1] != fsp_id.int_id[1]))
+ image_id = (u64 *)&fsp_ptr.fih->ImageId[0];
+ if (*image_id != FSP_IMAGE_ID)
return (FSP_INFO_HEADER *)ERROR_FSP_SIG_MISMATCH;
+ /* Verify the FSP Revision */
+ if (fsp_ptr.fih->ImageRevision != FSP_IMAGE_REV)
+ return (FSP_INFO_HEADER *)ERROR_FSP_REV_MISMATCH;
+
return fsp_ptr.fih;
}