From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web09.5764.1607416397842417158 for ; Tue, 08 Dec 2020 00:33:18 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=iSS6hmai; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: gregx.yeh@intel.com) IronPort-SDR: L8eeh/he9WD+OK8ngUlmW/tJY0JpnKJeqNwWC0e4rnpestnwywqA4kTYzdW/8nkg9+myOG4IHC NLOf4jP46fYQ== X-IronPort-AV: E=McAfee;i="6000,8403,9828"; a="160902193" X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="160902193" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2020 00:33:12 -0800 IronPort-SDR: Ce/HCRxJxpjs1ud+h744f2lIFZAMXszhVQWV0wS5fzwnem1qGoLjnkmW3KYDFbSZFlIW1Y4NaX nY3oksSiYDMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,402,1599548400"; d="scan'208";a="375853122" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by FMSMGA003.fm.intel.com with ESMTP; 08 Dec 2020 00:33:09 -0800 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX604.amr.corp.intel.com (10.22.229.17) 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:33:09 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx604.amr.corp.intel.com (10.22.229.17) 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:33:09 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.108) 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:33:08 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NDC5t+Oh7oxl98gg0Vk99klqHOoRZrGEF260/BYVrGhiKH0qLaA9GOaMMRmda5QSdu9OEbyNzRoY1iZXkMr0dEXUDgUgtRUIb7L9Bn5Ex688IA9dK5l4boMwVfd8DHS1eQfijFkunJku8iltrmW0UTdwYjMgKOG40CJ7VH5ZxJQeTa5wWK6GqNMJIOc+NV3fUsEBpmIElB7XXil93AfnVbemp13h/BDSQHNJm7lsW5/9diTc9y+lbLT+yPHssunaDk/y0yezuh5dFiZMARE5fRaBc+aMR757HP3qYW6UW2e/lO0IFpYVF7XjTcc45JkwJbvysCVJg+i32yRpNDECKw== 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=zsL3M8bHGizN9MyRQ/l/tmg4T7G9IAzDmazIG4X33fE=; b=erqc9DzYsNcBjrrax8i1EZzp22cjFoZTiDMqcW6K47QBt6yzfQO/CCaaVibkhkFZi77/HbIkoQzErJzRBg3UOwMDYDEr1vORsT5wvjtRBIK7aXTUYiwO1oHjhXf2gHl/vKoDz4MGUQto+r+S8T450YYqCMvIJbi3HvozZEAjST3MFtOcDo6sBThgX/ga92npOYxHhvQB0tH75exEVfycTitEsGMZl31bdHgUTCEn89VQbs3k5UwslxkdZXlKPS3CIEAZrRTJvY++gnSuVQpXK9BBjwyJofHQBZUG5yr/hnMjcXFu3/wCOj8B3wiHnXAxBzbPXUMIkbWQJqTs91vmSQ== 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=zsL3M8bHGizN9MyRQ/l/tmg4T7G9IAzDmazIG4X33fE=; b=iSS6hmaina8cLQSmFpF+tUop221FxmnGLxK9PCr3CvXTKDYyxVdNDjWB387oWEi5vXn3Sz8It2q+t25x3cd8x+hWxfKZ0whWpx8neuhpk9fd4AHI3bUzW3TQ0nhXtom1nr5gotSK25qmDKiQplxODDmQ9ThrBEGmT6kHk50Ec44= Received: from BYAPR11MB3368.namprd11.prod.outlook.com (20.177.186.77) by BYAPR11MB2854.namprd11.prod.outlook.com (52.135.228.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.19; Tue, 8 Dec 2020 08:33:07 +0000 Received: from BYAPR11MB3368.namprd11.prod.outlook.com ([fe80::e93c:4e1a:dfcd:e4cf]) by BYAPR11MB3368.namprd11.prod.outlook.com ([fe80::e93c:4e1a:dfcd:e4cf%5]) with mapi id 15.20.3632.021; Tue, 8 Dec 2020 08:33:07 +0000 From: "GregX Yeh" To: "Feng, Bob C" , "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: AQHWzTRNhDK8qHoARk2EOwuMJJvSt6ns3dwQgAAAstA= Date: Tue, 8 Dec 2020 08:33:07 +0000 Message-ID: References: <20201208073222.19400-1-gregx.yeh@intel.com> In-Reply-To: Accept-Language: zh-TW, 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.55.52.220] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb546636-5a47-4f44-af11-08d89b53e3af x-ms-traffictypediagnostic: BYAPR11MB2854: 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: 0/FMLbsAR2tSFwng56udCov/fhaCSsGWdC0nnfZmkty4onvuXJGUWlA6fBSFw/KAZl3aT28qqoSoTc6S3g4xVdik80jPOaIVJW8pz12VK2RaM8i1d4GZQZlTbWWdC0laM/YDmUvrYLCA0ThqLYZK4EkfLvyjrtz+ca+CQPQTXbVc0Ga9gZl+eC3uy8wFSHvXGQQLE3WVAz7ZEw+oJ+tOUSGvWwNaG5pxNvzSe+nKi9dQyoq3x/siQsmubAu5pFztFwq7AU1aLViop+0Ek0PvqCvVT3KAKd768LEdzseu1A1zoOjmIP+d5ssrOn3ady8B97of3NE4ncqd9Z0DjRRnaA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB3368.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(366004)(346002)(376002)(396003)(136003)(52536014)(5660300002)(7696005)(186003)(86362001)(8676002)(55016002)(9686003)(6506007)(2906002)(8936002)(66556008)(64756008)(4326008)(478600001)(66446008)(33656002)(110136005)(66476007)(76116006)(26005)(71200400001)(316002)(53546011)(66946007)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?zoU077kjFtLX5TQkcWHRsEFOule6sB2Zc5sB9QWaekPACKJmlw2dcVvEOFKh?= =?us-ascii?Q?1dJsPF+VvRZHHOXPfRHEcQDsYjLxiz1458TXXl2eaI8b25+rjsnfG9MmNq7o?= =?us-ascii?Q?0GLD2oJ1tUDBxUfDT0I87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MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3368.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb546636-5a47-4f44-af11-08d89b53e3af X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2020 08:33:07.6018 (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: oeWOgZSGgPNROdrtWTRAsws1RtvrFfN+YfAQH4ebS8Eim7mmU/nOvzCR7ZmKFAizsHx13IrWZAVmqWk2kkfkVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2854 Return-Path: gregx.yeh@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Bob, This is latest patch for FMMT. Thanks, Greg=20 -----Original Message----- From: Feng, Bob C =20 Sent: Tuesday, December 8, 2020 4:30 PM To: Yeh, GregX ; devel@edk2.groups.io Cc: Liming Gao Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure wh= en 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 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