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