]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
MdeModulePkg/Setup: Check ConfigAccess protocol in case it's destroyed
[mirror_edk2.git] / MdeModulePkg / Universal / SetupBrowserDxe / Presentation.c
index d7927725b231cc46e65dbd7739a42baf2946b7e1..7c36a6f2b7fa351e37cb57c168251f880b8ada48 100644 (file)
@@ -20,6 +20,38 @@ UINT16             mCurFakeQestId;
 FORM_DISPLAY_ENGINE_FORM gDisplayFormData;\r
 BOOLEAN            mFinishRetrieveCall = FALSE;\r
 \r
+/**\r
+  Check whether the ConfigAccess protocol is available\r
+\r
+  @parm FormSet           FormSet of which the ConfigAcces protocol need to be checked.\r
+\r
+  @retval EFI_SUCCESS     The function executed successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+CheckConfigAccess(\r
+  IN FORM_BROWSER_FORMSET  *FormSet\r
+  )\r
+{\r
+  EFI_STATUS                      Status;\r
+\r
+  Status = gBS->HandleProtocol (\r
+                  FormSet->DriverHandle,\r
+                  &gEfiHiiConfigAccessProtocolGuid,\r
+                  (VOID **) &FormSet->ConfigAccess\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    //\r
+    // Configuration Driver don't attach ConfigAccess protocol to its HII package\r
+    // list, then there will be no configuration action required.\r
+    // Or the ConfigAccess protocol has been uninstalled.\r
+    //\r
+    FormSet->ConfigAccess = NULL;\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
 /**\r
   Evaluate all expressions in a Form.\r
 \r
@@ -1686,6 +1718,8 @@ DisplayForm (
     return Status;\r
   }\r
 \r
+  CheckConfigAccess(gCurrentSelection->FormSet);\r
+\r
   Status = ProcessUserInput (&UserInput);\r
   FreeDisplayFormData();\r
   return Status;\r