diff --git a/CorebootModulePkg/Library/CorebootBdsLib/BdsPlatform.c b/CorebootModulePkg/Library/CorebootBdsLib/BdsPlatform.c index def2ad241d..bd2634740b 100644 --- a/CorebootModulePkg/Library/CorebootBdsLib/BdsPlatform.c +++ b/CorebootModulePkg/Library/CorebootBdsLib/BdsPlatform.c @@ -1357,6 +1357,42 @@ Returns: } +VOID +EFIAPI +PlatformBdsPreBoot ( + IN BDS_COMMON_OPTION *Option + ) +{ + EFI_STATUS Status; + EFI_EVENT UserInputDurationTime; + EFI_EVENT Events[2]; + UINTN Index; + + if (!ESCAPE_KEY_DETECTED) { + // Did not enter menu, return immediately + return; + } + + // Clear screen before waiting for input + gST->ConOut->ClearScreen(gST->ConOut); + + // Create a 1s duration event to ensure user has enough input time to provide a key to boot option + Status = gBS->CreateEvent ( + EVT_TIMER, + 0, + NULL, + NULL, + &UserInputDurationTime + ); + ASSERT (Status == EFI_SUCCESS); + Status = gBS->SetTimer (UserInputDurationTime, TimerRelative, 10000000); + ASSERT (Status == EFI_SUCCESS); + + Events[0] = gST->ConIn->WaitForKey; + Events[1] = UserInputDurationTime; + gBS->WaitForEvent (2, Events, &Index); +} + VOID EFIAPI PlatformBdsBootSuccess ( diff --git a/IntelFrameworkModulePkg/Include/Library/PlatformBdsLib.h b/IntelFrameworkModulePkg/Include/Library/PlatformBdsLib.h index d160d722b5..a45cd205d3 100644 --- a/IntelFrameworkModulePkg/Include/Library/PlatformBdsLib.h +++ b/IntelFrameworkModulePkg/Include/Library/PlatformBdsLib.h @@ -91,6 +91,12 @@ PlatformBdsPolicyBehavior ( IN BASEM_MEMORY_TEST BaseMemoryTest ); +VOID +EFIAPI +PlatformBdsPreBoot ( + IN BDS_COMMON_OPTION *Option + ); + /** Hook point for a user-provided function, for after a boot attempt fails. diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c index b899deca99..c6d879fd83 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c @@ -263,6 +263,8 @@ BdsBootDeviceSelect ( // BdsSetConsoleMode (FALSE); + PlatformBdsPreBoot (BootOption); + // // All the driver options should have been processed since // now boot will be performed. diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c index 1dca7579c7..d1e1979cab 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMngr/BootManager.c @@ -380,6 +380,8 @@ CallBootManager ( // BdsSetConsoleMode (FALSE); + PlatformBdsPreBoot (gOption); + // // parse the selected option // diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c index 0da0f961e5..3c647b2f25 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Hotkey.c @@ -91,6 +91,8 @@ HotkeyBoot ( // gST->ConOut->Reset (gST->ConOut, FALSE); + PlatformBdsPreBoot (mHotkeyBootOption); + Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData); if (EFI_ERROR (Status)) {