From 5676ccca070b261ff70e93bc32b5f7496c1b8c83 Mon Sep 17 00:00:00 2001 From: czhang46 Date: Wed, 10 Oct 2012 07:29:45 +0000 Subject: [PATCH] Fix some corner case for LazyConIn feature Signed-off-by: chao zhang Reviewed-by : Ni Ruiyu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13814 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/BdsDxe/Bds.h | 3 +- .../Universal/BdsDxe/BdsDxe.inf | 1 + .../Universal/BdsDxe/BdsEntry.c | 52 +++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h index 008d13e41b..0929f1d27b 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h @@ -1,7 +1,7 @@ /** @file Head file for BDS Architectural Protocol implementation -Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
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 #include #include +#include #include #include #include diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf index 0134f9b7d1..8eb22add21 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf @@ -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 diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c index 7949d0995f..a919625379 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c @@ -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); -- 2.39.2