public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] fix: F7 key can register Boot0000 if error happens getting mBootMenuOptionNumber
@ 2022-06-02  3:22 JamesWang [王家明]
  0 siblings, 0 replies; only message in thread
From: JamesWang [王家明] @ 2022-06-02  3:22 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: JamesWang [王家明]

From: JamesWang <jameswang@ami.com>

---
 .../Library/BoardBdsHookLib/BoardBootOption.c          | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
index 87138bdd..5456acfb 100644
--- a/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
+++ b/Platform/Intel/BoardModulePkg/Library/BoardBdsHookLib/BoardBootOption.c
@@ -472,12 +472,18 @@ RegisterStaticHotkey (
   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);
+  //
+  // Register F7 only when the mBootMenuOptionNumber is valid
+  //
+  if (mBootMenuOptionNumber != LoadOptionNumberUnassigned)
+  {
+    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);
+  }

 }

--
2.13.2.windows.1
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-02  3:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02  3:22 [PATCH] fix: F7 key can register Boot0000 if error happens getting mBootMenuOptionNumber JamesWang [王家明]

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