drivers/intel/fsp2_0: factor out and improve UPD signature check
In case of a mismatch print both the UPD signature in the FSP and the expected signature and then calls die(), since it shouldn't try calling into the wrong FSP binary for the platform. Signed-off-by: Justin Frodsham <justin.frodsham@protonmail.com> Signed-off-by: Felix Held <felix-coreboot@felixheld.de> Change-Id: I469836e09db6024ecb448a5261439c66d8e65daf Reviewed-on: https://review.coreboot.org/c/coreboot/+/50090 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Marshall Dawson <marshalldawson3rd@gmail.com> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
@ -224,6 +224,21 @@ void fsp_get_version(char *buf)
|
||||
revision.rev.minor, revision.rev.revision, revision.rev.bld_num);
|
||||
}
|
||||
|
||||
/* Check if the signature in the UPD header matches the expected one. If it doesn't match, the
|
||||
FSP binaries in CBFS are for a different platform than the platform code trying to use it
|
||||
in which case the function calls die(). */
|
||||
void fsp_verify_upd_header_signature(uint64_t upd_signature, uint64_t expected_signature)
|
||||
{
|
||||
if (upd_signature != expected_signature) {
|
||||
/* The UPD signatures are non-zero-terminated ASCII stored as a little endian
|
||||
uint64_t, so this needs some casts. */
|
||||
die_with_post_code(POST_INVALID_VENDOR_BINARY,
|
||||
"Invalid UPD signature! FSP provided \"%8s\", expected was \"%8s\".\n",
|
||||
(char *)&upd_signature,
|
||||
(char *)&expected_signature);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add FSP version to coreboot table LB_TAG_PLATFORM_BLOB_VERSION */
|
||||
void lb_string_platform_blob_version(struct lb_header *header)
|
||||
{
|
||||
|
Reference in New Issue
Block a user