summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuigi Leonardi <leonardi@redhat.com>2024-12-13 12:18:04 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-23 10:36:19 +0000
commit07bb2265426d94411c7f185478e614f624c56050 (patch)
treef5fe7b097cec04124d0d5d389f2fad254d27a020
parentb8f3199595d23c29433528a5207a6aa9fb368d44 (diff)
downloadedk2-07bb2265426d94411c7f185478e614f624c56050.tar.gz
OvmfPkg: Add a runtime switch for PlatformRegisterFvBootOption
Add a new parameter to selectively enable or disable the BootOption. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index a44e45df8f..579eae8780 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -86,7 +86,8 @@ VOID
PlatformRegisterFvBootOption (
EFI_GUID *FileGuid,
CHAR16 *Description,
- UINT32 Attributes
+ UINT32 Attributes,
+ BOOLEAN Enabled
)
{
EFI_STATUS Status;
@@ -138,9 +139,15 @@ PlatformRegisterFvBootOption (
BootOptionCount
);
- if (OptionIndex == -1) {
+ if ((OptionIndex == -1) && Enabled) {
Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);
ASSERT_EFI_ERROR (Status);
+ } else if ((OptionIndex != -1) && !Enabled) {
+ Status = EfiBootManagerDeleteLoadOptionVariable (
+ BootOptions[OptionIndex].OptionNumber,
+ LoadOptionTypeBoot
+ );
+ ASSERT_EFI_ERROR (Status);
}
EfiBootManagerFreeLoadOption (&NewOption);
@@ -1842,7 +1849,8 @@ PlatformBootManagerAfterConsole (
PlatformRegisterFvBootOption (
&gUefiShellFileGuid,
L"EFI Internal Shell",
- LOAD_OPTION_ACTIVE
+ LOAD_OPTION_ACTIVE,
+ TRUE
);
//
@@ -1851,7 +1859,8 @@ PlatformBootManagerAfterConsole (
PlatformRegisterFvBootOption (
&gGrubFileGuid,
L"Grub Bootloader",
- LOAD_OPTION_ACTIVE
+ LOAD_OPTION_ACTIVE,
+ TRUE
);
RemoveStaleFvFileOptions ();