mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
vboot: Handle GBB_FLAG_DISABLE_LID_SHUTDOWN
Handle GBB_FLAG_DISABLE_LID_SHUTDOWN to disable lid-triggered system shutdown. BUG=chromium:434462 BRANCH=Auron TEST=Manual on Auron, with corresponding depthcharge change. Set GBB flag 0x1000 and disable powerd launch on boot. Close lid and issue 'reboot' command over ssh. Verify system reboots successfully into OS. Change-Id: Id2731508296a5ba9229f969f8224565d64f3d4a3 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/234995 Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
d53b6684a2
commit
5d652cdffa
@@ -41,6 +41,23 @@ static void VbSetRecoveryRequest(uint32_t recovery_request)
|
||||
VbNvSet(&vnc, VBNV_RECOVERY_REQUEST, recovery_request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks GBB flags against VbExIsShutdownRequested() shutdown request to
|
||||
* determine if a shutdown is required.
|
||||
*
|
||||
* Returns true if a shutdown is required and false if no shutdown is required.
|
||||
*/
|
||||
static int VbWantShutdown(uint32_t gbb_flags)
|
||||
{
|
||||
uint32_t shutdown_request = VbExIsShutdownRequested();
|
||||
|
||||
/* If desired, ignore shutdown request due to lid closure. */
|
||||
if (gbb_flags & GBB_FLAG_DISABLE_LID_SHUTDOWN)
|
||||
shutdown_request &= ~VB_SHUTDOWN_REQUEST_LID_CLOSED;
|
||||
|
||||
return !!shutdown_request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt loading a kernel from the specified type(s) of disks.
|
||||
*
|
||||
@@ -147,7 +164,7 @@ int VbUserConfirms(VbCommonParams *cparams, uint32_t confirm_flags)
|
||||
|
||||
/* Await further instructions */
|
||||
while (1) {
|
||||
if (VbExIsShutdownRequested())
|
||||
if (VbWantShutdown(cparams->gbb->flags))
|
||||
return -1;
|
||||
key = VbExKeyboardReadWithFlags(&key_flags);
|
||||
button = VbExGetSwitches(VB_INIT_FLAG_REC_BUTTON_PRESSED);
|
||||
@@ -237,7 +254,7 @@ VbError_t VbBootDeveloper(VbCommonParams *cparams, LoadKernelParams *p)
|
||||
do {
|
||||
uint32_t key;
|
||||
|
||||
if (VbExIsShutdownRequested()) {
|
||||
if (VbWantShutdown(gbb->flags)) {
|
||||
VBDEBUG(("VbBootDeveloper() - shutdown requested!\n"));
|
||||
VbAudioClose(audio);
|
||||
return VBERROR_SHUTDOWN_REQUESTED;
|
||||
@@ -491,7 +508,7 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p)
|
||||
for (i = 0; i < REC_DISK_DELAY; i += REC_KEY_DELAY) {
|
||||
VbCheckDisplayKey(cparams, VbExKeyboardRead(),
|
||||
&vnc);
|
||||
if (VbExIsShutdownRequested())
|
||||
if (VbWantShutdown(cparams->gbb->flags))
|
||||
return VBERROR_SHUTDOWN_REQUESTED;
|
||||
VbExSleepMs(REC_KEY_DELAY);
|
||||
}
|
||||
@@ -588,7 +605,7 @@ VbError_t VbBootRecovery(VbCommonParams *cparams, LoadKernelParams *p)
|
||||
} else {
|
||||
VbCheckDisplayKey(cparams, key, &vnc);
|
||||
}
|
||||
if (VbExIsShutdownRequested())
|
||||
if (VbWantShutdown(cparams->gbb->flags))
|
||||
return VBERROR_SHUTDOWN_REQUESTED;
|
||||
VbExSleepMs(REC_KEY_DELAY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user