summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2014-09-23 15:53:56 -0700
committerAaron Durbin <adurbin@google.com>2015-03-24 15:19:36 +0100
commit6abe7c699679e27d0ae84b803994e5eacfaea538 (patch)
treee8079aa8f8af212aa2cd230127964ff3cd5c47f7
parent35890170b56941a155635d57b9ee693e5f690311 (diff)
downloadcoreboot-6abe7c699679e27d0ae84b803994e5eacfaea538.tar.xz
vboot2: avoid fall through when hard_reset is not implemented
this change makes prevent execution from falling through to unverified code when hard_reset is not implemented. it also includes a few touch-ups. BUG=None TEST=Booted Veyron Pinky. Verified firmware selection in the log. BRANCH=None Original-Change-Id: I9b02ab766172a62c98b434c29f310bc4a44f342d Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/219625 Original-Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Original-Tested-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit d1f5207d83d2247b55f2bb9d02ac843305fc3ded) Change-Id: I99dd5a2ca3a5369accb14408ea9d266bf60e7132 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/8884 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--src/vendorcode/google/chromeos/Kconfig2
-rw-r--r--src/vendorcode/google/chromeos/Makefile.inc2
-rw-r--r--src/vendorcode/google/chromeos/chromeos.c3
-rw-r--r--src/vendorcode/google/chromeos/chromeos.h3
-rw-r--r--src/vendorcode/google/chromeos/verstub.c2
5 files changed, 7 insertions, 5 deletions
diff --git a/src/vendorcode/google/chromeos/Kconfig b/src/vendorcode/google/chromeos/Kconfig
index 4e71c3bfe5..3ee92435bd 100644
--- a/src/vendorcode/google/chromeos/Kconfig
+++ b/src/vendorcode/google/chromeos/Kconfig
@@ -100,7 +100,7 @@ config VBOOT_VERIFY_FIRMWARE
config VBOOT2_VERIFY_FIRMWARE
bool "Firmware Verification with vboot2"
default n
- depends on CHROMEOS
+ depends on CHROMEOS && HAVE_HARD_RESET
help
Enabling VBOOT2_VERIFY_FIRMWARE will use vboot2 to verify the romstage
and boot loader.
diff --git a/src/vendorcode/google/chromeos/Makefile.inc b/src/vendorcode/google/chromeos/Makefile.inc
index e9eef4ac19..7e98860ea1 100644
--- a/src/vendorcode/google/chromeos/Makefile.inc
+++ b/src/vendorcode/google/chromeos/Makefile.inc
@@ -104,7 +104,7 @@ verstage-c-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
verstage-S-ccopts += -D__PRE_RAM__ -D__VER_STAGE__
ifeq ($(CONFIG_RETURN_FROM_VERSTAGE),y)
-bootblock-y += verstub.c
+bootblock-y += verstub.c chromeos.c
else
verstage-y += verstub.c
endif
diff --git a/src/vendorcode/google/chromeos/chromeos.c b/src/vendorcode/google/chromeos/chromeos.c
index 5696aec787..3a499d56e6 100644
--- a/src/vendorcode/google/chromeos/chromeos.c
+++ b/src/vendorcode/google/chromeos/chromeos.c
@@ -173,7 +173,7 @@ struct vboot_components *vboot_locate_components(struct vboot_region *region)
size_t req_size;
struct vboot_components *vbc;
- req_size = sizeof(*region);
+ req_size = sizeof(*vbc);
req_size += sizeof(struct vboot_component_entry) *
MAX_PARSED_FW_COMPONENTS;
@@ -259,6 +259,7 @@ struct vb2_working_data * const vboot_get_working_data(void)
void vboot_reboot(void)
{
hard_reset();
+ die("failed to reboot");
}
#endif
diff --git a/src/vendorcode/google/chromeos/chromeos.h b/src/vendorcode/google/chromeos/chromeos.h
index 0d8da8feaf..4395506c1b 100644
--- a/src/vendorcode/google/chromeos/chromeos.h
+++ b/src/vendorcode/google/chromeos/chromeos.h
@@ -118,9 +118,10 @@ static inline void chromeos_ram_oops_init(chromeos_acpi_t *chromeos) {}
static inline void chromeos_reserve_ram_oops(struct device *dev, int idx) {}
#endif /* CONFIG_CHROMEOS_RAMOOPS */
+void vboot2_verify_firmware(void);
+
#if CONFIG_VBOOT2_VERIFY_FIRMWARE
void *vboot_load_ramstage(void);
-void vboot2_verify_firmware(void);
void verstage_main(void);
void *vboot_load_stage(int stage_index,
struct vboot_region *fw_main,
diff --git a/src/vendorcode/google/chromeos/verstub.c b/src/vendorcode/google/chromeos/verstub.c
index a4ed77f96b..e295b25f07 100644
--- a/src/vendorcode/google/chromeos/verstub.c
+++ b/src/vendorcode/google/chromeos/verstub.c
@@ -61,7 +61,7 @@ void vboot2_verify_firmware(void)
/* load verstage from RO */
entry = cbfs_load_stage(CBFS_DEFAULT_MEDIA,
CONFIG_CBFS_PREFIX "/verstage");
- if (entry == -1)
+ if (entry == (void *)-1)
die("failed to load verstage");
/* verify and select a slot */