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>
This commit is contained in:
Daisuke Nojiri 2014-09-23 15:53:56 -07:00 committed by Aaron Durbin
parent 35890170b5
commit 6abe7c6996
5 changed files with 7 additions and 5 deletions

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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 */