[edk2-devel] [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule

Bob Morgan via groups.io posted 1 patch 2 years, 5 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
.../Library/DxeCapsuleLibFmp/CapsuleOnDisk.c  | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
[edk2-devel] [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Posted by Bob Morgan via groups.io 2 years, 5 months ago
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:
+  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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82248): https://edk2.groups.io/g/devel/message/82248
Mute This Topic: https://groups.io/mt/86424126/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


[edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Posted by gaoliming 2 years, 5 months ago
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





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82885): https://edk2.groups.io/g/devel/message/82885
Mute This Topic: https://groups.io/mt/86667788/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Posted by Bob Morgan via groups.io 2 years, 5 months ago
Hi Liming,

BuildSg is supposed to mean 'Build Scatter-Gather'.  Maybe 'BuildGather' would be a better goto label since it matches the comment and the function?

Let me know.

Thanks,

-bob


-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming via groups.io
Sent: Thursday, October 28, 2021 7:46 PM
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: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule

External email: Use caution opening links or attachments


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










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82940): https://edk2.groups.io/g/devel/message/82940
Mute This Topic: https://groups.io/mt/86667788/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


回复: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Posted by gaoliming 2 years, 4 months ago
Bob:
  Yes. 'BuildGather' is better. 

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Bob Morgan
> via groups.io
> 发送时间: 2021年10月30日 0:02
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: 'Jian J Wang' <jian.j.wang@intel.com>; 'Guomin Jiang'
> <guomin.jiang@intel.com>
> 主题: Re: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp:
> Capsule on Disk file name capsule
> 
> Hi Liming,
> 
> BuildSg is supposed to mean 'Build Scatter-Gather'.  Maybe 'BuildGather'
> would be a better goto label since it matches the comment and the function?
> 
> Let me know.
> 
> Thanks,
> 
> -bob
> 
> 
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
> via groups.io
> Sent: Thursday, October 28, 2021 7:46 PM
> 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: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp:
> Capsule on Disk file name capsule
> 
> External email: Use caution opening links or attachments
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83070): https://edk2.groups.io/g/devel/message/83070
Mute This Topic: https://groups.io/mt/86757076/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Posted by Bob Morgan via groups.io 2 years, 4 months ago
Thanks Liming.  I will send a v2 patch with that change.

-bob

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming via groups.io
Sent: Monday, November 1, 2021 7:12 PM
To: devel@edk2.groups.io; Bob Morgan <bobm@nvidia.com>
Cc: 'Jian J Wang' <jian.j.wang@intel.com>; 'Guomin Jiang' <guomin.jiang@intel.com>
Subject: 回复: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule

External email: Use caution opening links or attachments


Bob:
  Yes. 'BuildGather' is better.

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Bob Morgan via 
> groups.io
> 发送时间: 2021年10月30日 0:02
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn
> 抄送: 'Jian J Wang' <jian.j.wang@intel.com>; 'Guomin Jiang'
> <guomin.jiang@intel.com>
> 主题: Re: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp:
> Capsule on Disk file name capsule
>
> Hi Liming,
>
> BuildSg is supposed to mean 'Build Scatter-Gather'.  Maybe 'BuildGather'
> would be a better goto label since it matches the comment and the function?
>
> Let me know.
>
> Thanks,
>
> -bob
>
>
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of 
> gaoliming via groups.io
> Sent: Thursday, October 28, 2021 7:46 PM
> 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: [edk2-devel] 回复: [PATCH] MdeModulePkg/DxeCapsuleLibFmp:
> Capsule on Disk file name capsule
>
> External email: Use caution opening links or attachments
>
>
> 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
>
>
>
>
>
>
>
>
>
>
>
>










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#83177): https://edk2.groups.io/g/devel/message/83177
Mute This Topic: https://groups.io/mt/86776360/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-