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

@ -1,7 +1,7 @@
/** @file
Head file for BDS Architectural Protocol implementation
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@ -34,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/StatusCodeDataTypeId.h>
#include <Guid/LegacyDevOrder.h>
#include <Guid/BdsHii.h>
#include <Guid/ConnectConInEvent.h>
#include <Protocol/GenericMemoryTest.h>
#include <Protocol/FormBrowser2.h>
#include <Protocol/HiiConfigAccess.h>

View File

@ -141,6 +141,7 @@
gBootManagerFormSetGuid ## SOMETIMES_PRODUCES ## BootManager HII Package
gDeviceManagerFormSetGuid ## SOMETIMES_PRODUCES ## DeviceManager HII Package
gDriverHealthFormSetGuid ## SOMETIMES_PRODUCES ## DriverHealth HII Package
gConnectConInEventGuid ## CONSUMES ## GUID (Connect ConIn Event)
[Protocols]
gEfiSimpleFileSystemProtocolGuid ## PROTOCOL CONSUMES

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);