]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c
ArmPkg/Library: prevent endless reboot loop with emulated NV varstore
[mirror_edk2.git] / ArmPkg / Library / PlatformBootManagerLib / PlatformBm.c
index 9905cad22908fb5ee6507b5d12dd41bbd6d104b8..5ceb23d822e5d121158d87d437253559ef8d7eab 100644 (file)
@@ -848,11 +848,15 @@ PlatformBootManagerUnableToBoot (
   // If the number of configured boot options has changed, reboot\r
   // the system so the new boot options will be taken into account\r
   // while executing the ordinary BDS bootflow sequence.\r
+  // *Unless* persistent varstore is being emulated, since we would\r
+  // then end up in an endless reboot loop.\r
   //\r
-  if (NewBootOptionCount != OldBootOptionCount) {\r
-    DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",\r
-      __FUNCTION__));\r
-    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+  if (!PcdGetBool (PcdEmuVariableNvModeEnable)) {\r
+    if (NewBootOptionCount != OldBootOptionCount) {\r
+      DEBUG ((DEBUG_WARN, "%a: rebooting after refreshing all boot options\n",\r
+        __FUNCTION__));\r
+      gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
+    }\r
   }\r
 \r
   Status = EfiBootManagerGetBootManagerMenu (&BootManagerMenu);\r