]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
MdemodulePkg/HiiDatabase: Correct typo in comments.
[mirror_edk2.git] / MdeModulePkg / Universal / HiiDatabaseDxe / Database.c
index def1eb74a40854c7ce314522b9c1d5bf9e5e292d..4fd83f807281f9b7c70ae590aea85b04b38f97fc 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
@@ -355,7 +356,7 @@ InvokeRegisteredFunction (
   @param  NotifyType             The type of change concerning the database.\r
   @param  PackageList            Pointer to a package list which will be inserted\r
                                  to.\r
-  @param  Package                Created GUID pacakge\r
+  @param  Package                Created GUID package\r
 \r
   @retval EFI_SUCCESS            Guid Package is inserted successfully.\r
   @retval EFI_OUT_OF_RESOURCES   Unable to allocate necessary resources for the new\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
@@ -893,7 +903,7 @@ Error:
  @param  PackageList        Pointer to a package list which will be adjusted.\r
 \r
  @retval EFI_SUCCESS  Adjust all string packages successfully.\r
- @retval others       Can't adjust string packges.\r
+ @retval others       Can't adjust string packages.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -1542,7 +1552,7 @@ InsertImagePackage (
   if (ImageInfoOffset != 0) {\r
     ImageSize = ImagePackage->ImagePkgHdr.Header.Length -\r
                 sizeof (EFI_HII_IMAGE_PACKAGE_HDR) - PaletteSize;\r
-    ImagePackage->ImageBlock = (UINT8 *) AllocateZeroPool (ImageSize);\r
+    ImagePackage->ImageBlock = AllocateZeroPool (ImageSize);\r
     if (ImagePackage->ImageBlock == NULL) {\r
       FreePool (ImagePackage->PaletteBlock);\r
       FreePool (ImagePackage);\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
@@ -2993,7 +3041,7 @@ HiiNewPackageList (
 \r
 \r
 /**\r
-  This function removes the package list that is associated with a handle Handle\r
+  This function removes the package list that is associated with Handle\r
   from the HII database. Before removing the package, any registered functions\r
   with the notification type REMOVE_PACK and the same package type will be called.\r
 \r
@@ -3004,7 +3052,7 @@ HiiNewPackageList (
 \r
   @retval EFI_SUCCESS            The data associated with the Handle was removed\r
                                  from  the HII database.\r
-  @retval EFI_NOT_FOUND          The specified andle is not in database.\r
+  @retval EFI_NOT_FOUND          The specified handle is not in database.\r
   @retval EFI_INVALID_PARAMETER  The Handle was not valid.\r
 \r
 **/\r
@@ -3246,7 +3294,7 @@ HiiUpdatePackageList (
                                  buffer that is required for the handles found.\r
   @param  Handle                 An array of EFI_HII_HANDLE instances returned.\r
 \r
-  @retval EFI_SUCCESS            The matching handles are outputed successfully.\r
+  @retval EFI_SUCCESS            The matching handles are outputted successfully.\r
                                  HandleBufferLength is updated with the actual length.\r
   @retval EFI_BUFFER_TO_SMALL    The HandleBufferLength parameter indicates that\r
                                  Handle is too small to support the number of\r
@@ -3352,7 +3400,7 @@ HiiListPackageLists (
         }\r
         break;\r
         //\r
-        // Pesudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package handles\r
+        // Pseudo-type EFI_HII_PACKAGE_TYPE_ALL will cause all package handles\r
         // to be listed.\r
         //\r
       case EFI_HII_PACKAGE_TYPE_ALL:\r
@@ -3409,7 +3457,7 @@ HiiListPackageLists (
                                  Handle is too small to support the number of\r
                                  handles.      HandleBufferLength is updated with a\r
                                  value that will enable the data to fit.\r
-  @retval EFI_NOT_FOUND          The specifiecd Handle could not be found in the\r
+  @retval EFI_NOT_FOUND          The specified Handle could not be found in the\r
                                  current database.\r
   @retval EFI_INVALID_PARAMETER  BufferSize was NULL.\r
   @retval EFI_INVALID_PARAMETER  The value referenced by BufferSize was not zero \r