vboot: fix vboot_load_ramstage()

During a refactor the stage->load address was being returned as
an entry point. That is only true when the first instruction is
the entry point of the stage. Fix the handling of the load and
entry points.

BUG=chrome-os-partner:30784
BRANCH=None
TEST=Building still works. vboot still runs on rush.

Change-Id: I65a93c1c785569190406cd23006ea840c0011936
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/211010
Reviewed-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Aaron Durbin 2014-08-04 16:43:04 -05:00 committed by chrome-internal-fetch
commit 0eddbf7648

View file

@ -363,6 +363,7 @@ static void *vboot_load_ramstage(struct vboot_handoff *vboot_handoff,
struct cbfs_stage *stage;
const struct firmware_component *fwc;
void *entry;
void *load;
if (CONFIG_VBOOT_RAMSTAGE_INDEX >= MAX_PARSED_FW_COMPONENTS) {
printk(BIOS_ERR, "Invalid ramstage index: %d\n",
@ -388,16 +389,18 @@ static void *vboot_load_ramstage(struct vboot_handoff *vboot_handoff,
return NULL;
}
load = (void *)(uintptr_t)stage->load;
entry = (void *)(uintptr_t)stage->entry;
timestamp_add_now(TS_START_COPYRAM);
/* Stages rely the below clearing so that the bss is initialized. */
entry = (void *)(uintptr_t)stage->load;
memset(entry, 0, stage->memlen);
memset(load, 0, stage->memlen);
if (cbfs_decompress(stage->compression,
((unsigned char *) stage) +
sizeof(struct cbfs_stage),
entry, stage->len))
load, stage->len))
return NULL;
timestamp_add_now(TS_END_COPYRAM);