From nobody Tue Apr 30 12:07:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+68036+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68036+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1606443425; cv=none; d=zohomail.com; s=zohoarc; b=DjA2EJ/g6tIKvE5G7UtYoVdJqz8ObUyn4QsMmZEbot2mHfqEMcdY7uKX09+sLgUw/LhSNJAtBFkmcUBfRTKxJRgh+H+7dZf3RDWGclQ9LLVbTRz7UoYujRY6olOTx190esP9h+g+gGaPGbryx/YVVH5WIcM/jSdPzL8hY3oEDKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606443425; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=8bdST5F38CtgdstcDt7zQTT22NubeAp8nTaqWJgNvOQ=; b=gpuQ8SCa09TwOlVK5M5ty7fu1y14Z+viUnr/sxVOuw/Z7qDHMM1SWIF38MfkLpXuYaK2hUwbW1Wbmb6M/V4S7tnzD/hJPQd1c9BqLtgXM52mV++ewP4yDaiKVyhJnBfW3/XGBWK3BEZnLaMjRyP4loGNyynM6zxq6omt/qY6K7o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+68036+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1606443425320558.0606607514003; Thu, 26 Nov 2020 18:17:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hSUZYY1788612xugFEeqSiXg; Thu, 26 Nov 2020 18:17:04 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.13843.1606443424310461774 for ; Thu, 26 Nov 2020 18:17:04 -0800 IronPort-SDR: Z0QZ61mYVqJvcfyGKl4FRrx04NqHjgsSDhHuiBD3R3FRcBZUvKjuP///p3oiRDwsO1szFhW8Lx eVkMfEsbgTEA== X-IronPort-AV: E=McAfee;i="6000,8403,9817"; a="172439343" X-IronPort-AV: E=Sophos;i="5.78,373,1599548400"; d="scan'208";a="172439343" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Nov 2020 18:17:03 -0800 IronPort-SDR: tqo8NkSfXX3Mme/EoiqqolkROIpuhlHTb27Vb3YoiK6wwzjcxO7fd8sPciAGrwSOtcj44A5+FN 6OY8kgO3l7gg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,373,1599548400"; d="scan'208";a="479533270" X-Received: from chinghux-desk1.gar.corp.intel.com ([10.5.215.141]) by orsmga004.jf.intel.com with ESMTP; 26 Nov 2020 18:17:01 -0800 From: "GregX Yeh" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Date: Fri, 27 Nov 2020 10:16:58 +0800 Message-Id: <20201127021658.11480-1-gregx.yeh@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,gregx.yeh@intel.com X-Gm-Message-State: 4NQsM1zIIjenoLa4ZocYlHr2x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1606443424; bh=/nwaaAbYMysbu6WPi9+w+c4YALREXlLRy1+ijmw04fE=; h=Cc:Date:From:Reply-To:Subject:To; b=mzSYinJsoPehD2d3Fx3eCCwGufCfROtEnYGk44YuFE4orMXEgNOBnBI9fd4I2G2p1BA Fhjjxg+gNhN0KtNT6tFxt/clZdZ/4u2/VezDRxf4F1Ipv8BZnQVaO4SdkJ6bLJar7rGAZ P2P6xoCk554i17VpiGB52v3PK+pg6ReWmZM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fixed replace file failure when FFS in multi level FV and FV level over 2. Signed-off-by: GregX Yeh Cc: Bob Feng Cc: Liming Gao --- BaseTools/Source/C/FMMT/FirmwareModuleManagement.h | 4 +- BaseTools/Source/C/FMMT/FmmtLib.c | 654 ++++++++++-------= ---- 2 files changed, 326 insertions(+), 332 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.h b/BaseTools= /Source/C/FMMT/FirmwareModuleManagement.h index 9d09c9160a..ccc8ba00be 100644 --- a/BaseTools/Source/C/FMMT/FirmwareModuleManagement.h +++ b/BaseTools/Source/C/FMMT/FirmwareModuleManagement.h @@ -195,7 +195,7 @@ typedef struct { // UI Name for this FFS file, if has. // CHAR16 UiName[_MAX_PATH]; - UINT32 UiNameSize; + UINT32 UiNameSize; // // Total section number in this FFS. // @@ -208,7 +208,7 @@ typedef struct { // //Describe the belong to FV // - UINT8 FvId; + UINT8 FvId; // // If this FFS has no encapsulate section, this flag will set to True. // diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/Fm= mtLib.c index b945e9b63d..d6d43030fa 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -709,10 +709,10 @@ LibGenFfsFile ( free(FfsFileName); FfsFileName =3D NULL; =20 - CurrentFv->FfsNumbers =3D *FfsCount; - *FfsCount +=3D 1; =20 + CurrentFv->FfsNumbers =3D *FfsCount; + if (ErasePolarity) { CurrentFile->State =3D (UINT8)~(CurrentFile->State); } @@ -833,7 +833,6 @@ LibParseSection ( CHAR8 *ToolInputFileName; CHAR8 *ToolOutputFileName; BOOLEAN HasUiSection; - BOOLEAN FirstInFlag; =20 DataOffset =3D 0; GuidAttr =3D 0; @@ -869,7 +868,6 @@ LibParseSection ( EncapDataNeedUpdata =3D TRUE; LargeHeaderOffset =3D 0; HasUiSection =3D FALSE; - FirstInFlag =3D TRUE; =20 =20 while (ParsedLength < BufferLength) { @@ -997,9 +995,7 @@ LibParseSection ( break; =20 case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; - } + Level ++; NumberOfSections ++; =20 EncapDataNeedUpdata =3D 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 =3D TRUE; HasUiSection =3D TRUE; @@ -1682,7 +1676,6 @@ LibParseSection ( } =20 ParsedLength +=3D SectionLength; - FirstInFlag =3D FALSE; // // We make then next section begin on a 4-byte boundary // @@ -2016,7 +2009,7 @@ LibGetFileInfo ( =20 LocalEncapData->Level =3D Level; LocalEncapData->Type =3D FMMT_ENCAP_TREE_FFS; - LocalEncapData->FvExtHeader =3D NULL; + LocalEncapData->FvExtHeader =3D NULL; LocalEncapData->Depex =3D NULL; LocalEncapData->DepexLen =3D 0; LocalEncapData->UiNameSize =3D 0; @@ -4198,6 +4191,7 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] =3D {0xFF}; + =20 AlignN =3D 0; Id =3D 0; InputFileSize =3D 0; @@ -4225,7 +4219,6 @@ LibEncapNewFvFile( OutputFileSize =3D 0; LargeFileSize =3D 0x1000000; =20 - OutputFileNameList =3D (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)= ); if (OutputFileNameList =3D=3D NULL) { Error ("FMMT", 0, 0004, "Out of resource, memory allocation failed! \n= ", ""); @@ -4258,12 +4251,12 @@ LibEncapNewFvFile( // // Encapsulate from the lowest FFS file level. // - LocalEncapData =3D CurrentEncapData; - if (LocalEncapData =3D=3D NULL) { - LocalEncapData =3D FvInFd->EncapData; - } - Level =3D LocalEncapData->Level; - Type =3D LocalEncapData->Type; + LocalEncapData =3D CurrentEncapData; + if (LocalEncapData =3D=3D NULL) { + LocalEncapData =3D FvInFd->EncapData; + } + Level =3D LocalEncapData->Level; + Type =3D LocalEncapData->Type; =20 if (CurrentEncapData =3D=3D NULL) { LocalEncapData =3D FvInFd->EncapData; @@ -4271,22 +4264,21 @@ LibEncapNewFvFile( if (LocalEncapData->Type =3D=3D FMMT_ENCAP_TREE_FFS) { LocalEncapDataTemp =3D LocalEncapData->RightNode; while (LocalEncapDataTemp !=3D NULL) { - LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; - if (LocalEncapDataNext !=3D NULL && LocalEncapDataNext->NextNo= de !=3D NULL) { - - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &= ChildFileNameList); - ChildFileNameList->ParentLevel =3D LocalEncapDataTemp->Lev= el -1; - if (FvInFd->ChildFvFFS =3D=3D NULL) { - FvInFd->ChildFvFFS =3D ChildFileNameList; - } else { - NewFileNameList =3D FvInFd->ChildFvFFS; - while (NewFileNameList->Next !=3D NULL) { - NewFileNameList =3D NewFileNameList->Next; - } - NewFileNameList->Next =3D ChildFileNameList; + LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; + if(LocalEncapDataNext !=3D NULL && LocalEncapDataNext->NextNode = !=3D NULL) { + LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, LocalEnc= apDataTemp->Level-1, &ChildFileNameList); + //ChildFileNameList->ParentLevel =3D LocalEncapDataTemp->Level= -1; + if (FvInFd->ChildFvFFS =3D=3D NULL) { + FvInFd->ChildFvFFS =3D ChildFileNameList; + } else { + NewFileNameList =3D FvInFd->ChildFvFFS; + while (NewFileNameList->Next !=3D NULL) { + NewFileNameList =3D NewFileNameList->Next; } + NewFileNameList->Next =3D ChildFileNameList; } - LocalEncapDataTemp =3D LocalEncapDataTemp->RightNode; + } + LocalEncapDataTemp =3D LocalEncapDataTemp->RightNode; } } =20 @@ -4329,24 +4321,24 @@ LibEncapNewFvFile( } else { LocalEncapData =3D CurrentEncapData; while (LocalEncapData !=3D NULL) { - if (Level_Break > 1 && LocalEncapData->Type =3D=3D FMMT_ENCAP_TREE_F= FS) { + if (LocalEncapData->Type =3D=3D FMMT_ENCAP_TREE_FFS) { LocalEncapDataTemp =3D LocalEncapData->RightNode; while (LocalEncapDataTemp !=3D NULL) { - LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; - if (LocalEncapDataNext !=3D NULL && LocalEncapDataNext->NextNo= de !=3D NULL) { - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, Loca= lEncapDataTemp->Level-1, &ChildFileNameList); - //ChildFileNameList->ParentLevel =3D LocalEncapDataTemp->L= evel -1; - if (FvInFd->ChildFvFFS =3D=3D NULL) { - FvInFd->ChildFvFFS =3D ChildFileNameList; - } else { - NewFileNameList =3D FvInFd->ChildFvFFS; - while (NewFileNameList->Next !=3D NULL) { - NewFileNameList =3D NewFileNameList->Next; - } - NewFileNameList->Next =3D ChildFileNameList; + LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; + if (LocalEncapDataNext !=3D NULL && LocalEncapDataNext->NextNode= !=3D NULL) { + LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, LocalEnc= apDataTemp->Level-1, &ChildFileNameList); + //ChildFileNameList->ParentLevel =3D LocalEncapDataTemp->Level= -1; + if (FvInFd->ChildFvFFS =3D=3D NULL) { + FvInFd->ChildFvFFS =3D ChildFileNameList; + } else { + NewFileNameList =3D FvInFd->ChildFvFFS; + while (NewFileNameList->Next !=3D NULL) { + NewFileNameList =3D NewFileNameList->Next; } + NewFileNameList->Next =3D ChildFileNameList; } - LocalEncapDataTemp =3D LocalEncapDataTemp->RightNode; + } + LocalEncapDataTemp =3D LocalEncapDataTemp->RightNode; } } if (LocalEncapData->Level > Level) { @@ -4366,12 +4358,12 @@ LibEncapNewFvFile( case FMMT_ENCAP_TREE_FV: OutputFileNameListFlag =3D TRUE; EncapFvStart =3D 0; - for(OuterIndex=3D0;OutputFileNameListFlag;OuterIndex++){ + for(OuterIndex=3D0;OutputFileNameListFlag;OuterIndex++){ // // Generate FV.inf attributes. // InfFileName =3D LibFilenameStrExtended (strrchr(GenTempFile (),OS_= SEP), TemDir, "inf"); - FirstInFlag =3D TRUE; + FirstInFlag =3D TRUE; =20 InfFile =3D fopen (InfFileName, "wt+"); =20 @@ -4383,9 +4375,9 @@ LibEncapNewFvFile( } =20 if (CurrentEncapData =3D=3D NULL) { - LocalEncapData =3D FvInFd->EncapData; + LocalEncapData =3D FvInFd->EncapData; } else { - LocalEncapData =3D CurrentEncapData; + LocalEncapData =3D CurrentEncapData; } =20 while (LocalEncapData->NextNode !=3D NULL) { @@ -4456,6 +4448,7 @@ LibEncapNewFvFile( free (ChildFileNameList); return Status; } + if (LocalEncapData->FvExtHeader !=3D NULL) { Status =3D LibGenExtFile(LocalEncapData->FvExtHeader, InfFile); if (EFI_ERROR(Status)) { @@ -4473,93 +4466,93 @@ LibEncapNewFvFile( while (LocalEncapData->Level !=3D ParentLevel) { LocalEncapData =3D LocalEncapData->NextNode; } - for (Index =3D 0; Index <=3D FvInFd->FfsNumbers; Index++) { - if ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName, &(Loca= lEncapData->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)) { - SubFvId =3D Index; - break; - } + for (Index =3D 0; Index <=3D FvInFd->FfsNumbers; Index++) { + if ((memcmp(&FvInFd->FfsAttuibutes[Index].GuidName, &(LocalEnc= apData->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)) { + SubFvId =3D Index; + break; } + } } // // Found FFSs from Fv structure. // FfsFoundFlag =3D FALSE; IsRootFv =3D FALSE; - for (Index=3D0; Index <=3D FvInFd->FfsNumbers; Index++) { - if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSNam= e !=3D NULL && OutputFileNameList->IsFFS =3D=3D FALSE){ - break; - } - if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSNam= e !=3D NULL && OutputFileNameList->IsFFS =3D=3D TRUE){ - if (Index =3D=3D EncapFvIndex) { - if (FirstInFlag) { - Status =3D LibAddFfsFileToFvInf (OutputFileNam= eList->FFSName, InfFile, TRUE); - FirstInFlag =3D FALSE; - } else { - Status =3D LibAddFfsFileToFvInf (OutputFileNam= eList->FFSName, InfFile, FALSE); - } - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsula= te FD Image", "Generate FV inf file [files] section failed!"); - fclose (InfFile); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } - } + for (Index =3D 0; Index < FvInFd->FfsNumbers; Index++) { + if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSName = !=3D NULL && OutputFileNameList->IsFFS =3D=3D FALSE){ + break; + } + if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSName = !=3D NULL && OutputFileNameList->IsFFS =3D=3D TRUE){ + if (Index =3D=3D EncapFvIndex) { + if (FirstInFlag) { =20 + Status =3D LibAddFfsFileToFvInf (OutputFileNameList->FFSNa= me, InfFile, TRUE); + FirstInFlag =3D FALSE; + } else { + Status =3D LibAddFfsFileToFvInf (OutputFileNameList->FFSNa= me, InfFile, FALSE); + } + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image"= , "Generate FV inf file [files] section failed!"); + fclose (InfFile); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } } + } =20 - NewFileNameList =3D FvInFd->ChildFvFFS; - while (NewFileNameList !=3D NULL && NewFileNameList -> FFSName= !=3D NULL) { - if (NewFileNameList -> ParentLevel =3D=3D ParentLevel && I= ndex =3D=3D NewFileNameList->InFvId && NewFileNameList->FfsFoundFlag=3D=3DT= RUE) { - if (FirstInFlag) { - Status =3D LibAddFfsFileToFvInf (NewFileNameList->= FFSName, InfFile, TRUE); - FirstInFlag =3D FALSE; - } else { - Status =3D LibAddFfsFileToFvInf (NewFileNameList->= FFSName, InfFile, FALSE); - } - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate F= D Image", "Generate FV inf file [files] section failed!"); - fclose (InfFile); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } - NewFileNameList->FfsFoundFlag =3D FALSE; - } - NewFileNameList =3D NewFileNameList->Next; + NewFileNameList =3D FvInFd->ChildFvFFS; + while (NewFileNameList !=3D NULL && NewFileNameList -> FFSName != =3D NULL) { + if (NewFileNameList -> ParentLevel =3D=3D ParentLevel && Index= =3D=3D NewFileNameList->InFvId && NewFileNameList->FfsFoundFlag=3D=3DTRUE)= { + if (FirstInFlag) { + Status =3D LibAddFfsFileToFvInf (NewFileNameList->FFSName,= InfFile, TRUE); + FirstInFlag =3D FALSE; + } else { + Status =3D LibAddFfsFileToFvInf (NewFileNameList->FFSName,= InfFile, FALSE); + } + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image"= , "Generate FV inf file [files] section failed!"); + fclose (InfFile); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } + NewFileNameList->FfsFoundFlag =3D FALSE; } + NewFileNameList =3D NewFileNameList->Next; + } =20 - if (FvInFd->FfsAttuibutes[Index].IsHandle=3D=3DTRUE) { - continue; - } - if (SubFvId > 0 && Index < SubFvId) { - continue; - } + if (FvInFd->FfsAttuibutes[Index].IsHandle=3D=3DTRUE) { + continue; + } + if (SubFvId > 0 && Index < SubFvId) { + continue; + } =20 // // For the last level FFS, the level below FFSs we should not ca= re the IsLeaf Flag. // if (IsLastLevelFfs) { IsLeafFlagIgnore =3D TRUE; - } else { - IsLeafFlagIgnore =3D FvInFd->FfsAttuibutes[Index].IsLeaf; - } + } else { + IsLeafFlagIgnore =3D FvInFd->FfsAttuibutes[Index].IsLeaf; + } =20 if (FvInFd->FfsAttuibutes[Index].FvId =3D=3D LocalEncapData->FvI= d && FvInFd->FfsAttuibutes[Index].Level >=3D ParentLevel + 1 && IsLeafFlag= Ignore) { if (FirstInFlag) { - if (FvInFd->FfsAttuibutes[Index].Level < 0xFF) { - FfsFoundFlag =3D TRUE; - Status =3D LibAddFfsFileToFvInf (FvInFd->FfsAttuibutes[Index].Ff= sName, InfFile, TRUE); - FirstInFlag =3D FALSE; - FvInFd->FfsAttuibutes[Index].IsHandle=3DTRUE; - EncapFvStart =3D Index; - } + if (FvInFd->FfsAttuibutes[Index].Level < 0xFF) { + FfsFoundFlag =3D TRUE; + Status =3D LibAddFfsFileToFvInf (FvInFd->FfsAttuibutes[Ind= ex].FfsName, InfFile, TRUE); + FirstInFlag =3D FALSE; + FvInFd->FfsAttuibutes[Index].IsHandle=3DTRUE; + EncapFvStart =3D Index; + } =20 if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate FD Imag= e", "Generate FV inf file [files] section failed!"); - fclose (InfFile); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; + Error ("FMMT", 0, 0004, "error while encapsulate FD Image"= , "Generate FV inf file [files] section failed!"); + fclose (InfFile); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; } if (Index =3D=3D 0) { // Root FV need to include all FFS files. @@ -4586,33 +4579,32 @@ LibEncapNewFvFile( } =20 =20 - //avoid a FV contain too many ffs files - if ((!IsRootFv) && (FvInFd->FfsAttuibutes[Index].FvLevel <=3D F= vInFd->MulFvLevel) && (FvInFd->FfsAttuibutes[Index+1].FvLevel <=3D FvInFd->= MulFvLevel) && - (FvInFd->FfsAttuibutes[Index].FvLevel !=3D FvInFd->FfsAttui= butes[Index+1].FvLevel) && (ParentLevel !=3D 1) && (FvInFd->FfsAttuibutes[I= ndex].Level !=3D FvInFd->FfsAttuibutes[Index+1].Level) && - FvInFd->FfsAttuibutes[Index].Level !=3D 0xFF && FvInFd->Ffs= Attuibutes[Index+1].Level !=3D 0xFF && FvInFd->FfsAttuibutes[Index+1].Level= !=3D 0x0){ - FvInFd->FfsAttuibutes[Index].Level =3D 0; - break; - }else{ - if (FvInFd->FfsAttuibutes[Index].Level !=3D 0xFF){ - FvInFd->FfsAttuibutes[Index].Level =3D 0; - } - } - + //avoid a FV contain too many ffs files + if ((!IsRootFv) && (FvInFd->FfsAttuibutes[Index].FvLevel <=3D = FvInFd->MulFvLevel) && (FvInFd->FfsAttuibutes[Index+1].FvLevel <=3D FvInFd-= >MulFvLevel) && + (FvInFd->FfsAttuibutes[Index].FvLevel !=3D FvInFd->FfsAttuib= utes[Index+1].FvLevel) && (ParentLevel !=3D 1) && (FvInFd->FfsAttuibutes[In= dex].Level !=3D FvInFd->FfsAttuibutes[Index+1].Level) && + FvInFd->FfsAttuibutes[Index].Level !=3D 0xFF && FvInFd->FfsA= ttuibutes[Index+1].Level !=3D 0xFF && FvInFd->FfsAttuibutes[Index+1].Level = !=3D 0x0){ + FvInFd->FfsAttuibutes[Index].Level =3D 0; + break; + } else { + if (FvInFd->FfsAttuibutes[Index].Level !=3D 0xFF){ + FvInFd->FfsAttuibutes[Index].Level =3D 0; + } } } - // The Fv may has multiple level (> 2), when it is in the FvLevel = =3D=3D 2, we set the IsLastLevelFfs Flag - if (Index <=3DFvInFd->FfsNumbers && FvInFd->FfsAttuibutes[Index].Fv= Level <=3D FvInFd->MulFvLevel) { - if (FvInFd->FfsAttuibutes[Index].FvLevel =3D=3D 2) { - IsLastLevelFfs =3D FALSE; - } - } - if (!FfsFoundFlag){ - OutputFileNameListFlag =3D FALSE; - if (OuterIndex > 0){ - fclose (InfFile); - break; - } - } + } + // The Fv may has multiple level (> 2), when it is in the FvLevel = =3D=3D 2, we set the IsLastLevelFfs Flag + if (Index <=3DFvInFd->FfsNumbers && FvInFd->FfsAttuibutes[Index].F= vLevel <=3D FvInFd->MulFvLevel) { + if (FvInFd->FfsAttuibutes[Index].FvLevel =3D=3D 2) { + IsLastLevelFfs =3D FALSE; + } + } + if (!FfsFoundFlag){ + OutputFileNameListFlag =3D FALSE; + if (OuterIndex > 0){ + fclose (InfFile); + break; + } + } // // Create FV // @@ -4631,15 +4623,15 @@ LibEncapNewFvFile( return Status; } =20 - OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileName)+= 1); - if (OutputFileNameList->FFSName =3D=3D NULL) { - Error ("FMMT", 0, 0004, "Out of resource, memory allocation failed! = \n", ""); - return EFI_OUT_OF_RESOURCES; - } - memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, st= rlen(OutputFileName)+1); - if (CurrentEncapData !=3D NULL) { - OutputFileNameList->InFvId =3D EncapFvIndex; - if (EncapFvIndex > 0) { + OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileNa= me)+1); + if (OutputFileNameList->FFSName =3D=3D NULL) { + Error ("FMMT", 0, 0004, "Out of resource, memory allocation fail= ed! \n", ""); + return EFI_OUT_OF_RESOURCES; + } + memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName= , strlen(OutputFileName)+1); + if (CurrentEncapData !=3D NULL) { + OutputFileNameList->InFvId =3D EncapFvIndex; + if (EncapFvIndex > 0) { memcpy(OutputFileNameList->UiName,FvInFd->FfsAttuibutes[EncapF= vIndex - 1].UiName, FvInFd->FfsAttuibutes[EncapFvIndex - 1].UiNameSize); OutputFileNameList->UiNameSize =3D FvInFd->FfsAttuibutes[Encap= FvIndex - 1].UiNameSize; OutputFileNameList->Depex =3D FvInFd->FfsAttuibutes[EncapFvInd= ex - 1].Depex; @@ -4647,9 +4639,9 @@ LibEncapNewFvFile( OutputFileNameList->FfsFoundFlag =3D FfsFoundFlag; OutputFileNameList->FvId =3D FvInFd->FfsAttuibutes[EncapFvInde= x - 1].FvId; OutputFileNameList->ParentLevel =3D ParentLevel - 1; + } + } } - } - } break; case FMMT_ENCAP_TREE_FFS: =20 @@ -4662,13 +4654,13 @@ LibEncapNewFvFile( } while (LocalEncapData->NextNode !=3D NULL) { if (LocalEncapData->Level =3D=3D ParentLevel) { - for(;LocalEncapData->NextNode !=3D NULL;) { - if(LocalEncapData->FvExtHeader !=3D NULL) { - break; - } - LocalEncapData =3D LocalEncapData->NextNode; - } - break; + for(;LocalEncapData->NextNode !=3D NULL;) { + if(LocalEncapData->FvExtHeader !=3D NULL) { + break; + } + LocalEncapData =3D LocalEncapData->NextNode; + } + break; } LocalEncapData =3D LocalEncapData->NextNode; } @@ -4728,101 +4720,106 @@ LibEncapNewFvFile( InputFileName =3D TmpFileName; } if (OutputFileNameList->DepexLen > 0) { - TmpFileName =3D LibFilenameStrExtended(strrchr(GenTempFile (= ), OS_SEP), TemDir, "tmp"); - TmpFile =3D fopen(TmpFileName, "wb+"); - if (TmpFile =3D=3D NULL) { - Error("FMMT", 0, 0004, "Could not open tmp file %s to st= ore Depex section information! \n", ""); - free (OutputFileNameList); - free (ChildFileNameList); - return EFI_ABORTED; - } - InputFile =3D fopen(InputFileName, "rb+"); - if (InputFile =3D=3D NULL) { - Error("FMMT", 0, 0004, "Could not open input file %s! \n",= ""); + TmpFileName =3D LibFilenameStrExtended(strrchr(GenTempFile (),= OS_SEP), TemDir, "tmp"); + TmpFile =3D fopen(TmpFileName, "wb+"); + if (TmpFile =3D=3D NULL) { + Error("FMMT", 0, 0004, "Could not open tmp file %s to stor= e Depex section information! \n", ""); + free (OutputFileNameList); + free (ChildFileNameList); + return EFI_ABORTED; + } + InputFile =3D fopen(InputFileName, "rb+"); + if (InputFile =3D=3D NULL) { + Error("FMMT", 0, 0004, "Could not open input file %s! \n", "= "); + fclose(TmpFile); + free (OutputFileNameList); + free (ChildFileNameList); + return EFI_ABORTED; + } + fseek(InputFile, 0, SEEK_SET); + fseek(InputFile, 0, SEEK_END); + InputFileSize =3D ftell(InputFile); + fseek(InputFile, 0, SEEK_SET); + // make sure the section is 4 byte align + if (OutputFileNameList->DepexLen % 4 !=3D 0) { + AlignN =3D 4 - OutputFileNameList->DepexLen % 4; + } + Buffer =3D malloc(InputFileSize + OutputFileNameList->DepexLen= + AlignN); + memcpy(Buffer, OutputFileNameList->Depex, OutputFileNameList->= DepexLen); + if (AlignN !=3D 0) { + for (Index =3D 0; Index < AlignN; Index ++) { + memcpy(Buffer + OutputFileNameList->DepexLen + Index, = AlignV, 1); + } + } + if (fread(Buffer + OutputFileNameList->DepexLen + AlignN, 1, I= nputFileSize, InputFile) !=3D InputFileSize) { + Error("FMMT", 0, 0004, "Could not open sec file %s to add = Depex section information! \n", ""); fclose(TmpFile); + fclose(InputFile); + free(Buffer); free (OutputFileNameList); free (ChildFileNameList); return EFI_ABORTED; + } + fwrite(Buffer, 1, InputFileSize + OutputFileNameList->DepexLen= + AlignN, TmpFile); + free(Buffer); + fclose(TmpFile); + fclose(InputFile); + InputFileName =3D TmpFileName; + } + // + // Delete origin FFS + // + for (Id =3D FvInFd->FfsNumbers; Id <=3D FvInFd->FfsNumbers; Id--= ) { + if ((memcmp(&FvInFd->FfsAttuibutes[Id].GuidName, &(LocalEncapD= ata->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)){ + if (access(FvInFd->FfsAttuibutes[Id].FfsName, 0) !=3D -1) { + Status =3D LibFmmtDeleteFile(FvInFd->FfsAttuibutes[Id].Ffs= Name); + if (EFI_ERROR(Status)) { + Error("FMMT", 0, 0004, "error while encapsulate FD Ima= ge", "Delete the specified file failed!"); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } + memset(FvInFd->FfsAttuibutes[Id].FfsName, '\0', _MAX_PATH); + FvInFd->FfsAttuibutes[Id].Level =3D 0xFF; + break; } - fseek(InputFile, 0, SEEK_SET); - fseek(InputFile, 0, SEEK_END); - InputFileSize =3D ftell(InputFile); - fseek(InputFile, 0, SEEK_SET); - // make sure the section is 4 byte align - if (OutputFileNameList->DepexLen % 4 !=3D 0) { - AlignN =3D 4 - OutputFileNameList->DepexLen % 4; - } - Buffer =3D malloc(InputFileSize + OutputFileNameList->DepexL= en + AlignN); - memcpy(Buffer, OutputFileNameList->Depex, OutputFileNameList= ->DepexLen); - if (AlignN !=3D 0) { - for (Index =3D 0; Index < AlignN; Index ++) { - memcpy(Buffer + OutputFileNameList->DepexLen + Index= , AlignV, 1); - } - } - if (fread(Buffer + OutputFileNameList->DepexLen + AlignN, 1,= InputFileSize, InputFile) !=3D InputFileSize) { - Error("FMMT", 0, 0004, "Could not open sec file %s to ad= d Depex section information! \n", ""); - fclose(TmpFile); - fclose(InputFile); - free(Buffer); - free (OutputFileNameList); - free (ChildFileNameList); - return EFI_ABORTED; - } - fwrite(Buffer, 1, InputFileSize + OutputFileNameList->DepexL= en + AlignN, TmpFile); - free(Buffer); - fclose(TmpFile); - fclose(InputFile); - InputFileName =3D TmpFileName; - } - for (Id =3D FvInFd->FfsNumbers; Id <=3D FvInFd->FfsNumbers; Id--)= { - if ((memcmp(&FvInFd->FfsAttuibutes[Id].GuidName, &(LocalEncap= Data->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)){ - if (access(FvInFd->FfsAttuibutes[Id].FfsName, 0) !=3D -1)= { - Status =3D LibFmmtDeleteFile(FvInFd->FfsAttuibutes[Id= ].FfsName); - if (EFI_ERROR(Status)) { - Error("FMMT", 0, 0004, "error while encapsulate F= D Image", "Delete the specified file failed!"); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } - memset(FvInFd->FfsAttuibutes[Id].FfsName, '\0', _MAX_= PATH); - FvInFd->FfsAttuibutes[Id].Level =3D 0xFF; - break; - } - } - } - if (LocalEncapData->NextNode !=3D NULL) { - LocalEncapDataTemp =3D LocalEncapData->NextNode; - if ((LocalEncapDataTemp->Type =3D=3D FMMT_ENCAP_TREE_GUIDED_S= ECTION) || (LocalEncapDataTemp->Type =3D=3D FMMT_ENCAP_TREE_COMPRESS_SECTIO= N)) { - Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMW= ARE_VOLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeade= r->FvName, FALSE, "1"); - } - else{ - Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMW= ARE_VOLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeade= r->FvName, FALSE, FvInFd->AlignmentStr); - } - } - else{ - Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMWARE_= VOLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeader->F= vName, FALSE, FvInFd->AlignmentStr); - } - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "Gener= ate FFS file failed!"); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } - free(LocalEncapData->FvExtHeader); - LocalEncapData->FvExtHeader =3D NULL; - OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileName= )+1); - if (OutputFileNameList->FFSName =3D=3D NULL) { - Error ("FMMT", 0, 0004, "Out of resource, memory allocation fail= ed! \n", ""); - return EFI_OUT_OF_RESOURCES; - } - memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, = strlen(OutputFileName)+1); - OutputFileNameList->IsFFS =3D TRUE; - OutputFileNameList->ParentLevel =3D ParentLevel - 1; - if (OutputFileNameList->Next =3D=3D NULL){ - break; - } - OutputFileNameList =3D OutputFileNameList->Next; - } + } + } + if (LocalEncapData->NextNode !=3D NULL) { + LocalEncapDataTemp =3D LocalEncapData->NextNode; + if ((LocalEncapDataTemp->Type =3D=3D FMMT_ENCAP_TREE_GUIDED_SE= CTION) || (LocalEncapDataTemp->Type =3D=3D FMMT_ENCAP_TREE_COMPRESS_SECTION= )) { + Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMWARE= _VOLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeader->= FvName, FALSE, "1"); + } else{ + Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMWARE= _VOLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeader->= FvName, FALSE, FvInFd->AlignmentStr); + } + } else{ + Status =3D LibEncapSectionFileToFFS(EFI_FV_FILETYPE_FIRMWARE_V= OLUME_IMAGE, InputFileName, OutputFileName, LocalEncapData->FvExtHeader->Fv= Name, FALSE, FvInFd->AlignmentStr); + } + + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "G= enerate FFS file failed!"); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } + =20 + free(LocalEncapData->FvExtHeader); + LocalEncapData->FvExtHeader =3D NULL; + =20 + OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFile= Name)+1); + if (OutputFileNameList->FFSName =3D=3D NULL) { + Error ("FMMT", 0, 0004, "Out of resource, memory allocation fa= iled! \n", ""); + return EFI_OUT_OF_RESOURCES; + } + memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileNa= me, strlen(OutputFileName)+1); + OutputFileNameList->IsFFS =3D TRUE; + OutputFileNameList->ParentLevel =3D ParentLevel - 1; + OutputFileNameList->InFvId =3D Id; + if (OutputFileNameList->Next =3D=3D NULL){ + break; + } + OutputFileNameList =3D OutputFileNameList->Next; + } break; case FMMT_ENCAP_TREE_GUIDED_SECTION: while(OutputFileNameList!=3D NULL && OutputFileNameList->FFSName != =3D NULL){ @@ -4941,25 +4938,25 @@ LibEncapNewFvFile( if (OutputFileSize > LargeFileSize) { IsLargeFile =3D TRUE; } - OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileName)+= 1); - if (OutputFileNameList->FFSName =3D=3D NULL) { - Error ("FMMT", 0, 0004, "Out of resource, memory allocation failed! = \n", ""); - return EFI_OUT_OF_RESOURCES; - } - memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, st= rlen(OutputFileName)+1); - - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "Gen= erate guided section failed!"); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; + OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileNa= me)+1); + if (OutputFileNameList->FFSName =3D=3D NULL) { + Error ("FMMT", 0, 0004, "Out of resource, memory allocation fail= ed! \n", ""); + return EFI_OUT_OF_RESOURCES; + } + memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName= , strlen(OutputFileName)+1); + =20 + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "Ge= nerate guided section failed!"); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } + OutputFileNameList->ParentLevel =3D ParentLevel - 1; + if (OutputFileNameList->Next =3D=3D NULL) { + break; + } + OutputFileNameList =3D OutputFileNameList->Next; } - OutputFileNameList->ParentLevel =3D ParentLevel - 1; - if (OutputFileNameList->Next =3D=3D NULL){ - break; - } - OutputFileNameList =3D OutputFileNameList->Next; - } break; case FMMT_ENCAP_TREE_COMPRESS_SECTION: while(OutputFileNameList!=3D NULL && OutputFileNameList->FFSName != =3D NULL){ @@ -5000,89 +4997,86 @@ LibEncapNewFvFile( break; case FMMT_ENCAP_TREE_FV_SECTION: while(OutputFileNameList!=3D NULL && OutputFileNameList->FFSName != =3D NULL){ - InputFileName =3D OutputFileNameList->FFSName; - OutputFileName=3D LibFilenameStrExtended (strrchr(GenTempFile (), = OS_SEP), TemDir, "sec"); - - Status =3D LibCreateFfsSection(NULL, InputFileName, NULL, EFI_SECT= ION_FIRMWARE_VOLUME_IMAGE, OutputFileName, NULL, NULL, NULL, 0, 0, NULL); + InputFileName =3D OutputFileNameList->FFSName; + OutputFileName=3D LibFilenameStrExtended (strrchr(GenTempFile ()= , OS_SEP), TemDir, "sec"); =20 - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "Gen= erate FV section failed!"); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } + Status =3D LibCreateFfsSection(NULL, InputFileName, NULL, EFI_SE= CTION_FIRMWARE_VOLUME_IMAGE, OutputFileName, NULL, NULL, NULL, 0, 0, NULL); =20 - InputFileName =3D OutputFileName; - OutputFileName=3D LibFilenameStrExtended (strrchr(GenTempFile (), = OS_SEP), TemDir, "sec"); + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "G= enerate FV section failed!"); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } =20 - // - // Make it alignment. - // - Status =3D LibCreateFfsSection(FvInFd, InputFileName, NULL, 0, Out= putFileName, NULL, NULL, NULL, 0, 0, NULL); - OutFile =3D fopen(OutputFileName, "rb+"); - if (OutFile =3D=3D NULL) { + InputFileName =3D OutputFileName; + OutputFileName=3D LibFilenameStrExtended (strrchr(GenTempFile ()= , OS_SEP), TemDir, "sec"); + =20 + // + // Make it alignment. + // + Status =3D LibCreateFfsSection(FvInFd, InputFileName, NULL, 0, O= utputFileName, NULL, NULL, NULL, 0, 0, NULL); + OutFile =3D fopen(OutputFileName, "rb+"); + if (OutFile =3D=3D NULL) { Error("FMMT", 0, 0004, "Could not open the file %s! \n", ""); free (OutputFileNameList); free (ChildFileNameList); return EFI_ABORTED; - } - fseek(OutFile, 0, SEEK_SET); - fseek(OutFile, 0, SEEK_END); - OutputFileSize =3D ftell(OutFile); - fclose(OutFile); - if (OutputFileSize > LargeFileSize) { + } + fseek(OutFile, 0, SEEK_SET); + fseek(OutFile, 0, SEEK_END); + OutputFileSize =3D ftell(OutFile); + fclose(OutFile); + if (OutputFileSize > LargeFileSize) { IsLargeFile =3D TRUE; + } + =20 + OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFile= Name)+1); + if (OutputFileNameList->FFSName =3D=3D NULL) { + Error ("FMMT", 0, 0004, "Out of resource, memory allocation fa= iled! \n", ""); + return EFI_OUT_OF_RESOURCES; + } + memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileNa= me, strlen(OutputFileName)+1); + =20 + if (EFI_ERROR (Status)) { + Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "G= enerate FV section failed!"); + free (OutputFileNameList); + free (ChildFileNameList); + return Status; + } + OutputFileNameList->ParentLevel =3D ParentLevel - 1; + if (OutputFileNameList->Next =3D=3D NULL){ + break; + } + OutputFileNameList =3D OutputFileNameList->Next; } - - OutputFileNameList->FFSName =3D (char *)malloc(strlen(OutputFileName)+= 1); - if (OutputFileNameList->FFSName =3D=3D NULL) { - Error ("FMMT", 0, 0004, "Out of resource, memory allocation failed! = \n", ""); - return EFI_OUT_OF_RESOURCES; - } - memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, st= rlen(OutputFileName)+1); - - if (EFI_ERROR (Status)) { - Error ("FMMT", 0, 0004, "error while encapsulate FD Image", "Gen= erate FV section failed!"); - free (OutputFileNameList); - free (ChildFileNameList); - return Status; - } - OutputFileNameList->ParentLevel =3D ParentLevel - 1; - if (OutputFileNameList->Next =3D=3D NULL){ - break; - } - OutputFileNameList =3D OutputFileNameList->Next; - } break; default: for (Id =3D FvInFd->FfsNumbers; Id <=3D FvInFd->FfsNumbers; Id--) { - if ((memcmp(&FvInFd->FfsAttuibutes[Id].GuidName, &(CurrentEnca= pData->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)){ - FvInFd->FfsAttuibutes[Id].IsHandle =3D TRUE; - memcpy(OutputFileNameList->UiName, FvInFd->FfsAttuibutes[I= d].UiName, FvInFd->FfsAttuibutes[Id].UiNameSize); - OutputFileNameList->UiNameSize =3D FvInFd->FfsAttuibutes[I= d].UiNameSize; - OutputFileNameList->FFSName =3D FvInFd->FfsAttuibutes[Id].= FfsName; - OutputFileNameList->Depex =3D FvInFd->FfsAttuibutes[Id].De= pex; - OutputFileNameList->DepexLen =3D FvInFd->FfsAttuibutes[Id]= .DepexLen; - OutputFileNameList->FfsFoundFlag =3D TRUE; - OutputFileNameList->IsFFS =3D TRUE; - OutputFileNameList->InFvId =3D Id; - OutputFileNameList->FvId =3D FvInFd->FfsAttuibutes[Id].FvI= d; - OutputFileNameList->ParentLevel =3D ParentLevel - 1; - *OutputFile =3D OutputFileNameList; - return EFI_SUCCESS; - } + if ((memcmp(&FvInFd->FfsAttuibutes[Id].GuidName, &(CurrentEncapD= ata->FvExtHeader->FvName), sizeof(EFI_GUID)) =3D=3D 0)){ + FvInFd->FfsAttuibutes[Id].IsHandle =3D TRUE; + memcpy(OutputFileNameList->UiName, FvInFd->FfsAttuibutes[Id].U= iName, FvInFd->FfsAttuibutes[Id].UiNameSize); + OutputFileNameList->UiNameSize =3D FvInFd->FfsAttuibutes[Id].U= iNameSize; + OutputFileNameList->FFSName =3D FvInFd->FfsAttuibutes[Id].FfsN= ame; + OutputFileNameList->Depex =3D FvInFd->FfsAttuibutes[Id].Depex; + OutputFileNameList->DepexLen =3D FvInFd->FfsAttuibutes[Id].Dep= exLen; + OutputFileNameList->FfsFoundFlag =3D TRUE; + OutputFileNameList->IsFFS =3D TRUE; + OutputFileNameList->InFvId =3D Id; + OutputFileNameList->FvId =3D FvInFd->FfsAttuibutes[Id].FvId; + OutputFileNameList->ParentLevel =3D ParentLevel - 1; + *OutputFile =3D OutputFileNameList; + return EFI_SUCCESS; + } } } =20 if (CurrentEncapData =3D=3D NULL) { LocalEncapData =3D FvInFd->EncapData; } else { - if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSName != =3D NULL && OutputFileNameList->IsFFS =3D=3D TRUE) { - *OutputFile =3D OutputFileNameList; - return EFI_SUCCESS; - } LocalEncapData =3D CurrentEncapData; } + =20 ParentLevel -=3D 1; =20 while (LocalEncapData->NextNode !=3D NULL) { --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#68036): https://edk2.groups.io/g/devel/message/68036 Mute This Topic: https://groups.io/mt/78525275/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-