From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web09.5743.1607416213379326777 for ; Tue, 08 Dec 2020 00:30:13 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=oqAwzHIv; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: bob.c.feng@intel.com) IronPort-SDR: 11Ypgdd7JF+NqbkbpYSlZ/9txbCI06SQb7eBTu4jVfFS2yDtyrS33KKWOhg/duEhMBRl9zrWYp elAk8q4U40ZA== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="161618549" X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="161618549" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 00:30:12 -0800 IronPort-SDR: InR9VFrVDnLjfo/Tg2Vpcu+rFAz+Z5/2SLIDDZlzuDo5SzzFqY98rEPGDwUW0yo53Bipqhwh1Q uWCReijbpKxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="483549804" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga004.jf.intel.com with ESMTP; 08 Dec 2020 00:30:12 -0800 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 8 Dec 2020 00:30:12 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Tue, 8 Dec 2020 00:30:12 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 8 Dec 2020 00:30:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I9YpCOs/J1PoXbtAUlh4dIaDWmzh+DgigVz2Kx04v05H60CHy+hKo6nN/CMvwxyNMVWANatRjfpXdGwNSGeYfka//NPswVfv9xm4segF/3zTzNzhUinze9mHVARNPVWrrxuTiWoAJ0DIRV33TTaEmIfao2YcKcR0FiOGu6TZDtM8KlnKkE0wNMdbXmnitWo14gjNdDFwiffT++SCBQeCBf3zCAPHGDriaZyEBvW6+XsCvX0pAitunsmoaFS0uy2rqh9wLOrT8AnGG3b5wbju6hQPRHjxnJw58AnuRHZjaSr+ni7J58LVO+0ExiLJ57gOvXPjEHafloIwEV2P8wKdGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FH3hs9595hqyNzAzuVvl5oEaWy0YFWiVBZSV7bqCQX0=; b=Rcg+JYjmuHPPoy4/O/Wg21sAxlWnl0Se7TAnCAJKkqgkD+dGYNBXWAZjiWdIuvQSg7GP23+ysGW+Y5s2F+KWdXDK1Xx1kwU2QnWACPy9tPBM2FxLXOtSf0vP+aGMxPgFX1WiKN+UHMa4e1dkRri9ZYTsULMbmJOmeqtIMOJ4aNm0HzMldPAAXynYi7dLe8WC9sFqbMPm6jc0caXrGdr3b13MVW5tBxwuOMP+fQT9riKNaD36oUu9QGS36wiY6QbxwXmE2Pwq+UAEXwtZ0ROzL/y2lpA2bOvDtPAXFdQpZLiWabzK+qbHGct9PCH9GfmYfCbjwOpEvV43DSqmVMj1IQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FH3hs9595hqyNzAzuVvl5oEaWy0YFWiVBZSV7bqCQX0=; b=oqAwzHIviQLOMeFF2XEDUWZlJxTEbqurHXkmxJmPaKQgush7rQtvP7IxiayDWp2bb6lrELjiDbQ7c9S/N9fDZ3MENPDjv9+45zcafjeq5AlzG70zjO7Hb+wu4EoG2Pi0QPIm1GNBLyjuIVRafBTyuZRFtPGoCm1K4LbUQ/A+pGs= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM5PR11MB0027.namprd11.prod.outlook.com (2603:10b6:4:6b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.23; Tue, 8 Dec 2020 08:30:07 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::c9f:47ea:6321:5ccb]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::c9f:47ea:6321:5ccb%3]) with mapi id 15.20.3632.023; Tue, 8 Dec 2020 08:30:07 +0000 From: "Bob Feng" To: "Yeh, GregX" , "devel@edk2.groups.io" CC: Liming Gao Subject: Re: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Thread-Topic: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when FV level over 2 Thread-Index: AQHWzTRNhDK8qHoARk2EOwuMJJvSt6ns3dwQ Date: Tue, 8 Dec 2020 08:30:07 +0000 Message-ID: References: <20201208073222.19400-1-gregx.yeh@intel.com> In-Reply-To: <20201208073222.19400-1-gregx.yeh@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.102.204.37] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 16df75ac-c1d3-4cf0-e446-08d89b53782a x-ms-traffictypediagnostic: DM5PR11MB0027: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: YpMzjJVVJQmEOYIW+h/QLjY75t0VwJq6CSHcaGAV3ToU/Shkp6X4DLooZacAUs8HtLevFHrdNuI6dfoMuuyUIAgp5YVikd1oZIETVrGseVAbuY7OnEsMbjrnHeK7UVkS6x0xBcx52WKM/pzmp5cqcmd3idSNpiUvWfLx5Q2639nEyUBOVt/r/5m9X2zsww4BLqhE+5EDaLL78UaBvflB9wuntq75B1/zsxsQvXLk60LFqjRzwntnCK7/L3Ypc0GqrEEihb6do6gHSes7e5JnuHuLzSlvWysXwmPyZZaDKp5IXCHhgm7NlTGqtJ2aD1DGAsBAjm709RmuvYFdXWvdqQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB4073.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39860400002)(376002)(366004)(136003)(396003)(6506007)(7696005)(53546011)(9686003)(55016002)(83380400001)(8676002)(8936002)(52536014)(186003)(66446008)(26005)(86362001)(110136005)(478600001)(4326008)(5660300002)(66556008)(76116006)(66946007)(33656002)(2906002)(66476007)(64756008)(316002)(71200400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?aswOigngbALWfRR6y/CTOqOyDNhtk6KuvlNHbwFGvx78KpQNGZa8V5TCubwT?= =?us-ascii?Q?HrOi32VCAZWjgYz3v7tQpKK4Ke+RlCPvpRgG3gay20zqsVREArwF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/X4rmhTr6XDskLV5mHocJHaQdqsGG4=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB4073.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16df75ac-c1d3-4cf0-e446-08d89b53782a X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2020 08:30:07.2383 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: vI/TNkZjQdQNUdM8U7Wo0Q0c4hMC5h1XzxnogeiUQcbxuhItDZA8D/kXZ6nJnyx4YIXYMiLSmv0e8w13xIuikg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB0027 Return-Path: bob.c.feng@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Greg, Is it the version 2 of the patch that you sent in 12/4? Thanks, Bob -----Original Message----- From: Yeh, GregX =20 Sent: Tuesday, December 8, 2020 3:32 PM To: devel@edk2.groups.io Cc: Feng, Bob C ; Liming Gao Subject: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure when F= V level over 2 Fixed replace file failure when FFS in multiple level FV and FV level over = 2. Signed-off-by: GregX Yeh Cc: Bob Feng Cc: Liming Gao --- 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/Fm= mtLib.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 =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 @@ LibParseSectio= n ( 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 // @@ -4198,10 +4191,13 @@ LibEncapNewFvFile( UINT32 header; UINT8 AlignN; UINT8 AlignV[1] =3D {0xFF}; + UINT32 EntryFvId; + AlignN =3D 0; Id =3D 0; InputFileSize =3D 0; TmpFileSize =3D 0; + AlignmentFileSize =3D 0; EncapFvIndex =3D 0; Index =3D 0; OuterIndex =3D 0; @@ -4224,7 +4220,7 @@ LibEncapNewFvFile( IsLargeFile =3D FALSE; OutputFileSize =3D 0; LargeFileSize =3D 0x1000000; - + EntryFvId =3D 0; =20 OutputFileNameList =3D (FFS_INFORMATION *)malloc(sizeof(FFS_INFORMATION)= ); if (OutputFileNameList =3D=3D NULL) { @@ -4261,6 +4257,9 @@ LibEncapNewFvFile( LocalEncapData =3D CurrentEncapData; if (LocalEncapData =3D=3D NULL) { LocalEncapData =3D FvInFd->EncapData; + EntryFvId =3D 0xFFFFFFFF; + } else { + EntryFvId =3D LocalEncapData->FvId; } Level =3D LocalEncapData->Level; Type =3D LocalEncapData->Type; @@ -4274,7 +4273,7 @@ LibEncapNewFvFile( LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; if (LocalEncapDataNext !=3D NULL && LocalEncapDataNext->NextNo= de !=3D NULL) { =20 - LibEncapNewFvFile(FvInFd, TemDir, LocalEncapDataTemp, 1, &= ChildFileNameList); + LibEncapNewFvFile(FvInFd, TemDir,=20 + LocalEncapDataTemp,LocalEncapDataTemp->Level - 1, &ChildFileNameList); ChildFileNameList->ParentLevel =3D LocalEncapDataTemp->Lev= el -1; if (FvInFd->ChildFvFFS =3D=3D NULL) { FvInFd->ChildFvFFS =3D ChildFileNameList; @@ -4329,7 += 4328,7 @@ LibEncapNewFvFile( } else { LocalEncapData =3D CurrentEncapData; while (LocalEncapData !=3D NULL) { - if (Level_Break > 1 && LocalEncapData->Type =3D=3D FMMT_ENCAP_TREE_F= FS) { + if ((LocalEncapData->FvId > EntryFvId) && (LocalEncapData->Type=20 + =3D=3D FMMT_ENCAP_TREE_FFS)) { LocalEncapDataTemp =3D LocalEncapData->RightNode; while (LocalEncapDataTemp !=3D NULL) { LocalEncapDataNext =3D LocalEncapDataTemp->NextNode; @@ -4485,= 7 +4484,7 @@ LibEncapNewFvFile( // FfsFoundFlag =3D FALSE; IsRootFv =3D FALSE; - for (Index=3D0; Index <=3D FvInFd->FfsNumbers; Index++) { + for (Index=3D0; Index < FvInFd->FfsNumbers; Index++) { if (OutputFileNameList !=3D NULL && OutputFileNameList->FFSNam= e !=3D NULL && OutputFileNameList->IsFFS =3D=3D FALSE){ break; } @@ -4818,6 +4817,7 @@ LibEncapNewFvFile( memcpy((char *)OutputFileNameList->FFSName, (char *)OutputFileName, = strlen(OutputFileName)+1); OutputFileNameList->IsFFS =3D TRUE; OutputFileNameList->ParentLevel =3D ParentLevel - 1; + OutputFileNameList->InFvId =3D Id; if (OutputFileNameList->Next =3D=3D NULL){ break; } @@ -5077,10 +5077,6 @@ LibEncapNewFvFile( 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; } ParentLevel -=3D 1; -- 2.16.2.windows.1