mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-16 21:07:26 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
e08ee28548
commit
487a54bcbe
@@ -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 */
|
||||
|
||||
|
||||
@@ -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) &&
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,6 +45,8 @@ static uint32_t screens_count = 0;
|
||||
static uint32_t mock_num_disks[8];
|
||||
static uint32_t mock_num_disks_count;
|
||||
|
||||
extern enum VbEcBootMode_t VbGetMode(void);
|
||||
|
||||
/* Reset mock data (for use before each test) */
|
||||
static void ResetMocks(void)
|
||||
{
|
||||
@@ -262,7 +264,9 @@ static void VbUserConfirmsTest(void)
|
||||
static void VbBootTest(void)
|
||||
{
|
||||
ResetMocks();
|
||||
VbExEcEnteringMode(0, VB_EC_NORMAL);
|
||||
TEST_EQ(VbBootNormal(&cparams, &lkp), 1002, "VbBootNormal()");
|
||||
TEST_EQ(VbGetMode(), VB_EC_NORMAL, "vboot_mode normal");
|
||||
}
|
||||
|
||||
static void VbBootDevTest(void)
|
||||
@@ -273,7 +277,9 @@ static void VbBootDevTest(void)
|
||||
|
||||
/* Proceed after timeout */
|
||||
ResetMocks();
|
||||
VbExEcEnteringMode(0, VB_EC_DEVELOPER);
|
||||
TEST_EQ(VbBootDeveloper(&cparams, &lkp), 1002, "Timeout");
|
||||
TEST_EQ(VbGetMode(), VB_EC_DEVELOPER, "vboot_mode developer");
|
||||
TEST_EQ(screens_displayed[0], VB_SCREEN_DEVELOPER_WARNING,
|
||||
" warning screen");
|
||||
VbNvGet(VbApiKernelGetVnc(), VBNV_RECOVERY_REQUEST, &u);
|
||||
@@ -448,8 +454,11 @@ static void VbBootRecTest(void)
|
||||
/* Shutdown requested in loop */
|
||||
ResetMocks();
|
||||
shutdown_request_calls_left = 10;
|
||||
VbExEcEnteringMode(0, VB_EC_RECOVERY);
|
||||
TEST_EQ(VbBootRecovery(&cparams, &lkp), VBERROR_SHUTDOWN_REQUESTED,
|
||||
"Shutdown requested");
|
||||
TEST_EQ(VbGetMode(), VB_EC_RECOVERY, "vboot_mode recovery");
|
||||
|
||||
VbNvGet(VbApiKernelGetVnc(), VBNV_RECOVERY_REQUEST, &u);
|
||||
TEST_EQ(u, 0, " recovery reason");
|
||||
TEST_EQ(screens_displayed[0], VB_SCREEN_BLANK,
|
||||
|
||||
Reference in New Issue
Block a user