public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "gaoliming via groups.io" <gaoliming=byosoft.com.cn@groups.io>
To: "'Dong, Eric'" <eric.dong@intel.com>,
	"'Bi, Dandan'" <dandan.bi@intel.com>, <devel@edk2.groups.io>
Subject: [edk2-devel] 回复: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStore
Date: Wed, 2 Aug 2023 13:07:52 +0800	[thread overview]
Message-ID: <003b01d9c4ff$4a6f8f30$df4ead90$@byosoft.com.cn> (raw)
In-Reply-To: <DM4PR11MB64807F153CC83614B1671D91FE05A@DM4PR11MB6480.namprd11.prod.outlook.com>

Dandan:
  Have you collected the performance data for this enhancement? Is the
updated one better than before?

Thanks
Liming
> -----邮件原件-----
> 发件人: Dong, Eric <eric.dong@intel.com>
> 发送时间: 2023年7月31日 13:04
> 收件人: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io
> 抄送: Gao, Liming <gaoliming@byosoft.com.cn>
> 主题: RE: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via
> GetVariable for EfiVarStore
> 
> Reviewed-by: Eric Dong <eric.dong@intel.com>
> 
> -----Original Message-----
> From: Bi, Dandan <dandan.bi@intel.com>
> Sent: Monday, July 31, 2023 8:46 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <gaoliming@byosoft.com.cn>; Dong, Eric
> <eric.dong@intel.com>
> Subject: [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via
> GetVariable for EfiVarStore
> 
> 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 <gaoliming@byosoft.com.cn>
> Cc: Eric Dong <eric.dong@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
> 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 <ConfigAltResp> to <ConfigResp>
> +    // 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 <ConfigAltResp> to <ConfigResp>
> +      //
> +      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 (#107446): https://edk2.groups.io/g/devel/message/107446
Mute This Topic: https://groups.io/mt/100499712/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-08-02  5:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  0:46 [edk2-devel] [PATCH v2] MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStore Dandan Bi
2023-07-31  5:03 ` Dong, Eric
2023-08-02  5:07   ` gaoliming via groups.io [this message]
2023-08-03  4:52     ` Dandan Bi
2023-08-03 11:05       ` [edk2-devel] 回复: " gaoliming via groups.io
2023-08-04  6:01       ` [edk2-devel] " Ni, Ray
2023-08-04  6:16         ` Ni, Ray
2023-08-04  7:17           ` Dandan Bi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003b01d9c4ff$4a6f8f30$df4ead90$@byosoft.com.cn' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox