BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-)
Fixed replace file failure when FFS in multiple level FV and FV level over 2.
Signed-off-by: GregX Yeh <gregx.yeh@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
---
BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c
index b945e9b63d..bfb3b57d4a 100644
--- a/BaseTools/Source/C/FMMT/FmmtLib.c
+++ b/BaseTools/Source/C/FMMT/FmmtLib.c
@@ -709,10 +709,10 @@ LibGenFfsFile (
free(FfsFileName);
FfsFileName = NULL;
- CurrentFv->FfsNumbers = *FfsCount;
-
*FfsCount += 1;
+ CurrentFv->FfsNumbers = *FfsCount;
+
if (ErasePolarity) {
CurrentFile->State = (UINT8)~(CurrentFile->State);
}
@@ -833,7 +833,6 @@ LibParseSection (
CHAR8 *ToolInputFileName;
CHAR8 *ToolOutputFileName;
BOOLEAN HasUiSection;
- BOOLEAN FirstInFlag;
DataOffset = 0;
GuidAttr = 0;
@@ -869,7 +868,6 @@ LibParseSection (
EncapDataNeedUpdata = TRUE;
LargeHeaderOffset = 0;
HasUiSection = FALSE;
- FirstInFlag = TRUE;
while (ParsedLength < BufferLength) {
@@ -997,9 +995,7 @@ LibParseSection (
break;
case EFI_SECTION_COMPRESSION:
- if (FirstInFlag) {
- Level ++;
- }
+ Level ++;
NumberOfSections ++;
EncapDataNeedUpdata = TRUE;
@@ -1181,9 +1177,7 @@ LibParseSection (
// looks up the appropriate tool to use for extracting
// a GUID defined FV section.
//
- if (FirstInFlag) {
- Level ++;
- }
+ Level ++;
NumberOfSections++;
EncapDataNeedUpdata = TRUE;
HasUiSection = TRUE;
@@ -1682,7 +1676,6 @@ LibParseSection (
}
ParsedLength += SectionLength;
- FirstInFlag = FALSE;
//
// We make then next section begin on a 4-byte boundary
//
@@ -4198,10 +4191,13 @@ LibEncapNewFvFile(
UINT32 header;
UINT8 AlignN;
UINT8 AlignV[1] = {0xFF};
+ UINT32 EntryFvId;
+
AlignN = 0;
Id = 0;
InputFileSize = 0;
TmpFileSize = 0;
+ AlignmentFileSize = 0;
EncapFvIndex = 0;
Index = 0;
OuterIndex = 0;
@@ -4224,7 +4220,7 @@ LibEncapNewFvFile(
IsLargeFile = FALSE;
OutputFileSize = 0;
LargeFileSize = 0x1000000;
-
+ EntryFvId = 0;
OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION));
if (OutputFileNameList == NULL) {
@@ -4261,6 +4257,9 @@ LibEncapNewFvFile(
LocalEncapData = CurrentEncapData;
if (LocalEncapData == NULL) {
LocalEncapData = FvInFd->EncapData;
+ EntryFvId = 0xFFFFFFFF;
+ } else {
+ EntryFvId = LocalEncapData->FvId;
}
Level = LocalEncapData->Level;
Type = LocalEncapData->Type;
@@ -4274,7 +4273,7 @@ LibEncapNewFvFile(
LocalEncapDataNext = LocalEncapDataTemp->NextNode;
if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) {
- LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList);
+ LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList);
ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1;
if (FvInFd->ChildFvFFS == NULL) {
FvInFd->ChildFvFFS = ChildFileNameList;
@@ -4329,7 +4328,7 @@ LibEncapNewFvFile(
} else {
LocalEncapData = CurrentEncapData;
while (LocalEncapData != NULL) {
- if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) {
+ if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type == FMMT_ENCAP_TREE_FFS)) {
LocalEncapDataTemp = LocalEncapData->RightNode;
while (LocalEncapDataTemp != NULL) {
LocalEncapDataNext = LocalEncapDataTemp->NextNode;
@@ -4485,7 +4484,7 @@ LibEncapNewFvFile(
//
FfsFoundFlag = FALSE;
IsRootFv = FALSE;
- for (Index=0; Index <= FvInFd->FfsNumbers; Index++) {
+ for (Index=0; Index < FvInFd->FfsNumbers; Index++) {
if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){
break;
}
@@ -4818,6 +4817,7 @@ LibEncapNewFvFile(
memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1);
OutputFileNameList->IsFFS = TRUE;
OutputFileNameList->ParentLevel = ParentLevel - 1;
+ OutputFileNameList->InFvId = Id;
if (OutputFileNameList->Next == NULL){
break;
}
@@ -5077,10 +5077,6 @@ LibEncapNewFvFile(
if (CurrentEncapData == NULL) {
LocalEncapData = FvInFd->EncapData;
} else {
- if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) {
- *OutputFile = OutputFileNameList;
- return EFI_SUCCESS;
- }
LocalEncapData = CurrentEncapData;
}
ParentLevel -= 1;
--
2.16.2.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68452): https://edk2.groups.io/g/devel/message/68452
Mute This Topic: https://groups.io/mt/78798812/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Greg For the change of the following block, 1. - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + 2. - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { I think it's correct but I see there are many places still have such statement: "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) { " I think all others may also need to be changed from "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {" need to change to "for (Index = 0; Index < FvInFd->FfsNumbers; Index++) {" Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..bfb3b57d4a 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type + == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69175): https://edk2.groups.io/g/devel/message/69175 Mute This Topic: https://groups.io/mt/78798812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Bob, I have fixed for loop that use FfsNumbers. I attach new patch file. Thanks, Greg -----Original Message----- From: Feng, Bob C <bob.c.feng@intel.com> Sent: Friday, December 18, 2020 5:33 PM To: Yeh, GregX <gregx.yeh@intel.com>; devel@edk2.groups.io Cc: Liming Gao <gaoliming@byosoft.com.cn>; 'Yunhua Feng' <fengyunhua@byosoft.com.cn> Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Hi Greg For the change of the following block, 1. - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + 2. - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { I think it's correct but I see there are many places still have such statement: "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) { " I think all others may also need to be changed from "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {" need to change to "for (Index = 0; Index < FvInFd->FfsNumbers; Index++) {" Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..bfb3b57d4a 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type + == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69408): https://edk2.groups.io/g/devel/message/69408 Mute This Topic: https://groups.io/mt/78798812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=- From 54edfad456fdef488c953404f71b2aef646bc143 Mon Sep 17 00:00:00 2001 From: GregX Yeh <gregx.yeh@intel.com> Date: Tue, 1 Dec 2020 15:37:23 +0800 Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..60bd47e5bb 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4473,7 +4472,7 @@ LibEncapNewFvFile( while (LocalEncapData->Level != ParentLevel) { LocalEncapData = LocalEncapData->NextNode; } - for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index = 0; Index < FvInFd->FfsNumbers; Index++) { if ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName, &(LocalEncapData->FvExtHeader->FvName), sizeof(EFI_GUID)) == 0)) { SubFvId = Index; break; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1
Hi Greg, Could you send a code review mail with this patch embedded? Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Wednesday, December 23, 2020 4:01 PM To: Feng, Bob C <bob.c.feng@intel.com>; devel@edk2.groups.io Cc: Liming Gao <gaoliming@byosoft.com.cn>; 'Yunhua Feng' <fengyunhua@byosoft.com.cn> Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Hi Bob, I have fixed for loop that use FfsNumbers. I attach new patch file. Thanks, Greg -----Original Message----- From: Feng, Bob C <bob.c.feng@intel.com> Sent: Friday, December 18, 2020 5:33 PM To: Yeh, GregX <gregx.yeh@intel.com>; devel@edk2.groups.io Cc: Liming Gao <gaoliming@byosoft.com.cn>; 'Yunhua Feng' <fengyunhua@byosoft.com.cn> Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Hi Greg For the change of the following block, 1. - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + 2. - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { I think it's correct but I see there are many places still have such statement: "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) { " I think all others may also need to be changed from "for (Index = 0; Index <= FvInFd->FfsNumbers; Index++) {" need to change to "for (Index = 0; Index < FvInFd->FfsNumbers; Index++) {" Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..bfb3b57d4a 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type + == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#69528): https://edk2.groups.io/g/devel/message/69528 Mute This Topic: https://groups.io/mt/78798812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Greg, Is it the version 2 of the patch that you sent in 12/4? Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..bfb3b57d4a 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type + == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68454): https://edk2.groups.io/g/devel/message/68454 Mute This Topic: https://groups.io/mt/78798812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
Hi Bob, This is latest patch for FMMT. Thanks, Greg -----Original Message----- From: Feng, Bob C <bob.c.feng@intel.com> Sent: Tuesday, December 8, 2020 4:30 PM To: Yeh, GregX <gregx.yeh@intel.com>; devel@edk2.groups.io Cc: Liming Gao <gaoliming@byosoft.com.cn> Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Hi Greg, Is it the version 2 of the patch that you sent in 12/4? Thanks, Bob -----Original Message----- From: Yeh, GregX <gregx.yeh@intel.com> Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over 2. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> --- BaseTools/Source/C/FMMT/FmmtLib.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/FmmtLib.c index b945e9b63d..bfb3b57d4a 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName = NULL; - CurrentFv->FfsNumbers = *FfsCount; - *FfsCount += 1; + CurrentFv->FfsNumbers = *FfsCount; + if (ErasePolarity) { CurrentFile->State = (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; DataOffset = 0; GuidAttr = 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata = TRUE; LargeHeaderOffset = 0; HasUiSection = FALSE; - FirstInFlag = TRUE; while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; EncapDataNeedUpdata = TRUE; @@ -1181,9 +1177,7 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections++; EncapDataNeedUpdata = TRUE; HasUiSection = TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } ParsedLength += SectionLength; - FirstInFlag = FALSE; // // We make then next section begin on a 4-byte boundary // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] = {0xFF}; + UINT32 EntryFvId; + AlignN = 0; Id = 0; InputFileSize = 0; TmpFileSize = 0; + AlignmentFileSize = 0; EncapFvIndex = 0; Index = 0; OuterIndex = 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile = FALSE; OutputFileSize = 0; LargeFileSize = 0x1000000; - + EntryFvId = 0; OutputFileNameList = (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)); if (OutputFileNameList == NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData = CurrentEncapData; if (LocalEncapData == NULL) { LocalEncapData = FvInFd->EncapData; + EntryFvId = 0xFFFFFFFF; + } else { + EntryFvId = LocalEncapData->FvId; } Level = LocalEncapData->Level; Type = LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext = LocalEncapDataTemp->NextNode; if (LocalEncapDataNext != NULL && LocalEncapDataNext->NextNode != NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir, + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel = LocalEncapDataTemp->Level -1; if (FvInFd->ChildFvFFS == NULL) { FvInFd->ChildFvFFS = ChildFileNameList; @@ -4329,7 +4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData = CurrentEncapData; while (LocalEncapData != NULL) { - if (Level_Break > 1 && LocalEncapData->Type == FMMT_ENCAP_TREE_FFS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type + == FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp = LocalEncapData->RightNode; while (LocalEncapDataTemp != NULL) { LocalEncapDataNext = LocalEncapDataTemp->NextNode; @@ -4485,7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag = FALSE; IsRootFv = FALSE; - for (Index=0; Index <= FvInFd->FfsNumbers; Index++) { + for (Index=0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, strlen(OutputFileName)+1); OutputFileNameList->IsFFS = TRUE; OutputFileNameList->ParentLevel = ParentLevel - 1; + OutputFileNameList->InFvId = Id; if (OutputFileNameList->Next == NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( if (CurrentEncapData == NULL) { LocalEncapData = FvInFd->EncapData; } else { - if (OutputFileNameList != NULL && OutputFileNameList->FFSName != NULL && OutputFileNameList->IsFFS == TRUE) { - *OutputFile = OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData = CurrentEncapData; } ParentLevel -= 1; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68455): https://edk2.groups.io/g/devel/message/68455 Mute This Topic: https://groups.io/mt/78798812/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.