public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Ming Huang <ming.huang@linaro.org>
To: huangming23@huawei.com, edk2-devel@lists.01.org
Subject: [RFC MdeModulePkg/UefiBootManagerLib v1 1/1] MdeModulePkg/UefiBootManagerLib: Fix raid card repair fail issue
Date: Sat, 15 Sep 2018 14:33:18 +0800	[thread overview]
Message-ID: <20180915063318.4854-2-ming.huang@linaro.org> (raw)
In-Reply-To: <20180915063318.4854-1-ming.huang@linaro.org>

When some type raid cards is not healthy, such as Broadcom 3108/3508
raid card, board will enter endless loop in BmRepairAllControllers()
and can't show configuration formset which need to repair raid card.

DriverHealthManagerDxe is added to platform dsc/fdf, driver health
manager menu can show drivers which are not healthy, but raid card
can not be repaired by the menus under Device Manager. This modification
of BmRepairAllControllers() can show configuration formset for repair
when booting an option.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>
---
 MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf |  2 +
 MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c       | 48 +++++++++++++++++++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
index 228b91033695..b9f96c763ff6 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
+++ b/MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
@@ -89,6 +89,8 @@ [Guids]
   gEfiDiskInfoIdeInterfaceGuid                  ## SOMETIMES_CONSUMES ## GUID
   gEfiDiskInfoScsiInterfaceGuid                 ## SOMETIMES_CONSUMES ## GUID
   gEfiDiskInfoSdMmcInterfaceGuid                ## SOMETIMES_CONSUMES ## GUID
+  gEfiHiiDriverHealthFormsetGuid
+  gEfiHiiPlatformSetupFormsetGuid
 
 [Protocols]
   gEfiPciRootBridgeIoProtocolGuid               ## CONSUMES
diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
index ecd01bbb81e3..fd47651ec937 100644
--- a/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
+++ b/MdeModulePkg/Library/UefiBootManagerLib/BmDriverHealth.c
@@ -421,6 +421,47 @@ EfiBootManagerFreeDriverHealthInfo (
   return gBS->FreePool (DriverHealthInfo);
 }
 
+STATIC
+VOID
+ShowConfigureForm (
+  EFI_FORM_BROWSER2_PROTOCOL          *FormBrowser2,
+  EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo
+  )
+{
+  EFI_STATUS                          Status;
+  EFI_HII_HANDLE                      FormHiiHandle;
+  EFI_DRIVER_HEALTH_STATUS            HealthStatus;
+
+  if (DriverHealthInfo != NULL) {
+    Status = DriverHealthInfo->DriverHealth->GetHealthStatus (
+                                               DriverHealthInfo->DriverHealth,
+                                               DriverHealthInfo->ControllerHandle,
+                                               DriverHealthInfo->ChildHandle,
+                                               &HealthStatus,
+                                               NULL,
+                                               &FormHiiHandle
+                                               );
+    if (!EFI_ERROR (Status) &&
+        (HealthStatus == EfiDriverHealthStatusConfigurationRequired) &&
+        (FormHiiHandle != NULL)) {
+      Status = FormBrowser2->SendForm (
+                               FormBrowser2,
+                               &FormHiiHandle,
+                               1,
+                               &gEfiHiiPlatformSetupFormsetGuid,
+                               0,
+                               NULL,
+                               NULL
+                               );
+      if (EFI_ERROR (Status)) {
+        Print (L"Show configurae menu:%r\n", Status);
+      }
+    }
+  }
+
+  return;
+}
+
 /**
   Repair all the controllers according to the Driver Health status queried.
 
@@ -434,6 +475,7 @@ BmRepairAllControllers (
 {
   EFI_STATUS                          Status;
   EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *DriverHealthInfo;
+  EFI_BOOT_MANAGER_DRIVER_HEALTH_INFO *InfoConfigurationRequired;
   EFI_DRIVER_HEALTH_STATUS            HealthStatus;
   UINTN                               Count;
   UINTN                               Index;
@@ -462,6 +504,7 @@ BmRepairAllControllers (
   do {
     RepairRequired        = FALSE;
     ConfigurationRequired = FALSE;
+    InfoConfigurationRequired = NULL;
 
     //
     // Deal with Repair Required
@@ -470,6 +513,7 @@ BmRepairAllControllers (
     for (Index = 0; Index < Count; Index++) {
       if (DriverHealthInfo[Index].HealthStatus == EfiDriverHealthStatusConfigurationRequired) {
         ConfigurationRequired = TRUE;
+        InfoConfigurationRequired = &DriverHealthInfo[Index];
       }
 
       if (DriverHealthInfo[Index].HealthStatus == EfiDriverHealthStatusRepairRequired) {
@@ -494,6 +538,7 @@ BmRepairAllControllers (
                                                            );
           if (!EFI_ERROR (Status) && (HealthStatus == EfiDriverHealthStatusConfigurationRequired)) {
             ConfigurationRequired = TRUE;
+            InfoConfigurationRequired = &DriverHealthInfo[Index];
           }
         }
       }
@@ -507,12 +552,13 @@ BmRepairAllControllers (
                                    FormBrowser2,
                                    &HiiHandles[Index],
                                    1,
-                                   PcdGetPtr (PcdDriverHealthConfigureForm),
+                                   &gEfiHiiDriverHealthFormsetGuid,
                                    0,
                                    NULL,
                                    NULL
                                    );
           if (!EFI_ERROR (Status)) {
+            ShowConfigureForm (FormBrowser2, InfoConfigurationRequired);
             break;
           }
         }
-- 
2.18.0



  reply	other threads:[~2018-09-15  6:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-15  6:33 [RFC MdeModulePkg/UefiBootManagerLib v1 0/1] Fix raid card repair fail issue Ming Huang
2018-09-15  6:33 ` Ming Huang [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-09-15  6:36 Ming Huang
2018-09-15  6:36 ` [RFC MdeModulePkg/UefiBootManagerLib v1 1/1] MdeModulePkg/UefiBootManagerLib: " Ming Huang
2018-09-18  9:40   ` Ni, Ruiyu
2018-09-19  2:10     ` Ming Huang
2018-09-26  5:00   ` Ni, Ruiyu
2018-09-28  6:18     ` Ming Huang
2018-10-08  6:39       ` Ni, Ruiyu
2018-10-08 12:15         ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180915063318.4854-2-ming.huang@linaro.org \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox