[edk2-devel] [edk2-platforms][PATCH v2 2/2] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration
Benjamin Doron
benjamin.doron00 at gmail.com
Sat Aug 14 00:42:38 UTC 2021
Retrieve BootOption of BootManagerMenu for registering F7 hotkey, rather
than creating an additional boot option.
Tested, both F7 hotkey still opens the list of boot options.
Cc: Eric Dong <eric.dong at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Nate DeSimone <nathaniel.l.desimone at intel.com>
Signed-off-by: Benjamin Doron <benjamin.doron00 at gmail.com>
---
Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c | 19 ++++---------------
1 file changed, 4 insertions(+), 15 deletions(-)
diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
index e734e3ad15c3..7ac6c150f2e7 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
@@ -14,7 +14,6 @@ BOOLEAN mPxeBoot = FALSE;
BOOLEAN mHotKeypressed = FALSE;
EFI_EVENT HotKeyEvent = NULL;
-UINTN mBootMenuOptionNumber;
UINTN mSetupOptionNumber;
@@ -189,9 +188,6 @@ CreateFvBootOption (
EFI_GUID mUiFile = {
0x462CAA21, 0x7614, 0x4503, { 0x83, 0x6E, 0x8A, 0xB6, 0xF4, 0x66, 0x23, 0x31 }
};
-EFI_GUID mBootMenuFile = {
- 0xEEC25BDC, 0x67F2, 0x4D95, { 0xB1, 0xD5, 0xF8, 0x1B, 0x20, 0x39, 0xD1, 0x1D }
-};
/**
@@ -354,15 +350,6 @@ RegisterDefaultBootOption (
ShellDataSize = 0;
RegisterFvBootOption (&gUefiShellFileGuid, INTERNAL_UEFI_SHELL_NAME, (UINTN) -1, LOAD_OPTION_ACTIVE, (UINT8 *)ShellData, ShellDataSize);
- //
- // Boot Menu
- //
- mBootMenuOptionNumber = RegisterFvBootOption (&mBootMenuFile, L"Boot Device List", (UINTN) -1, LOAD_OPTION_CATEGORY_APP | LOAD_OPTION_ACTIVE | LOAD_OPTION_HIDDEN, NULL, 0);
-
- if (mBootMenuOptionNumber == LoadOptionNumberUnassigned) {
- DEBUG ((DEBUG_INFO, "BootMenuOptionNumber (%d) should not be same to LoadOptionNumberUnassigned(%d).\n", mBootMenuOptionNumber, LoadOptionNumberUnassigned));
- }
-
//
// Boot Manager Menu
//
@@ -468,8 +455,10 @@ RegisterStaticHotkey (
F7.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
F7.KeyState.KeyToggleState = 0;
mBootMenuBoot = !EnterSetup;
- RegisterBootOptionHotkey ((UINT16) mBootMenuOptionNumber, &F7.Key, mBootMenuBoot);
-
+ Status = EfiBootManagerGetBootManagerMenu (&BootOption);
+ ASSERT_EFI_ERROR (Status);
+ RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F7.Key, mBootMenuBoot);
+ EfiBootManagerFreeLoadOption (&BootOption);
}
--
2.31.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#79302): https://edk2.groups.io/g/devel/message/79302
Mute This Topic: https://groups.io/mt/84876596/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list