Fix some corner case for LazyConIn feature

Signed-off-by: chao zhang <chao.b.zhang@intel.com>
Reviewed-by  : Ni Ruiyu   <ruiyu.ni@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13814 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
czhang46
2012-10-10 07:29:45 +00:00
parent c843ef6796
commit 5676ccca07
3 changed files with 55 additions and 1 deletions

View File

@@ -72,6 +72,24 @@ BdsInitialize (
return Status;
}
/**
An empty function to pass error checking of CreateEventEx ().
@param Event Event whose notification function is being invoked.
@param Context Pointer to the notification function's context,
which is implementation-dependent.
**/
VOID
EFIAPI
BdsEmptyCallbackFunction (
IN EFI_EVENT Event,
IN VOID *Context
)
{
}
/**
This function attempts to boot for the boot order specified
@@ -93,12 +111,14 @@ BdsBootDeviceSelect (
CHAR16 Buffer[20];
BOOLEAN BootNextExist;
LIST_ENTRY *LinkBootNext;
EFI_EVENT ConnectConInEvent;
//
// Got the latest boot option
//
BootNextExist = FALSE;
LinkBootNext = NULL;
ConnectConInEvent = NULL;
InitializeListHead (&BootLists);
//
@@ -106,6 +126,23 @@ BdsBootDeviceSelect (
//
ZeroMem (Buffer, sizeof (Buffer));
//
// Create Event to signal ConIn connection request
//
if (PcdGetBool (PcdConInConnectOnDemand)) {
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
BdsEmptyCallbackFunction,
NULL,
&gConnectConInEventGuid,
&ConnectConInEvent
);
if (EFI_ERROR(Status)) {
ConnectConInEvent = NULL;
}
}
if (mBootNext != NULL) {
//
// Indicate we have the boot next variable, so this time
@@ -171,6 +208,13 @@ BdsBootDeviceSelect (
// Check the boot option list first
//
if (Link == &BootLists) {
//
// When LazyConIn enabled, signal connect ConIn event before enter UI
//
if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {
gBS->SignalEvent (ConnectConInEvent);
}
//
// There are two ways to enter here:
// 1. There is no active boot option, give user chance to
@@ -248,6 +292,14 @@ BdsBootDeviceSelect (
// Boot success, then stop process the boot order, and
// present the boot manager menu, front page
//
//
// When LazyConIn enabled, signal connect ConIn Event before enter UI
//
if (PcdGetBool (PcdConInConnectOnDemand) && ConnectConInEvent != NULL) {
gBS->SignalEvent (ConnectConInEvent);
}
Timeout = 0xffff;
PlatformBdsEnterFrontPage (Timeout, FALSE);