Attention is currently required from: Patrick Rudolph, Christian Walter.

Angel Pons has uploaded this change for review.

View Change

[RFC] mb/prodrive/hermes: Make board settings less error-prone

If the board settings definition differs between coreboot and the BMC,
the CRC will not match. Allow coreboot to use the BMC settings provided
by older BMC firmware revisions which have less settings, if the CRC of
the first N bytes matches the expected CRC.

TEST=Boot coreboot master with BMC FW 4.05, observe board settings being
honored even though coreboot's definition has an extra option.

Change-Id: I0f009b21ef0850a2af6edef1818c770171358314
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
---
M src/mainboard/prodrive/hermes/eeprom.c
1 file changed, 32 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/81/67381/1
diff --git a/src/mainboard/prodrive/hermes/eeprom.c b/src/mainboard/prodrive/hermes/eeprom.c
index 7a92fe3..8ce671b 100644
--- a/src/mainboard/prodrive/hermes/eeprom.c
+++ b/src/mainboard/prodrive/hermes/eeprom.c
@@ -51,6 +51,20 @@

if (crc != board_cfg->signature) {
printk(BIOS_ERR, "CFG EEPROM: Board settings have invalid checksum\n");
+
+ /*
+ * coreboot's board settings definition may be newer than the BMC's,
+ * try to see if the CRC of the first i bytes matches the expected CRC.
+ */
+ for (size_t i = 1; i < sizeof(board_cfg->raw_settings); i++) {
+ const uint32_t crc_part = CRC(&board_cfg->raw_settings, i, crc32_byte);
+ if (crc_part == board_cfg->signature) {
+ for (; i < sizeof(board_cfg->raw_settings); i++)
+ board_cfg->raw_settings[i] = 0;
+ printk(BIOS_ERR, "CFG EEPROM: Checksum OK for %zu bytes\n", i);
+ return true;
+ }
+ }
return false;
}
return true;

To view, visit change 67381. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0f009b21ef0850a2af6edef1818c770171358314
Gerrit-Change-Number: 67381
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Attention: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Attention: Christian Walter <christian.walter@9elements.com>
Gerrit-MessageType: newchange