vboot: make vboot2_verify_firmware return
this allows each board to decide what to do after firmware verification is done. some board needs to return back to the previous stage and let the previous stage kick off the verified stage. this also makes it more visible what is going to happen in the verstage since stage_exit now resides in main(). BUG=none BRANCH=tot TEST=booted cosmos dev board. booted blaze in normal and recovery mode. built for all current boards. Original-Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Original-Change-Id: I3cb466cedf2a9c2b0d48fc4b0f73f76d0714c0c7 Original-Reviewed-on: https://chromium-review.googlesource.com/232517 (cherry picked from commit 495704f36aa54ba12231d396376f01289d083f58) Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: Ic20dfd3fa93849befc2b37012a5e0907fe83e8e2 Reviewed-on: http://review.coreboot.org/9702 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
parent
7c256405c3
commit
23727ca424
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <arch/cache.h>
|
#include <arch/cache.h>
|
||||||
#include <arch/exception.h>
|
#include <arch/exception.h>
|
||||||
|
#include <arch/hlt.h>
|
||||||
|
#include <arch/stages.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <soc/cache.h>
|
#include <soc/cache.h>
|
||||||
#include <soc/early_configs.h>
|
#include <soc/early_configs.h>
|
||||||
|
@ -47,12 +49,23 @@ static void soc_init(void)
|
||||||
enable_cache();
|
enable_cache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void verstage(void)
|
||||||
|
{
|
||||||
|
void *entry;
|
||||||
|
|
||||||
|
soc_init();
|
||||||
|
early_mainboard_init();
|
||||||
|
|
||||||
|
entry = vboot2_verify_firmware();
|
||||||
|
if (entry != (void *)-1)
|
||||||
|
stage_exit(entry);
|
||||||
|
}
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
asm volatile ("bl arm_init_caches"
|
asm volatile ("bl arm_init_caches"
|
||||||
: : : "r0", "r1", "r2", "r3", "r4", "r5", "ip");
|
: : : "r0", "r1", "r2", "r3", "r4", "r5", "ip");
|
||||||
|
|
||||||
soc_init();
|
verstage();
|
||||||
early_mainboard_init();
|
hlt();
|
||||||
vboot2_verify_firmware();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <arch/cache.h>
|
#include <arch/cache.h>
|
||||||
#include <arch/exception.h>
|
#include <arch/exception.h>
|
||||||
|
#include <arch/hlt.h>
|
||||||
|
#include <arch/stages.h>
|
||||||
#include <console/console.h>
|
#include <console/console.h>
|
||||||
#include <soc/verstage.h>
|
#include <soc/verstage.h>
|
||||||
#include <vendorcode/google/chromeos/chromeos.h>
|
#include <vendorcode/google/chromeos/chromeos.h>
|
||||||
|
@ -28,12 +30,21 @@ void __attribute__((weak)) verstage_mainboard_init(void)
|
||||||
/* Default empty implementation. */
|
/* Default empty implementation. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void main(void)
|
static void verstage(void)
|
||||||
{
|
{
|
||||||
|
void *entry;
|
||||||
|
|
||||||
console_init();
|
console_init();
|
||||||
exception_init();
|
exception_init();
|
||||||
|
|
||||||
verstage_mainboard_init();
|
verstage_mainboard_init();
|
||||||
|
|
||||||
vboot2_verify_firmware();
|
entry = vboot2_verify_firmware();
|
||||||
|
if (entry != (void *)-1)
|
||||||
|
stage_exit(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
verstage();
|
||||||
|
hlt();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../vboot_common.h"
|
#include "../vboot_common.h"
|
||||||
|
|
||||||
void vboot2_verify_firmware(void);
|
void *vboot2_verify_firmware(void);
|
||||||
void *vboot2_load_ramstage(void);
|
void *vboot2_load_ramstage(void);
|
||||||
void verstage_main(void);
|
void verstage_main(void);
|
||||||
void *vboot_load_stage(int stage_index,
|
void *vboot_load_stage(int stage_index,
|
||||||
|
|
|
@ -52,7 +52,7 @@ static struct vb2_working_data *init_vb2_working_data(void)
|
||||||
* 2) We're already in the verstage. Verify firmware, then load the romstage and
|
* 2) We're already in the verstage. Verify firmware, then load the romstage and
|
||||||
* exits to it.
|
* exits to it.
|
||||||
*/
|
*/
|
||||||
void vboot2_verify_firmware(void)
|
void *vboot2_verify_firmware(void)
|
||||||
{
|
{
|
||||||
void *entry;
|
void *entry;
|
||||||
struct vb2_working_data *wd;
|
struct vb2_working_data *wd;
|
||||||
|
@ -66,7 +66,6 @@ void vboot2_verify_firmware(void)
|
||||||
if (entry == (void *)-1)
|
if (entry == (void *)-1)
|
||||||
die("failed to load verstage");
|
die("failed to load verstage");
|
||||||
|
|
||||||
timestamp_add_now(TS_END_COPYVER);
|
|
||||||
/* verify and select a slot */
|
/* verify and select a slot */
|
||||||
stage_exit(entry);
|
stage_exit(entry);
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,7 +74,7 @@ void vboot2_verify_firmware(void)
|
||||||
|
|
||||||
/* jump to the selected slot */
|
/* jump to the selected slot */
|
||||||
timestamp_add_now(TS_START_COPYROM);
|
timestamp_add_now(TS_START_COPYROM);
|
||||||
entry = NULL;
|
entry = (void *)-1;
|
||||||
if (vboot_is_slot_selected(wd)) {
|
if (vboot_is_slot_selected(wd)) {
|
||||||
/* RW A or B */
|
/* RW A or B */
|
||||||
struct vboot_region fw_main;
|
struct vboot_region fw_main;
|
||||||
|
@ -93,8 +92,5 @@ void vboot2_verify_firmware(void)
|
||||||
}
|
}
|
||||||
timestamp_add_now(TS_END_COPYROM);
|
timestamp_add_now(TS_END_COPYROM);
|
||||||
|
|
||||||
if (entry != NULL && entry != (void *)-1)
|
return entry;
|
||||||
stage_exit(entry);
|
|
||||||
|
|
||||||
die("failed to exit from stage\n");
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue