diff options
author | Sheng-Liang Song <ssl@chromium.org> | 2014-07-26 21:34:28 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-03 22:49:35 +0000 |
commit | 487a54bcbe7b6dac1a856b0991e6d13c34a1c423 (patch) | |
tree | d39c23b04503e39b3fe42032c0c2169a0ef0e46b /firmware | |
parent | e08ee28548934e933733babf0bc0c418142d095d (diff) | |
download | vboot-487a54bcbe7b6dac1a856b0991e6d13c34a1c423.tar.gz |
vboot: Notify EC of current boot mode
Notify EC of boot mode, i.e. normal, developer or recovery.
This is necessary for battery firmware updates.
BUG=chrome-os-partner:24741
CQ-DEPEND=CL:205323
CQ-DEPEND=CL:210033
CQ-DEPEND=CL:215720
BRANCH=ToT
TEST=Verified on samus & glimmer.
Passed runalltests.
~/trunk/src/platform/vboot_reference $ make runalltests -j
Change-Id: I1613ede34b4a929d1e8114fb519861f349377e94
Signed-off-by: Sheng-Liang Song <ssl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/210032
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/include/vboot_api.h | 7 | ||||
-rw-r--r-- | firmware/lib/vboot_api_kernel.c | 3 | ||||
-rw-r--r-- | firmware/stub/vboot_api_stub.c | 13 |
3 files changed, 23 insertions, 0 deletions
diff --git a/firmware/include/vboot_api.h b/firmware/include/vboot_api.h index 2e618dce..9b053715 100644 --- a/firmware/include/vboot_api.h +++ b/firmware/include/vboot_api.h @@ -826,6 +826,13 @@ VbError_t VbExEcUpdateRW(int devidx, const uint8_t *image, int image_size); */ VbError_t VbExEcProtectRW(int devidx); +/** + * Info the EC of the boot mode selected by the AP. + * mode: Normal, Developer, or Recovery + */ +enum VbEcBootMode_t {VB_EC_NORMAL, VB_EC_DEVELOPER, VB_EC_RECOVERY }; +VbError_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode); + /*****************************************************************************/ /* Misc */ diff --git a/firmware/lib/vboot_api_kernel.c b/firmware/lib/vboot_api_kernel.c index 4f013117..0b2f941e 100644 --- a/firmware/lib/vboot_api_kernel.c +++ b/firmware/lib/vboot_api_kernel.c @@ -1012,15 +1012,18 @@ VbError_t VbSelectAndLoadKernel(VbCommonParams *cparams, /* Recovery boot */ p.boot_flags |= BOOT_FLAG_RECOVERY; retval = VbBootRecovery(cparams, &p); + VbExEcEnteringMode(0, VB_EC_RECOVERY); VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc); } else if (p.boot_flags & BOOT_FLAG_DEVELOPER) { /* Developer boot */ retval = VbBootDeveloper(cparams, &p); + VbExEcEnteringMode(0, VB_EC_DEVELOPER); VbDisplayScreen(cparams, VB_SCREEN_BLANK, 0, &vnc); } else { /* Normal boot */ + VbExEcEnteringMode(0, VB_EC_NORMAL); retval = VbBootNormal(cparams, &p); if ((1 == shared->firmware_index) && diff --git a/firmware/stub/vboot_api_stub.c b/firmware/stub/vboot_api_stub.c index c9ecd9df..6d82f121 100644 --- a/firmware/stub/vboot_api_stub.c +++ b/firmware/stub/vboot_api_stub.c @@ -17,6 +17,8 @@ #include "vboot_api.h" +static enum VbEcBootMode_t vboot_mode; + void VbExSleepMs(uint32_t msec) { } @@ -151,6 +153,17 @@ VbError_t VbExEcProtectRW(int devidx) return VBERROR_SUCCESS; } +VbError_t VbExEcEnteringMode(int devidx, enum VbEcBootMode_t mode) +{ + vboot_mode = mode; + return VBERROR_SUCCESS; +} + +enum VbEcBootMode_t VbGetMode(void) +{ + return vboot_mode; +} + int VbExLegacy(void) { return 1; |