Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/48147 )
Change subject: mb/prodrive/hermes: Generalise `check_signature` function ......................................................................
mb/prodrive/hermes: Generalise `check_signature` function
Allow to specify which signature is to be checked.
Change-Id: Ica874b1c4283fdb8dbd702c34ccb3315a2cf160d Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/48147 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Patrick Georgi pgeorgi@google.com --- M src/mainboard/prodrive/hermes/eeprom.c M src/mainboard/prodrive/hermes/ramstage.c M src/mainboard/prodrive/hermes/romstage.c M src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h 4 files changed, 6 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index fee40a0..25fde34 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -9,13 +9,13 @@ * Check Signature in EEPROM (M24C32-FMN6TP) * If signature is there we assume that that the content is valid */ -int check_signature(u8 addr) +int check_signature(u8 addr, const size_t offset, const uint64_t signature) { u8 blob[8] = {0};
- if (!read_write_config(addr, blob, EEPROM_OFFSET_FSP_SIGNATURE, 0, ARRAY_SIZE(blob))) { + if (!read_write_config(addr, blob, offset, 0, ARRAY_SIZE(blob))) { /* Check signature */ - if (*(uint64_t *)blob == FSP_UPD_SIGNATURE) { + if (*(uint64_t *)blob == signature) { printk(BIOS_DEBUG, "CFG EEPROM: Signature valid.\n"); return 1; } diff --git a/src/mainboard/prodrive/hermes/ramstage.c b/src/mainboard/prodrive/hermes/ramstage.c index e3dfffc..b8b147d 100644 --- a/src/mainboard/prodrive/hermes/ramstage.c +++ b/src/mainboard/prodrive/hermes/ramstage.c @@ -17,7 +17,7 @@ params->SataLedEnable = 1;
/* Overwrite params */ - if (!check_signature(I2C_ADDR_EEPROM)) + if (!check_signature(I2C_ADDR_EEPROM, EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE)) return;
for (u8 i = 0; i <= ARRAY_SIZE(parmas_list); i++) { diff --git a/src/mainboard/prodrive/hermes/romstage.c b/src/mainboard/prodrive/hermes/romstage.c index 2bcd27a..6e88413 100644 --- a/src/mainboard/prodrive/hermes/romstage.c +++ b/src/mainboard/prodrive/hermes/romstage.c @@ -19,7 +19,7 @@ cannonlake_memcfg_init(&memupd->FspmConfig, variant_memcfg_config());
/* Overwrite memupd */ - if (!check_signature(I2C_ADDR_EEPROM)) + if (!check_signature(I2C_ADDR_EEPROM, EEPROM_OFFSET_FSP_SIGNATURE, FSP_UPD_SIGNATURE)) return;
for (size_t i = 0; i < ARRAY_SIZE(parmas_list); i++) { diff --git a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h index 79fda3c..85edbcf 100644 --- a/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h +++ b/src/mainboard/prodrive/hermes/variants/baseboard/include/eeprom.h @@ -30,4 +30,4 @@
bool read_write_config(u8 addr, void *blob, size_t read_offset, size_t write_offset, size_t size); -int check_signature(u8 addr); +int check_signature(u8 addr, const size_t offset, const uint64_t signature);