Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/48646 )
Change subject: mb/prodrive/hermes: Cache check_board_settings_checksum ......................................................................
mb/prodrive/hermes: Cache check_board_settings_checksum
Change-Id: I46e063fd9c2808ae427bdbfb3a8b0a63c59dec47 Signed-off-by: Patrick Rudolph patrick.rudolph@9elements.com --- M src/mainboard/prodrive/hermes/eeprom.c 1 file changed, 13 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/46/48646/1
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c index f88b587..a0bb639 100644 --- a/src/mainboard/prodrive/hermes/eeprom.c +++ b/src/mainboard/prodrive/hermes/eeprom.c @@ -42,6 +42,12 @@ struct eeprom_board_settings BoardSettings; uint32_t crc;
+ static bool checked; + static bool valid; + + if (checked) + goto out; + if (read_write_config(&BoardSettings, off, 0, sizeof(BoardSettings))) { printk(BIOS_ERR, "CFG EEPROM: Failed to read board settings\n"); return 0; @@ -49,11 +55,14 @@
crc = CRC(((uint8_t *)&BoardSettings) + sizeof(uint32_t), sizeof(BoardSettings) - sizeof(uint32_t), crc32_byte); - if (crc != BoardSettings.signature) { + + valid = crc == BoardSettings.signature; + checked = true; +out: + if (!valid) printk(BIOS_ERR, "CFG EEPROM: Board settings have invalid checksum\n"); - return 0; - } - return 1; + + return valid; }
/* Read data from offset and write it to offset in UPD */