From c83687d520ddb5e0bb691ef87484643e99f19c40 Mon Sep 17 00:00:00 2001 From: Vadim Bendebury Date: Fri, 10 Apr 2015 17:50:11 -0700 Subject: [PATCH] vboot: route all resets through a single function It is necessary to trigger console buffer contents dump on reset. Let's make sure all vboot resets are routed through the same function. BRANCH=none BUG=chromium:475347 TEST=built and booted storm Change-Id: I0d8580fb65417ba4b06dfae763dd6455afc8fc26 Signed-off-by: Patrick Georgi Original-Commit-Id: 9788e2043cb1bd5df7e30574f7df4de4f25caa0d Original-Change-Id: Iafca416700c51a0546249438ca583a415a1ca944 Original-Signed-off-by: Vadim Bendebury Original-Reviewed-on: https://chromium-review.googlesource.com/265292 Original-Reviewed-by: Julius Werner Reviewed-on: http://review.coreboot.org/9931 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/vendorcode/google/chromeos/chromeos.h | 1 + src/vendorcode/google/chromeos/vboot1/vboot_loader.c | 9 ++------- src/vendorcode/google/chromeos/vboot2/common.c | 6 ------ src/vendorcode/google/chromeos/vboot2/misc.h | 1 - src/vendorcode/google/chromeos/vboot_common.c | 12 ++++++++++-- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h index ccbadabc49..dad357e71d 100644 --- a/src/vendorcode/google/chromeos/chromeos.h +++ b/src/vendorcode/google/chromeos/chromeos.h @@ -87,5 +87,6 @@ static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {} #endif /* CONFIG_CHROMEOS_RAMOOPS */ void cbmem_add_vpd_calibration_data(void); +void vboot_reboot(void); #endif /* __CHROMEOS_H__ */ diff --git a/src/vendorcode/google/chromeos/vboot1/vboot_loader.c b/src/vendorcode/google/chromeos/vboot1/vboot_loader.c index a2972621d3..dd6c7de180 100644 --- a/src/vendorcode/google/chromeos/vboot1/vboot_loader.c +++ b/src/vendorcode/google/chromeos/vboot1/vboot_loader.c @@ -73,7 +73,7 @@ static void log_msg(const char *fmt, va_list args) static void fatal_error(void) { printk(BIOS_ERR, "vboot encountered fatal error. Resetting.\n"); - hard_reset(); + vboot_reboot(); } static int fw_region_size(struct vboot_region *r) @@ -195,11 +195,6 @@ static void vboot_clean_up(struct vboot_context *context) cbmem_entry_remove(context->vblocks); } -static void reset(void) -{ - hard_reset(); -} - static void vboot_invoke_wrapper(struct vboot_handoff *vboot_handoff) { VbCommonParams cparams; @@ -280,7 +275,7 @@ static void vboot_invoke_wrapper(struct vboot_handoff *vboot_handoff) context.log_msg = &log_msg; context.fatal_error = &fatal_error; context.get_region = &vboot_get_region; - context.reset = &reset; + context.reset = &vboot_reboot; vboot_run_stub(&context); diff --git a/src/vendorcode/google/chromeos/vboot2/common.c b/src/vendorcode/google/chromeos/vboot2/common.c index 15b661a7b4..d70a108b05 100644 --- a/src/vendorcode/google/chromeos/vboot2/common.c +++ b/src/vendorcode/google/chromeos/vboot2/common.c @@ -67,9 +67,3 @@ void *vboot_get_work_buffer(struct vb2_working_data *wd) { return (void *)((uintptr_t)wd + wd->buffer_offset); } - -void vboot_reboot(void) -{ - hard_reset(); - die("failed to reboot"); -} diff --git a/src/vendorcode/google/chromeos/vboot2/misc.h b/src/vendorcode/google/chromeos/vboot2/misc.h index d638cfadae..7425082064 100644 --- a/src/vendorcode/google/chromeos/vboot2/misc.h +++ b/src/vendorcode/google/chromeos/vboot2/misc.h @@ -28,7 +28,6 @@ void verstage_main(void); void *vboot_load_stage(int stage_index, struct vboot_region *fw_main, struct vboot_components *fw_info); -void vboot_reboot(void); /* * this is placed at the start of the vboot work buffer. selected_region is used diff --git a/src/vendorcode/google/chromeos/vboot_common.c b/src/vendorcode/google/chromeos/vboot_common.c index 95bab367ed..3c1a9c3444 100644 --- a/src/vendorcode/google/chromeos/vboot_common.c +++ b/src/vendorcode/google/chromeos/vboot_common.c @@ -17,12 +17,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include #include #include #include #include +#include +#include +#include + #include "chromeos.h" #include "vboot_common.h" #include "vboot_handoff.h" @@ -124,3 +126,9 @@ void *vboot_get_payload(int *len) /* This will leak a mapping. */ return vboot_get_region(fwc->address, fwc->size, NULL); } + +void vboot_reboot(void) +{ + hard_reset(); + die("failed to reboot"); +}