From b491bc8bb1499452536eb140c22f749d1c9f9fc3 Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Wed, 21 Oct 2015 14:31:02 -0700 Subject: vboot_api_kernel: Add new EcVbootDone API Add a new post-EC software sync API VbExEcVbootDone() to take actions which normally need to happen after EC verification / sysjump. BUG=chromium:537269 TEST=Manual on Glados. Set CHG_MW thresh to 20000, BAT_PCT to 50. Verify that LIMIT_POWER host event is set until Zinger negotiates to 20V. Also verify that we do not proceed with boot when Donette is plugged. BRANCH=None CQ-DEPEND=CL:307885,CL:309523 Change-Id: I77e6000aa8a44e3aca4fb5982e5b5f5191774989 Signed-off-by: Shawn Nematbakhsh Reviewed-on: https://chromium-review.googlesource.com/307952 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Randall Spangler --- firmware/include/vboot_api.h | 13 +++++++++++++ firmware/lib/vboot_api_kernel.c | 5 +++++ firmware/stub/vboot_api_stub.c | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 18ee4cc1..ff858acb 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -925,6 +925,19 @@ VbError_t VbExEcProtectRW(int devidx); enum VbEcBootMode_t {VB_EC_NORMAL, VB_EC_DEVELOPER, VB_EC_RECOVERY }; VbError_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode); +/** + * Perform EC post-verification / updating / jumping actions. + * + * This routine is called to perform certain actions that must wait until + * after the EC resides in its `final` image (the image the EC will + * run for the duration of boot). These actions include verifying that + * enough power is available to continue with boot. + * + * @param in_recovery 1 if recovery mode is selected by the AP, 0 otherwise. + * @return VBERROR_... error, VBERROR_SUCCESS on success. + */ +VbError_t VbExEcVbootDone(int in_recovery); + /*****************************************************************************/ /* Misc */ diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index 94c2c8a7..2bf183b3 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -1047,6 +1047,11 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, } } + /* EC verification (and possibily updating / jumping) is done */ + retval = VbExEcVbootDone(!!shared->recovery_reason); + if (retval != VBERROR_SUCCESS) + goto VbSelectAndLoadKernel_exit; + /* Read kernel version from the TPM. Ignore errors in recovery mode. */ tpm_status = RollbackKernelRead(&shared->kernel_version_tpm); if (0 != tpm_status) { diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index 33aee93d..23e3dfbe 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -159,6 +159,11 @@ VbError_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode) return VBERROR_SUCCESS; } +VbError_t VbExEcVbootDone(int in_recovery) +{ + return VBERROR_SUCCESS; +} + enum VbEcBootMode_t VbGetMode(void) { return vboot_mode; -- cgit v1.2.1