summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c')
-rw-r--r--MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
index ddcee8b067..db2f859ae7 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
@@ -423,10 +423,13 @@ EfiBootManagerFreeDriverHealthInfo (
/**
Repair all the controllers according to the Driver Health status queried.
+
+ @param ReconnectRepairCount To record the number of recursive call of
+ this function itself.
**/
VOID
BmRepairAllControllers (
- VOID
+ UINTN ReconnectRepairCount
)
{
EFI_STATUS Status;
@@ -548,10 +551,6 @@ BmRepairAllControllers (
EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);
- if (ReconnectRequired) {
- BmRepairAllControllers ();
- }
-
DEBUG_CODE (
CHAR16 *ControllerName;
@@ -576,6 +575,15 @@ BmRepairAllControllers (
EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);
);
+ if (ReconnectRequired) {
+ if (ReconnectRepairCount < MAX_RECONNECT_REPAIR) {
+ BmRepairAllControllers (ReconnectRepairCount + 1);
+ } else {
+ DEBUG ((DEBUG_ERROR, "[%a:%d] Repair failed after %d retries.\n",
+ __FUNCTION__, __LINE__, ReconnectRepairCount));
+ }
+ }
+
if (RebootRequired) {
DEBUG ((EFI_D_INFO, "[BDS] One of the Driver Health instances requires rebooting.\n"));
gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);