summaryrefslogtreecommitdiff
path: root/src/vboot/vboot_loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vboot/vboot_loader.c')
-rw-r--r--src/vboot/vboot_loader.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/vboot/vboot_loader.c b/src/vboot/vboot_loader.c
index 7395fd7d92..207aadaac7 100644
--- a/src/vboot/vboot_loader.c
+++ b/src/vboot/vboot_loader.c
@@ -17,6 +17,7 @@
#include <cbfs.h>
#include <cbmem.h>
#include <console/console.h>
+#include <ec/google/chromeec/ec.h>
#include <rmodule.h>
#include <rules.h>
#include <string.h>
@@ -89,9 +90,29 @@ int vb2_logic_executed(void)
static void vboot_prepare(void)
{
if (verification_should_run()) {
+ /*
+ * Note that this path isn't taken when
+ * CONFIG_RETURN_FROM_VERSTAGE is employed.
+ */
verstage_main();
car_set_var(vboot_executed, 1);
vb2_save_recovery_reason_vbnv();
+
+ /*
+ * Avoid double memory retrain when the EC is running RW code
+ * and a recovery request came in through an EC host event. The
+ * double retrain happens because the EC won't be rebooted
+ * until kernel verification notices the EC isn't running RO
+ * code which is after memory training. Therefore, reboot the
+ * EC after we've saved the potential recovery request so it's
+ * not lost. Lastly, only perform this sequence on x86
+ * platforms since those are the ones that currently do a
+ * costly memory training in recovery mode.
+ */
+ if (IS_ENABLED(CONFIG_EC_GOOGLE_CHROMEEC) &&
+ IS_ENABLED(CONFIG_ARCH_X86))
+ google_chromeec_early_init();
+
} else if (verstage_should_load()) {
struct cbfsf file;
struct prog verstage =