summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2018-10-11 14:37:09 +0800
committerHao Wu <hao.a.wu@intel.com>2018-10-26 15:08:40 +0800
commitadb2c050128c62ab96bdec95f648f9a18603b028 (patch)
tree05cd7f551339d71abdc8064960b168ee3472214c
parent599bb2be1f2b119dcde9e5a7515dc6f3d19eb29d (diff)
downloadedk2-adb2c050128c62ab96bdec95f648f9a18603b028.tar.gz
edk2-adb2c050128c62ab96bdec95f648f9a18603b028.tar.xz
edk2-adb2c050128c62ab96bdec95f648f9a18603b028.zip
MdeModulePkg/HiiDB: Reorganize codes of exporting HII settings
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1235 Function "HiiGetConfigurationSetting" may be called when HiiDatabase contents have been updated. And it is just to call function "HiiGetDatabaseInfo" to get the contents in HiiDatabase and call function "HiiGetConfigRespInfo" and get the configuration response string form HII drivers. So here we can remove function "HiiGetConfigurationSetting" and make caller to call "HiiGetDatabaseInfo" and "HiiGetConfigRespInfo" directly. And thus it also can distinguish which code blocks are to operate HiiDatabase contents and which code blocks are not. Then it's easy to know which code blocks should be atomic when updating HiiDatabase contents. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Database.c75
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h6
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c3
3 files changed, 37 insertions, 47 deletions
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
index 664687796f..655eba8cb9 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c
@@ -21,7 +21,7 @@ EFI_HII_PACKAGE_LIST_HEADER *gRTDatabaseInfoBuffer = NULL;
EFI_STRING gRTConfigRespBuffer = NULL;
UINTN gDatabaseInfoSize = 0;
UINTN gConfigRespSize = 0;
-BOOLEAN gExportConfigResp = TRUE;
+BOOLEAN gExportConfigResp = FALSE;
UINTN gNvDefaultStoreSize = 0;
SKU_ID gSkuId = 0xFFFFFFFFFFFFFFFF;
LIST_ENTRY gVarStorageList = INITIALIZE_LIST_HEAD_VARIABLE (gVarStorageList);
@@ -3436,39 +3436,6 @@ HiiGetDatabaseInfo(
}
/**
-This function mainly use to get and update configuration settings information.
-
-@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
-
-@retval EFI_SUCCESS Get the information successfully.
-@retval EFI_OUT_OF_RESOURCES Not enough memory to store the Configuration Setting data.
-
-**/
-EFI_STATUS
-HiiGetConfigurationSetting(
- IN CONST EFI_HII_DATABASE_PROTOCOL *This
- )
-{
- EFI_STATUS Status;
-
- //
- // Get the HiiDatabase info.
- //
- Status = HiiGetDatabaseInfo(This);
-
- //
- // Get ConfigResp string
- //
- if (gExportConfigResp) {
- Status = HiiGetConfigRespInfo (This);
- gExportConfigResp = FALSE;
- }
- return Status;
-
-}
-
-
-/**
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.
@@ -3561,11 +3528,19 @@ HiiNewPackageList (
*Handle = DatabaseRecord->Handle;
//
- // Check whether need to get the Database and configuration setting info.
+ // Check whether need to get the Database info.
// Only after ReadyToBoot, need to do the export.
//
if (gExportAfterReadyToBoot) {
- HiiGetConfigurationSetting(This);
+ HiiGetDatabaseInfo (This);
+ }
+
+ //
+ // Check whether need to get the configuration setting info from HII drivers.
+ // When after ReadyToBoot and need to do the export for form package add.
+ //
+ if (gExportAfterReadyToBoot && gExportConfigResp) {
+ HiiGetConfigRespInfo (This);
}
return EFI_SUCCESS;
@@ -3674,11 +3649,19 @@ HiiRemovePackageList (
FreePool (Node);
//
- // Check whether need to get the Database and configuration setting info.
+ // Check whether need to get the Database info.
// Only after ReadyToBoot, need to do the export.
//
if (gExportAfterReadyToBoot) {
- HiiGetConfigurationSetting(This);
+ HiiGetDatabaseInfo (This);
+ }
+
+ //
+ // Check whether need to get the configuration setting info from HII drivers.
+ // When after ReadyToBoot and need to do the export for form package remove.
+ //
+ if (gExportAfterReadyToBoot && gExportConfigResp) {
+ HiiGetConfigRespInfo (This);
}
return EFI_SUCCESS;
}
@@ -3790,13 +3773,19 @@ HiiUpdatePackageList (
Status = AddPackages (Private, EFI_HII_DATABASE_NOTIFY_ADD_PACK, PackageList, Node);
//
- // Check whether need to get the Database and configuration setting info.
+ // Check whether need to get the Database info.
// Only after ReadyToBoot, need to do the export.
//
- if (gExportAfterReadyToBoot) {
- if (Status == EFI_SUCCESS){
- HiiGetConfigurationSetting(This);
- }
+ if (gExportAfterReadyToBoot && Status == EFI_SUCCESS) {
+ HiiGetDatabaseInfo (This);
+ }
+
+ //
+ // Check whether need to get the configuration setting info from HII drivers.
+ // When after ReadyToBoot and need to do the export for form package update.
+ //
+ if (gExportAfterReadyToBoot && gExportConfigResp && Status == EFI_SUCCESS) {
+ HiiGetConfigRespInfo (This);
}
return Status;
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
index 4391625a9f..3a6eb8a55c 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabase.h
@@ -2329,12 +2329,12 @@ This function mainly use to get HiiDatabase information.
**/
EFI_STATUS
-HiiGetDatabaseInfo(
+HiiGetDatabaseInfo (
IN CONST EFI_HII_DATABASE_PROTOCOL *This
);
/**
-This is an internal function,mainly use to get and update configuration settings information.
+This function mainly use to get and update ConfigResp string.
@param This A pointer to the EFI_HII_DATABASE_PROTOCOL instance.
@@ -2343,7 +2343,7 @@ This is an internal function,mainly use to get and update configuration settings
**/
EFI_STATUS
-HiiGetConfigurationSetting(
+HiiGetConfigRespInfo (
IN CONST EFI_HII_DATABASE_PROTOCOL *This
);
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
index 5951b5e304..1a71798ac0 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseEntry.c
@@ -144,7 +144,8 @@ OnReadyToBoot (
// When ready to boot, we begin to export the HiiDatabase date.
// And hook all the possible HiiDatabase change actions to export data.
//
- HiiGetConfigurationSetting(&mPrivate.HiiDatabase);
+ HiiGetDatabaseInfo (&mPrivate.HiiDatabase);
+ HiiGetConfigRespInfo (&mPrivate.HiiDatabase);
gExportAfterReadyToBoot = TRUE;
gBS->CloseEvent (Event);