MdeModulePkg: Export ConfigResp only for form Package after ReadyToBoot

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>
This commit is contained in:
Dandan Bi 2016-04-20 12:59:47 +08:00 committed by Star Zeng
parent e626a36c93
commit c87b13cdb5
2 changed files with 58 additions and 8 deletions

View File

@ -19,6 +19,7 @@ EFI_HII_PACKAGE_LIST_HEADER *gRTDatabaseInfoBuffer = NULL;
EFI_STRING gRTConfigRespBuffer = NULL;
UINTN gDatabaseInfoSize = 0;
UINTN gConfigRespSize = 0;
BOOLEAN gExportConfigResp = TRUE;
/**
This function generates a HII_DATABASE_RECORD node and adds into hii database.
@ -739,7 +740,16 @@ RemoveFormPackages (
PackageList->PackageListHdr.PackageLength -= Package->FormPkgHdr.Length;
FreePool (Package->IfrData);
FreePool (Package);
//
// If Hii runtime support feature is enabled,
// will export Hii info for runtime use after ReadyToBoot event triggered.
// If some driver add/update/remove packages from HiiDatabase after ReadyToBoot,
// will need to export the content of HiiDatabase.
// But if form packages removed, also need to export the ConfigResp string
//
if (gExportAfterReadyToBoot) {
gExportConfigResp = TRUE;
}
}
return EFI_SUCCESS;
@ -2486,6 +2496,16 @@ AddPackages (
(UINT8) (PackageHeader.Type),
DatabaseRecord->Handle
);
//
// If Hii runtime support feature is enabled,
// will export Hii info for runtime use after ReadyToBoot event triggered.
// If some driver add/update/remove packages from HiiDatabase after ReadyToBoot,
// will need to export the content of HiiDatabase.
// But if form packages added/updated, also need to export the ConfigResp string.
//
if (gExportAfterReadyToBoot) {
gExportConfigResp = TRUE;
}
break;
case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
Status = InsertKeyboardLayoutPackage (
@ -2781,7 +2801,7 @@ ExportPackageList (
}
/**
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.
@ -2790,7 +2810,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
)
{
@ -2804,11 +2824,6 @@ HiiGetConfigurationSetting(
Private = HII_DATABASE_DATABASE_PRIVATE_DATA_FROM_THIS (This);
//
// Get the HiiDatabase info.
//
HiiGetDatabaseInfo(This);
//
// Get ConfigResp string
//
@ -2888,6 +2903,39 @@ 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

View File

@ -146,6 +146,8 @@ OnReadyToBoot (
//
HiiGetConfigurationSetting(&mPrivate.HiiDatabase);
gExportAfterReadyToBoot = TRUE;
gBS->CloseEvent (Event);
}
/**