Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings available to OS runtime

2015-12-22 Thread Dong, Eric
Aaron,

This patch just follow UEFI spec 2.5 chapter 31.2.11.1 description to enable 
this feature. I think in OS environment, OS utility can just partial change the 
configuration data. We can't export config access protocol to OS environment.

Thanks,
Eric
From: aaron@congatec.com [mailto:aaron@congatec.com]
Sent: Wednesday, December 23, 2015 2:27 AM
To: Dong, Eric
Cc: Bi, Dandan; edk2-devel@lists.01.org; edk2-devel; Gao, Liming; 
El-Haj-Mahmoud, Samer
Subject: Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

I have a question about this.   Making the Hii Configuration data available to 
the OS at run time only exports the data from the Hii database.  It does not 
make the Hii Configuration Access protocols (or their callback functions) 
available to the OS?  So if a 3rd party OpRom was making using of their own Hii 
Configuration Access protocols and using callbacks to prevent specific 
combinations of configurations, then that would not be caught by an OS based 
setup browser?  Additionally, shouldn't an OS based setup browser have the 
problem of retrieving the current configuration data since it would need to use 
the config access protocols?

Best Regards,
Aaron



From:"Dong, Eric" <eric.d...@intel.com<mailto:eric.d...@intel.com>>
To:"El-Haj-Mahmoud, Samer" 
<samer.el-haj-mahm...@hpe.com<mailto:samer.el-haj-mahm...@hpe.com>>, "Bi, 
Dandan" <dandan...@intel.com<mailto:dandan...@intel.com>>, 
"edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>" 
<edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>>,
Cc:"Gao, Liming" <liming@intel.com<mailto:liming@intel.com>>
Date:    12/21/2015 05:29 PM
Subject:    Re: [edk2] [patch] MdeModulePkg:Make HIIconfiguration   
 settingsavailable to OS runtime
Sent by:"edk2-devel" 
<edk2-devel-boun...@lists.01.org<mailto:edk2-devel-boun...@lists.01.org>>




Yes, all the Hii database data will be export. Also the ConfigResp string for 
all HII drivers.

-Original Message-
From: El-Haj-Mahmoud, Samer [mailto:samer.el-haj-mahm...@hpe.com]
Sent: Tuesday, December 22, 2015 9:25 AM
To: Dong, Eric; Bi, Dandan; 
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Gao, Liming
Subject: RE: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Does this also export all string packages?

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dong, 
Eric
Sent: Monday, December 21, 2015 8:22 PM
To: Bi, Dandan <dandan...@intel.com<mailto:dandan...@intel.com>>; 
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Gao, Liming <liming@intel.com<mailto:liming@intel.com>>
Subject: Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Reviewed-by: Eric Dong <eric.d...@intel.com<mailto:eric.d...@intel.com>>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Monday, December 21, 2015 4:45 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Dong, Eric; Gao, Liming
Subject: [edk2] [patch] MdeModulePkg:Make HII configuration settings available 
to OS runtime

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@intel.com<mailto:liming@intel.com>>
Cc: Eric Dong <eric.d...@intel.com<mailto:eric.d...@intel.com>>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com<mailto:dandan...@intel.com>>
---
MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 102 -
.../Universal/HiiDatabaseDxe/HiiDatabase.h |   5 +
.../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  51 +++
3 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index ec56795..011e712 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2773,10 +2773,96 @@ ExportPackageList (
  *UsedSize += ResultSize + sizeof (EFI_HII_PACKAGE_HEADER);

  return EFI_SUCCESS;
}

+/**
+This is an internal function,mainly use to get and update configuration 
settings information.
+
+@param  ThisA pointer to the EFI_HII_DATABASE_PROTOCOL instance.
+@param  NewPackage  Indaicate whether add the packages in the package list 
to th

Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings available to OS runtime

2015-12-22 Thread Aaron . Pop
I have a question about this.   Making the Hii Configuration data 
available to the OS at run time only exports the data from the Hii 
database.  It does not make the Hii Configuration Access protocols (or 
their callback functions) available to the OS?  So if a 3rd party OpRom 
was making using of their own Hii Configuration Access protocols and using 
callbacks to prevent specific combinations of configurations, then that 
would not be caught by an OS based setup browser?  Additionally, shouldn't 
an OS based setup browser have the problem of retrieving the current 
configuration data since it would need to use the config access protocols?

Best Regards,
Aaron



From:   "Dong, Eric" <eric.d...@intel.com>
To: "El-Haj-Mahmoud, Samer" <samer.el-haj-mahm...@hpe.com>, "Bi, 
Dandan" <dandan...@intel.com>, "edk2-devel@lists.01.org" 
<edk2-devel@lists.01.org>, 
Cc: "Gao, Liming" <liming....@intel.com>
Date:   12/21/2015 05:29 PM
Subject:Re: [edk2] [patch] MdeModulePkg:Make HII configuration 
settingsavailable to OS runtime
Sent by:"edk2-devel" <edk2-devel-boun...@lists.01.org>



Yes, all the Hii database data will be export. Also the ConfigResp string 
for all HII drivers. 

-Original Message-
From: El-Haj-Mahmoud, Samer [mailto:samer.el-haj-mahm...@hpe.com] 
Sent: Tuesday, December 22, 2015 9:25 AM
To: Dong, Eric; Bi, Dandan; edk2-devel@lists.01.org
Cc: Gao, Liming
Subject: RE: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Does this also export all string packages?

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Dong, Eric
Sent: Monday, December 21, 2015 8:22 PM
To: Bi, Dandan <dandan...@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming....@intel.com>
Subject: Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Reviewed-by: Eric Dong <eric.d...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Dandan Bi
Sent: Monday, December 21, 2015 4:45 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric; Gao, Liming
Subject: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

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@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 102 
-
 .../Universal/HiiDatabaseDxe/HiiDatabase.h |   5 +
 .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  51 +++
 3 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index ec56795..011e712 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2773,10 +2773,96 @@ ExportPackageList (
   *UsedSize += ResultSize + sizeof (EFI_HII_PACKAGE_HEADER);
 
   return EFI_SUCCESS;
 }
 
+/**
+This is an internal function,mainly use to get and update configuration 
settings information.
+
+@param  ThisA pointer to the EFI_HII_DATABASE_PROTOCOL 
instance.
+@param  NewPackage  Indaicate whether add the packages in the package 
list to the database.
+
+@retval EFI_SUCCESS Get the information successfully.
+
+**/
+EFI_STATUS
+HiiGetConfigurationSetting(
+  IN CONST EFI_HII_DATABASE_PROTOCOL*This,
+  IN BOOLEANNewPackage
+  )
+{
+  EFI_STATUS  Status;
+  HII_DATABASE_PRIVATE_DATA   *Private;
+  EFI_HII_PACKAGE_LIST_HEADER *DatabaseInfo;
+  EFI_STRING  ConfigAltResp;
+  UINTN   DatabaseInfoSize;
+  UINTN   ConfigLen;
+ 
+  DatabaseInfo = NULL;
+  ConfigAltResp= NULL;
+  DatabaseInfoSize = 0;
+  ConfigLen= 0;
+
+  Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+
+  //
+  // Get the length of the buffer that is required for the exported data.
+  //
+
+  Status = HiiExportPackageLists(This, NULL, , 
+ DatabaseInfo);  if (Status == EFI_BUFFER_TOO_SMALL) {
+if (gRTDatabaseInfoBuffer == NULL){
+  gRTDatabaseInfoBuffer = AllocateRuntimePool (DatabaseInfoSize);
+} else if (DatabaseInfoSize != gDatabaseInfoSize ) {
+  if (NewPackage){
+gBS->InstallConfigurationTable (, 
NULL);
+  }
+  gRTDatabaseInfoBuffe

Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings available to OS runtime

2015-12-21 Thread Dong, Eric
Reviewed-by: Eric Dong <eric.d...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Monday, December 21, 2015 4:45 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric; Gao, Liming
Subject: [edk2] [patch] MdeModulePkg:Make HII configuration settings available 
to OS runtime

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@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 102 -
 .../Universal/HiiDatabaseDxe/HiiDatabase.h |   5 +
 .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  51 +++
 3 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index ec56795..011e712 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2773,10 +2773,96 @@ ExportPackageList (
   *UsedSize += ResultSize + sizeof (EFI_HII_PACKAGE_HEADER);
 
   return EFI_SUCCESS;
 }
 
+/**
+This is an internal function,mainly use to get and update configuration 
settings information.
+
+@param  ThisA pointer to the EFI_HII_DATABASE_PROTOCOL instance.
+@param  NewPackage  Indaicate whether add the packages in the package list 
to the database.
+
+@retval EFI_SUCCESS Get the information successfully.
+
+**/
+EFI_STATUS
+HiiGetConfigurationSetting(
+  IN CONST EFI_HII_DATABASE_PROTOCOL*This,
+  IN BOOLEANNewPackage
+  )
+{
+  EFI_STATUS  Status;
+  HII_DATABASE_PRIVATE_DATA   *Private;
+  EFI_HII_PACKAGE_LIST_HEADER *DatabaseInfo;
+  EFI_STRING  ConfigAltResp;
+  UINTN   DatabaseInfoSize;
+  UINTN   ConfigLen;
+  
+  DatabaseInfo = NULL;
+  ConfigAltResp= NULL;
+  DatabaseInfoSize = 0;
+  ConfigLen= 0;
+
+  Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+
+  //
+  // Get the length of the buffer that is required for the exported data.
+  //
+
+  Status = HiiExportPackageLists(This, NULL, , 
+ DatabaseInfo);  if (Status == EFI_BUFFER_TOO_SMALL) {
+if (gRTDatabaseInfoBuffer == NULL){
+  gRTDatabaseInfoBuffer = AllocateRuntimePool (DatabaseInfoSize);
+} else if (DatabaseInfoSize != gDatabaseInfoSize ) {
+  if (NewPackage){
+gBS->InstallConfigurationTable (, NULL);
+  }
+  gRTDatabaseInfoBuffer = 
ReallocateRuntimePool(gDatabaseInfoSize,DatabaseInfoSize,gRTDatabaseInfoBuffer);
+}
+ASSERT (gRTDatabaseInfoBuffer != NULL);
+
+gDatabaseInfoSize = DatabaseInfoSize;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTDatabaseInfoBuffer);
+}
+  }
+
+  //
+  // Get ConfigResp string
+  //
+  Status = 
+ HiiConfigRoutingExportConfig(>ConfigRouting,);
+  if (!EFI_ERROR (Status)){
+ConfigLen = StrLen(ConfigAltResp);
+if (gRTConfigRespBuffer == NULL){
+  gRTConfigRespBuffer = AllocateRuntimePool ((ConfigLen + 1) * sizeof 
(CHAR16));
+} else if (ConfigLen != gConfigLen ){
+  if (NewPackage){
+gBS->InstallConfigurationTable (, 
NULL);
+  }
+  gRTConfigRespBuffer = ReallocateRuntimePool((gConfigLen + 1) * sizeof 
(CHAR16),(ConfigLen + 1) * sizeof (CHAR16),gRTConfigRespBuffer);
+}
+ASSERT (gRTConfigRespBuffer != NULL);
+
+gConfigLen = ConfigLen;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTConfigRespBuffer);
+}
+
+FreePool(ConfigAltResp);
+  }
+
+  return EFI_SUCCESS;
+
+}
 
 /**
   This function adds the packages in the package list to the database and 
returns a handle. If there is a
   EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this 
function will
   create a package of type EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the 
package list.
@@ -2865,10 +2951,18 @@ HiiNewPackageList (
 Status = AddDevicePathPackage (Private, EFI_HII_DATABASE_NOTIFY_NEW_PACK, 
DevicePath, DatabaseRecord);
 ASSERT_EFI_ERROR (Status);
   }
 
   *Handle = DatabaseRecord->Handle;
+
+  //
+  // Get the configuration setting info.
+  // And install it to configuration table.
+  //
+
+  HiiGetConfigurationSetting(This,TRUE);
+
   return EFI_SUCCESS;
 }
 
 
 /**
@@ -3077,11 +3171,17 @@ HiiUpdatePackageList (
   }
 
   //
   // Add all o

Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings available to OS runtime

2015-12-21 Thread Dong, Eric
Yes, all the Hii database data will be export. Also the ConfigResp string for 
all HII drivers. 

-Original Message-
From: El-Haj-Mahmoud, Samer [mailto:samer.el-haj-mahm...@hpe.com] 
Sent: Tuesday, December 22, 2015 9:25 AM
To: Dong, Eric; Bi, Dandan; edk2-devel@lists.01.org
Cc: Gao, Liming
Subject: RE: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Does this also export all string packages?

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dong, 
Eric
Sent: Monday, December 21, 2015 8:22 PM
To: Bi, Dandan <dandan...@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming@intel.com>
Subject: Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Reviewed-by: Eric Dong <eric.d...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Monday, December 21, 2015 4:45 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric; Gao, Liming
Subject: [edk2] [patch] MdeModulePkg:Make HII configuration settings available 
to OS runtime

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@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 102 -
 .../Universal/HiiDatabaseDxe/HiiDatabase.h |   5 +
 .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  51 +++
 3 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index ec56795..011e712 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2773,10 +2773,96 @@ ExportPackageList (
   *UsedSize += ResultSize + sizeof (EFI_HII_PACKAGE_HEADER);
 
   return EFI_SUCCESS;
 }
 
+/**
+This is an internal function,mainly use to get and update configuration 
settings information.
+
+@param  ThisA pointer to the EFI_HII_DATABASE_PROTOCOL instance.
+@param  NewPackage  Indaicate whether add the packages in the package list 
to the database.
+
+@retval EFI_SUCCESS Get the information successfully.
+
+**/
+EFI_STATUS
+HiiGetConfigurationSetting(
+  IN CONST EFI_HII_DATABASE_PROTOCOL*This,
+  IN BOOLEANNewPackage
+  )
+{
+  EFI_STATUS  Status;
+  HII_DATABASE_PRIVATE_DATA   *Private;
+  EFI_HII_PACKAGE_LIST_HEADER *DatabaseInfo;
+  EFI_STRING  ConfigAltResp;
+  UINTN   DatabaseInfoSize;
+  UINTN   ConfigLen;
+  
+  DatabaseInfo = NULL;
+  ConfigAltResp= NULL;
+  DatabaseInfoSize = 0;
+  ConfigLen= 0;
+
+  Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+
+  //
+  // Get the length of the buffer that is required for the exported data.
+  //
+
+  Status = HiiExportPackageLists(This, NULL, , 
+ DatabaseInfo);  if (Status == EFI_BUFFER_TOO_SMALL) {
+if (gRTDatabaseInfoBuffer == NULL){
+  gRTDatabaseInfoBuffer = AllocateRuntimePool (DatabaseInfoSize);
+} else if (DatabaseInfoSize != gDatabaseInfoSize ) {
+  if (NewPackage){
+gBS->InstallConfigurationTable (, NULL);
+  }
+  gRTDatabaseInfoBuffer = 
ReallocateRuntimePool(gDatabaseInfoSize,DatabaseInfoSize,gRTDatabaseInfoBuffer);
+}
+ASSERT (gRTDatabaseInfoBuffer != NULL);
+
+gDatabaseInfoSize = DatabaseInfoSize;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTDatabaseInfoBuffer);
+}
+  }
+
+  //
+  // Get ConfigResp string
+  //
+  Status =
+ HiiConfigRoutingExportConfig(>ConfigRouting,);
+  if (!EFI_ERROR (Status)){
+ConfigLen = StrLen(ConfigAltResp);
+if (gRTConfigRespBuffer == NULL){
+  gRTConfigRespBuffer = AllocateRuntimePool ((ConfigLen + 1) * sizeof 
(CHAR16));
+} else if (ConfigLen != gConfigLen ){
+  if (NewPackage){
+gBS->InstallConfigurationTable (, 
NULL);
+  }
+  gRTConfigRespBuffer = ReallocateRuntimePool((gConfigLen + 1) * sizeof 
(CHAR16),(ConfigLen + 1) * sizeof (CHAR16),gRTConfigRespBuffer);
+}
+ASSERT (gRTConfigRespBuffer != NULL);
+
+gConfigLen = ConfigLen;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTConfigRespBuffer);
+}
+
+FreePool(ConfigAltResp);
+  }
+
+  return EFI_SUCC

Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings available to OS runtime

2015-12-21 Thread El-Haj-Mahmoud, Samer
Does this also export all string packages?

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dong, 
Eric
Sent: Monday, December 21, 2015 8:22 PM
To: Bi, Dandan <dandan...@intel.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming@intel.com>
Subject: Re: [edk2] [patch] MdeModulePkg:Make HII configuration settings 
available to OS runtime

Reviewed-by: Eric Dong <eric.d...@intel.com>

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Dandan Bi
Sent: Monday, December 21, 2015 4:45 PM
To: edk2-devel@lists.01.org
Cc: Dong, Eric; Gao, Liming
Subject: [edk2] [patch] MdeModulePkg:Make HII configuration settings available 
to OS runtime

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@intel.com>
Cc: Eric Dong <eric.d...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan...@intel.com>
---
 MdeModulePkg/Universal/HiiDatabaseDxe/Database.c   | 102 -
 .../Universal/HiiDatabaseDxe/HiiDatabase.h |   5 +
 .../Universal/HiiDatabaseDxe/HiiDatabaseEntry.c|  51 +++
 3 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index ec56795..011e712 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -2773,10 +2773,96 @@ ExportPackageList (
   *UsedSize += ResultSize + sizeof (EFI_HII_PACKAGE_HEADER);
 
   return EFI_SUCCESS;
 }
 
+/**
+This is an internal function,mainly use to get and update configuration 
settings information.
+
+@param  ThisA pointer to the EFI_HII_DATABASE_PROTOCOL instance.
+@param  NewPackage  Indaicate whether add the packages in the package list 
to the database.
+
+@retval EFI_SUCCESS Get the information successfully.
+
+**/
+EFI_STATUS
+HiiGetConfigurationSetting(
+  IN CONST EFI_HII_DATABASE_PROTOCOL*This,
+  IN BOOLEANNewPackage
+  )
+{
+  EFI_STATUS  Status;
+  HII_DATABASE_PRIVATE_DATA   *Private;
+  EFI_HII_PACKAGE_LIST_HEADER *DatabaseInfo;
+  EFI_STRING  ConfigAltResp;
+  UINTN   DatabaseInfoSize;
+  UINTN   ConfigLen;
+  
+  DatabaseInfo = NULL;
+  ConfigAltResp= NULL;
+  DatabaseInfoSize = 0;
+  ConfigLen= 0;
+
+  Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
+
+  //
+  // Get the length of the buffer that is required for the exported data.
+  //
+
+  Status = HiiExportPackageLists(This, NULL, , 
+ DatabaseInfo);  if (Status == EFI_BUFFER_TOO_SMALL) {
+if (gRTDatabaseInfoBuffer == NULL){
+  gRTDatabaseInfoBuffer = AllocateRuntimePool (DatabaseInfoSize);
+} else if (DatabaseInfoSize != gDatabaseInfoSize ) {
+  if (NewPackage){
+gBS->InstallConfigurationTable (, NULL);
+  }
+  gRTDatabaseInfoBuffer = 
ReallocateRuntimePool(gDatabaseInfoSize,DatabaseInfoSize,gRTDatabaseInfoBuffer);
+}
+ASSERT (gRTDatabaseInfoBuffer != NULL);
+
+gDatabaseInfoSize = DatabaseInfoSize;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTDatabaseInfoBuffer);
+}
+  }
+
+  //
+  // Get ConfigResp string
+  //
+  Status =
+ HiiConfigRoutingExportConfig(>ConfigRouting,);
+  if (!EFI_ERROR (Status)){
+ConfigLen = StrLen(ConfigAltResp);
+if (gRTConfigRespBuffer == NULL){
+  gRTConfigRespBuffer = AllocateRuntimePool ((ConfigLen + 1) * sizeof 
(CHAR16));
+} else if (ConfigLen != gConfigLen ){
+  if (NewPackage){
+gBS->InstallConfigurationTable (, 
NULL);
+  }
+  gRTConfigRespBuffer = ReallocateRuntimePool((gConfigLen + 1) * sizeof 
(CHAR16),(ConfigLen + 1) * sizeof (CHAR16),gRTConfigRespBuffer);
+}
+ASSERT (gRTConfigRespBuffer != NULL);
+
+gConfigLen = ConfigLen;
+
+//
+//install it to configuration table.
+//
+if (NewPackage){
+  gBS->InstallConfigurationTable (, 
gRTConfigRespBuffer);
+}
+
+FreePool(ConfigAltResp);
+  }
+
+  return EFI_SUCCESS;
+
+}
 
 /**
   This function adds the packages in the package list to the database and 
returns a handle. If there is a
   EFI_DEVICE_PATH_PROTOCOL associated with the DriverHandle, then this 
function will
   create a package of type EFI_PACKAGE_TYPE_DEVICE_PATH and add it to the 
package list.
@@ -2865,10 +2951,18 @@ HiiNewPackageList (
 Status = AddDevicePathPackage (Private, EFI_HII_DA