[coreboot-gerrit] New patch to review for coreboot: vendorcode/google: Deal with MULTIPLE_CBFS_INSTANCES

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Fri Oct 16 11:51:51 CEST 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11914

-gerrit

commit ebf8f15c5557c3eaa6842655de9219bda2cf6212
Author: Patrick Georgi <pgeorgi at google.com>
Date:   Fri Oct 16 11:48:39 2015 +0200

    vendorcode/google: Deal with MULTIPLE_CBFS_INSTANCES
    
    We need to special-case filling out the vboot structures when
    we use CBFS instead of vboot's custom indexed format, otherwise
    (due to the way the CBFS header looks), it will try to write several
    million entries.
    
    Instead fill out the table so that it spans the entire CBFS region.
    
    Change-Id: Ie1289d4a19060bac48089ff70e5cfc04a2de373f
    Signed-off-by: Patrick Georgi <pgeorgi at google.com>
---
 .../google/chromeos/vboot2/vboot_handoff.c         | 35 ++++++++++++----------
 1 file changed, 20 insertions(+), 15 deletions(-)

diff --git a/src/vendorcode/google/chromeos/vboot2/vboot_handoff.c b/src/vendorcode/google/chromeos/vboot2/vboot_handoff.c
index 769e267..a91a9d7 100644
--- a/src/vendorcode/google/chromeos/vboot2/vboot_handoff.c
+++ b/src/vendorcode/google/chromeos/vboot2/vboot_handoff.c
@@ -154,22 +154,27 @@ void vboot_fill_handoff(void)
 	if (vb2_get_selected_region(&fw_main))
 		die("No component metadata.\n");
 
-	metadata_sz = sizeof(*fw_info);
-	metadata_sz += MAX_PARSED_FW_COMPONENTS * sizeof(fw_info->entries[0]);
-
-	fw_info = rdev_mmap(&fw_main, 0, metadata_sz);
-
-	if (fw_info == NULL)
-		die("failed to locate firmware components\n");
-
-	/* these offset & size are used to load a rw boot loader */
-	for (i = 0; i < fw_info->num_components; i++) {
-		vh->components[i].address = region_device_offset(&fw_main);
-		vh->components[i].address += fw_info->entries[i].offset;
-		vh->components[i].size = fw_info->entries[i].size;
+	if (IS_ENABLED(CONFIG_MULTIPLE_CBFS_INSTANCES)) {
+		vh->components[0].address = region_device_offset(&fw_main);
+		vh->components[0].size = region_device_sz(&fw_main);
+	} else {
+		metadata_sz = sizeof(*fw_info);
+		metadata_sz += MAX_PARSED_FW_COMPONENTS * sizeof(fw_info->entries[0]);
+
+		fw_info = rdev_mmap(&fw_main, 0, metadata_sz);
+
+		if (fw_info == NULL)
+			die("failed to locate firmware components\n");
+
+		/* these offset & size are used to load a rw boot loader */
+		for (i = 0; i < fw_info->num_components; i++) {
+			vh->components[i].address = region_device_offset(&fw_main);
+			vh->components[i].address += fw_info->entries[i].offset;
+			vh->components[i].size = fw_info->entries[i].size;
+		}
+
+		rdev_munmap(&fw_main, fw_info);
 	}
-
-	rdev_munmap(&fw_main, fw_info);
 }
 
 /*



More information about the coreboot-gerrit mailing list