vboot2: provide path for booting using alternative CBFS instances

When CONFIG_MULTIPLE_CBFS_INSTANCES is enabled, the image is expected
to have CBFS instances in rw-a and rw-b sections of the bootrom.

This patch adds code which makes sure that CBFS header points at the
proper bootrpom section as determined by vboot, and the RW stages load
from that section.

BRANCH=storm
BUG=chrome-os-partner:34161, chromium:445938
TEST=with the rest of the patches in, STORM boots all the way into
     Linux login prompt.

Original-Change-Id: I187e3d3e65d548c672fdf3b42419544d3bd11ea1
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/237662
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>

(cherry picked from commit 71ad0bb41b183374a84a5b9fb92c3afd813ceace)
Signed-off-by: Aaron Durbin <adurbin@chromium.org>

Change-Id: Ia05cb713981c44da8cb379b72dfbe17fe1f6c5ff
Reviewed-on: http://review.coreboot.org/9704
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Vadim Bendebury 2014-12-25 15:34:32 -08:00 committed by Patrick Georgi
parent 3c90365bdd
commit 42001a7051
3 changed files with 26 additions and 11 deletions

View File

@ -176,9 +176,13 @@ void *vboot2_load_ramstage(void)
/* we're on recovery path. continue to ro-ramstage. */
return NULL;
printk(BIOS_INFO,
"loading ramstage from Slot %c\n", sd->fw_slot ? 'B' : 'A');
if (IS_ENABLED(CONFIG_MULTIPLE_CBFS_INSTANCES)) {
return cbfs_load_stage(CBFS_DEFAULT_MEDIA,
CONFIG_CBFS_PREFIX "/ramstage");
} else {
printk(BIOS_INFO, "loading ramstage from Slot %c\n",
sd->fw_slot ? 'B' : 'A');
vb2_get_selected_region(wd, &fw_main);
return load_ramstage(vh, &fw_main);
}
}

View File

@ -78,13 +78,21 @@ void *vboot2_verify_firmware(void)
if (vboot_is_slot_selected(wd)) {
/* RW A or B */
struct vboot_region fw_main;
struct vboot_components *fw_info;
vb2_get_selected_region(wd, &fw_main);
if (IS_ENABLED(CONFIG_MULTIPLE_CBFS_INSTANCES)) {
cbfs_set_header_offset(fw_main.offset_addr);
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
CONFIG_CBFS_PREFIX "/romstage");
} else {
struct vboot_components *fw_info;
fw_info = vboot_locate_components(&fw_main);
if (fw_info == NULL)
die("failed to locate firmware components\n");
entry = vboot_load_stage(CONFIG_VBOOT_ROMSTAGE_INDEX,
&fw_main, fw_info);
}
} else if (vboot_is_readonly_path(wd)) {
/* RO */
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,

View File

@ -95,6 +95,9 @@ void *vboot_get_payload(int *len)
struct vboot_handoff *vboot_handoff;
struct firmware_component *fwc;
if (IS_ENABLED(CONFIG_MULTIPLE_CBFS_INSTANCES))
return NULL; /* Let CBFS figure it out. */
vboot_handoff = cbmem_find(CBMEM_ID_VBOOT_HANDOFF);
if (vboot_handoff == NULL)