summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward O'Callaghan <quasisec@google.com>2023-02-14 19:21:17 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-02-16 10:20:52 +0000
commitc705d6376c04451840697d7b7e97c42a5c1befb8 (patch)
tree5359f35169ac14e9e2f6052fa89bf54d22647432
parent59fd26b77fd66efcfc2beceda9eaafba0e74ec3e (diff)
downloadvboot-c705d6376c04451840697d7b7e97c42a5c1befb8.tar.gz
host/lib/flashrom_drv.c: Move flag to avoid locked ME issue
Older Intel DUT's have a ME in "locked" mode in the descriptor and while the write_flash() attempts to write back to flash to a specific region it needs to read the FMAP to obtain the region name. This read overlaps with the "locked" region and thus the following is observed in logs: ``` FREG2: Management Engine region (0x00001000-0x001fffff) is locked. [..] read_flash: cannot read inside Management Engine region (0x001000..0x1fffff). ``` BUG=b:269199980 TEST=builds. Change-Id: If7bebf28cd4d34cc4074700184233c83edbd2409 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/4248344 Auto-Submit: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Sam McNally <sammc@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Tested-by: Edward O'Callaghan <quasisec@chromium.org> Commit-Queue: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r--host/lib/flashrom_drv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c
index 6f0057aa..d30d1dec 100644
--- a/host/lib/flashrom_drv.c
+++ b/host/lib/flashrom_drv.c
@@ -184,6 +184,9 @@ int flashrom_write_image(const struct firmware_image *image,
}
}
+ /* Must occur before attempting to read FMAP from SPI flash. */
+ flashrom_flag_set(flashctx, FLASHROM_FLAG_SKIP_UNREADABLE_REGIONS, true);
+
if (regions) {
int i;
r = flashrom_layout_read_fmap_from_buffer(
@@ -216,7 +219,6 @@ int flashrom_write_image(const struct firmware_image *image,
goto err_cleanup;
}
- flashrom_flag_set(flashctx, FLASHROM_FLAG_SKIP_UNREADABLE_REGIONS, true);
flashrom_flag_set(flashctx, FLASHROM_FLAG_SKIP_UNWRITABLE_REGIONS, true);
flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_WHOLE_CHIP, false);
flashrom_flag_set(flashctx, FLASHROM_FLAG_VERIFY_AFTER_WRITE,