UPSTREAM: 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.

BUG=none
BRANCH=none
TEST=none

Change-Id: I0b936414f7c4d0c17800ea59c2bb3665cf700f6b
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Original-Commit-Id: e7947df462
Original-Change-Id: Ic86229e7f0c2d0525b8a79add292c6c81a349aa6
Original-Signed-off-by: Nico Huber <nico.huber@secunet.com>
Original-Reviewed-on: https://review.coreboot.org/19635
Original-Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Original-Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-on: https://chromium-review.googlesource.com/528182
Commit-Ready: Patrick Georgi <pgeorgi@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
This commit is contained in:
Nico Huber 2017-05-09 16:03:24 +02:00 committed by chrome-bot
commit 69923b9609
4 changed files with 8 additions and 25 deletions

View file

@ -50,13 +50,6 @@ config FSP_FILE
help
The path and filename of the Intel FSP binary for this platform.
config FSP_IMAGE_ID_STRING
string "8 byte platform string identifying the FSP platform"
default "$XXXFSP$"
help
8 ASCII character byte signature string that will help match the FSP
binary to a supported hardware configuration.
config FSP_LOC
hex "Intel FSP Binary location in CBFS"
default 0xffee0000

View file

@ -32,14 +32,8 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
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 @@ FSP_INFO_HEADER *find_fsp(uintptr_t fsp_base_address)
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;
}

View file

@ -87,6 +87,7 @@ int fsp_relocate(struct prog *fsp_relocd, const struct region_device *fsp_src);
#define ERROR_IMAGEBASE_MISMATCH 4
#define ERROR_INFO_HEAD_SIG_MISMATCH 5
#define ERROR_FSP_SIG_MISMATCH 6
#define ERROR_FSP_REV_MISMATCH 7
#if ENV_RAMSTAGE
extern void *FspHobListPtr;

View file

@ -222,14 +222,6 @@ config FSP_FILE
help
The path and filename of the Intel FSP binary for this platform.
config FSP_IMAGE_ID_STRING
string "8 byte platform string identifying the FSP platform"
default "QUK-FSP0"
depends on PLATFORM_USES_FSP1_1
help
8 ASCII character byte signature string that will help match the FSP
binary to a supported hardware configuration.
config FSP_LOC
hex
default 0xfff80000