diff options
author | Leif Lindholm <leif@nuviainc.com> | 2021-02-04 12:36:59 +0000 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2021-02-04 16:11:23 +0000 |
commit | 1b6c3a94eca7f12f6a3b65a3e8619d2e2e7c1eb6 (patch) | |
tree | b8c5904ded1d22c27c48ec6b36d3ceb2069c0ad6 | |
parent | f6ec1dd34fb6b9757b5ead465ee2ea20c182b0ac (diff) | |
download | edk2-1b6c3a94eca7f12f6a3b65a3e8619d2e2e7c1eb6.tar.gz edk2-1b6c3a94eca7f12f6a3b65a3e8619d2e2e7c1eb6.tar.bz2 edk2-1b6c3a94eca7f12f6a3b65a3e8619d2e2e7c1eb6.zip |
ArmPkg/Library: prevent endless reboot loop with emulated NV varstore
If no valid boot options were found, PlatformBootManagerLib refreshes a
set of sane default options and then reboots. However, if there is in
fact no persistent varstore, the same thing happens again on next boot,
and we end up in an endlessly rebooting loop.
So when PcdEmuVariableNvModeEnable is TRUE, skip the reboot step and
enter the setup menu instead.
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r-- | ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 12 | ||||
-rw-r--r-- | ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 |
2 files changed, 9 insertions, 4 deletions
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
|