diff options
Diffstat (limited to 'ArmPkg/Library/PlatformBootManagerLib')
-rw-r--r-- | ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c index 15c5cac1be..9905cad229 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -820,6 +820,40 @@ PlatformBootManagerUnableToBoot ( {
EFI_STATUS Status;
EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;
+ UINTN OldBootOptionCount;
+ UINTN NewBootOptionCount;
+
+ //
+ // Record the total number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&OldBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, OldBootOptionCount);
+
+ //
+ // Connect all devices, and regenerate all boot options
+ //
+ EfiBootManagerConnectAll ();
+ EfiBootManagerRefreshAllBootOption ();
+
+ //
+ // Record the updated number of boot configured boot options
+ //
+ BootOptions = EfiBootManagerGetLoadOptions (&NewBootOptionCount,
+ LoadOptionTypeBoot);
+ EfiBootManagerFreeLoadOptions (BootOptions, NewBootOptionCount);
+
+ //
+ // 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.
+ //
+ 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);
if (EFI_ERROR (Status)) {
|