]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Make HII configuration settings available to OS runtime
authorDandan Bi <dandan.bi@intel.com>
Wed, 2 Mar 2016 08:53:50 +0000 (16:53 +0800)
committerFeng Tian <feng.tian@intel.com>
Fri, 4 Mar 2016 06:04:43 +0000 (14:04 +0800)
This feature is aimed to allow OS make use of the HII database
during runtime. In this case, the contents of the HII Database
is exported to a buffer. The pointer to the buffer is placed
in the EFI System Configuration Table, where it can be retrieved
by an OS application.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Brian J. Johnson <bjohnson@sgi.com>
Cc: Andrew Fish <afish@apple.com>
Cc: El-Haj-Mahmoud Samer <samer.el-haj-mahmoud@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
MdeModulePkg/Universal/HiiDatabaseDxe/String.c

index b685132e5d28041beb17fe6072fd54b959003a73..efd870b61828de45046206d1b1e022de96d80547 100644 (file)
   # @Prompt Enable Serial device Half Hand Shake\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHalfHandshake|FALSE|BOOLEAN|0x00010073\r
 \r
   # @Prompt Enable Serial device Half Hand Shake\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialUseHalfHandshake|FALSE|BOOLEAN|0x00010073\r
 \r
+  ## Indicates if HII data and configuration has been exported.<BR><BR>\r
+  #  Add this PCD mainly consider the use case of simulator. This PCD maybe set to FALSE for\r
+  #  simulator platform because the performance cost for this feature.\r
+  #   TRUE  - Export HII data and configuration data.<BR>\r
+  #   FALSE - Does not export HII data and configuration.<BR>\r
+  # @Prompt Enable export HII data and configuration to be used in OS runtime.\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport|TRUE|BOOLEAN|0x00010074\r
+\r
 [PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64]\r
   ## Indicates if DxeIpl should switch to long mode to enter DXE phase.\r
   #  It is assumed that 64-bit DxeCore is built in firmware if it is true; otherwise 32-bit DxeCore\r
 [PcdsFeatureFlag.IA32, PcdsFeatureFlag.X64]\r
   ## Indicates if DxeIpl should switch to long mode to enter DXE phase.\r
   #  It is assumed that 64-bit DxeCore is built in firmware if it is true; otherwise 32-bit DxeCore\r
index ec56795ebb1924942403472a062cc3129aecbc8c..def1eb74a40854c7ce314522b9c1d5bf9e5e292d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Implementation for EFI_HII_DATABASE_PROTOCOL.\r
 \r
 /** @file\r
 Implementation for EFI_HII_DATABASE_PROTOCOL.\r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 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
 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
@@ -15,6 +15,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "HiiDatabase.h"\r
 \r
 \r
 #include "HiiDatabase.h"\r
 \r
+EFI_HII_PACKAGE_LIST_HEADER    *gRTDatabaseInfoBuffer = NULL;\r
+EFI_STRING                     gRTConfigRespBuffer    = NULL;\r
+UINTN                          gDatabaseInfoSize = 0;\r
+UINTN                          gConfigRespSize = 0;\r
+\r
 /**\r
   This function generates a HII_DATABASE_RECORD node and adds into hii database.\r
   This is a internal function.\r
 /**\r
   This function generates a HII_DATABASE_RECORD node and adds into hii database.\r
   This is a internal function.\r
@@ -2775,6 +2780,113 @@ ExportPackageList (
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+This is an internal 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
+  HII_DATABASE_PRIVATE_DATA           *Private;\r
+  EFI_STRING                          ConfigAltResp;\r
+  UINTN                               ConfigSize;\r
+\r
+  ConfigAltResp        = NULL;\r
+  ConfigSize           = 0;\r
+\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
+  Status = HiiConfigRoutingExportConfig(&Private->ConfigRouting,&ConfigAltResp);\r
+\r
+  if (!EFI_ERROR (Status)){\r
+    ConfigSize = StrSize(ConfigAltResp);\r
+    if (ConfigSize > gConfigRespSize){\r
+      gConfigRespSize = ConfigSize;\r
+      if (gRTConfigRespBuffer != NULL){\r
+        FreePool(gRTConfigRespBuffer);\r
+      }\r
+      gRTConfigRespBuffer = (EFI_STRING)AllocateRuntimeZeroPool(ConfigSize);\r
+      if (gRTConfigRespBuffer == NULL){\r
+        FreePool(ConfigAltResp);\r
+        DEBUG ((DEBUG_ERROR, "Not enough memory resource to get the ConfigResp string.\n"));\r
+        return EFI_OUT_OF_RESOURCES;\r
+      }\r
+    } else {\r
+      ZeroMem(gRTConfigRespBuffer,gConfigRespSize);\r
+    }\r
+    CopyMem(gRTConfigRespBuffer,ConfigAltResp,ConfigSize);\r
+    gBS->InstallConfigurationTable (&gEfiHiiConfigRoutingProtocolGuid, gRTConfigRespBuffer);\r
+    FreePool(ConfigAltResp);\r
+  }\r
+\r
+  return EFI_SUCCESS;\r
+\r
+}\r
+\r
+/**\r
+This is an internal function,mainly use to get HiiDatabase 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 Hiidatabase data.\r
+\r
+**/\r
+EFI_STATUS\r
+HiiGetDatabaseInfo(\r
+  IN CONST EFI_HII_DATABASE_PROTOCOL        *This\r
+  )\r
+{\r
+  EFI_STATUS                          Status;\r
+  EFI_HII_PACKAGE_LIST_HEADER         *DatabaseInfo;\r
+  UINTN                               DatabaseInfoSize;\r
+\r
+  DatabaseInfo         = NULL;\r
+  DatabaseInfoSize     = 0;\r
+\r
+  //\r
+  // Get HiiDatabase information.\r
+  //\r
+  Status = HiiExportPackageLists(This, NULL, &DatabaseInfoSize, DatabaseInfo);\r
+\r
+  ASSERT(Status == EFI_BUFFER_TOO_SMALL);\r
+\r
+  if(DatabaseInfoSize > gDatabaseInfoSize ) {\r
+    gDatabaseInfoSize = DatabaseInfoSize;\r
+    if (gRTDatabaseInfoBuffer != NULL){\r
+      FreePool(gRTDatabaseInfoBuffer);\r
+    }\r
+    gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool(DatabaseInfoSize);\r
+    if (gRTDatabaseInfoBuffer == NULL){\r
+      DEBUG ((DEBUG_ERROR, "Not enough memory resource to get the HiiDatabase info.\n"));\r
+      return EFI_OUT_OF_RESOURCES;\r
+    }\r
+  } else {\r
+    ZeroMem(gRTDatabaseInfoBuffer,gDatabaseInfoSize);\r
+  }\r
+  Status = HiiExportPackageLists(This, NULL, &DatabaseInfoSize, gRTDatabaseInfoBuffer);\r
+  ASSERT_EFI_ERROR (Status);\r
+  gBS->InstallConfigurationTable (&gEfiHiiDatabaseProtocolGuid, gRTDatabaseInfoBuffer);\r
+\r
+  return EFI_SUCCESS;\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
 \r
 /**\r
   This function adds the packages in the package list to the database and returns a handle. If there is a\r
@@ -2867,6 +2979,15 @@ HiiNewPackageList (
   }\r
 \r
   *Handle = DatabaseRecord->Handle;\r
   }\r
 \r
   *Handle = DatabaseRecord->Handle;\r
+\r
+  //\r
+  // Check whether need to get the Database and configuration setting info.\r
+  // Only after ReadyToBoot, need to do the export.\r
+  //\r
+  if (gExportAfterReadyToBoot) {\r
+    HiiGetConfigurationSetting(This);\r
+  }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -2972,6 +3093,13 @@ HiiRemovePackageList (
       FreePool (Node->PackageList);\r
       FreePool (Node);\r
 \r
       FreePool (Node->PackageList);\r
       FreePool (Node);\r
 \r
+      //\r
+      // Check whether need to get the Database and configuration setting info.\r
+      // Only after ReadyToBoot, need to do the export.\r
+      //\r
+      if (gExportAfterReadyToBoot) {\r
+        HiiGetConfigurationSetting(This);\r
+      }\r
       return EFI_SUCCESS;\r
     }\r
   }\r
       return EFI_SUCCESS;\r
     }\r
   }\r
@@ -3079,7 +3207,19 @@ HiiUpdatePackageList (
       //\r
       // Add all of the packages within the new package list\r
       //\r
       //\r
       // Add all of the packages within the new package list\r
       //\r
-      return AddPackages (Private, EFI_HII_DATABASE_NOTIFY_ADD_PACK, PackageList, Node);\r
+      Status = AddPackages (Private, EFI_HII_DATABASE_NOTIFY_ADD_PACK, PackageList, Node);\r
+\r
+      //\r
+      // Check whether need to get the Database and configuration setting info.\r
+      // Only after ReadyToBoot, need to do the export.\r
+      //\r
+      if (gExportAfterReadyToBoot) {\r
+        if (Status == EFI_SUCCESS){\r
+          HiiGetConfigurationSetting(This);\r
+        }\r
+      }\r
+\r
+      return Status;\r
     }\r
   }\r
 \r
     }\r
   }\r
 \r
index 6e28df7f456a0a274c856d0b1413a8f38c463e10..d90bc0290dba5d7e6077bffce09d41b9a5e77c23 100644 (file)
@@ -2017,8 +2017,38 @@ GetSupportedLanguages (
   IN EFI_HII_HANDLE           HiiHandle\r
   );\r
 \r
   IN EFI_HII_HANDLE           HiiHandle\r
   );\r
 \r
+/**\r
+This function mainly use to get HiiDatabase 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 Hiidatabase data.\r
+\r
+**/\r
+EFI_STATUS\r
+HiiGetDatabaseInfo(\r
+  IN CONST EFI_HII_DATABASE_PROTOCOL        *This\r
+  );\r
+\r
+/**\r
+This is an internal 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
 //\r
 // Global variables\r
 //\r
 extern EFI_EVENT gHiiKeyboardLayoutChanged;\r
 //\r
 // Global variables\r
 //\r
 extern EFI_EVENT gHiiKeyboardLayoutChanged;\r
+extern BOOLEAN   gExportAfterReadyToBoot;\r
+\r
 #endif\r
 #endif\r
index 7892503b47963c26676d7bd2c817a9555c56888f..2fb619e05a8b70b25bbf312013f4f470659526df 100644 (file)
@@ -4,7 +4,7 @@
 # This driver produces all required HII serivces that includes HiiDataBase, HiiString,\r
 # HiiFont, HiiConfigRouting. To support UEFI HII, this driver is required.\r
 #\r
 # This driver produces all required HII serivces that includes HiiDataBase, HiiString,\r
 # HiiFont, HiiConfigRouting. To support UEFI HII, this driver is required.\r
 #\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials       \r
 #  are licensed and made available under the terms and conditions of the BSD License   \r
 #\r
 #  This program and the accompanying materials       \r
 #  are licensed and made available under the terms and conditions of the BSD License   \r
@@ -72,6 +72,7 @@
 \r
 [FeaturePcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol   ## CONSUMES\r
 \r
 [FeaturePcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportHiiImageProtocol   ## CONSUMES\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdHiiOsRuntimeSupport       ## CONSUMES\r
 \r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## CONSUMES\r
 \r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang ## CONSUMES\r
index 6448c97256fc764d812b141870a097ec4c98af8c..63f879382166ebe90e55d83dd3fc00a015109156 100644 (file)
@@ -2,7 +2,7 @@
 This file contains the entry code to the HII database, which is defined by\r
 UEFI 2.1 specification.\r
 \r
 This file contains the entry code to the HII database, which is defined by\r
 UEFI 2.1 specification.\r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 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
 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
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 // Global variables\r
 //\r
 EFI_EVENT gHiiKeyboardLayoutChanged;\r
 // Global variables\r
 //\r
 EFI_EVENT gHiiKeyboardLayoutChanged;\r
+BOOLEAN   gExportAfterReadyToBoot = FALSE;\r
 \r
 HII_DATABASE_PRIVATE_DATA mPrivate = {\r
   HII_DATABASE_PRIVATE_DATA_SIGNATURE,\r
 \r
 HII_DATABASE_PRIVATE_DATA mPrivate = {\r
   HII_DATABASE_PRIVATE_DATA_SIGNATURE,\r
@@ -123,6 +124,30 @@ KeyboardLayoutChangeNullEvent (
   return;\r
 }\r
 \r
   return;\r
 }\r
 \r
+/**\r
+  On Ready To Boot Services Event notification handler.\r
+\r
+  To trigger the function that to export the Hii Configuration setting.\r
+\r
+  @param[in]  Event     Event whose notification function is being invoked\r
+  @param[in]  Context   Pointer to the notification function's context\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+OnReadyToBoot (\r
+  IN      EFI_EVENT                         Event,\r
+  IN      VOID                              *Context\r
+  )\r
+{\r
+  //\r
+  // When ready to boot, we begin to export the HiiDatabase date.\r
+  // And hook all the possible HiiDatabase change actions to export data.\r
+  //\r
+  HiiGetConfigurationSetting(&mPrivate.HiiDatabase);\r
+  gExportAfterReadyToBoot = TRUE;\r
+}\r
+\r
 /**\r
   Initialize HII Database.\r
 \r
 /**\r
   Initialize HII Database.\r
 \r
@@ -135,6 +160,8 @@ KeyboardLayoutChangeNullEvent (
           gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for\r
           details. Or failed to insatll the protocols.\r
           Check gBS->InstallMultipleProtocolInterfaces for details.\r
           gHiiKeyboardLayoutChanged. Check gBS->CreateEventEx for\r
           details. Or failed to insatll the protocols.\r
           Check gBS->InstallMultipleProtocolInterfaces for details.\r
+          Or failed to create Ready To Boot Event.\r
+          Check EfiCreateEventReadyToBootEx for details.\r
 \r
 **/\r
 EFI_STATUS\r
 \r
 **/\r
 EFI_STATUS\r
@@ -146,6 +173,7 @@ InitializeHiiDatabase (
 {\r
   EFI_STATUS                             Status;\r
   EFI_HANDLE                             Handle;\r
 {\r
   EFI_STATUS                             Status;\r
   EFI_HANDLE                             Handle;\r
+  EFI_EVENT                              ReadyToBootEvent;\r
 \r
   //\r
   // There will be only one HII Database in the system\r
 \r
   //\r
   // There will be only one HII Database in the system\r
@@ -211,6 +239,18 @@ InitializeHiiDatabase (
 \r
   }\r
 \r
 \r
   }\r
 \r
+  if (FeaturePcdGet(PcdHiiOsRuntimeSupport)) {\r
+    Status = EfiCreateEventReadyToBootEx (\r
+               TPL_CALLBACK,\r
+               OnReadyToBoot,\r
+               NULL,\r
+               &ReadyToBootEvent\r
+               );\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+  }\r
+\r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
 \r
index c46c96545e80ab8ae93b9fa0525f226ba1d040a5..612d57a61505a48aa0a36ef8466e51db65de6f37 100644 (file)
@@ -790,6 +790,14 @@ HiiNewImage (
   ImageBlock += NewBlockSize;\r
   ((EFI_HII_IIBT_END_BLOCK *) (ImageBlock))->Header.BlockType = EFI_HII_IIBT_END;\r
 \r
   ImageBlock += NewBlockSize;\r
   ((EFI_HII_IIBT_END_BLOCK *) (ImageBlock))->Header.BlockType = EFI_HII_IIBT_END;\r
 \r
+  //\r
+  // Check whether need to get the contents of HiiDataBase.\r
+  // Only after ReadyToBoot to do the export.\r
+  //\r
+  if (gExportAfterReadyToBoot) {\r
+    HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+  }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -1178,6 +1186,14 @@ HiiSetImage (
   ImagePackage->ImagePkgHdr.Header.Length += NewBlockSize - OldBlockSize;\r
   PackageListNode->PackageListHdr.PackageLength += NewBlockSize - OldBlockSize;\r
 \r
   ImagePackage->ImagePkgHdr.Header.Length += NewBlockSize - OldBlockSize;\r
   PackageListNode->PackageListHdr.PackageLength += NewBlockSize - OldBlockSize;\r
 \r
+  //\r
+  // Check whether need to get the contents of HiiDataBase.\r
+  // Only after ReadyToBoot to do the export.\r
+  //\r
+  if (gExportAfterReadyToBoot) {\r
+    HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+  }\r
+\r
   return EFI_SUCCESS;\r
 \r
 }\r
   return EFI_SUCCESS;\r
 \r
 }\r
index 756f19c7c3fc2d46cee17329691c4a7d729cd338..e55aa293cbb4176e12afbd956a13b9c9f0974d3c 100644 (file)
@@ -2,7 +2,7 @@
 Implementation for EFI_HII_STRING_PROTOCOL.\r
 \r
 \r
 Implementation for EFI_HII_STRING_PROTOCOL.\r
 \r
 \r
-Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
@@ -1560,6 +1560,18 @@ Done:
     FreePool (StringPackage->StringPkgHdr);\r
     FreePool (StringPackage);\r
   }\r
     FreePool (StringPackage->StringPkgHdr);\r
     FreePool (StringPackage);\r
   }\r
+  //\r
+  // The contents of HiiDataBase may updated,need to check.\r
+  //\r
+  //\r
+  // Check whether need to get the contents of HiiDataBase.\r
+  // Only after ReadyToBoot to do the export.\r
+  //\r
+  if (gExportAfterReadyToBoot) {\r
+    if (!EFI_ERROR (Status)) {\r
+      HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+    }\r
+  }\r
 \r
   return Status;\r
 }\r
 \r
   return Status;\r
 }\r
@@ -1755,6 +1767,13 @@ HiiSetString (
           return Status;\r
         }\r
         PackageListNode->PackageListHdr.PackageLength += StringPackage->StringPkgHdr->Header.Length - OldPackageLen;\r
           return Status;\r
         }\r
         PackageListNode->PackageListHdr.PackageLength += StringPackage->StringPkgHdr->Header.Length - OldPackageLen;\r
+        //\r
+        // Check whether need to get the contents of HiiDataBase.\r
+        // Only after ReadyToBoot to do the export.\r
+        //\r
+        if (gExportAfterReadyToBoot) {\r
+          HiiGetDatabaseInfo(&Private->HiiDatabase);\r
+        }\r
         return EFI_SUCCESS;\r
       }\r
     }\r
         return EFI_SUCCESS;\r
       }\r
     }\r