From 103aed83a7e4a71bf93ee6f8caa937f5e9a21411 Mon Sep 17 00:00:00 2001 From: Luigi Leonardi Date: Fri, 13 Dec 2024 12:19:14 +0100 Subject: OvmfPkg/PlatformBootManagerLib: Introduce support for fw_cfg for UEFI Shell usage: qemu -fw_cfg name=opt/org.tianocore/EFIShellSupport,string=no Signed-off-by: Luigi Leonardi --- OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c | 16 +++++++++++++++- .../PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + OvmfPkg/OvmfXen.dsc | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c index 579eae8780..fdd4db5ca8 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c +++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c @@ -15,6 +15,8 @@ #include #include +#include + // // Global data // @@ -1843,6 +1845,18 @@ PlatformBootManagerAfterConsole ( EfiBootManagerRefreshAllBootOption (); } + BOOLEAN ShellEnabled; + RETURN_STATUS RetStatus; + + RetStatus = QemuFwCfgParseBool ( + "opt/org.tianocore/EFIShellSupport", + &ShellEnabled + ); + + if (RETURN_ERROR (RetStatus)) { + ShellEnabled = TRUE; + } + // // Register UEFI Shell // @@ -1850,7 +1864,7 @@ PlatformBootManagerAfterConsole ( &gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE, - TRUE + ShellEnabled ); // diff --git a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index c6ffc1ed9e..1a422ebb0e 100644 --- a/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -56,6 +56,7 @@ PlatformBmPrintScLib Tcg2PhysicalPresenceLib XenPlatformLib + QemuFwCfgSimpleParserLib [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdEmuVariableEvent diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 5e845e5f91..3f52483dc0 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -168,6 +168,7 @@ UefiUsbLib|MdePkg/Library/UefiUsbLib/UefiUsbLib.inf SerializeVariablesLib|OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.inf QemuFwCfgLib|OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgDxeLib.inf + QemuFwCfgSimpleParserLib|OvmfPkg/Library/QemuFwCfgSimpleParserLib/QemuFwCfgSimpleParserLib.inf QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf MemEncryptSevLib|OvmfPkg/Library/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxBaseLib.inf -- cgit