summaryrefslogtreecommitdiff
path: root/src/vboot
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-08-24 14:58:12 -0500
committerAaron Durbin <adurbin@chromium.org>2016-08-25 22:50:17 +0200
commitf7ce40baf6a26e70ca18026f26977cd7f6f2cefa (patch)
treee8b942f64f1a45e96f8406e70c958f8b561dec2e /src/vboot
parent70385968cea517ed20dc3f3f665d92096acc768c (diff)
vboot: consolidate google_chromeec_early_init() calls
On x86 platforms, google_chromeec_early_init() is used to put the EC into RO mode when there's a recovery request. This is to avoid training memory multiple times when the recovery request is through an EC host event while the EC is running RW code. Under that condition the EC will be reset (along with the rest of the system) when the kernel verification happens. This leads to an execessively long recovery path because of the double reboot performing full memory training each time. By putting this logic into the verstage program this reduces the bootblock size on the skylake boards. Additionally, this provides the the correct logic for all future boards since it's not tied to FSP nor the mainboard itself. Lastly, this double memory training protection works only for platforms which verify starting from bootblock. The platforms which don't start verifying until after romstage need to have their own calls (such as haswell and baytrail). Change-Id: Ia8385dfc136b09fb20bd3519f3cc621e540b11a5 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/16318 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/vboot')
-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 =