From e0763f87575cbd58bc38c4220e59010265a620e1 Mon Sep 17 00:00:00 2001 From: Eric Dong Date: Thu, 6 Nov 2014 08:56:54 +0000 Subject: [PATCH] Try to read key strike even when the TimeOuts value is zero, this will avoid BDS not get user input when TimeOuts value set to zero. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Eric Dong Reviewed-by: Ruiyu Ni Reviewed-by: Laszlo Ersek Tested-by: Laszlo Ersek git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16304 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/BdsDxe/FrontPage.c | 96 +++++++++---------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index f69b17c7bf..a0c638100a 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -891,64 +891,62 @@ ShowProgress ( EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background; EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color; - if (TimeoutDefault == 0) { - return EFI_TIMEOUT; - } - - DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n")); + if (TimeoutDefault != 0) { + DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n")); - SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff); - SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0); - SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff); - - TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION)); - - if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { - // - // Clear the progress status bar first - // - if (TmpStr != NULL) { - PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0); - } - } - - - TimeoutRemain = TimeoutDefault; - while (TimeoutRemain != 0) { - DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain)); - - Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND); - if (Status != EFI_TIMEOUT) { - break; - } - TimeoutRemain--; + SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff); + SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0); + SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff); + TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION)); + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { // - // Show progress + // Clear the progress status bar first // if (TmpStr != NULL) { - PlatformBdsShowProgress ( - Foreground, - Background, - TmpStr, - Color, - ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault), - 0 - ); + PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0); } } - } - - if (TmpStr != NULL) { - gBS->FreePool (TmpStr); - } + - // - // Timeout expired - // - if (TimeoutRemain == 0) { - return EFI_TIMEOUT; + TimeoutRemain = TimeoutDefault; + while (TimeoutRemain != 0) { + DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain)); + + Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND); + if (Status != EFI_TIMEOUT) { + break; + } + TimeoutRemain--; + + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { + // + // Show progress + // + if (TmpStr != NULL) { + PlatformBdsShowProgress ( + Foreground, + Background, + TmpStr, + Color, + ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault), + 0 + ); + } + } + } + + if (TmpStr != NULL) { + gBS->FreePool (TmpStr); + } + + // + // Timeout expired + // + if (TimeoutRemain == 0) { + return EFI_TIMEOUT; + } } // -- 2.39.2