Add PlatformBdsPreBoot to allow hooks immediately before booting an option
This commit is contained in:
committed by
Tim Crawford
parent
814c0fa862
commit
6dff36c9b2
@ -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
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PlatformBdsBootSuccess (
|
PlatformBdsBootSuccess (
|
||||||
|
@ -91,6 +91,12 @@ PlatformBdsPolicyBehavior (
|
|||||||
IN BASEM_MEMORY_TEST BaseMemoryTest
|
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.
|
Hook point for a user-provided function, for after a boot attempt fails.
|
||||||
|
|
||||||
|
@ -263,6 +263,8 @@ BdsBootDeviceSelect (
|
|||||||
//
|
//
|
||||||
BdsSetConsoleMode (FALSE);
|
BdsSetConsoleMode (FALSE);
|
||||||
|
|
||||||
|
PlatformBdsPreBoot (BootOption);
|
||||||
|
|
||||||
//
|
//
|
||||||
// All the driver options should have been processed since
|
// All the driver options should have been processed since
|
||||||
// now boot will be performed.
|
// now boot will be performed.
|
||||||
|
@ -380,6 +380,8 @@ CallBootManager (
|
|||||||
//
|
//
|
||||||
BdsSetConsoleMode (FALSE);
|
BdsSetConsoleMode (FALSE);
|
||||||
|
|
||||||
|
PlatformBdsPreBoot (gOption);
|
||||||
|
|
||||||
//
|
//
|
||||||
// parse the selected option
|
// parse the selected option
|
||||||
//
|
//
|
||||||
|
@ -91,6 +91,8 @@ HotkeyBoot (
|
|||||||
//
|
//
|
||||||
gST->ConOut->Reset (gST->ConOut, FALSE);
|
gST->ConOut->Reset (gST->ConOut, FALSE);
|
||||||
|
|
||||||
|
PlatformBdsPreBoot (mHotkeyBootOption);
|
||||||
|
|
||||||
Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
|
Status = BdsLibBootViaBootOption (mHotkeyBootOption, mHotkeyBootOption->DevicePath, &ExitDataSize, &ExitData);
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
Reference in New Issue
Block a user