diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2014-09-19 09:56:15 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@google.com> | 2015-03-24 15:19:21 +0100 |
commit | 35890170b56941a155635d57b9ee693e5f690311 (patch) | |
tree | a4726d08c3aafcb85527a10779536df5abd09956 /src/vendorcode/google | |
parent | 1bbac3fd248ad7c91511d12c74b61c239ba3aa9f (diff) |
vboot2: load decompressed stage directly to load address
this change allows vboot_load_stage to load a decompressed stage directly to the
load address without using the cbfs cache.
BUG=None
TEST=Booted Nyan Blaze.
BRANCH=None
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Original-Change-Id: I76530276ff9a87b44f98a33f2c34bd5b2de6888f
Original-Reviewed-on: https://chromium-review.googlesource.com/219028
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Original-Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
(cherry picked from commit 0ad6f7fee9df31e1b35d4df9a8c373516416a235)
Change-Id: I7abdbdda0cc549894dfb9d599a576bba0a4fadfc
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/8883
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/vendorcode/google')
-rw-r--r-- | src/vendorcode/google/chromeos/chromeos.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c index bd72e77e6c..5696aec787 100644 --- a/src/vendorcode/google/chromeos/chromeos.c +++ b/src/vendorcode/google/chromeos/chromeos.c @@ -222,9 +222,10 @@ void *vboot_load_stage(int stage_index, struct vboot_region *fw_main, struct vboot_components *fw_info) { - struct cbfs_stage *stage; + struct cbfs_media default_media, *media = &default_media; uintptr_t fc_addr; uint32_t fc_size; + void *entry; if (stage_index >= fw_info->num_components) { printk(BIOS_INFO, "invalid stage index\n"); @@ -239,27 +240,15 @@ void *vboot_load_stage(int stage_index, return NULL; } - /* Loading to cbfs cache. This stage data must be retained until it's - * decompressed. */ - stage = vboot_get_region(fc_addr, fc_size, NULL); + init_default_cbfs_media(media); - if (stage == NULL) { - printk(BIOS_INFO, "failed to load a stage\n"); - return NULL; - } - - /* Stages rely the below clearing so that the bss is initialized. */ - memset((void *) (uintptr_t)stage->load, 0, stage->memlen); - - if (cbfs_decompress(stage->compression, - (unsigned char *)stage + sizeof(*stage), - (void *) (uintptr_t) stage->load, - stage->len)) { - printk(BIOS_INFO, "failed to decompress a stage\n"); - return NULL; - } - - return (void *)(uintptr_t)stage->entry; + /* we're making cbfs access offset outside of the region managed by + * cbfs. this works because cbfs_load_stage_by_offset does not check + * the offset. */ + entry = cbfs_load_stage_by_offset(media, fc_addr); + if (entry == (void *)-1) + entry = NULL; + return entry; } struct vb2_working_data * const vboot_get_working_data(void) |