From aeb652a4a04226f467eb8e850b2096d772c6e31e Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Thu, 14 Nov 2019 15:42:25 +0800 Subject: security/vboot: Remove selected_region from struct vboot_working_data Since we already have pre-RAM cache for FMAP (CB:36657), calling load_firmware() multiple times is no longer a problem. This patch replaces vboot_get_selected_region() usage with vboot_locate_firmware(), which locates the firmware by reading from the CBMEM cache. In addition, returning false from vboot_is_slot_selected() implies the recovery path was requested, i.e., vb2_shared_data.recovery_reason was set. Therefore, we simply remove the vboot_is_slot_selected() check from vboot_check_recovery_request(). BRANCH=none BUG=chromium:1021452 TEST=emerge-kukui coreboot Change-Id: I27cb1a2175beb189053fc3e44b17b60aba474bb0 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/36845 Tested-by: build bot (Jenkins) Reviewed-by: Julius Werner --- src/security/vboot/vboot_loader.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/security/vboot/vboot_loader.c') diff --git a/src/security/vboot/vboot_loader.c b/src/security/vboot/vboot_loader.c index 2b7ba83503..3903f18f6b 100644 --- a/src/security/vboot/vboot_loader.c +++ b/src/security/vboot/vboot_loader.c @@ -73,17 +73,23 @@ void vboot_run_logic(void) static int vboot_locate(struct cbfs_props *props) { - struct region selected_region; + const struct vb2_context *ctx; + struct region_device fw_main; /* Don't honor vboot results until the vboot logic has run. */ if (!vboot_logic_executed()) return -1; - if (vboot_get_selected_region(&selected_region)) + ctx = vboot_get_context(); + + if (ctx->flags & VB2_CONTEXT_RECOVERY_MODE) + return -1; + + if (vboot_locate_firmware(ctx, &fw_main)) return -1; - props->offset = region_offset(&selected_region); - props->size = region_sz(&selected_region); + props->offset = region_device_offset(&fw_main); + props->size = region_device_sz(&fw_main); return 0; } -- cgit v1.2.3