]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Driver health management implementation in BDS based on UEFI Specification 2.3.
authorgikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 4 Dec 2009 03:22:44 +0000 (03:22 +0000)
committergikidy <gikidy@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 4 Dec 2009 03:22:44 +0000 (03:22 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9514 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.c
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManager.h
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerVfr.Vfr
IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr [new file with mode: 0644]

index 53f384a14953b53db1895f2e700ff154b598a073..f8272c0d93bf82068999ebfc1604575d2afc36cd 100644 (file)
@@ -19,6 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <IndustryStandard/PeImage.h>\r
 #include <Guid/MdeModuleHii.h>\r
 #include <Guid/FileSystemVolumeLabelInfo.h>\r
+#include <Guid/HiiPlatformSetupFormset.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <IndustryStandard/SmBios.h>\r
 #include <Protocol/LoadFile.h>\r
@@ -42,6 +43,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SerialIo.h>\r
 #include <Protocol/LegacyBios.h>\r
 #include <Protocol/SimpleTextInEx.h>\r
+#include <Protocol/DriverHealth.h>\r
 \r
 #include <Library/UefiDriverEntryPoint.h>\r
 #include <Library/PrintLib.h>\r
index 1ab62282e87df0974fad8b96fc981a7d3ed4932b..c7f99755239fb7306927897db58d8ea399d13152 100644 (file)
@@ -55,6 +55,7 @@
 \r
   DeviceMngr/DeviceManager.h\r
   DeviceMngr/DeviceManagerVfr.Vfr\r
+  DeviceMngr/DriverHealthVfr.Vfr\r
   DeviceMngr/DeviceManagerStrings.uni\r
   DeviceMngr/DeviceManager.c\r
   BootMngr/BootManagerVfr.Vfr\r
   gEfiFileInfoGuid                              ## CONSUMES ## GUID (Indicate the information type is file)\r
   gEfiHiiPlatformSetupFormsetGuid               ## CONSUMES ## GUID (Indicate the formset class guid to be displayed)\r
   gEfiIfrTianoGuid                              ## CONSUMES ## GUID (Extended IFR Guid Opcode)\r
-\r
+  gEfiHiiDriverHealthFormsetGuid                ## CONSUMES ## GUID (Indicate the Driver Health formset class guid to be displayed)\r
+  \r
 [Protocols]\r
-  gEfiSimpleFileSystemProtocolGuid              # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiLoadFileProtocolGuid                      # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiBdsArchProtocolGuid                       # PROTOCOL ALWAYS_PRODUCES\r
-  gEfiSmbiosProtocolGuid                        # PROTOCOL ALWAYS_CONSUMED\r
-  gEfiGenericMemTestProtocolGuid                # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiLegacyBiosProtocolGuid                    # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport # PROTOCOL SOMETIMES_CONSUMES\r
-  gEfiBlockIoProtocolGuid                       # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiGraphicsOutputProtocolGuid                # PROTOCOL SOMETIMES_CONSUMES\r
-  gEfiSimpleTextInputExProtocolGuid             # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiHiiConfigAccessProtocolGuid               # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiFormBrowser2ProtocolGuid                  # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiSerialIoProtocolGuid                      # PROTOCOL ALWAYS_CONSUMES\r
-  gEfiDevicePathProtocolGuid                    # PROTOCOL ALWAYS_CONSUMES\r
+  gEfiSimpleFileSystemProtocolGuid              ## PROTOCOL CONSUMES\r
+  gEfiLoadFileProtocolGuid                      ## PROTOCOL CONSUMES\r
+  gEfiBdsArchProtocolGuid                       ## PROTOCOL PRODUCES\r
+  gEfiSmbiosProtocolGuid                        ## PROTOCOL CONSUMES\r
+  gEfiGenericMemTestProtocolGuid                ## PROTOCOL CONSUMES\r
+  gEfiLegacyBiosProtocolGuid                    ## PROTOCOL CONSUMES\r
+  gEfiUgaDrawProtocolGuid |PcdUgaConsumeSupport ## PROTOCOL SOMETIMES_CONSUMES\r
+  gEfiBlockIoProtocolGuid                       ## PROTOCOL CONSUMES\r
+  gEfiGraphicsOutputProtocolGuid                ## PROTOCOL SOMETIMES_CONSUMES\r
+  gEfiSimpleTextInputExProtocolGuid             ## PROTOCOL CONSUMES\r
+  gEfiHiiConfigAccessProtocolGuid               ## PROTOCOL CONSUMES\r
+  gEfiFormBrowser2ProtocolGuid                  ## PROTOCOL CONSUMES\r
+  gEfiSerialIoProtocolGuid                      ## PROTOCOL CONSUMES\r
+  gEfiDevicePathProtocolGuid                    ## PROTOCOL CONSUMES\r
+  gEfiDriverHealthProtocolGuid                  ## PROTOCOL SOMETIMES_CONSUMES\r
 \r
 [FeaturePcd.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultLangDeprecate\r
index 6f153d0c3f10789d8659ed96faa821e3540bfa4f..1d4b0f525653dc74d6c9be8caf1753f8b2ba2daf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform device manager reference implementation\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -13,20 +13,27 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 \r
 #include "DeviceManager.h"\r
-#include <Guid/HiiPlatformSetupFormset.h>\r
 \r
 DEVICE_MANAGER_CALLBACK_DATA  gDeviceManagerPrivate = {\r
   DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE,\r
   NULL,\r
   NULL,\r
+  NULL,\r
+  NULL,\r
   {\r
     FakeExtractConfig,\r
     FakeRouteConfig,\r
     DeviceManagerCallback\r
+  },\r
+  {\r
+    FakeExtractConfig,\r
+    FakeRouteConfig,\r
+    DriverHealthCallback\r
   }\r
 };\r
 \r
 EFI_GUID mDeviceManagerGuid = DEVICE_MANAGER_FORMSET_GUID;\r
+EFI_GUID mDriverHealthGuid = DRIVER_HEALTH_FORMSET_GUID;\r
 \r
 DEVICE_MANAGER_MENU_ITEM  mDeviceManagerMenuItemTable[] = {\r
   { STRING_TOKEN (STR_DISK_DEVICE),     EFI_DISK_DEVICE_CLASS },\r
@@ -63,7 +70,7 @@ HII_VENDOR_DEVICE_PATH  mDeviceManagerHiiVendorDevicePath = {
 };\r
 \r
 /**\r
-  This function is invoked if user selected a iteractive opcode from Device Manager's\r
+  This function is invoked if user selected a interactive opcode from Device Manager's\r
   Formset. The decision by user is saved to gCallbackKey for later processing. If\r
   user set VBIOS, the new value is saved to EFI variable.\r
 \r
@@ -94,7 +101,6 @@ DeviceManagerCallback (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-\r
   gCallbackKey = QuestionId;\r
 \r
   //\r
@@ -102,7 +108,6 @@ DeviceManagerCallback (
   //\r
   *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
 \r
-\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -134,6 +139,14 @@ InitializeDeviceManager (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &gDeviceManagerPrivate.DriverHealthHandle,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  &gDeviceManagerPrivate.DriverHealthConfigAccess,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
   //\r
   // Publish our HII data\r
   //\r
@@ -145,10 +158,27 @@ InitializeDeviceManager (
                                       NULL\r
                                       );\r
   if (gDeviceManagerPrivate.HiiHandle == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  } else {\r
+    Status = EFI_SUCCESS;\r
+  }\r
+  \r
+  //\r
+  // Publish Driver Health HII data\r
+  //\r
+  gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages (\r
+                                                  &mDeviceManagerGuid,\r
+                                                  gDeviceManagerPrivate.DriverHealthHandle,\r
+                                                  DriverHealthVfrBin,\r
+                                                  BdsDxeStrings,\r
+                                                  NULL\r
+                                                  );\r
+  if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) {\r
     Status = EFI_OUT_OF_RESOURCES;\r
   } else {\r
     Status = EFI_SUCCESS;\r
   }\r
+\r
   return Status;\r
 }\r
 \r
@@ -301,10 +331,14 @@ CallDeviceManager (
   VOID                        *EndOpCodeHandle;\r
   EFI_IFR_GUID_LABEL          *StartLabel;\r
   EFI_IFR_GUID_LABEL          *EndLabel;\r
+  UINTN                       NumHandles;\r
+  EFI_HANDLE                  *DriverHealthHandles;\r
 \r
   HiiHandles    = NULL;\r
   Status        = EFI_SUCCESS;\r
   gCallbackKey  = 0;\r
+  NumHandles    = 0;\r
+  DriverHealthHandles = NULL;\r
 \r
   //\r
   // Connect all prior to entering the platform setup menu.\r
@@ -313,7 +347,6 @@ CallDeviceManager (
     BdsLibConnectAllDriversToAllControllers ();\r
     gConnectAllHappened = TRUE;\r
   }\r
-\r
   //\r
   // Create Subtitle OpCodes\r
   //\r
@@ -389,6 +422,36 @@ CallDeviceManager (
   //\r
   HiiCreateEndOpCode (StartOpCodeHandle);\r
 \r
+  Status = gBS->LocateHandleBuffer (\r
+                ByProtocol,\r
+                &gEfiDriverHealthProtocolGuid,\r
+                NULL,\r
+                &NumHandles,\r
+                &DriverHealthHandles\r
+                );\r
+  //\r
+  // If there are no drivers installed driver health protocol\r
+  //\r
+  if (NumHandles == 0) {\r
+    HiiSetString (HiiHandle, STRING_TOKEN (STR_DM_DRIVER_HEALTH_TITLE), GetStringById (STRING_TOKEN (STR_EMPTY_STRING)), NULL);\r
+    HiiSetString (HiiHandle, STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY), GetStringById (STRING_TOKEN (STR_EMPTY_STRING)), NULL);\r
+  } else {\r
+    //\r
+    // Check All Driver health status\r
+    //\r
+    if (!PlaformHealthStatusCheck ()) {\r
+      //\r
+      // At least one driver in the platform are not in healthy status\r
+      //\r
+      HiiSetString (HiiHandle, STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY), GetStringById (STRING_TOKEN (STR_DRIVER_NOT_HEALTH)), NULL);\r
+    } else {\r
+      //\r
+      // For the string of STR_DRIVER_HEALTH_ALL_HEALTHY previously has been updated and we need to update it while re-entry.\r
+      //\r
+      HiiSetString (HiiHandle, STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY), GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY)), NULL);\r
+    }\r
+  }\r
+\r
   HiiUpdateForm (\r
     HiiHandle,\r
     &mDeviceManagerGuid,\r
@@ -415,7 +478,7 @@ CallDeviceManager (
   // We will have returned from processing a callback - user either hit ESC to exit, or selected\r
   // a target to display\r
   //\r
-  if (gCallbackKey != 0) {\r
+  if ((gCallbackKey != 0) && (gCallbackKey != DEVICE_MANAGER_KEY_DRIVER_HEALTH)) {\r
     ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
     Status = gFormBrowser2->SendForm (\r
                              gFormBrowser2,\r
@@ -437,6 +500,13 @@ CallDeviceManager (
     gCallbackKey = FRONT_PAGE_KEY_DEVICE_MANAGER;\r
   }\r
 \r
+  //\r
+  // Driver Health item chose. \r
+  //\r
+  if (gCallbackKey == DEVICE_MANAGER_KEY_DRIVER_HEALTH) {\r
+    CallDriverHealth ();\r
+  }\r
+\r
   //\r
   // Cleanup dynamic created strings in HII database by reinstall the packagelist\r
   //\r
@@ -461,3 +531,1379 @@ CallDeviceManager (
 \r
   return Status;\r
 }\r
+\r
+/**\r
+  This function is invoked if user selected a interactive opcode from Driver Health's\r
+  Formset. The decision by user is saved to gCallbackKey for later processing.\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\r
+  @param Type            The type of value for the question.\r
+  @param Value           A pointer to the data being sent to the original exporting driver.\r
+  @param ActionRequest   On return, points to the action requested by the callback function.\r
+\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DriverHealthCallback (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  )\r
+{\r
+  if ((Value == NULL) || (ActionRequest == NULL)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  gCallbackKey = QuestionId;\r
+\r
+  //\r
+  // Request to exit SendForm(), so as to switch to selected form\r
+  //\r
+  *ActionRequest = EFI_BROWSER_ACTION_REQUEST_EXIT;\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Collect and display the platform's driver health relative information, allow user to do interactive \r
+  operation while the platform is unhealthy.\r
+\r
+  This function display a form which divided into two parts. The one list all modules which has installed \r
+  driver health protocol. The list usually contain driver name, controller name, and it's health info.\r
+  While the driver name can't be retrieved, will use device path as backup. The other part of the form provide\r
+  a choice to the user to repair all platform.\r
+\r
+**/\r
+VOID\r
+CallDriverHealth (\r
+  VOID\r
+  )\r
+{\r
+  EFI_STATUS                  Status; \r
+  EFI_HII_HANDLE              HiiHandle;\r
+  EFI_BROWSER_ACTION_REQUEST  ActionRequest;\r
+  EFI_IFR_GUID_LABEL          *StartLabel;\r
+  EFI_IFR_GUID_LABEL          *StartLabelRepair;\r
+  EFI_IFR_GUID_LABEL          *EndLabel;\r
+  EFI_IFR_GUID_LABEL          *EndLabelRepair;\r
+  VOID                        *StartOpCodeHandle;\r
+  VOID                        *EndOpCodeHandle;\r
+  VOID                        *StartOpCodeHandleRepair;\r
+  VOID                        *EndOpCodeHandleRepair;\r
+  UINTN                       Index;\r
+  EFI_STRING_ID               Token;\r
+  EFI_STRING_ID               TokenHelp;\r
+  EFI_STRING                  String;\r
+  EFI_STRING                  TmpString;\r
+  EFI_STRING                  DriverName;\r
+  EFI_STRING                  ControllerName;\r
+  LIST_ENTRY                  DriverHealthList;\r
+  DRIVER_HEALTH_INFO          *DriverHealthInfo;\r
+  LIST_ENTRY                  *Link;\r
+  EFI_DEVICE_PATH_PROTOCOL    *DriverDevicePath;\r
+  UINTN                       Length;\r
+\r
+  HiiHandle           = gDeviceManagerPrivate.DriverHealthHiiHandle;\r
+  Index               = 0;\r
+  Length              = 0;\r
+  DriverHealthInfo    = NULL;  \r
+  DriverDevicePath    = NULL;\r
+  InitializeListHead (&DriverHealthList);\r
+\r
+  //\r
+  // Allocate space for creation of UpdateData Buffer\r
+  //\r
+  StartOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+  ASSERT (StartOpCodeHandle != NULL);\r
+\r
+  EndOpCodeHandle = HiiAllocateOpCodeHandle ();\r
+  ASSERT (EndOpCodeHandle != NULL);\r
+\r
+  StartOpCodeHandleRepair = HiiAllocateOpCodeHandle ();\r
+  ASSERT (StartOpCodeHandleRepair != NULL);\r
+\r
+  EndOpCodeHandleRepair = HiiAllocateOpCodeHandle ();\r
+  ASSERT (EndOpCodeHandleRepair != NULL);\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the start opcode\r
+  //\r
+  StartLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  StartLabel->Number       = LABEL_DRIVER_HEALTH;\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the start opcode\r
+  //\r
+  StartLabelRepair = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (StartOpCodeHandleRepair, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  StartLabelRepair->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  StartLabelRepair->Number       = LABEL_DRIVER_HEALTH_REAPIR_ALL;\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the end opcode\r
+  //\r
+  EndLabel = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandle, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  EndLabel->Number       = LABEL_DRIVER_HEALTH_END;\r
+\r
+  //\r
+  // Create Hii Extend Label OpCode as the end opcode\r
+  //\r
+  EndLabelRepair = (EFI_IFR_GUID_LABEL *) HiiCreateGuidOpCode (EndOpCodeHandleRepair, &gEfiIfrTianoGuid, NULL, sizeof (EFI_IFR_GUID_LABEL));\r
+  EndLabelRepair->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;\r
+  EndLabelRepair->Number       = LABEL_DRIVER_HEALTH_REAPIR_ALL_END;\r
+\r
+  HiiCreateSubTitleOpCode (StartOpCodeHandle, STRING_TOKEN (STR_DH_STATUS_LIST), 0, 0, 1);\r
+\r
+  Status = GetAllControllersHealthStatus (&DriverHealthList);\r
+  ASSERT (Status != EFI_OUT_OF_RESOURCES);\r
+\r
+  Link = GetFirstNode (&DriverHealthList);\r
+\r
+  while (!IsNull (&DriverHealthList, Link)) {   \r
+    DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);\r
+    \r
+    //\r
+    // Assume no line strings is longer than 512 bytes.\r
+    //\r
+    String = (EFI_STRING) AllocateZeroPool (0x200);\r
+    ASSERT (String != NULL);\r
+\r
+    Status = DriverHealthGetDriverName (DriverHealthInfo->DriverHandle, &DriverName);\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // Can not get the Driver name, so use the Device path\r
+      //\r
+      DriverDevicePath = DevicePathFromHandle (DriverHealthInfo->DriverHandle);\r
+      DriverName       = DevicePathToStr (DriverDevicePath);\r
+    }\r
+    //\r
+    // Add the Driver name & Controller name into FormSetTitle string\r
+    // \r
+    StrnCat (String, DriverName, StrLen (DriverName));\r
+\r
+\r
+    Status = DriverHealthGetControllerName (\r
+               DriverHealthInfo->DriverHandle, \r
+               DriverHealthInfo->ControllerHandle, \r
+               DriverHealthInfo->ChildHandle, \r
+               &ControllerName\r
+               );\r
+\r
+    if (!EFI_ERROR (Status)) {\r
+      //\r
+      // Can not get the Controller name, just let it empty.\r
+      //\r
+      StrnCat (String, L"    ", StrLen (L"    "));\r
+      StrnCat (String, ControllerName, StrLen (ControllerName));   \r
+    }\r
+   \r
+    //\r
+    // Add the message of the Module itself provided after the string item.\r
+    //\r
+    if ((DriverHealthInfo->MessageList != NULL) && (DriverHealthInfo->MessageList->StringId != 0)) {\r
+       StrnCat (String, L"    ", StrLen (L"    "));\r
+       TmpString = HiiGetString (\r
+                     DriverHealthInfo->MessageList->HiiHandle, \r
+                     DriverHealthInfo->MessageList->StringId, \r
+                     NULL\r
+                     );\r
+       //\r
+       // Assert if can not retrieve the message string\r
+       //\r
+       ASSERT (TmpString != NULL);\r
+       StrnCat (String, TmpString, StrLen (TmpString));\r
+       FreePool (TmpString);\r
+    } else {\r
+      //\r
+      // Update the string will be displayed base on the driver's health status\r
+      //\r
+      switch(DriverHealthInfo->HealthStatus) {\r
+      case EfiDriverHealthStatusRepairRequired:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_REPAIR_REQUIRED)), Length);\r
+        break;\r
+      case EfiDriverHealthStatusConfigurationRequired:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_CONFIGURATION_REQUIRED)), Length);\r
+        break;\r
+      case EfiDriverHealthStatusFailed:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_OPERATION_FAILED)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_OPERATION_FAILED)), Length);\r
+        break;\r
+      case EfiDriverHealthStatusReconnectRequired:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_RECONNECT_REQUIRED)), Length);\r
+        break;\r
+      case EfiDriverHealthStatusRebootRequired:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_REBOOT_REQUIRED)), Length);\r
+        break;\r
+      default:\r
+        Length = StrLen (GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY)));\r
+        StrnCat (String, GetStringById (STRING_TOKEN (STR_DRIVER_HEALTH_HEALTHY)), Length);\r
+        break;\r
+      }\r
+    }\r
+\r
+    Token = HiiSetString (HiiHandle, 0, String, NULL);\r
+    FreePool (String);\r
+\r
+    TokenHelp = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_SINGLE_HELP)), NULL);\r
+\r
+    HiiCreateActionOpCode (\r
+      StartOpCodeHandle,\r
+      (EFI_QUESTION_ID) (Index + DRIVER_HEALTH_KEY_OFFSET),\r
+      Token,\r
+      TokenHelp,\r
+      EFI_IFR_FLAG_CALLBACK,\r
+      0\r
+      );\r
+    Index++;\r
+    Link = GetNextNode (&DriverHealthList, Link);\r
+  }\r
+   \r
+  //\r
+  // Add End Opcode for Subtitle\r
+  // \r
+  HiiCreateEndOpCode (StartOpCodeHandle);\r
+\r
+  HiiCreateSubTitleOpCode (StartOpCodeHandleRepair, STRING_TOKEN (STR_DRIVER_HEALTH_REPAIR_ALL), 0, 0, 1);\r
+  TokenHelp = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_ALL_HELP)), NULL);  \r
+\r
+  if (PlaformHealthStatusCheck ()) {\r
+    //\r
+    // No action need to do for the platform\r
+    //\r
+    Token = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DRIVER_HEALTH_ALL_HEALTHY)), NULL);\r
+    HiiCreateActionOpCode (\r
+      StartOpCodeHandleRepair,\r
+      0,\r
+      Token,\r
+      TokenHelp,\r
+      EFI_IFR_FLAG_READ_ONLY,\r
+      0\r
+      );\r
+  } else {\r
+    //\r
+    // Create ActionOpCode only while the platform need to do health related operation.\r
+    //\r
+    Token = HiiSetString (HiiHandle, 0, GetStringById( STRING_TOKEN (STR_DH_REPAIR_ALL_TITLE)), NULL);\r
+    HiiCreateActionOpCode (\r
+      StartOpCodeHandleRepair,\r
+      (EFI_QUESTION_ID) DRIVER_HEALTH_REPAIR_ALL_KEY,\r
+      Token,\r
+      TokenHelp,\r
+      EFI_IFR_FLAG_CALLBACK,\r
+      0\r
+      );\r
+  }\r
+\r
+  HiiCreateEndOpCode (StartOpCodeHandleRepair);\r
+\r
+  Status = HiiUpdateForm (\r
+             HiiHandle,\r
+             &mDriverHealthGuid,\r
+             DRIVER_HEALTH_FORM_ID,\r
+             StartOpCodeHandle,\r
+             EndOpCodeHandle\r
+             );\r
+  ASSERT (Status != EFI_NOT_FOUND);\r
+  ASSERT (Status != EFI_BUFFER_TOO_SMALL);\r
+\r
+  Status = HiiUpdateForm (\r
+            HiiHandle,\r
+            &mDriverHealthGuid,\r
+            DRIVER_HEALTH_FORM_ID,\r
+            StartOpCodeHandleRepair,\r
+            EndOpCodeHandleRepair\r
+    );\r
+  ASSERT (Status != EFI_NOT_FOUND);\r
+  ASSERT (Status != EFI_BUFFER_TOO_SMALL);\r
+\r
+  ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
+  Status = gFormBrowser2->SendForm (\r
+                           gFormBrowser2,\r
+                           &HiiHandle,\r
+                           1,\r
+                           &mDriverHealthGuid,\r
+                           DRIVER_HEALTH_FORM_ID,\r
+                           NULL,\r
+                           &ActionRequest\r
+                           );\r
+  if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {\r
+    EnableResetRequired ();\r
+  }\r
+\r
+  //\r
+  // We will have returned from processing a callback - user either hit ESC to exit, or selected\r
+  // a target to display.\r
+  // Process the diver health status states here.\r
+  // \r
+  if (gCallbackKey >= DRIVER_HEALTH_KEY_OFFSET && gCallbackKey != DRIVER_HEALTH_REPAIR_ALL_KEY && gCallbackKey != FRONT_PAGE_KEY_DEVICE_MANAGER) {\r
+    ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
+\r
+    Link = GetFirstNode (&DriverHealthList);\r
+    Index = 0;\r
+\r
+    while (!IsNull (&DriverHealthList, Link)) {\r
+      //\r
+      // Got the item relative node in the List\r
+      //\r
+      if (Index == (gCallbackKey - DRIVER_HEALTH_KEY_OFFSET)) { \r
+        DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);\r
+        //\r
+        // Process the driver's healthy status for the specify module\r
+        //\r
+        ProcessSingleControllerHealth (\r
+          DriverHealthInfo->DriverHealth,\r
+          DriverHealthInfo->ControllerHandle,      \r
+          DriverHealthInfo->ChildHandle,\r
+          DriverHealthInfo->HealthStatus,\r
+          &(DriverHealthInfo->MessageList),\r
+          DriverHealthInfo->HiiHandle\r
+       );  \r
+       break;\r
+      }\r
+      Index++;\r
+      Link = GetNextNode (&DriverHealthList, Link);\r
+    }\r
+\r
+    if (ActionRequest == EFI_BROWSER_ACTION_REQUEST_RESET) {\r
+      EnableResetRequired ();\r
+    }\r
+    \r
+    //\r
+    // Force return to the form of Driver Health in Device Manager \r
+    //\r
+    gCallbackKey = DRIVER_HEALTH_RETURN_KEY;\r
+  }\r
+\r
+  //\r
+  // Repair the whole platform\r
+  //\r
+  if (gCallbackKey == DRIVER_HEALTH_REPAIR_ALL_KEY) {\r
+    ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;\r
+    \r
+    PlatformRepairAll (&DriverHealthList);\r
+\r
+    gCallbackKey = DRIVER_HEALTH_RETURN_KEY;\r
+  }\r
+   \r
+  //\r
+  // Cleanup dynamic created strings in HII database by reinstall the packagelist\r
+  //\r
+  \r
+  HiiRemovePackages (HiiHandle);\r
+\r
+  gDeviceManagerPrivate.DriverHealthHiiHandle = HiiAddPackages (\r
+                                                  &mDriverHealthGuid,\r
+                                                  gDeviceManagerPrivate.DriverHealthHandle,\r
+                                                  DriverHealthVfrBin,\r
+                                                  BdsDxeStrings,\r
+                                                  NULL\r
+                                                  );\r
+  if (gDeviceManagerPrivate.DriverHealthHiiHandle == NULL) {\r
+    Status = EFI_OUT_OF_RESOURCES;\r
+  } else {\r
+    Status = EFI_SUCCESS;\r
+  }\r
+  //\r
+  // Free driver health info list\r
+  //\r
+  while (!IsListEmpty (&DriverHealthList)) {\r
+\r
+    Link = GetFirstNode(&DriverHealthList);\r
+    DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);\r
+    RemoveEntryList (Link);\r
+\r
+    if (DriverHealthInfo->MessageList != NULL) {\r
+      FreePool(DriverHealthInfo->MessageList);\r
+      FreePool (DriverHealthInfo);\r
+    }   \r
+  }\r
+\r
+  HiiFreeOpCodeHandle (StartOpCodeHandle);\r
+  HiiFreeOpCodeHandle (EndOpCodeHandle); \r
+  HiiFreeOpCodeHandle (StartOpCodeHandleRepair);\r
+  HiiFreeOpCodeHandle (EndOpCodeHandleRepair); \r
+\r
+  if (gCallbackKey == DRIVER_HEALTH_RETURN_KEY) {\r
+    gCallbackKey = DEVICE_MANAGER_KEY_DRIVER_HEALTH;\r
+    CallDriverHealth ();\r
+  }\r
+  if (gCallbackKey == DEVICE_MANAGER_KEY_DRIVER_HEALTH) {\r
+    CallDeviceManager();\r
+  }\r
+}\r
+\r
+\r
+/*\r
+  Check the Driver Health status of a single controller and try to process it if not healthy.\r
+\r
+  This function called by CheckAllControllersHealthStatus () function in order to process a specify\r
+  contoller's health state.\r
+\r
+  @param DriverHealth       A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+  @param ControllerHandle   The class guid specifies which form set will be displayed.\r
+  @param ChildHandle        The handle of the child controller to retrieve the health \r
+                           status on.  This is an optional parameter that may be NULL. \r
+  @param HealthStatus       The health status of the controller.\r
+  @param MessageList        An array of warning or error messages associated \r
+                           with the controller specified by ControllerHandle and \r
+                           ChildHandle.  This is an optional parameter that may be NULL.\r
+  @param FormHiiHandle      The HII handle for an HII form associated with the \r
+                           controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_INVALID_PARAMETER   HealthStatus or DriverHealth is NULL.\r
+  @retval HealthStatus            The Health status of specify controller.\r
+  @retval EFI_OUT_OF_RESOURCES    The list of Driver Health Protocol handles can not be retrieved.\r
+  @retval EFI_NOT_FOUND           No controller in the platform install Driver Health Protocol.\r
+  @retval EFI_SUCCESS             The Health related operation has been taken successfully.\r
+\r
+*/\r
+EFI_STATUS\r
+EFIAPI\r
+GetSingleControllerHealthStatus (\r
+  IN OUT LIST_ENTRY                   *DriverHealthList,\r
+  IN EFI_HANDLE                       DriverHandle,\r
+  IN EFI_HANDLE                       ControllerHandle,  OPTIONAL\r
+  IN EFI_HANDLE                       ChildHandle,       OPTIONAL\r
+  IN EFI_DRIVER_HEALTH_PROTOCOL       *DriverHealth,\r
+  IN EFI_DRIVER_HEALTH_STATUS         *HealthStatus\r
+  )\r
+{\r
+  EFI_STATUS                     Status;\r
+  EFI_DRIVER_HEALTH_HII_MESSAGE  *MessageList;\r
+  EFI_HII_HANDLE                 FormHiiHandle;\r
+  DRIVER_HEALTH_INFO             *DriverHealthInfo;\r
+\r
+  if (HealthStatus == NULL) {\r
+    //\r
+    // If HealthStatus is NULL, then return EFI_INVALID_PARAMETER\r
+    //\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  //\r
+  // Assume the HealthStatus is healthy\r
+  //\r
+  *HealthStatus = EfiDriverHealthStatusHealthy;\r
+\r
+  if (DriverHealth == NULL) {\r
+    //\r
+    // If DriverHealth is NULL, then return EFI_INVALID_PARAMETER\r
+    //\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (ControllerHandle == NULL) {\r
+    //\r
+    // If ControllerHandle is NULL, the return the cumulative health status of the driver\r
+    //\r
+    Status = DriverHealth->GetHealthStatus (DriverHealth, NULL, NULL, HealthStatus, NULL, NULL);\r
+    if (*HealthStatus == EfiDriverHealthStatusHealthy) {\r
+      //\r
+      // Add the driver health related information into the list\r
+      //\r
+      DriverHealthInfo = AllocateZeroPool (sizeof (DRIVER_HEALTH_INFO));\r
+      if (DriverHealthInfo == NULL) {\r
+        return EFI_OUT_OF_RESOURCES;\r
+      }\r
+\r
+      DriverHealthInfo->Signature          = DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE;\r
+      DriverHealthInfo->DriverHandle       = DriverHandle;\r
+      DriverHealthInfo->ControllerHandle   = NULL;\r
+      DriverHealthInfo->ChildHandle        = NULL;\r
+      DriverHealthInfo->HiiHandle          = NULL;\r
+      DriverHealthInfo->DriverHealth       = DriverHealth;\r
+      DriverHealthInfo->MessageList        = NULL;\r
+      DriverHealthInfo->HealthStatus       = *HealthStatus;\r
+\r
+      InsertTailList (DriverHealthList, &DriverHealthInfo->Link);\r
+    }\r
+    return Status;\r
+  }\r
+\r
+  MessageList   = NULL;\r
+  FormHiiHandle = NULL;\r
+\r
+  //\r
+  // Collect the health status with the optional HII message list\r
+  //\r
+  Status = DriverHealth->GetHealthStatus (DriverHealth, ControllerHandle, ChildHandle, HealthStatus, &MessageList, &FormHiiHandle);\r
+\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // If the health status could not be retrieved, then return immediately\r
+    //\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Add the driver health related information into the list\r
+  //\r
+  DriverHealthInfo = AllocateZeroPool (sizeof (DRIVER_HEALTH_INFO));\r
+  if (DriverHealthInfo == NULL) {\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  DriverHealthInfo->Signature          = DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE; \r
+  DriverHealthInfo->DriverHandle       = DriverHandle;\r
+  DriverHealthInfo->ControllerHandle   = ControllerHandle;\r
+  DriverHealthInfo->ChildHandle        = ChildHandle;\r
+  DriverHealthInfo->HiiHandle          = FormHiiHandle;\r
+  DriverHealthInfo->DriverHealth       = DriverHealth;\r
+  DriverHealthInfo->MessageList        = MessageList;\r
+  DriverHealthInfo->HealthStatus       = *HealthStatus;\r
+\r
+  InsertTailList (DriverHealthList, &DriverHealthInfo->Link);\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+  Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database, \r
+  and queries each EFI Driver Health Protocol to determine if one or more of the controllers \r
+  managed by each EFI Driver Health Protocol instance are not healthy.  \r
+\r
+  @param DriverHealthList   A Pointer to the list contain all of the platform driver health\r
+                            information. \r
+\r
+  @retval    EFI_NOT_FOUND         No controller in the platform install Driver Health Protocol.\r
+  @retval    EFI_SUCCESS           All the controllers in the platform are healthy.\r
+  @retval    EFI_OUT_OF_RESOURCES  The list of Driver Health Protocol handles can not be retrieved.\r
+\r
+**/\r
+EFI_STATUS\r
+GetAllControllersHealthStatus (\r
+  IN OUT LIST_ENTRY  *DriverHealthList\r
+  )\r
+{\r
+  EFI_STATUS                 Status; \r
+  UINTN                      NumHandles;\r
+  EFI_HANDLE                 *DriverHealthHandles;\r
+  EFI_DRIVER_HEALTH_PROTOCOL *DriverHealth;\r
+  EFI_DRIVER_HEALTH_STATUS   HealthStatus;\r
+  UINTN                      DriverHealthIndex;\r
+  EFI_HANDLE                 *Handles;\r
+  UINTN                      HandleCount;\r
+  UINTN                      ControllerIndex;\r
+  UINTN                      ChildIndex;\r
\r
+  //\r
+  // Initialize local variables\r
+  //\r
+  Handles                 = NULL;\r
+  DriverHealthHandles     = NULL;\r
+  NumHandles              = 0;\r
+  HandleCount             = 0;\r
+\r
+  HealthStatus = EfiDriverHealthStatusHealthy;\r
+\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiDriverHealthProtocolGuid,\r
+                  NULL,\r
+                  &NumHandles,\r
+                  &DriverHealthHandles\r
+                  );\r
+\r
+  if (Status == EFI_NOT_FOUND || NumHandles == 0) {\r
+    //\r
+    // If there are no Driver Health Protocols handles, then return EFI_NOT_FOUND\r
+    //\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  if (EFI_ERROR (Status) || DriverHealthHandles == NULL) {\r
+    //\r
+    // If the list of Driver Health Protocol handles can not be retrieved, then \r
+    // return EFI_OUT_OF_RESOURCES\r
+    //\r
+    return EFI_OUT_OF_RESOURCES;\r
+  }\r
+\r
+  //\r
+  // Check the health status of all controllers in the platform\r
+  // Start by looping through all the Driver Health Protocol handles in the handle database\r
+  //\r
+  for (DriverHealthIndex = 0; DriverHealthIndex < NumHandles; DriverHealthIndex++) {\r
+    //\r
+    // Skip NULL Driver Health Protocol handles\r
+    //\r
+    if (DriverHealthHandles[DriverHealthIndex] == NULL) {\r
+      continue;\r
+    }\r
+\r
+    //\r
+    // Retrieve the Driver Health Protocol from DriverHandle\r
+    //\r
+    Status = gBS->HandleProtocol ( \r
+                    DriverHealthHandles[DriverHealthIndex],\r
+                    &gEfiDriverHealthProtocolGuid,\r
+                    (VOID **)&DriverHealth\r
+                    );\r
+    if (EFI_ERROR (Status)) {\r
+      //\r
+      // If the Driver Health Protocol can not be retrieved, then skip to the next\r
+      // Driver Health Protocol handle\r
+      //\r
+      continue;\r
+    }\r
+\r
+    //\r
+    // Check the health of all the controllers managed by a Driver Health Protocol handle\r
+    //\r
+    Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], NULL, NULL, DriverHealth, &HealthStatus);\r
+\r
+    //\r
+    // If Status is an error code, then the health information could not be retrieved, so assume healthy\r
+    // and skip to the next Driver Health Protocol handle\r
+    //\r
+    if (EFI_ERROR (Status)) {\r
+      continue;\r
+    }\r
+\r
+    //\r
+    // If all the controllers managed by this Driver Health Protocol are healthy, then skip to the next \r
+    // Driver Health Protocol handle\r
+    //\r
+    if (HealthStatus == EfiDriverHealthStatusHealthy) {\r
+      continue;\r
+    }\r
+\r
+    //\r
+    // See if the list of all handles in the handle database has been retrieved\r
+    //\r
+    //\r
+    if (Handles == NULL) {\r
+      //\r
+      // Retrieve the list of all handles from the handle database\r
+      //\r
+      Status = gBS->LocateHandleBuffer (\r
+        AllHandles,\r
+        NULL,\r
+        NULL,\r
+        &HandleCount,\r
+        &Handles\r
+        );\r
+      if (EFI_ERROR (Status) || Handles == NULL) {\r
+        //\r
+        // If all the handles in the handle database can not be retrieved, then \r
+        // return EFI_OUT_OF_RESOURCES\r
+        //\r
+        Status = EFI_OUT_OF_RESOURCES;\r
+        goto Done;\r
+      }\r
+    }\r
+    //\r
+    // Loop through all the controller handles in the handle database\r
+    //\r
+    for (ControllerIndex = 0; ControllerIndex < HandleCount; ControllerIndex++) {\r
+      //\r
+      // Skip NULL controller handles\r
+      //\r
+      if (Handles[ControllerIndex] == NULL) {\r
+        continue;\r
+      }\r
+\r
+      Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], Handles[ControllerIndex], NULL, DriverHealth, &HealthStatus);\r
+      if (EFI_ERROR (Status)) {\r
+        //\r
+        // If Status is an error code, then the health information could not be retrieved, so assume healthy\r
+        //\r
+        HealthStatus = EfiDriverHealthStatusHealthy;\r
+      }\r
+\r
+      //\r
+      // If CheckHealthSingleController() returned an error on a terminal state, then do not check the health of child controllers\r
+      //\r
+      if (EFI_ERROR (Status)) {\r
+        continue;\r
+      }\r
+\r
+      //\r
+      // Loop through all the child handles in the handle database\r
+      //\r
+      for (ChildIndex = 0; ChildIndex < HandleCount; ChildIndex++) {\r
+        //\r
+        // Skip NULL child handles\r
+        //\r
+        if (Handles[ChildIndex] == NULL) {\r
+          continue;\r
+        }\r
+\r
+        Status = GetSingleControllerHealthStatus (DriverHealthList, DriverHealthHandles[DriverHealthIndex], Handles[ControllerIndex], Handles[ChildIndex], DriverHealth, &HealthStatus);\r
+        if (EFI_ERROR (Status)) {\r
+          //\r
+          // If Status is an error code, then the health information could not be retrieved, so assume healthy\r
+          //\r
+          HealthStatus = EfiDriverHealthStatusHealthy;\r
+        }\r
+\r
+        //\r
+        // If CheckHealthSingleController() returned an error on a terminal state, then skip to the next child\r
+        //\r
+        if (EFI_ERROR (Status)) {\r
+          continue;\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+  Status = EFI_SUCCESS;\r
+\r
+Done:\r
+  if (Handles != NULL) {\r
+    gBS->FreePool (Handles);\r
+  }\r
+  if (DriverHealthHandles != NULL) {\r
+    gBS->FreePool (DriverHealthHandles);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+\r
+/*\r
+  Check the healthy status of the platform, this function will return immediately while found one driver \r
+  in the platform are not healthy.\r
+\r
+  @retval FALSE      at least one driver in the platform are not healthy.\r
+  @retval TRUE       No controller install Driver Health Protocol,\r
+                     or all controllers in the platform are in healthy status.\r
+*/\r
+BOOLEAN\r
+PlaformHealthStatusCheck (\r
+  VOID\r
+  )\r
+{\r
+  EFI_DRIVER_HEALTH_STATUS          HealthStatus;\r
+  EFI_STATUS                        Status;\r
+  UINTN                             Index;\r
+  UINTN                             NoHandles;\r
+  EFI_HANDLE                        *DriverHealthHandles;\r
+  EFI_DRIVER_HEALTH_PROTOCOL        *DriverHealth;\r
+  BOOLEAN                           AllHealthy;\r
+\r
+  //\r
+  // Initialize local variables\r
+  //\r
+  DriverHealthHandles = NULL;\r
+  DriverHealth        = NULL;\r
+\r
+  HealthStatus = EfiDriverHealthStatusHealthy;\r
+\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiDriverHealthProtocolGuid,\r
+                  NULL,\r
+                  &NoHandles,\r
+                  &DriverHealthHandles\r
+                  );\r
+  //\r
+  // There are no handles match the search for Driver Health Protocol has been installed.\r
+  //\r
+  if (Status == EFI_NOT_FOUND) {\r
+    return TRUE;\r
+  }\r
+  //\r
+  // Assume all modules are healthy.\r
+  // \r
+  AllHealthy = TRUE;\r
+\r
+  //\r
+  // Found one or more Handles.\r
+  //\r
+  if (!EFI_ERROR (Status)) {    \r
+    for (Index = 0; Index < NoHandles; Index++) {\r
+      Status = gBS->HandleProtocol (\r
+                      DriverHealthHandles[Index],\r
+                      &gEfiDriverHealthProtocolGuid,\r
+                      (VOID **) &DriverHealth\r
+                      );\r
+      if (!EFI_ERROR (Status)) {\r
+        Status = DriverHealth->GetHealthStatus (\r
+                                 DriverHealth,\r
+                                 NULL,\r
+                                 NULL,\r
+                                 &HealthStatus,\r
+                                 NULL,\r
+                                 NULL\r
+                                 );\r
+      }\r
+      //\r
+      // Get the healthy status of the module\r
+      //\r
+      if (!EFI_ERROR (Status)) {\r
+         if (HealthStatus != EfiDriverHealthStatusHealthy) {\r
+           //\r
+           // Return immediately one driver's status not in healthy.\r
+           //\r
+           return FALSE;         \r
+         }\r
+      }\r
+    }\r
+  }\r
+  return AllHealthy;\r
+}\r
+\r
+/**\r
+  Processes a single controller using the EFI Driver Health Protocol associated with \r
+  that controller. This algorithm continues to query the GetHealthStatus() service until\r
+  one of the legal terminal states of the EFI Driver Health Protocol is reached. This may \r
+  require the processing of HII Messages, HII Form, and invocation of repair operations.\r
+\r
+  @param DriverHealth       A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+  @param ControllerHandle   The class guid specifies which form set will be displayed.\r
+  @param ChildHandle        The handle of the child controller to retrieve the health \r
+                            status on.  This is an optional parameter that may be NULL. \r
+  @param HealthStatus       The health status of the controller.\r
+  @param MessageList        An array of warning or error messages associated \r
+                            with the controller specified by ControllerHandle and \r
+                            ChildHandle.  This is an optional parameter that may be NULL.\r
+  @param FormHiiHandle      The HII handle for an HII form associated with the \r
+                            controller specified by ControllerHandle and ChildHandle.\r
+**/\r
+VOID\r
+ProcessSingleControllerHealth (\r
+    IN  EFI_DRIVER_HEALTH_PROTOCOL         *DriverHealth,\r
+    IN  EFI_HANDLE                         ControllerHandle, OPTIONAL\r
+    IN  EFI_HANDLE                         ChildHandle,      OPTIONAL\r
+    IN  EFI_DRIVER_HEALTH_STATUS           HealthStatus,\r
+    IN  EFI_DRIVER_HEALTH_HII_MESSAGE      **MessageList,    OPTIONAL\r
+    IN  EFI_HII_HANDLE                     FormHiiHandle\r
+  )\r
+{\r
+  EFI_STATUS                         Status;\r
+  EFI_DRIVER_HEALTH_STATUS           LocalHealthStatus;\r
+  \r
+  LocalHealthStatus = HealthStatus;\r
+  //\r
+  // If the module need to be repaired or reconfiguration,  will process it until\r
+  // reach a terminal status. The status from EfiDriverHealthStatusRepairRequired after repair \r
+  // will be in (Health, Failed, Configuration Required).\r
+  //\r
+  while( LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired ||\r
+         LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {\r
+\r
+    if (LocalHealthStatus == EfiDriverHealthStatusRepairRequired) {\r
+      Status = DriverHealth->Repair (\r
+                               DriverHealth,\r
+                               ControllerHandle,\r
+                               ChildHandle,\r
+                               (EFI_DRIVER_HEALTH_REPAIR_PROGRESS_NOTIFY) RepairNotify\r
+                               );\r
+    }\r
+    //\r
+    // Via a form of the driver need to do configuration provided to process of status in \r
+    // EfiDriverHealthStatusConfigurationRequired. The status after configuration should be in\r
+    // (Healthy, Reboot Required, Failed, Reconnect Required, Repair Required).   \r
+    //\r
+    if (LocalHealthStatus == EfiDriverHealthStatusConfigurationRequired) {\r
+      Status = gFormBrowser2->SendForm (\r
+                                gFormBrowser2,\r
+                                &FormHiiHandle,\r
+                                1,\r
+                                &gEfiHiiDriverHealthFormsetGuid,\r
+                                0,\r
+                                NULL,\r
+                                NULL\r
+                                );\r
+      ASSERT( !EFI_ERROR (Status));\r
+    }\r
+\r
+    Status = DriverHealth->GetHealthStatus (\r
+                              DriverHealth,\r
+                              ControllerHandle,\r
+                              ChildHandle,\r
+                              &LocalHealthStatus,\r
+                              NULL,\r
+                              &FormHiiHandle\r
+                              );\r
+   ASSERT_EFI_ERROR (Status);\r
+\r
+   if (*MessageList != NULL) {\r
+      ProcessMessages (*MessageList);\r
+   }  \r
+  }\r
+  \r
+  //\r
+  // Health status in {Healthy, Failed} may also have Messages need to process\r
+  //\r
+  if (LocalHealthStatus == EfiDriverHealthStatusHealthy || LocalHealthStatus == EfiDriverHealthStatusFailed) {\r
+    if (*MessageList != NULL) {\r
+      ProcessMessages (*MessageList);\r
+    }\r
+  }\r
+  //\r
+  // Check for RebootRequired or ReconnectRequired\r
+  //\r
+  if (LocalHealthStatus == EfiDriverHealthStatusRebootRequired) {\r
+    gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+  }\r
+  \r
+  //\r
+  // Do reconnect if need.\r
+  //\r
+  if (LocalHealthStatus == EfiDriverHealthStatusReconnectRequired) {\r
+    Status = gBS->DisconnectController (ControllerHandle, NULL, NULL);\r
+    if (EFI_ERROR (Status)) {\r
+        //\r
+        // Disconnect failed.  Need to promote reconnect to a reboot.\r
+        //\r
+        gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+    }\r
+    gBS->ConnectController (ControllerHandle, NULL, NULL, TRUE);\r
+  }\r
+}\r
+\r
+\r
+/**\r
+  Platform specific notification function for controller repair operations.\r
+\r
+  If the driver for a controller support the Driver Health Protocol and the\r
+  current state of the controller is EfiDriverHealthStatusRepairRequired then\r
+  when the Repair() service of the Driver Health Protocol is called, this \r
+  platform specific notification function can display the progress of the repair\r
+  operation.  Some platforms may choose to not display anything, other may choose\r
+  to show the percentage complete on text consoles, and other may choose to render\r
+  a progress bar on text and graphical consoles.\r
+\r
+  This function displays the percentage of the repair operation that has been\r
+  completed on text consoles.  The percentage is Value / Limit * 100%.\r
+  \r
+  @param  Value               Value in the range 0..Limit the the repair has completed..\r
+  @param  Limit               The maximum value of Value\r
+\r
+**/\r
+VOID\r
+RepairNotify (\r
+  IN  UINTN Value,\r
+  IN  UINTN Limit\r
+  )\r
+{\r
+  UINTN Percent;\r
+\r
+  if (Limit  == 0) {\r
+    Print(L"Repair Progress Undefined\n\r");\r
+  } else {\r
+    Percent = Value * 100 / Limit;\r
+    Print(L"Repair Progress = %3d%%\n\r", Percent);\r
+  }\r
+}\r
+\r
+/**\r
+  Processes a set of messages returned by the GetHealthStatus ()\r
+  service of the EFI Driver Health Protocol\r
+\r
+  @param    MessageList  The MessageList point to messages need to processed.  \r
+\r
+**/\r
+VOID\r
+ProcessMessages (\r
+  IN  EFI_DRIVER_HEALTH_HII_MESSAGE      *MessageList\r
+  )\r
+{\r
+  UINTN                           MessageIndex;\r
+  EFI_STRING                      MessageString;\r
+\r
+  for (MessageIndex = 0;\r
+       MessageList[MessageIndex].HiiHandle != NULL;\r
+       MessageIndex++) {\r
+\r
+    MessageString = HiiGetString (\r
+                        MessageList[MessageIndex].HiiHandle,\r
+                        MessageList[MessageIndex].StringId,\r
+                        NULL\r
+                        );\r
+    if (MessageString != NULL) {\r
+      //\r
+      // User can customize the output. Just simply print out the MessageString like below. \r
+      // Also can use the HiiHandle to display message on the front page.\r
+      // \r
+      // Print(L"%s\n",MessageString);\r
+      // gBS->Stall (100000);\r
+    }\r
+  }\r
+\r
+}\r
+\r
+/*\r
+  Repair the whole platform.\r
+\r
+  This function is the main entry for user choose "Repair All" in the front page.\r
+  It will try to do recovery job till all the driver health protocol installed modules \r
+  reach a terminal state.\r
+\r
+  @param DriverHealthList   A Pointer to the list contain all of the platform driver health\r
+                            information.\r
+\r
+*/\r
+VOID\r
+PlatformRepairAll (\r
+  IN LIST_ENTRY  *DriverHealthList\r
+  )\r
+{ \r
+  DRIVER_HEALTH_INFO          *DriverHealthInfo;\r
+  LIST_ENTRY                  *Link;\r
+\r
+  ASSERT (DriverHealthList != NULL);\r
+\r
+  Link = GetFirstNode (DriverHealthList);\r
+\r
+  while (!IsNull (DriverHealthList, Link)) {   \r
+    DriverHealthInfo = DEVICE_MANAGER_HEALTH_INFO_FROM_LINK (Link);\r
+    //\r
+    // Do driver health status operation by each link node\r
+    //\r
+    ASSERT (DriverHealthInfo != NULL);\r
+\r
+    ProcessSingleControllerHealth ( \r
+        DriverHealthInfo->DriverHealth,\r
+        DriverHealthInfo->ControllerHandle,\r
+        DriverHealthInfo->ChildHandle,\r
+        DriverHealthInfo->HealthStatus,\r
+        &(DriverHealthInfo->MessageList),\r
+        DriverHealthInfo->HiiHandle\r
+        );\r
+\r
+    Link = GetNextNode (DriverHealthList, Link);\r
+  }\r
+}\r
+\r
+/**\r
+\r
+  Select the best matching language according to front page policy for best user experience. \r
+  \r
+  This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
+  code types may not be mixed in a single call to this function. \r
+\r
+  @param  SupportedLanguages   A pointer to a Null-terminated ASCII string that\r
+                               contains a set of language codes in the format \r
+                               specified by Iso639Language.\r
+  @param  Iso639Language       If TRUE, then all language codes are assumed to be\r
+                               in ISO 639-2 format.  If FALSE, then all language\r
+                               codes are assumed to be in RFC 4646 language format.\r
+\r
+  @retval NULL                 The best matching language could not be found in SupportedLanguages.\r
+  @retval NULL                 There are not enough resources available to return the best matching \r
+                               language.\r
+  @retval Other                A pointer to a Null-terminated ASCII string that is the best matching \r
+                               language in SupportedLanguages.\r
+**/\r
+CHAR8 *\r
+DriverHealthSelectBestLanguage (\r
+  IN CHAR8        *SupportedLanguages,\r
+  IN BOOLEAN      Iso639Language\r
+  )\r
+{\r
+  CHAR8           *LanguageVariable;\r
+  CHAR8           *BestLanguage;\r
+\r
+  LanguageVariable =  GetEfiGlobalVariable (Iso639Language ? L"Lang" : L"PlatformLang");\r
+\r
+  BestLanguage = GetBestLanguage(\r
+                   SupportedLanguages,\r
+                   Iso639Language,\r
+                   (LanguageVariable != NULL) ? LanguageVariable : "",\r
+                   Iso639Language ? "eng" : "en-US",\r
+                   NULL\r
+                   );\r
+  if (LanguageVariable != NULL) {\r
+    FreePool (LanguageVariable);\r
+  }\r
+\r
+  return BestLanguage;\r
+}\r
+\r
+\r
+\r
+/**\r
+\r
+  This is an internal worker function to get the Component Name (2) protocol interface\r
+  and the language it supports.\r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ComponentName        A pointer to the Component Name (2) protocol interface.\r
+  @param  SupportedLanguage    The best suitable language that matches the SupportedLangues interface for the \r
+                               located Component Name (2) instance.\r
+\r
+  @param  EFI_SUCCESS          The Component Name (2) protocol instance is successfully located and we find\r
+                               the best matching language it support.\r
+  @param  EFI_UNSUPPORTED      The input Language is not supported by the Component Name (2) protocol.\r
+  @param  Other                Some error occurs when locating Component Name (2) protocol instance or finding\r
+                               the supported language.\r
+\r
+**/\r
+EFI_STATUS\r
+GetComponentNameWorker (\r
+  IN  EFI_GUID                    *ProtocolGuid,\r
+  IN  EFI_HANDLE                  DriverBindingHandle,\r
+  OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r
+  OUT CHAR8                       **SupportedLanguage\r
+  )\r
+{\r
+  EFI_STATUS                      Status;\r
+\r
+  //\r
+  // Locate Component Name (2) protocol on the driver binging handle.\r
+  //\r
+  Status = gBS->OpenProtocol (\r
+                 DriverBindingHandle,\r
+                 ProtocolGuid,\r
+                 (VOID **) ComponentName,\r
+                 NULL,\r
+                 NULL,\r
+                 EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+                 );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Apply shell policy to select the best language.\r
+  //\r
+  *SupportedLanguage = DriverHealthSelectBestLanguage (\r
+                         (*ComponentName)->SupportedLanguages,\r
+                         (BOOLEAN) (ProtocolGuid == &gEfiComponentNameProtocolGuid)\r
+                         );\r
+  if (*SupportedLanguage == NULL) {\r
+    Status = EFI_UNSUPPORTED;\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+\r
+  This is an internal worker function to get driver name from Component Name (2) protocol interface.\r
+\r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  DriverName           A pointer to the Unicode string to return. This Unicode string is the name\r
+                               of the driver specified by This.\r
+\r
+  @retval EFI_SUCCESS          The driver name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The driver name cannot be retrieved from Component Name (2) protocol\r
+                               interface.\r
+\r
+**/\r
+EFI_STATUS\r
+GetDriverNameWorker (\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  OUT CHAR16      **DriverName\r
+  )\r
+{\r
+  EFI_STATUS                     Status;\r
+  CHAR8                          *BestLanguage;\r
+  EFI_COMPONENT_NAME_PROTOCOL    *ComponentName;\r
+\r
+  //\r
+  // Retrieve Component Name (2) protocol instance on the driver binding handle and \r
+  // find the best language this instance supports. \r
+  //\r
+  Status = GetComponentNameWorker (\r
+             ProtocolGuid,\r
+             DriverBindingHandle,\r
+             &ComponentName,\r
+             &BestLanguage\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
\r
+  //\r
+  // Get the driver name from Component Name (2) protocol instance on the driver binging handle.\r
+  //\r
+  Status = ComponentName->GetDriverName (\r
+                            ComponentName,\r
+                            BestLanguage,\r
+                            DriverName\r
+                            );\r
+  FreePool (BestLanguage);\r
\r
+  return Status;\r
+}\r
+\r
+/**\r
+\r
+  This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r
+  If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  DriverName           A pointer to the Unicode string to return. This Unicode string is the name\r
+                               of the driver specified by This.\r
+\r
+  @retval EFI_SUCCESS          The driver name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The driver name cannot be retrieved from Component Name (2) protocol\r
+                               interface.\r
+\r
+**/\r
+EFI_STATUS\r
+DriverHealthGetDriverName (\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  OUT CHAR16      **DriverName\r
+  )\r
+{\r
+  EFI_STATUS      Status;\r
+\r
+  //\r
+  // Get driver name from UEFI 2.0 Component Name 2 protocol interface.\r
+  //\r
+  Status = GetDriverNameWorker (&gEfiComponentName2ProtocolGuid, DriverBindingHandle, DriverName);\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // If it fails to get the driver name from Component Name protocol interface, we should fall back on\r
+    // EFI 1.1 Component Name protocol interface.\r
+    //\r
+    Status = GetDriverNameWorker (&gEfiComponentNameProtocolGuid, DriverBindingHandle, DriverName);\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+\r
+\r
+/**\r
+  This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
+  If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ControllerHandle     The handle of a controller that the driver specified by This is managing.\r
+                               This handle specifies the controller whose name is to be returned.\r
+  @param  ChildHandle          The handle of the child controller to retrieve the name of. This is an\r
+                               optional parameter that may be NULL. It will be NULL for device drivers.\r
+                               It will also be NULL for bus drivers that attempt to retrieve the name\r
+                               of the bus controller. It will not be NULL for a bus driver that attempts\r
+                               to retrieve the name of a child controller.\r
+  @param  ControllerName       A pointer to the Unicode string to return. This Unicode string\r
+                               is the name of the controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval  EFI_SUCCESS         The controller name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval  Other               The controller name cannot be retrieved from Component Name (2) protocol.\r
+\r
+**/\r
+EFI_STATUS\r
+GetControllerNameWorker (\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  EFI_HANDLE  ChildHandle,\r
+  OUT CHAR16      **ControllerName\r
+  )\r
+{\r
+  EFI_STATUS                     Status;\r
+  CHAR8                          *BestLanguage;\r
+  EFI_COMPONENT_NAME_PROTOCOL    *ComponentName;\r
+\r
+  //\r
+  // Retrieve Component Name (2) protocol instance on the driver binding handle and \r
+  // find the best language this instance supports. \r
+  //\r
+  Status = GetComponentNameWorker (\r
+             ProtocolGuid,\r
+             DriverBindingHandle,\r
+             &ComponentName,\r
+             &BestLanguage\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    return Status;\r
+  }\r
+\r
+  //\r
+  // Get the controller name from Component Name (2) protocol instance on the driver binging handle.\r
+  //\r
+  Status = ComponentName->GetControllerName (\r
+                            ComponentName,\r
+                            ControllerHandle,\r
+                            ChildHandle,\r
+                            BestLanguage,\r
+                            ControllerName\r
+                            );\r
+  FreePool (BestLanguage);\r
+\r
+  return Status;\r
+}\r
+\r
+/**\r
+\r
+  This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. \r
+  If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ControllerHandle     The handle of a controller that the driver specified by This is managing.\r
+                               This handle specifies the controller whose name is to be returned.\r
+  @param  ChildHandle          The handle of the child controller to retrieve the name of. This is an\r
+                               optional parameter that may be NULL. It will be NULL for device drivers.\r
+                               It will also be NULL for bus drivers that attempt to retrieve the name\r
+                               of the bus controller. It will not be NULL for a bus driver that attempts\r
+                               to retrieve the name of a child controller.\r
+  @param  Language             An ASCII string that represents the language command line option.\r
+  @param  ControllerName       A pointer to the Unicode string to return. This Unicode string\r
+                               is the name of the controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_SUCCESS          The controller name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The controller name cannot be retrieved from Component Name (2) protocol.\r
+\r
+**/\r
+EFI_STATUS\r
+DriverHealthGetControllerName (\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  EFI_HANDLE  ChildHandle,\r
+  OUT CHAR16      **ControllerName\r
+  )\r
+{\r
+  EFI_STATUS      Status;\r
+\r
+  //\r
+  // Get controller name from UEFI 2.0 Component Name 2 protocol interface.\r
+  //\r
+  Status = GetControllerNameWorker (\r
+             &gEfiComponentName2ProtocolGuid,\r
+             DriverBindingHandle,\r
+             ControllerHandle,\r
+             ChildHandle,\r
+             ControllerName\r
+             );\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // If it fails to get the controller name from Component Name protocol interface, we should fall back on\r
+    // EFI 1.1 Component Name protocol interface.\r
+    //\r
+    Status = GetControllerNameWorker (\r
+               &gEfiComponentNameProtocolGuid,\r
+               DriverBindingHandle,\r
+               ControllerHandle,\r
+               ChildHandle,\r
+               ControllerName\r
+               );\r
+  }\r
+\r
+  return Status;\r
+}\r
index 4bcd09a1b0bf3e4010ad77e0f01c2ee8ab6f74b4..d04027ae4c49a97828fad1b7f6882f3cb557a475 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The platform device manager reference implement\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -26,43 +26,111 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
   0x3ebfa8e6, 0x511d, 0x4b5b, {0xa9, 0x5f, 0xfb, 0x38, 0x26, 0xf, 0x1c, 0x27} \\r
   }\r
 \r
+#define DRIVER_HEALTH_FORMSET_GUID  \\r
+  { \\r
+  0xf76e0a70, 0xb5ed, 0x4c38, {0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34} \\r
+  }\r
+\r
 #define LABEL_DEVICES_LIST                   0x0080\r
 #define LABEL_END                            0xffff\r
 \r
+#define LABEL_DRIVER_HEALTH                  0x2000\r
+#define LABEL_DRIVER_HEALTH_END              0x2001\r
+\r
+#define LABEL_DRIVER_HEALTH_REAPIR_ALL       0x3000\r
+#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END   0x3001\r
+\r
 #define LABEL_VBIOS                          0x0040\r
 \r
 #define DEVICE_MANAGER_FORM_ID               0x1000\r
+#define DRIVER_HEALTH_FORM_ID                0x1001\r
 \r
 #define DEVICE_KEY_OFFSET                    0x1000\r
 #define DEVICE_MANAGER_KEY_VBIOS             0x2000\r
 \r
+#define DEVICE_MANAGER_KEY_DRIVER_HEALTH     0x1111\r
+#define DRIVER_HEALTH_KEY_OFFSET             0x2000\r
+#define DRIVER_HEALTH_REPAIR_ALL_KEY         0x3000\r
+#define DRIVER_HEALTH_RETURN_KEY             0x4000\r
+\r
 //\r
 // These are the VFR compiler generated data representing our VFR data.\r
 //\r
 extern UINT8  DeviceManagerVfrBin[];\r
+extern UINT8  DriverHealthVfrBin[];\r
 \r
 #define DEVICE_MANAGER_CALLBACK_DATA_SIGNATURE  SIGNATURE_32 ('D', 'M', 'C', 'B')\r
+#define DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE  SIGNATURE_32 ('D', 'M', 'D', 'H')\r
+\r
 \r
 typedef struct {\r
   UINTN                           Signature;\r
 \r
   ///\r
-  /// HII relative handles\r
+  /// Device Manager HII relative handles\r
   ///\r
   EFI_HII_HANDLE                  HiiHandle;\r
+\r
+  ///\r
+  /// Driver Health HII relative handles\r
+  ///\r
+  EFI_HII_HANDLE                  DriverHealthHiiHandle;\r
+\r
   EFI_HANDLE                      DriverHandle;\r
+  EFI_HANDLE                      DriverHealthHandle;\r
 \r
   ///\r
-  /// Produced protocols\r
+  /// Device Manager Produced protocols\r
   ///\r
   EFI_HII_CONFIG_ACCESS_PROTOCOL  ConfigAccess;\r
 \r
+  ///\r
+  /// Driver Health Produced protocols\r
+  ///\r
+  EFI_HII_CONFIG_ACCESS_PROTOCOL  DriverHealthConfigAccess;\r
+\r
   ///\r
   /// Configuration data\r
   ///\r
   UINT8                           VideoBios;\r
 } DEVICE_MANAGER_CALLBACK_DATA;\r
 \r
+\r
+typedef struct {\r
+  UINTN                           Signature;\r
+  LIST_ENTRY                      Link;\r
+\r
+  ///\r
+  /// HII relative handles\r
+  ///\r
+  EFI_HII_HANDLE                  HiiHandle;\r
+\r
+  ///\r
+  /// Driver relative handles\r
+  ///\r
+  EFI_HANDLE                      DriverHandle;\r
+  EFI_HANDLE                      ControllerHandle;\r
+  EFI_HANDLE                      ChildHandle;\r
+\r
+  EFI_DRIVER_HEALTH_PROTOCOL      *DriverHealth;\r
+  ///\r
+  /// Driver health messages of the specify Driver \r
+  ///\r
+  EFI_DRIVER_HEALTH_HII_MESSAGE   *MessageList;\r
+\r
+  ///\r
+  /// Driver Health status\r
+  ///\r
+  EFI_DRIVER_HEALTH_STATUS        HealthStatus;\r
+} DRIVER_HEALTH_INFO;\r
+\r
+#define DEVICE_MANAGER_HEALTH_INFO_FROM_LINK(a) \\r
+  CR (a, \\r
+      DRIVER_HEALTH_INFO, \\r
+      Link, \\r
+      DEVICE_MANAGER_DRIVER_HEALTH_INFO_SIGNATURE \\r
+      )\r
+\r
 #define DEVICE_MANAGER_CALLBACK_DATA_FROM_THIS(a) \\r
   CR (a, \\r
       DEVICE_MANAGER_CALLBACK_DATA, \\r
@@ -75,7 +143,7 @@ typedef struct {
 } DEVICE_MANAGER_MENU_ITEM;\r
 \r
 /**\r
-  This function is invoked if user selected a iteractive opcode from Device Manager's\r
+  This function is invoked if user selected a interactive opcode from Device Manager's\r
   Formset. The decision by user is saved to gCallbackKey for later processing. If\r
   user set VBIOS, the new value is saved to EFI variable.\r
 \r
@@ -103,6 +171,35 @@ DeviceManagerCallback (
   OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
   );\r
 \r
+/**\r
+  This function is invoked if user selected a interactive opcode from Driver Health's\r
+  Formset. The decision by user is saved to gCallbackKey for later processing.\r
+\r
+\r
+  @param This            Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.\r
+  @param Action          Specifies the type of action taken by the browser.\r
+  @param QuestionId      A unique value which is sent to the original exporting driver\r
+                         so that it can identify the type of data to expect.\r
+  @param Type            The type of value for the question.\r
+  @param Value           A pointer to the data being sent to the original exporting driver.\r
+  @param ActionRequest   On return, points to the action requested by the callback function.\r
+\r
+  @retval  EFI_SUCCESS           The callback successfully handled the action.\r
+  @retval  EFI_INVALID_PARAMETER The setup browser call this function with invalid parameters.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DriverHealthCallback (\r
+  IN  CONST EFI_HII_CONFIG_ACCESS_PROTOCOL   *This,\r
+  IN  EFI_BROWSER_ACTION                     Action,\r
+  IN  EFI_QUESTION_ID                        QuestionId,\r
+  IN  UINT8                                  Type,\r
+  IN  EFI_IFR_TYPE_VALUE                     *Value,\r
+  OUT EFI_BROWSER_ACTION_REQUEST             *ActionRequest\r
+  );\r
+\r
+\r
 /**\r
 \r
   This function registers HII packages to HII database.\r
@@ -134,4 +231,317 @@ CallDeviceManager (
   VOID\r
   );\r
 \r
+\r
+/*\r
+  Check the Driver Health status of a single controller and try to process it if not healthy.\r
+\r
+  This function called by CheckAllControllersHealthStatus () function in order to process a specify\r
+  contoller's health state.\r
+\r
+  @param DriverHealth       A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+  @param ControllerHandle   The class guid specifies which form set will be displayed.\r
+  @param ChildHandle        The handle of the child controller to retrieve the health \r
+                           status on.  This is an optional parameter that may be NULL. \r
+  @param HealthStatus       The health status of the controller.\r
+  @param MessageList        An array of warning or error messages associated \r
+                           with the controller specified by ControllerHandle and \r
+                           ChildHandle.  This is an optional parameter that may be NULL.\r
+  @param FormHiiHandle      The HII handle for an HII form associated with the \r
+                           controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_INVALID_PARAMETER   HealthStatus or DriverHealth is NULL.\r
+  @retval HealthStatus            The Health status of specify controller.\r
+  @retval EFI_OUT_OF_RESOURCES    The list of Driver Health Protocol handles can not be retrieved.\r
+  @retval EFI_NOT_FOUND           No controller in the platform install Driver Health Protocol.\r
+  @retval EFI_SUCCESS             The Health related operation has been taken successfully.\r
+\r
+*/\r
+EFI_STATUS\r
+EFIAPI\r
+GetSingleControllerHealthStatus (\r
+  IN OUT LIST_ENTRY                   *DriverHealthList,\r
+  IN EFI_HANDLE                       DriverHandle,\r
+  IN EFI_HANDLE                       ControllerHandle,  OPTIONAL\r
+  IN EFI_HANDLE                       ChildHandle,       OPTIONAL\r
+  IN EFI_DRIVER_HEALTH_PROTOCOL       *DriverHealth,\r
+  IN EFI_DRIVER_HEALTH_STATUS         *HealthStatus\r
+  );\r
+\r
+/**\r
+  Collects all the EFI Driver Health Protocols currently present in the EFI Handle Database, \r
+  and queries each EFI Driver Health Protocol to determine if one or more of the controllers \r
+  managed by each EFI Driver Health Protocol instance are not healthy.  \r
+\r
+  @param DriverHealthList   A Pointer to the list contain all of the platform driver health\r
+                            information.\r
+\r
+  @retval    EFI_NOT_FOUND         No controller in the platform install Driver Health Protocol.\r
+  @retval    EFI_SUCCESS           All the controllers in the platform are healthy.\r
+  @retval    EFI_OUT_OF_RESOURCES  The list of Driver Health Protocol handles can not be retrieved.\r
+\r
+**/\r
+EFI_STATUS\r
+GetAllControllersHealthStatus (\r
+  IN OUT LIST_ENTRY  *DriverHealthList\r
+  );\r
+\r
+/*\r
+  Check the healthy status of the platform, this function will return immediately while found one driver \r
+  in the platform are not healthy.\r
+\r
+  @retval FALSE      at least one driver in the platform are not healthy.\r
+  @retval TRUE       No controller install Driver Health Protocol,\r
+                     or all controllers in the platform are in healthy status.\r
+*/\r
+BOOLEAN\r
+PlaformHealthStatusCheck (\r
+  VOID\r
+  );\r
+\r
+/*\r
+  Repair the whole platform.\r
+\r
+  This function is the main entry for user choose "Repair All" in the front page.\r
+  It will try to do recovery job till all the driver health protocol installed modules \r
+  reach a terminal state.\r
+\r
+  @param DriverHealthList   A Pointer to the list contain all of the platform driver health\r
+                            information.\r
+\r
+*/\r
+VOID\r
+PlatformRepairAll (\r
+  IN LIST_ENTRY  *DriverHealthList\r
+  );\r
+\r
+/**\r
+  Processes a single controller using the EFI Driver Health Protocol associated with \r
+  that controller. This algorithm continues to query the GetHealthStatus() service until\r
+  one of the legal terminal states of the EFI Driver Health Protocol is reached. This may \r
+  require the processing of HII Messages, HII Form, and invocation of repair operations.\r
+\r
+  @param DriverHealth       A pointer to the EFI_DRIVER_HEALTH_PROTOCOL instance.\r
+  @param ControllerHandle   The class guid specifies which form set will be displayed.\r
+  @param ChildHandle        The handle of the child controller to retrieve the health \r
+                            status on.  This is an optional parameter that may be NULL. \r
+  @param HealthStatus       The health status of the controller.\r
+  @param MessageList        An array of warning or error messages associated \r
+                            with the controller specified by ControllerHandle and \r
+                            ChildHandle.  This is an optional parameter that may be NULL.\r
+  @param FormHiiHandle      The HII handle for an HII form associated with the \r
+                            controller specified by ControllerHandle and ChildHandle.\r
+\r
+**/\r
+VOID\r
+ProcessSingleControllerHealth (\r
+  IN  EFI_DRIVER_HEALTH_PROTOCOL         *DriverHealth,\r
+  IN  EFI_HANDLE                         ControllerHandle, OPTIONAL\r
+  IN  EFI_HANDLE                         ChildHandle,      OPTIONAL\r
+  IN  EFI_DRIVER_HEALTH_STATUS           HealthStatus,\r
+  IN  EFI_DRIVER_HEALTH_HII_MESSAGE      **MessageList,    OPTIONAL\r
+  IN  EFI_HII_HANDLE                     FormHiiHandle\r
+  );\r
+\r
+/**\r
+  Repair notification function, simply print the repair progress.\r
+\r
+  @param  Value   The value of part has been repaired.\r
+  @param  Limit   Total value need to be repaired.\r
+\r
+**/\r
+VOID\r
+RepairNotify (\r
+  IN  UINTN Value,\r
+  IN  UINTN Limit\r
+  );\r
+\r
+/**\r
+  Processes a set of messages returned by the GetHealthStatus ()\r
+  service of the EFI Driver Health Protocol\r
+\r
+  @param    MessageList  The MessageList point to messages need to processed.  \r
+\r
+**/\r
+VOID\r
+ProcessMessages (\r
+  IN  EFI_DRIVER_HEALTH_HII_MESSAGE      *MessageList\r
+  );\r
+\r
+\r
+/**\r
+  Collect and display the platform's driver health relative information, allow user to do interactive \r
+  operation while the platform is unhealthy.\r
+\r
+  This function display a form which divided into two parts. The one list all modules which has installed \r
+  driver health protocol. The list usually contain driver name, controller name, and it's health info.\r
+  While the driver name can't be retrieved, will use device path as backup. The other part of the form provide\r
+  a choice to the user to repair all platform.\r
+\r
+**/\r
+VOID\r
+CallDriverHealth (\r
+  VOID\r
+  );\r
+\r
+/**\r
+\r
+  Select the best matching language according to front page policy for best user experience. \r
+  \r
+  This function supports both ISO 639-2 and RFC 4646 language codes, but language \r
+  code types may not be mixed in a single call to this function. \r
+\r
+  @param  SupportedLanguages   A pointer to a Null-terminated ASCII string that\r
+                               contains a set of language codes in the format \r
+                               specified by Iso639Language.\r
+  @param  Iso639Language       If TRUE, then all language codes are assumed to be\r
+                               in ISO 639-2 format.  If FALSE, then all language\r
+                               codes are assumed to be in RFC 4646 language format.\r
+\r
+  @retval NULL                 The best matching language could not be found in SupportedLanguages.\r
+  @retval NULL                 There are not enough resources available to return the best matching \r
+                               language.\r
+  @retval Other                A pointer to a Null-terminated ASCII string that is the best matching \r
+                               language in SupportedLanguages.\r
+**/\r
+CHAR8 *\r
+DriverHealthSelectBestLanguage (\r
+  IN CHAR8        *SupportedLanguages,\r
+  IN BOOLEAN      Iso639Language\r
+  );\r
+\r
+/**\r
+\r
+  This is an internal worker function to get the Component Name (2) protocol interface\r
+  and the language it supports.\r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ComponentName        A pointer to the Component Name (2) protocol interface.\r
+  @param  SupportedLanguage    The best suitable language that matches the SupportedLangues interface for the \r
+                               located Component Name (2) instance.\r
+\r
+  @param  EFI_SUCCESS          The Component Name (2) protocol instance is successfully located and we find\r
+                               the best matching language it support.\r
+  @param  EFI_UNSUPPORTED      The input Language is not supported by the Component Name (2) protocol.\r
+  @param  Other                Some error occurs when locating Component Name (2) protocol instance or finding\r
+                               the supported language.\r
+\r
+**/\r
+EFI_STATUS\r
+GetComponentNameWorker (\r
+  IN  EFI_GUID                    *ProtocolGuid,\r
+  IN  EFI_HANDLE                  DriverBindingHandle,\r
+  OUT EFI_COMPONENT_NAME_PROTOCOL **ComponentName,\r
+  OUT CHAR8                       **SupportedLanguage\r
+  );\r
+\r
+/**\r
+\r
+  This is an internal worker function to get driver name from Component Name (2) protocol interface.\r
+\r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  DriverName           A pointer to the Unicode string to return. This Unicode string is the name\r
+                               of the driver specified by This.\r
+\r
+  @retval EFI_SUCCESS          The driver name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The driver name cannot be retrieved from Component Name (2) protocol\r
+                               interface.\r
+\r
+**/\r
+EFI_STATUS\r
+GetDriverNameWorker (\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  OUT CHAR16      **DriverName\r
+  );\r
+\r
+/**\r
+\r
+  This function gets driver name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the driver name.\r
+  If the attempt fails, it then gets the driver name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  DriverName           A pointer to the Unicode string to return. This Unicode string is the name\r
+                               of the driver specified by This.\r
+\r
+  @retval EFI_SUCCESS          The driver name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The driver name cannot be retrieved from Component Name (2) protocol\r
+                               interface.\r
+\r
+**/\r
+EFI_STATUS\r
+DriverHealthGetDriverName (\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  OUT CHAR16      **DriverName\r
+  );\r
+\r
+/**\r
+  This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name.\r
+  If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  ProtocolGuid         A pointer to an EFI_GUID. It points to Component Name (2) protocol GUID.\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ControllerHandle     The handle of a controller that the driver specified by This is managing.\r
+                               This handle specifies the controller whose name is to be returned.\r
+  @param  ChildHandle          The handle of the child controller to retrieve the name of. This is an\r
+                               optional parameter that may be NULL. It will be NULL for device drivers.\r
+                               It will also be NULL for bus drivers that attempt to retrieve the name\r
+                               of the bus controller. It will not be NULL for a bus driver that attempts\r
+                               to retrieve the name of a child controller.\r
+  @param  ControllerName       A pointer to the Unicode string to return. This Unicode string\r
+                               is the name of the controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval  EFI_SUCCESS         The controller name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval  Other               The controller name cannot be retrieved from Component Name (2) protocol.\r
+\r
+**/\r
+\r
+EFI_STATUS\r
+GetControllerNameWorker (\r
+  IN  EFI_GUID    *ProtocolGuid,\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  EFI_HANDLE  ChildHandle,\r
+  OUT CHAR16      **ControllerName\r
+  );\r
+\r
+/**\r
+  This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface\r
+  in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. \r
+  If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward\r
+  compatibility support. \r
+\r
+  @param  DriverBindingHandle  The handle on which the Component Name (2) protocol instance is retrieved.\r
+  @param  ControllerHandle     The handle of a controller that the driver specified by This is managing.\r
+                               This handle specifies the controller whose name is to be returned.\r
+  @param  ChildHandle          The handle of the child controller to retrieve the name of. This is an\r
+                               optional parameter that may be NULL. It will be NULL for device drivers.\r
+                               It will also be NULL for bus drivers that attempt to retrieve the name\r
+                               of the bus controller. It will not be NULL for a bus driver that attempts\r
+                               to retrieve the name of a child controller.\r
+  @param  ControllerName       A pointer to the Unicode string to return. This Unicode string\r
+                               is the name of the controller specified by ControllerHandle and ChildHandle.\r
+\r
+  @retval EFI_SUCCESS          The controller name is successfully retrieved from Component Name (2) protocol\r
+                               interface.\r
+  @retval Other                The controller name cannot be retrieved from Component Name (2) protocol.\r
+\r
+**/\r
+EFI_STATUS\r
+DriverHealthGetControllerName (\r
+  IN  EFI_HANDLE  DriverBindingHandle,\r
+  IN  EFI_HANDLE  ControllerHandle,\r
+  IN  EFI_HANDLE  ChildHandle,\r
+  OUT CHAR16      **ControllerName\r
+  );\r
+\r
 #endif\r
index 5a595d18d653637d695077bafc1fce5615538e26..e9b0ba8efcbd0bc8fac87f089cc72a10f7fe29cf 100644 (file)
Binary files a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni and b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DeviceManagerStrings.uni differ
index 55ee419bc5852870177fb6ea6b00afd79908e728..c08ad2621478636ab0e5548037eaac23b3d00a1a 100644 (file)
@@ -2,7 +2,7 @@
 //  \r
 //    Device Manager formset.\r
 //  \r
-//  Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+//  Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 //  All rights reserved. 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
@@ -31,6 +31,8 @@
 \r
 #define DEVICE_MANAGER_FORM_ID             0x1000\r
 \r
+#define DEVICE_MANAGER_KEY_DRIVER_HEALTH   0x1111\r
+\r
 formset\r
   guid      = FORMSET_GUID,\r
   title     = STRING_TOKEN(STR_DEVICE_MANAGER_TITLE),\r
@@ -64,12 +66,22 @@ formset
 \r
     label LABEL_DEVICES_LIST;\r
     label LABEL_END;\r
-\r
+    \r
+    subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+    subtitle text = STRING_TOKEN(STR_DM_DRIVER_HEALTH_TITLE); \r
+    \r
+    text\r
+      help   = STRING_TOKEN(STR_DRIVER_HEALTH_STATUS_HELP),\r
+      text   = STRING_TOKEN(STR_DRIVER_HEALTH_ALL_HEALTHY),\r
+      text   = STRING_TOKEN(STR_LAST_STRING),\r
+      flags  = INTERACTIVE,\r
+      key    = DEVICE_MANAGER_KEY_DRIVER_HEALTH;   \r
+      \r
     subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
 \r
     label LABEL_VBIOS;\r
     label LABEL_END;\r
-\r
+    \r
     subtitle text = STRING_TOKEN(STR_EMPTY_STRING);\r
     subtitle text = STRING_TOKEN(STR_EXIT_STRING);\r
 \r
diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr b/IntelFrameworkModulePkg/Universal/BdsDxe/DeviceMngr/DriverHealthVfr.Vfr
new file mode 100644 (file)
index 0000000..bbe98d9
--- /dev/null
@@ -0,0 +1,45 @@
+///** @file\r
+//  \r
+//    Driver Health formset.\r
+//  \r
+//  Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
+//  All rights reserved. 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
+//  http://opensource.org/licenses/bsd-license.php\r
+//  \r
+//  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+//  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//  \r
+//**/\r
+\r
+#define DRIVER_HEALTH_FORMSET_GUID  { 0xf76e0a70, 0xb5ed, 0x4c38, 0xac, 0x9a, 0xe5, 0xf5, 0x4b, 0xf1, 0x6e, 0x34 }\r
+\r
+#define LABEL_DRIVER_HEALTH                0x2000\r
+#define LABEL_DRIVER_HEALTH_END            0x2001\r
+#define LABEL_DRIVER_HEALTH_REAPIR_ALL     0x3000\r
+#define LABEL_DRIVER_HEALTH_REAPIR_ALL_END 0x3001\r
+\r
+#define DRIVER_HEALTH_FORM_ID              0x1001\r
+\r
+formset\r
+  guid      = DRIVER_HEALTH_FORMSET_GUID,\r
+  title     = STRING_TOKEN(STR_DH_BANNER),\r
+  help      = STRING_TOKEN(STR_EMPTY_STRING),\r
+  classguid = DRIVER_HEALTH_FORMSET_GUID,\r
\r
+  form formid = DRIVER_HEALTH_FORM_ID,\r
+      title  = STRING_TOKEN(STR_DH_BANNER);\r
+\r
+      label LABEL_DRIVER_HEALTH;\r
+      label LABEL_DRIVER_HEALTH_END;  \r
+            \r
+      subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+      label LABEL_DRIVER_HEALTH_REAPIR_ALL;\r
+      label LABEL_DRIVER_HEALTH_REAPIR_ALL_END;\r
+            \r
+      subtitle text = STRING_TOKEN(STR_LAST_STRING);\r
+      subtitle text = STRING_TOKEN(STR_HELP_FOOTER);\r
+      subtitle text = STRING_TOKEN(STR_LAST_STRING);      \r
+  endform;   \r
+endformset;\r