From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 68BD1AC00FD for ; Mon, 31 Jul 2023 00:47:10 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MpFQhkGD6wqHZowqDCYhEH26ZgckEEls7b62xSnsXWA=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690764429; v=1; b=bCkF7TyPNsoIob5FDjTNGb6b6m6fn6y//92J/4qG0l2BD4EUbS8mPjwLnlHdPvQtXAvffgI+ sIcuIFo4HX2uvYz4mlBh0JfxTV9gsMtAfLwNPF0xNkhZK/IXVER9/3g2dBpaVcMZedywUp/dG7+ VYqZOENWCjFMEDghVwpjIQVU= X-Received: by 127.0.0.2 with SMTP id 0WbTYY7687511x4g72SdvrTt; Sun, 30 Jul 2023 17:47:09 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.84911.1690764428041316798 for ; Sun, 30 Jul 2023 17:47:08 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="349191593" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="349191593" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 17:46:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10787"; a="818119053" X-IronPort-AV: E=Sophos;i="6.01,243,1684825200"; d="scan'208";a="818119053" X-Received: from shwdeqlab1144.ccr.corp.intel.com ([10.239.154.129]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2023 17:46:21 -0700 From: "Dandan Bi" To: devel@edk2.groups.io Cc: Liming Gao , Eric Dong Subject: [edk2-devel] [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStore Date: Mon, 31 Jul 2023 08:46:06 +0800 Message-Id: <20230731004606.1740-1-dandan.bi@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,dandan.bi@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: G1HEn2tMwGU3kiRWMrhVYEVHx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=bCkF7TyP; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io For EfiVarStore (EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER), it will call ExtractConfig-GetVariable-HiiBlockToConfig-ConfigToBlock when load storage value in LoadStorage function. It's not necessary and costs lots of time to do the conversion between config and block. So now enhance it to call GetVariable directly. Cc: Liming Gao Cc: Eric Dong Signed-off-by: Dandan Bi --- v2: Fix coding style issue. .../Universal/SetupBrowserDxe/Setup.c | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c index 5158baf5bd..2f7b11b1aa 100644 --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c @@ -5634,32 +5634,42 @@ LoadStorage ( ConfigRequest = Storage->ConfigRequest; } - // - // Request current settings from Configuration Driver - // - Status = mHiiConfigRouting->ExtractConfig ( - mHiiConfigRouting, - ConfigRequest, - &Progress, - &Result - ); - - // - // If get value fail, extract default from IFR binary - // - if (EFI_ERROR (Status)) { - ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, TRUE); - } else { + if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { // - // Convert Result from to + // Call GetVariable directly for EfiVarStore // - StrPtr = StrStr (Result, L"&GUID="); - if (StrPtr != NULL) { - *StrPtr = L'\0'; + Status = gRT->GetVariable (Storage->BrowserStorage->Name, &(Storage->BrowserStorage->Guid), NULL, (UINTN *)(&(Storage->BrowserStorage->Size)), Storage->BrowserStorage->EditBuffer); + if (EFI_ERROR (Status)) { + ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, TRUE); } + } else { + // + // Request current settings from Configuration Driver + // + Status = mHiiConfigRouting->ExtractConfig ( + mHiiConfigRouting, + ConfigRequest, + &Progress, + &Result + ); - Status = ConfigRespToStorage (Storage->BrowserStorage, Result); - FreePool (Result); + // + // If get value fail, extract default from IFR binary + // + if (EFI_ERROR (Status)) { + ExtractDefault (FormSet, NULL, EFI_HII_DEFAULT_CLASS_STANDARD, FormSetLevel, GetDefaultForStorage, Storage->BrowserStorage, TRUE, TRUE); + } else { + // + // Convert Result from to + // + StrPtr = StrStr (Result, L"&GUID="); + if (StrPtr != NULL) { + *StrPtr = L'\0'; + } + + Status = ConfigRespToStorage (Storage->BrowserStorage, Result); + FreePool (Result); + } } Storage->BrowserStorage->ConfigRequest = AllocateCopyPool (StrSize (Storage->ConfigRequest), Storage->ConfigRequest); -- 2.39.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107385): https://edk2.groups.io/g/devel/message/107385 Mute This Topic: https://groups.io/mt/100453623/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-