public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-platforms][PATCH v1] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration
@ 2021-08-04 20:39 Benjamin Doron
  2021-08-13  7:23 ` [edk2-devel] " Nate DeSimone
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Doron @ 2021-08-04 20:39 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Liming Gao

If BootOption free is delayed, hotkey registration can be simplified.
There will be no need to register an additional boot option.

Tested, both F2 and F7 keys still open the list of boot options.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
index 2dd0b250d44e..df60f6903a22 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
@@ -14,8 +14,6 @@ BOOLEAN    mPxeBoot       = FALSE;
 BOOLEAN    mHotKeypressed = FALSE;
 EFI_EVENT  HotKeyEvent    = NULL;
 
-UINTN      mBootMenuOptionNumber;
-
 
 /**
   This function will create a SHELL BootOption to boot.
@@ -188,9 +186,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 }
-};
 
 
 /**
@@ -353,15 +348,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
   //
@@ -461,15 +447,14 @@ RegisterStaticHotkey (
   Status = EfiBootManagerGetBootManagerMenu (&BootOption);
   ASSERT_EFI_ERROR (Status);
   RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F2.Key, TRUE);
-  EfiBootManagerFreeLoadOption (&BootOption);
 
   F7.Key.ScanCode    = SCAN_F7;
   F7.Key.UnicodeChar = CHAR_NULL;
   F7.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;
   F7.KeyState.KeyToggleState = 0;
   mBootMenuBoot  = !EnterSetup;
-  RegisterBootOptionHotkey ((UINT16) mBootMenuOptionNumber, &F7.Key, mBootMenuBoot);
-
+  RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F7.Key, mBootMenuBoot);
+  EfiBootManagerFreeLoadOption (&BootOption);
 }
 
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [edk2-platforms][PATCH v1] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration
  2021-08-04 20:39 [edk2-platforms][PATCH v1] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration Benjamin Doron
@ 2021-08-13  7:23 ` Nate DeSimone
  0 siblings, 0 replies; 2+ messages in thread
From: Nate DeSimone @ 2021-08-13  7:23 UTC (permalink / raw)
  To: devel@edk2.groups.io, benjamin.doron00@gmail.com; +Cc: Dong, Eric, Liming Gao

Hi Benjamin,

This patch is unable to apply unless the content of your other patch https://edk2.groups.io/g/devel/message/78309 has already been merged. Accordingly, after you address my feedback on the first patch please send this patch as part of the same patch series so it can be applied cleanly.

Thanks,
Nate

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Benjamin Doron
Sent: Wednesday, August 4, 2021 1:39 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
Subject: [edk2-devel] [edk2-platforms][PATCH v1] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration

If BootOption free is delayed, hotkey registration can be simplified.
There will be no need to register an additional boot option.

Tested, both F2 and F7 keys still open the list of boot options.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
---
 Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
index 2dd0b250d44e..df60f6903a22 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOpt
+++ ion.c
@@ -14,8 +14,6 @@ BOOLEAN    mPxeBoot       = FALSE;
 BOOLEAN    mHotKeypressed = FALSE; EFI_EVENT  HotKeyEvent    = NULL; -UINTN      mBootMenuOptionNumber;-  /**   This function will create a SHELL BootOption to boot.@@ -188,9 +186,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 }-};   /**@@ -353,15 +348,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   //@@ -461,15 +447,14 @@ RegisterStaticHotkey (
   Status = EfiBootManagerGetBootManagerMenu (&BootOption);   ASSERT_EFI_ERROR (Status);   RegisterBootOptionHotkey ((UINT16) BootOption.OptionNumber, &F2.Key, TRUE);-  EfiBootManagerFreeLoadOption (&BootOption);    F7.Key.ScanCode    = SCAN_F7;   F7.Key.UnicodeChar = CHAR_NULL;   F7.KeyState.KeyShiftState = EFI_SHIFT_STATE_VALID;   F7.KeyState.KeyToggleState = 0;   mBootMenuBoot  = !EnterSetup;-  RegisterBootOptionHotkey ((UINT16) mBootMenuOptionNumber, &F7.Key, mBootMenuBoot);-+  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 (#78677): https://edk2.groups.io/g/devel/message/78677
Mute This Topic: https://groups.io/mt/84671368/1767664
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [nathaniel.l.desimone@intel.com] -=-=-=-=-=-=



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-13  7:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-04 20:39 [edk2-platforms][PATCH v1] BoardModulePkg/BoardBdsHookLib: Simplify hotkey registration Benjamin Doron
2021-08-13  7:23 ` [edk2-devel] " Nate DeSimone

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox