]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Export ConfigResp only for form Package after ReadyToBoot
authorDandan Bi <dandan.bi@intel.com>
Wed, 20 Apr 2016 04:59:47 +0000 (12:59 +0800)
committerStar Zeng <star.zeng@intel.com>
Wed, 27 Apr 2016 08:39:47 +0000 (16:39 +0800)
The Hii runtime support feature will export the content of
HiiDatabase and the ConfigResp string to runtime buffer
after ReadyToBoot event is triggered. If some drivers
add/update/remove packages from Hiidatabase after ReadyToBoot:
Originally we will both export the content of HiiDatabase and
the ConfigResp string for all packages.
But now after investigation, we found only for form packages need
to export the content of HiiDatabase and the ConfigResp string,
for other packages just need to export the content of HiiDatabase.
Now to enhance this logic.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Samer El-Haj-Mahmoud <elhaj@hpe.com>
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c

index def1eb74a40854c7ce314522b9c1d5bf9e5e292d..d1eb88188479ba076f8a6c2bd821fadaffcdf545 100644 (file)
@@ -19,6 +19,7 @@ EFI_HII_PACKAGE_LIST_HEADER    *gRTDatabaseInfoBuffer = NULL;
 EFI_STRING                     gRTConfigRespBuffer    = NULL;\r
 UINTN                          gDatabaseInfoSize = 0;\r
 UINTN                          gConfigRespSize = 0;\r
+BOOLEAN                        gExportConfigResp = TRUE;\r
 \r
 /**\r
   This function generates a HII_DATABASE_RECORD node and adds into hii database.\r
@@ -739,7 +740,16 @@ RemoveFormPackages (
     PackageList->PackageListHdr.PackageLength -= Package->FormPkgHdr.Length;\r
     FreePool (Package->IfrData);\r
     FreePool (Package);\r
-\r
+    //\r
+    // If Hii runtime support feature is enabled,\r
+    // will export Hii info for runtime use after ReadyToBoot event triggered.\r
+    // If some driver add/update/remove packages from HiiDatabase after ReadyToBoot,\r
+    // will need to export the content of HiiDatabase.\r
+    // But if form packages removed, also need to export the ConfigResp string\r
+    //\r
+    if (gExportAfterReadyToBoot) {\r
+      gExportConfigResp = TRUE;\r
+    }\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -2486,6 +2496,16 @@ AddPackages (
                  (UINT8) (PackageHeader.Type),\r
                  DatabaseRecord->Handle\r
                  );\r
+      //\r
+      // If Hii runtime support feature is enabled,\r
+      // will export Hii info for runtime use after ReadyToBoot event triggered.\r
+      // If some driver add/update/remove packages from HiiDatabase after ReadyToBoot,\r
+      // will need to export the content of HiiDatabase.\r
+      // But if form packages added/updated, also need to export the ConfigResp string.\r
+      //\r
+      if (gExportAfterReadyToBoot) {\r
+        gExportConfigResp = TRUE;\r
+      }\r
       break;\r
     case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:\r
       Status = InsertKeyboardLayoutPackage (\r
@@ -2781,7 +2801,7 @@ ExportPackageList (
 }\r
 \r
 /**\r
-This is an internal function,mainly use to get and update configuration settings information.\r
+This function mainly use to get and update ConfigResp string.\r
 \r
 @param  This                   A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
 \r
@@ -2790,7 +2810,7 @@ This is an internal function,mainly use to get and update configuration settings
 \r
 **/\r
 EFI_STATUS\r
-HiiGetConfigurationSetting(\r
+HiiGetConfigRespInfo(\r
   IN CONST EFI_HII_DATABASE_PROTOCOL        *This\r
   )\r
 {\r
@@ -2804,11 +2824,6 @@ HiiGetConfigurationSetting(
 \r
   Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);\r
 \r
-  //\r
-  // Get the HiiDatabase info.\r
-  //\r
-  HiiGetDatabaseInfo(This);\r
-\r
   //\r
   // Get ConfigResp string\r
   //\r
@@ -2888,6 +2903,39 @@ HiiGetDatabaseInfo(
 \r
 }\r
 \r
+/**\r
+This  function mainly use to get and update configuration settings information.\r
+\r
+@param  This                   A pointer to the EFI_HII_DATABASE_PROTOCOL instance.\r
+\r
+@retval EFI_SUCCESS            Get the information successfully.\r
+@retval EFI_OUT_OF_RESOURCES   Not enough memory to store the Configuration Setting data.\r
+\r
+**/\r
+EFI_STATUS\r
+HiiGetConfigurationSetting(\r
+  IN CONST EFI_HII_DATABASE_PROTOCOL        *This\r
+  )\r
+{\r
+  EFI_STATUS                          Status;\r
+\r
+  //\r
+  // Get the HiiDatabase info.\r
+  //\r
+  Status = HiiGetDatabaseInfo(This);\r
+\r
+  //\r
+  // Get ConfigResp string\r
+  //\r
+  if (gExportConfigResp) {\r
+    Status = HiiGetConfigRespInfo (This);\r
+    gExportConfigResp = FALSE;\r
+  }\r
+  return Status;\r
+\r
+}\r
+\r
+\r
 /**\r
   This function adds the packages in the package list to the database and returns a handle. If there is a\r
   EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this function will\r
index 63f879382166ebe90e55d83dd3fc00a015109156..03a4184c45015ab70371cce9e799e21a1e1a8300 100644 (file)
@@ -146,6 +146,8 @@ OnReadyToBoot (
   //\r
   HiiGetConfigurationSetting(&mPrivate.HiiDatabase);\r
   gExportAfterReadyToBoot = TRUE;\r
+\r
+  gBS->CloseEvent (Event);\r
 }\r
 \r
 /**\r