From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=dandan.bi@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2337821962301 for ; Fri, 12 Oct 2018 04:26:01 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2018 04:25:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,371,1534834800"; d="scan'208";a="87824326" Received: from shwdeopenpsi114.ccr.corp.intel.com ([10.239.157.135]) by FMSMGA003.fm.intel.com with ESMTP; 12 Oct 2018 04:25:59 -0700 From: Dandan Bi To: edk2-devel@lists.01.org Cc: Liming Gao , Eric Dong Date: Fri, 12 Oct 2018 19:25:40 +0800 Message-Id: <20181012112541.35880-2-dandan.bi@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20181012112541.35880-1-dandan.bi@intel.com> References: <20181012112541.35880-1-dandan.bi@intel.com> Subject: [patch 1/2] MdeModulePkg/HiiDB: Reorganize codes of exporting HII settings X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Oct 2018 11:26:01 -0000 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 Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Dandan Bi --- .../Universal/HiiDatabaseDxe/Database.c | 75 ++++++++----------- .../Universal/HiiDatabaseDxe/HiiDatabase.h | 6 +- .../HiiDatabaseDxe/HiiDatabaseEntry.c | 3 +- 3 files changed, 37 insertions(+), 47 deletions(-) diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c index 664687796f..1e2724f126 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Database.c @@ -19,11 +19,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 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); /** @@ -3433,43 +3433,10 @@ HiiGetDatabaseInfo( return EFI_SUCCESS; } -/** -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. @@ -3559,15 +3526,23 @@ 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; } @@ -3672,15 +3647,23 @@ HiiRemovePackageList ( FreePool (HiiHandle); FreePool (Node->PackageList); 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; } } @@ -3788,17 +3771,23 @@ HiiUpdatePackageList ( // Add all of the packages within the new package list // 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 @@ -2327,25 +2327,25 @@ This function mainly use to get HiiDatabase information. @retval EFI_SUCCESS Get the information successfully. @retval EFI_OUT_OF_RESOURCES Not enough memory to store the Hiidatabase data. **/ 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. @retval EFI_SUCCESS Get the information successfully. @retval EFI_OUT_OF_RESOURCES Not enough memory to store the Configuration Setting data. **/ EFI_STATUS -HiiGetConfigurationSetting( +HiiGetConfigRespInfo ( IN CONST EFI_HII_DATABASE_PROTOCOL *This ); // // Global variables 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 @@ -142,11 +142,12 @@ 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); } -- 2.18.0.windows.1