Nikolai Vyssotski has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/56190 )
Change subject: src/drivers/intel/fsp2_0: allow larger FSP 2.0 header ......................................................................
src/drivers/intel/fsp2_0: allow larger FSP 2.0 header
This is in preparation for migrating EDK2 to more recent version(s). In EDK2 repo commit f2cdb268ef appended an additional field to FSP 2.0 header (FspMultiPhaseSiInitEntryOffset). This increases the length of the header from 0x48 to 0x4c. This field is not used in coreboot yet. Allow headers of both lengths to be accepted.
BUG=b:181766974 TEST=build/boot with both header flavors Signed-off-by: Nikolai Vyssotski nikolai.vyssotski@amd.corp-partner.google.com Change-Id: Ie8422447b2cff0a6c536e13014905ffa15c70586 --- M src/drivers/intel/fsp2_0/include/fsp/info_header.h M src/drivers/intel/fsp2_0/util.c 2 files changed, 12 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/56190/1
diff --git a/src/drivers/intel/fsp2_0/include/fsp/info_header.h b/src/drivers/intel/fsp2_0/include/fsp/info_header.h index e08828a..e23e1d0 100644 --- a/src/drivers/intel/fsp2_0/include/fsp/info_header.h +++ b/src/drivers/intel/fsp2_0/include/fsp/info_header.h @@ -6,11 +6,15 @@ #include <types.h>
#define FSP_HDR_OFFSET 0x94 -#if CONFIG(PLATFORM_USES_FSP2_2) -#define FSP_HDR_LEN 0x4c -#else + +/* + * 0x48 is the length of header for FSP 2.0 (per specification). + * 0x4c is the length of header for FSP 2.2, + * however, some FSP 2.0 variants have it as well. + */ +#define FSP_HDR_LEN_EX 0x4c #define FSP_HDR_LEN 0x48 -#endif + #define FSP_HDR_SIGNATURE "FSPH" #define FSP_HDR_ATTRIB_FSPT 1 #define FSP_HDR_ATTRIB_FSPM 2 diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c index e9809e1..24af62b 100644 --- a/src/drivers/intel/fsp2_0/util.c +++ b/src/drivers/intel/fsp2_0/util.c @@ -13,13 +13,15 @@
static bool looks_like_fsp_header(const uint8_t *raw_hdr) { + uint32_t fsp_header_length = read32(raw_hdr + 4); + if (memcmp(raw_hdr, FSP_HDR_SIGNATURE, 4)) { printk(BIOS_ALERT, "Did not find a valid FSP signature\n"); return false; }
- if (read32(raw_hdr + 4) != FSP_HDR_LEN) { - printk(BIOS_ALERT, "FSP header has invalid length\n"); + if ((fsp_header_length != FSP_HDR_LEN) && (fsp_header_length != FSP_HDR_LEN_EX)) { + printk(BIOS_ALERT, "FSP header has invalid length: %d\n", fsp_header_length); return false; }