]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
MdeModulePkg/UefiBootManagerLib: Generate boot description for NVME
[mirror_edk2.git] / MdeModulePkg / Library / UefiBootManagerLib / BmDriverHealth.c
index d197816fa1fa99ab6ed74c1c414cdbeedb4fb744..ddcee8b0676f9f387b897dfe29bb9a74e9e0230d 100644 (file)
@@ -1,7 +1,9 @@
 /** @file\r
   Library functions which relates with driver health.\r
 \r
-Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
+(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -76,7 +78,7 @@ BmGetControllerName (
   }\r
 \r
   if (!EFI_ERROR (Status)) {\r
-    LanguageVariable = GetEfiGlobalVariable (Iso639Language ? L"Lang" : L"PlatformLang");\r
+    GetEfiGlobalVariable2 (Iso639Language ? L"Lang" : L"PlatformLang", (VOID**)&LanguageVariable, NULL);\r
     BestLanguage     = GetBestLanguage(\r
                          ComponentName->SupportedLanguages,\r
                          Iso639Language,\r
@@ -295,7 +297,6 @@ EfiBootManagerGetDriverHealthInfo (
   EFI_STATUS                 Status;\r
   UINTN                      NumHandles;\r
   EFI_HANDLE                 *DriverHealthHandles;\r
-  EFI_DRIVER_HEALTH_STATUS   HealthStatus;\r
   UINTN                      DriverHealthIndex;\r
   EFI_HANDLE                 *Handles;\r
   UINTN                      HandleCount;\r
@@ -313,8 +314,6 @@ EfiBootManagerGetDriverHealthInfo (
   NumHandles              = 0;\r
   HandleCount             = 0;\r
 \r
-  HealthStatus = EfiDriverHealthStatusHealthy;\r
-\r
   Status = gBS->LocateHandleBuffer (\r
                   ByProtocol,\r
                   &gEfiDriverHealthProtocolGuid,\r
@@ -441,17 +440,22 @@ BmRepairAllControllers (
   BOOLEAN                             RebootRequired;\r
   EFI_HII_HANDLE                      *HiiHandles;\r
   EFI_FORM_BROWSER2_PROTOCOL          *FormBrowser2;\r
+  UINT32                              MaxRepairCount;\r
+  UINT32                              RepairCount;\r
 \r
   //\r
   // Configure PcdDriverHealthConfigureForm to ZeroGuid to disable driver health check.\r
   //\r
-  if (CompareGuid (PcdGetPtr (PcdDriverHealthConfigureForm), &gZeroGuid)) {\r
+  if (IsZeroGuid (PcdGetPtr (PcdDriverHealthConfigureForm))) {\r
     return;\r
   }\r
 \r
   Status = gBS->LocateProtocol (&gEfiFormBrowser2ProtocolGuid, NULL, (VOID **) &FormBrowser2);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  MaxRepairCount = PcdGet32 (PcdMaxRepairCount);\r
+  RepairCount = 0;\r
+\r
   do {\r
     RepairRequired        = FALSE;\r
     ConfigurationRequired = FALSE;\r
@@ -514,7 +518,8 @@ BmRepairAllControllers (
     }\r
   \r
     EfiBootManagerFreeDriverHealthInfo (DriverHealthInfo, Count);\r
-  } while (RepairRequired || ConfigurationRequired);\r
+    RepairCount++;\r
+  } while ((RepairRequired || ConfigurationRequired) && ((MaxRepairCount == 0) || (RepairCount < MaxRepairCount)));\r
 \r
   RebootRequired    = FALSE;\r
   ReconnectRequired = FALSE;\r