intel/fsp2_0: Add soc_validate_fsp_version for FSP version check

Only need to check this once so check it at romstage where
the console is usually ready. Also define union fsp_revision
to avoid code duplication.

Change-Id: I628014e05bd567462f50af2633fbf48f3dc412bc
Signed-off-by: Johnny Lin <johnny_lin@wiwynn.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/47559
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Marc Jones <marc@marcjonesconsulting.com>
Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
This commit is contained in:
Johnny Lin
2020-11-13 17:21:25 +08:00
committed by Marc Jones
parent 982f64d1b7
commit 5b47d77047
3 changed files with 21 additions and 18 deletions

View File

@ -85,6 +85,9 @@ enum cb_err fsp_validate_component(struct fsp_header *hdr,
return CB_ERR;
}
if (ENV_ROMSTAGE)
soc_validate_fsp_version(hdr);
return CB_SUCCESS;
}
@ -213,15 +216,7 @@ enum cb_err fsp_load_component(struct fsp_load_descriptor *fspld, struct fsp_hea
void fsp_get_version(char *buf)
{
struct fsp_header *hdr = &fsps_hdr;
union {
uint32_t val;
struct {
uint8_t bld_num;
uint8_t revision;
uint8_t minor;
uint8_t major;
} rev;
} revision;
union fsp_revision revision;
revision.val = hdr->fsp_revision;
snprintf(buf, FSP_VER_LEN, "%u.%u-%u.%u.%u.%u", (hdr->spec_version >> 4),
@ -243,3 +238,8 @@ void lb_string_platform_blob_version(struct lb_header *header)
rec->size = ALIGN_UP(sizeof(*rec) + len + 1, 8);
memcpy(rec->string, fsp_version, len+1);
}
__weak void soc_validate_fsp_version(const struct fsp_header *hdr)
{
printk(BIOS_DEBUG, "%s not implemented.\n", __func__);
}