diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c index 9905cad229..5ceb23d822 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -848,11 +848,15 @@ PlatformBootManagerUnableToBoot ( // If the number of configured boot options has changed, reboot // the system so the new boot options will be taken into account // while executing the ordinary BDS bootflow sequence. + // *Unless* persistent varstore is being emulated, since we would + // then end up in an endless reboot loop. // - if (NewBootOptionCount != OldBootOptionCount) { - DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n", - __FUNCTION__)); - gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + if (!PcdGetBool (PcdEmuVariableNvModeEnable)) { + if (NewBootOptionCount != OldBootOptionCount) { + DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n", + __FUNCTION__)); + gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL); + } } Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu); diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 2f726d117d..353d7a967b 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -55,6 +55,7 @@ gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport [FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdEmuVariableNvModeEnable gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits