[edk2-devel] [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e
Liming Gao
liming.gao at intel.com
Mon Jul 20 14:30:27 UTC 2020
Reviewed-by: Liming Gao <liming.gao at intel.com>
> -----Original Message-----
> From: Feng, YunhuaX <yunhuax.feng at intel.com>
> Sent: Monday, July 20, 2020 3:27 PM
> To: devel at edk2.groups.io
> Cc: Gao, Liming <liming.gao at intel.com>; Feng, Bob C <bob.c.feng at intel.com>
> Subject: [edk2-staging][PATCH] BaseTools/Fmmt: Fix regression issue by b41fac8e
>
> Fix regression issue by b41fac8e
>
> Cc: Bob Feng <bob.c.feng at intel.com>
> Cc: Liming Gao <liming.gao at intel.com>
> Signed-off-by: Yunhua Feng <yunhuax.feng at 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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#62843): https://edk2.groups.io/g/devel/message/62843
Mute This Topic: https://groups.io/mt/75677604/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list