From: "gaoliming" <gaoliming@byosoft.com.cn>
To: "'Bob Morgan'" <bobm@nvidia.com>, <devel@edk2.groups.io>
Cc: "'Jian J Wang'" <jian.j.wang@intel.com>,
"'Guomin Jiang'" <guomin.jiang@intel.com>
Subject: 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Date: Fri, 29 Oct 2021 09:46:26 +0800 [thread overview]
Message-ID: <00a501d7cc66$c954fe40$5bfefac0$@byosoft.com.cn> (raw)
In-Reply-To: <40287570ea45e6e5724c00657a7f9ef99f8693d0.1634587878.git.bobm@nvidia.com>
Bob:
> -----邮件原件-----
> 发件人: Bob Morgan <bobm@nvidia.com>
> 发送时间: 2021年10月19日 4:12
> 收件人: devel@edk2.groups.io
> 抄送: Bob Morgan <bobm@nvidia.com>; Jian J Wang
> <jian.j.wang@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Guomin
> Jiang <guomin.jiang@intel.com>
> 主题: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name
> capsule
>
> Enhance RelocateCapsuleToRam() to skip creation of the Capsule on Disk
> file name capsule if PcdSupportUpdateCapsuleReset feature is not enabled.
> This avoids an EFI_UNSUPPORTED return status from UpdateCapsule() when
> the
> file name capsule is encountered and PcdSupportUpdateCapsuleReset is
> FALSE.
>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Guomin Jiang <guomin.jiang@intel.com>
> Signed-off-by: Bob Morgan <bobm@nvidia.com>
> ---
> .../Library/DxeCapsuleLibFmp/CapsuleOnDisk.c | 19
> ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c
> index 4c32c6cdcf..e65e335585 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/CapsuleOnDisk.c
> @@ -1739,6 +1739,7 @@ RelocateCapsuleToRam (
> UINT8 *StringBuf;
> UINTN StringSize;
> UINTN TotalStringSize;
> + UINTN CapsulesToProcess;
>
> CapsuleOnDiskBuf = NULL;
> BlockDescriptors = NULL;
> @@ -1778,6 +1779,13 @@ RelocateCapsuleToRam (
> TotalStringSize += StrSize
> (CapsuleOnDiskBuf[Index].FileInfo->FileName);
> }
>
> + // If Persist Across Reset isn't supported, skip the file name strings
capsule
> + if (!FeaturePcdGet (PcdSupportUpdateCapsuleReset)) {
> + CapsulesToProcess = CapsuleOnDiskNum;
> + goto BuildSg;
> + }
> + CapsulesToProcess = CapsuleOnDiskNum + 1;
> +
> FileNameCapsule = AllocateZeroPool (sizeof (EFI_CAPSULE_HEADER) +
> TotalStringSize);
> if (FileNameCapsule == NULL) {
> DEBUG ((DEBUG_ERROR, "Fail to allocate memory for name
> capsule.\n"));
> @@ -1804,18 +1812,23 @@ RelocateCapsuleToRam (
> //
> // 3. Build Gather list for the capsules
> //
> - Status = BuildGatherList (CapsuleBuffer, CapsuleSize, CapsuleOnDiskNum
+
> 1, &BlockDescriptors);
> +BuildSg:
What does 'BuildSg' mean?
Thanks
Liming
> + Status = BuildGatherList (CapsuleBuffer, CapsuleSize,
CapsulesToProcess,
> &BlockDescriptors);
> if (EFI_ERROR (Status) || BlockDescriptors == NULL) {
> FreePool (CapsuleBuffer);
> FreePool (CapsuleSize);
> - FreePool (FileNameCapsule);
> + if (FileNameCapsule != NULL) {
> + FreePool (FileNameCapsule);
> + }
> return EFI_OUT_OF_RESOURCES;
> }
>
> //
> // 4. Call UpdateCapsule() service
> //
> - Status = gRT->UpdateCapsule((EFI_CAPSULE_HEADER **) CapsuleBuffer,
> CapsuleOnDiskNum + 1, (UINTN) BlockDescriptors);
> + Status = gRT->UpdateCapsule ((EFI_CAPSULE_HEADER **) CapsuleBuffer,
> + CapsulesToProcess,
> + (UINTN) BlockDescriptors);
>
> return Status;
> }
> --
> 2.17.1
next prev parent reply other threads:[~2021-10-29 1:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 20:11 [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule Bob Morgan
2021-10-29 1:46 ` gaoliming [this message]
2021-10-29 16:01 ` [edk2-devel] 回复: " Bob Morgan
2021-11-02 1:11 ` 回复: " gaoliming
2021-11-02 20:35 ` Bob Morgan
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='00a501d7cc66$c954fe40$5bfefac0$@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