]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg:Prevent the BmRepairAllControllers routine in an infinite loop
authorGary Li <garyli@hpe.com>
Fri, 3 Jun 2016 07:21:26 +0000 (15:21 +0800)
committerLiming Gao <liming.gao@intel.com>
Fri, 3 Jun 2016 07:57:47 +0000 (15:57 +0800)
Prevent the BmRepairAllControllers routine in an infinite loop

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Gary Li <garyli@hpe.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/MdeModulePkg.uni

index bffbedaf84469cb6edf55ca3c88b5f36bce52cae..1e68cbc01f9a3992b27b4be95c01a40dd5a7b386 100644 (file)
@@ -1,8 +1,9 @@
 /** @file\r
   Library functions which relates with driver health.\r
 \r
-(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>\r
 Copyright (c) 2011 - 2015, 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
@@ -439,6 +440,8 @@ 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
@@ -450,6 +453,9 @@ BmRepairAllControllers (
   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
@@ -512,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
index 9d62d3d2c12de69fd7772a997093cf0b94dfe034..078f2723db4a83ba563f53372291b136c4ff8afa 100644 (file)
@@ -6,6 +6,7 @@
 #  manipulation, driver health checking and etc.\r
 #\r
 #  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<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
   gEfiMdeModulePkgTokenSpaceGuid.PcdErrorCodeSetVariable                    ## SOMETIMES_CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile                     ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdDriverHealthConfigureForm               ## SOMETIMES_CONSUMES\r
-\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount                          ## CONSUMES\r
index a1338240d139e2e7888f3e258069115e2e9e7127..27efb378bde9ead04de16f088ebbcc7d2642bc54 100644 (file)
   # @Prompt Exposed ACPI table versions.\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x3E|UINT32|0x0001004c\r
 \r
+  ## This PCD defines the MAX repair count.\r
+  #  The default value is 0 that means infinite.\r
+  # @Prompt MAX repair count\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxRepairCount|0x00|UINT32|0x00010076\r
+\r
 [PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]\r
   ## This PCD defines the Console output row. The default value is 25 according to UEFI spec.\r
   #  This PCD could be set to 0 then console output would be at max column and max row.\r
index 346f735fdba5c48a19aae472ad03c648698657c6..f529dced6f0eac30fea48f772fa31e6f2103a108 100644 (file)
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSdMmcPciHostControllerMmioBase_PROMPT  #language en-US "Mmio base address of pci-based SD/MMC host controller"\r
 \r
 #string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdSdMmcPciHostControllerMmioBase_HELP  #language en-US "This PCD specifies the PCI-based SD/MMC host controller mmio base address. Define the mmio base address of the pci-based SD/MMC host controller. If there are multiple SD/MMC host controllers, their mmio base addresses are calculated one by one from this base address.<BR>"\r
+\r
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaxRepairCount_PROMPT  #language en-US "MAX repair count"\r
+\r
+#string STR_gEfiMdeModulePkgTokenSpaceGuid_PcdMaxRepairCount_HELP  #language en-US "This PCD defines the MAX repair count. The default value is 0 that means infinite.<BR>"\r