public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e
@ 2020-07-20  7:26 Feng, YunhuaX
  2020-07-20 14:30 ` Liming Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Feng, YunhuaX @ 2020-07-20  7:26 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Gao, Liming, Feng, Bob C

Fix regression issue by b41fac8e

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
 .../Source/C/FMMT/FirmwareModuleManagement.c  |  1 +
 BaseTools/Source/C/FMMT/FmmtLib.c             | 20 +++++++------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
index c8a53d3def..20663ba163 100644
--- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
+++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
@@ -1212,10 +1212,11 @@ FmmtImageAdd(
                 FvInFd->FfsAttuibutes[EndId].FfsName[_MAX_PATH - 1] = 0;
                 FvInFd->FfsAttuibutes[EndId].Level = NewAddedFfsLevel;
                 memset (&FvInFd->FfsAttuibutes[EndId].GuidName, '\0', sizeof(EFI_GUID));
                 if (EndId > 0) {
                     FvInFd->FfsAttuibutes[EndId].FvLevel = FvInFd->FfsAttuibutes[EndId - 1].FvLevel;
+                    FvInFd->FfsAttuibutes[EndId].FvId    = FvInFd->FfsAttuibutes[EndId - 1].FvId;
                     FvInFd->FfsAttuibutes[EndId - 1].IsFvEnd = 0;
                 }
                 FvInFd->FfsAttuibutes[EndId].IsFvEnd = 1;
                 FvInFd->FfsAttuibutes[EndId].IsFvStart = 0;
                 NewFileNode = NewFileNode->Next;
diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
index 2c3529680e..b945e9b63d 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -1,10 +1,10 @@
 /** @file

  Library to parse and generate FV image.

- Copyright (c)  2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c)  2019 - 2020, Intel Corporation. All rights reserved.<BR>
  SPDX-License-Identifier: BSD-2-Clause-Patent

 **/

 #include "FirmwareModuleManagement.h"
@@ -900,13 +900,11 @@ LibParseSection (
     case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:

       EncapDataNeedUpdata = TRUE;
       HasUiSection = TRUE;

-      if (FirstInFlag) {
-        Level ++;
-      }
+      Level ++;
       NumberOfSections ++;

       CurrentFv->FfsAttuibutes[*FfsCount].IsLeaf = FALSE;
       CurrentFv->FfsAttuibutes[*FfsCount].IsFvStart = TRUE;
       //
@@ -1193,13 +1191,10 @@ LibParseSection (
       // Put in encapsulate data information.
       //
       LocalEncapData = *CurrentFvEncapData;
       if (LocalEncapData->NextNode != NULL) {
         EncapDataNeedUpdata = FALSE;
-        while (Level != LocalEncapData->Level) {
-          LocalEncapData = LocalEncapData->NextNode;
-        }
         while (LocalEncapData->RightNode != NULL) {
           LocalEncapData = LocalEncapData->RightNode;
         }
       }
       GuidAttr = ((EFI_GUID_DEFINED_SECTION *)(Ptr + LargeHeaderOffset))->Attributes;
@@ -1524,13 +1519,10 @@ LibParseSection (

     //
     //Leaf sections
     //
     case EFI_SECTION_RAW:
-      if (FirstInFlag) {
-        Level++;
-      }
       NumberOfSections ++;
       CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
       if (!ViewFlag) {
         if (!*IsFfsGenerated) {
           LibGenFfsFile(CurrentFile, CurrentFv, FvName, Level, FfsCount, ErasePolarity);
@@ -2149,10 +2141,11 @@ LibGetFvInfo (
   EFI_FFS_FILE_HEADER2        *CurrentFile;
   UINTN                       Key;
   ENCAP_INFO_DATA             *LocalEncapData;
   EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHdrPtr;
   EFI_FIRMWARE_VOLUME_HEADER *FvHdr;
+  UINT8                      PreFvId;

   NumberOfFiles  = 0;
   Key            = 0;
   LocalEncapData = NULL;
   CurrentFile    = NULL;
@@ -2324,10 +2317,11 @@ LibGetFvInfo (
     CurrentFile = NULL;
   } else if (EFI_ERROR (Status)) {
     Error ("FMMT", 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
     return Status;
   }
+  PreFvId = *FvCount;

   while (CurrentFile != NULL) {

     //
     // Increment the number of files counter
@@ -2347,11 +2341,11 @@ LibGetFvInfo (
     CurrentFv->FfsHeader[*FfsCount].Type             = CurrentFile->Type;
     CurrentFv->FfsHeader[*FfsCount].ExtendedSize     = CurrentFile->ExtendedSize;
     CurrentFv->FfsAttuibutes[*FfsCount].Offset = Key - GetFfsFileLength ((EFI_FFS_FILE_HEADER *) CurrentFile);

     CurrentFv->FfsAttuibutes[*FfsCount].FvLevel = CurrentFv->FvLevel;
-    CurrentFv->FfsAttuibutes[*FfsCount].FvId    = *FvCount;
+    CurrentFv->FfsAttuibutes[*FfsCount].FvId    = PreFvId;
      if (CurrentFv->FvLevel > CurrentFv->MulFvLevel) {
       CurrentFv->MulFvLevel = CurrentFv->FvLevel;
    }
     //
     // Display info about this file
@@ -4333,11 +4327,11 @@ LibEncapNewFvFile(
       LocalEncapData = LocalEncapData->NextNode;
     }
   } else {
     LocalEncapData = CurrentEncapData;
     while (LocalEncapData != NULL) {
-      if (LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) {
+      if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) {
         LocalEncapDataTemp = LocalEncapData->RightNode;
         while (LocalEncapDataTemp != NULL) {
             LocalEncapDataNext = LocalEncapDataTemp->NextNode;
             if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) {
                 LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, LocalEncapDataTemp->Level-1, &ChildFileNameList);
@@ -4513,11 +4507,11 @@ LibEncapNewFvFile(
                 }
             }

             NewFileNameList = FvInFd->ChildFvFFS;
             while (NewFileNameList != NULL && NewFileNameList -> FFSName != NULL) {
-                if (NewFileNameList->FvId == LocalEncapData->FvId && NewFileNameList -> ParentLevel == ParentLevel && Index == NewFileNameList->InFvId && NewFileNameList->FfsFoundFlag==TRUE) {
+                if (NewFileNameList -> ParentLevel == ParentLevel && Index == NewFileNameList->InFvId && NewFileNameList->FfsFoundFlag==TRUE) {
                     if (FirstInFlag) {
                         Status = LibAddFfsFileToFvInf (NewFileNameList->FFSName, InfFile, TRUE);
                         FirstInFlag = FALSE;
                     } else {
                         Status = LibAddFfsFileToFvInf (NewFileNameList->FFSName, InfFile, FALSE);
--
2.27.0.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e
  2020-07-20  7:26 [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e Feng, YunhuaX
@ 2020-07-20 14:30 ` Liming Gao
  0 siblings, 0 replies; 2+ messages in thread
From: Liming Gao @ 2020-07-20 14:30 UTC (permalink / raw)
  To: Feng, YunhuaX, devel@edk2.groups.io; +Cc: Feng, Bob C

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng@intel.com>
> Sent: Monday, July 20, 2020 3:27 PM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e
> 
> Fix regression issue by b41fac8e
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
> ---
>  .../Source/C/FMMT/FirmwareModuleManagement.c  |  1 +
>  BaseTools/Source/C/FMMT/FmmtLib.c             | 20 +++++++------------
>  2 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> index c8a53d3def..20663ba163 100644
> --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.c
> @@ -1212,10 +1212,11 @@ FmmtImageAdd(
>                  FvInFd->FfsAttuibutes[EndId].FfsName[_MAX_PATH - 1] = 0;
>                  FvInFd->FfsAttuibutes[EndId].Level = NewAddedFfsLevel;
>                  memset (&FvInFd->FfsAttuibutes[EndId].GuidName, '\0', sizeof(EFI_GUID));
>                  if (EndId > 0) {
>                      FvInFd->FfsAttuibutes[EndId].FvLevel = FvInFd->FfsAttuibutes[EndId - 1].FvLevel;
> +                    FvInFd->FfsAttuibutes[EndId].FvId    = FvInFd->FfsAttuibutes[EndId - 1].FvId;
>                      FvInFd->FfsAttuibutes[EndId - 1].IsFvEnd = 0;
>                  }
>                  FvInFd->FfsAttuibutes[EndId].IsFvEnd = 1;
>                  FvInFd->FfsAttuibutes[EndId].IsFvStart = 0;
>                  NewFileNode = NewFileNode->Next;
> diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
> index 2c3529680e..b945e9b63d 100644
> --- a/BaseTools/Source/C/FMMT/FmmtLib.c
> +++ b/BaseTools/Source/C/FMMT/FmmtLib.c
> @@ -1,10 +1,10 @@
>  /** @file
> 
>   Library to parse and generate FV image.
> 
> - Copyright (c)  2019, Intel Corporation. All rights reserved.<BR>
> + Copyright (c)  2019 - 2020, Intel Corporation. All rights reserved.<BR>
>   SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "FirmwareModuleManagement.h"
> @@ -900,13 +900,11 @@ LibParseSection (
>      case EFI_SECTION_FIRMWARE_VOLUME_IMAGE:
> 
>        EncapDataNeedUpdata = TRUE;
>        HasUiSection = TRUE;
> 
> -      if (FirstInFlag) {
> -        Level ++;
> -      }
> +      Level ++;
>        NumberOfSections ++;
> 
>        CurrentFv->FfsAttuibutes[*FfsCount].IsLeaf = FALSE;
>        CurrentFv->FfsAttuibutes[*FfsCount].IsFvStart = TRUE;
>        //
> @@ -1193,13 +1191,10 @@ LibParseSection (
>        // Put in encapsulate data information.
>        //
>        LocalEncapData = *CurrentFvEncapData;
>        if (LocalEncapData->NextNode != NULL) {
>          EncapDataNeedUpdata = FALSE;
> -        while (Level != LocalEncapData->Level) {
> -          LocalEncapData = LocalEncapData->NextNode;
> -        }
>          while (LocalEncapData->RightNode != NULL) {
>            LocalEncapData = LocalEncapData->RightNode;
>          }
>        }
>        GuidAttr = ((EFI_GUID_DEFINED_SECTION *)(Ptr + LargeHeaderOffset))->Attributes;
> @@ -1524,13 +1519,10 @@ LibParseSection (
> 
>      //
>      //Leaf sections
>      //
>      case EFI_SECTION_RAW:
> -      if (FirstInFlag) {
> -        Level++;
> -      }
>        NumberOfSections ++;
>        CurrentFv->FfsAttuibutes[*FfsCount].Level = Level;
>        if (!ViewFlag) {
>          if (!*IsFfsGenerated) {
>            LibGenFfsFile(CurrentFile, CurrentFv, FvName, Level, FfsCount, ErasePolarity);
> @@ -2149,10 +2141,11 @@ LibGetFvInfo (
>    EFI_FFS_FILE_HEADER2        *CurrentFile;
>    UINTN                       Key;
>    ENCAP_INFO_DATA             *LocalEncapData;
>    EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHdrPtr;
>    EFI_FIRMWARE_VOLUME_HEADER *FvHdr;
> +  UINT8                      PreFvId;
> 
>    NumberOfFiles  = 0;
>    Key            = 0;
>    LocalEncapData = NULL;
>    CurrentFile    = NULL;
> @@ -2324,10 +2317,11 @@ LibGetFvInfo (
>      CurrentFile = NULL;
>    } else if (EFI_ERROR (Status)) {
>      Error ("FMMT", 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
>      return Status;
>    }
> +  PreFvId = *FvCount;
> 
>    while (CurrentFile != NULL) {
> 
>      //
>      // Increment the number of files counter
> @@ -2347,11 +2341,11 @@ LibGetFvInfo (
>      CurrentFv->FfsHeader[*FfsCount].Type             = CurrentFile->Type;
>      CurrentFv->FfsHeader[*FfsCount].ExtendedSize     = CurrentFile->ExtendedSize;
>      CurrentFv->FfsAttuibutes[*FfsCount].Offset = Key - GetFfsFileLength ((EFI_FFS_FILE_HEADER *) CurrentFile);
> 
>      CurrentFv->FfsAttuibutes[*FfsCount].FvLevel = CurrentFv->FvLevel;
> -    CurrentFv->FfsAttuibutes[*FfsCount].FvId    = *FvCount;
> +    CurrentFv->FfsAttuibutes[*FfsCount].FvId    = PreFvId;
>       if (CurrentFv->FvLevel > CurrentFv->MulFvLevel) {
>        CurrentFv->MulFvLevel = CurrentFv->FvLevel;
>     }
>      //
>      // Display info about this file
> @@ -4333,11 +4327,11 @@ LibEncapNewFvFile(
>        LocalEncapData = LocalEncapData->NextNode;
>      }
>    } else {
>      LocalEncapData = CurrentEncapData;
>      while (LocalEncapData != NULL) {
> -      if (LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) {
> +      if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) {
>          LocalEncapDataTemp = LocalEncapData->RightNode;
>          while (LocalEncapDataTemp != NULL) {
>              LocalEncapDataNext = LocalEncapDataTemp->NextNode;
>              if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) {
>                  LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, LocalEncapDataTemp->Level-1, &ChildFileNameList);
> @@ -4513,11 +4507,11 @@ LibEncapNewFvFile(
>                  }
>              }
> 
>              NewFileNameList = FvInFd->ChildFvFFS;
>              while (NewFileNameList != NULL && NewFileNameList -> FFSName != NULL) {
> -                if (NewFileNameList->FvId == LocalEncapData->FvId && NewFileNameList -> ParentLevel == ParentLevel && Index ==
> NewFileNameList->InFvId && NewFileNameList->FfsFoundFlag==TRUE) {
> +                if (NewFileNameList -> ParentLevel == ParentLevel && Index == NewFileNameList->InFvId && NewFileNameList-
> >FfsFoundFlag==TRUE) {
>                      if (FirstInFlag) {
>                          Status = LibAddFfsFileToFvInf (NewFileNameList->FFSName, InfFile, TRUE);
>                          FirstInFlag = FALSE;
>                      } else {
>                          Status = LibAddFfsFileToFvInf (NewFileNameList->FFSName, InfFile, FALSE);
> --
> 2.27.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-20 14:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-20  7:26 [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e Feng, YunhuaX
2020-07-20 14:30 ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox