From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web08.3100.1615964267097391515 for ; Tue, 16 Mar 2021 23:57:47 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=D0TJrRbP; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: bob.c.feng@intel.com) IronPort-SDR: 0QukSh1Lj4sCjw2q8Pc2c71Sx3rnRcDRPo5hlpDJ52Vgwojr3OTm+OAKLa+NLDmSgM9li/FXEM vmZ3Z5AcWvtA== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="189451353" X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="189451353" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Mar 2021 23:57:45 -0700 IronPort-SDR: OuX5eaKZXt8a6WLe/dxRjHQLBCSDIGks1xq+Czs7RFfwTnJzAyfsuZpFAQWzQZoUiB8QpLY3xR mA2zGarbVEUg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,255,1610438400"; d="scan'208";a="388733828" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga002.jf.intel.com with ESMTP; 16 Mar 2021 23:57:45 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 16 Mar 2021 23:57:44 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 16 Mar 2021 23:57:44 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.57) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 16 Mar 2021 23:57:44 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UhGGux//R3Fco+gAhymU8eN1Mqisk5xahtAOlQtGVdovvX3U7kZct1Xkwq8f5tXu+ucUrEPw3uXCLmr84faM27V8uo2kuaY7YZvP+Qx4+v+nAWx9eW5t/auVQRkilPGeCZ97hKRX25Y+vn2d2+1I4P3V6ZX9Sg7gAb/KB6cDShwCvVhr6nDmIv6LOQLAhim9guW7V7gDiuLXVVP23IK5/fQTYT0jVJHZUpRghWTMrRyYb0nIexQ/8Y7//MGAzIejjAGh1bq4WzDfplXUMcCLtQ1RnvaVaG9AV0McWLLvRYPRcz3Jd8rqNq9dYE5VfvXY4waD11w+4ne4yJtNwtdfxg== 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=DNFH8O+twgs+CkEKNVx4y6J7xxINr8jL32KhNtuCpK4=; b=UbNbNOp9IkJbUNTKDzJ6oydJWcePoOWOjugmr2Yf8seHxldQjegfPecOrpai2GAGS5kDHMidcChTcSRxIR9k4vHwW7tTpnH53WiyY0SBD4Q6ayJQhGwlLstUAssigs9674ooEu0f/Uq2CJgGTSA8WhmSYiB3JV4BQ9F1ITDV9f2Vt8zBzsBa0QQlndkxi2V9fpznBC5/pDTjwKJ5TyOROs4MuScCOf01L8pvBWhLKbf7J3yeaV4+1c2Ewh3QgiUzT3rHGRtsLE/JW2Kuxjjs3rahjj8UGdyyDfMqt1+LrEJ7/pMk7maU6wZHNwXxUmun9sgkRlfPSFjKeEUy/pcTdw== 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=DNFH8O+twgs+CkEKNVx4y6J7xxINr8jL32KhNtuCpK4=; b=D0TJrRbPzbIoaoiUlcPmub5bFrYMfIkSLiqIpuczL1P1KXwLfKmYQ4ud4jkk+peB2VVC/VXm+B5zYjL08gurRb1GsJ1Eyti3bTsRuSVc87YdU9n/Sqww9zrDnqUESJwc4NO6fRkazXH2+VXTD7+9VQ+iuZEDI07Yc+DVE9svZo4= Received: from DM6PR11MB4073.namprd11.prod.outlook.com (2603:10b6:5:19f::22) by DM5PR11MB1964.namprd11.prod.outlook.com (2603:10b6:3:111::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Wed, 17 Mar 2021 06:57:43 +0000 Received: from DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::10db:5760:d7f5:d0e0]) by DM6PR11MB4073.namprd11.prod.outlook.com ([fe80::10db:5760:d7f5:d0e0%3]) with mapi id 15.20.3955.018; Wed, 17 Mar 2021 06:57:43 +0000 From: "Bob Feng" To: "Yeh, GregX" , "devel@edk2.groups.io" , Yunhua Feng 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: AQHXFVHee5nf56AOnE2kZ7LYe1W1YKqEfJRAgAFmjVCAAeefAA== Date: Wed, 17 Mar 2021 06:57:43 +0000 Message-ID: References: <20210310020528.1924-1-gregx.yeh@intel.com> In-Reply-To: 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.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e359d495-f427-4470-ce6d-08d8e911f692 x-ms-traffictypediagnostic: DM5PR11MB1964: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:962; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Qaku12bAuWB2ZXyLAc8t7n8qWw7baaGxBslJTIQ+qukDk2FvtTREj0egzvJqPkxjVtgIFa2xlCppfqkeVL8mpk9LX5gEeZ9yRmu2L2K1lUOPd86d799Pz6XYuxr4ImbQJWDTt+tP8PQmSRxEV/rjU4qqpK9fNc0lcpYJddyNsWpMoA33VJrMFLRfhmNsfSVkYa0CJTXOaPU7emKV4CjWC6xCfQNA/ZB6C7L9UrUEsyJTFi5l6foKetu2X6bYCWQ0u3oPYdO+Q1w5EPHczbtHRkAV8GW5UO7nJDUQEesJHnheWNjY5l5k2/Tt5b13dP6loXniAZhdEUlBZvXVEZ5mep8oXTuR2kp+fg2HvYEiq8h/kfaJrczxeknvW8DNn4nVJ3kQoYIXfk51towXO0xxKfKvkBiKkXeIFe/Lit3x9+TZUH5sbr0eFArl2u//BUZ8Bi3eElJkv6+oaCTzpd+S21JwSF9NzNS2zr2zZjYRtZEW0/z5HA4sES0+ra4H3kUxEbYjEWB3BM2guzTCTTMYvGeJ6cK33jDx4yVexnJ7xRunWvDVOqEzxrGvCqVz/6pV 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:(346002)(136003)(376002)(396003)(39860400002)(366004)(66946007)(76116006)(66446008)(26005)(9686003)(316002)(71200400001)(110136005)(66476007)(478600001)(6506007)(55016002)(8936002)(7696005)(186003)(64756008)(8676002)(83380400001)(53546011)(66556008)(2906002)(5660300002)(86362001)(4326008)(33656002)(52536014);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?inUXJYwN3uNxMLzeF+HM3wi9uF4TqLPuvNsEtMznsSbKcYWKWV/l3p9wFRio?= =?us-ascii?Q?li3yrpcul/SWqh10AmmLY6hieqG6zyZl3cTdVtpZrdAmlH99pTjMv8XcHQyM?= =?us-ascii?Q?p/MR0shKKIADqp9x/4/ydTNUQfaB9SRYbCvo9WSiEOrQM+DnCdvuHCdY17eU?= =?us-ascii?Q?5wGLuJE2KTBOtJ5CPVApBhPexvwtulI5/pF2h6167nl/reX84ltfPr42Vx3p?= =?us-ascii?Q?xM+AFDuSL3LxaeFEYcSK0svZ6oXNRggV6eVG/qDuX5Ng5wm36kb96VKnfof9?= =?us-ascii?Q?ZkedVYEHBIhaEa0oOy+fYzkcapcDqZotf8uKEHiimr4sMt9MfiLbWByOnLPP?= =?us-ascii?Q?F4CTZYQuJ/SP0sCy+Sn/sAXWFjd6/mVY7MbapJ2jg01xZVCKrsTxsBnMZAlZ?= =?us-ascii?Q?vZl6Xai1r/xT66q9bkr5cURahKcVkruST3DqfXtnauemGyEBAHhbc3Alikr+?= =?us-ascii?Q?14MKxM0WJnofO/hirhPpvspoxVFxmYBb7ozZqu/rShWMuYYurOsMCBamzZN0?= =?us-ascii?Q?dmxGXq9Fe/V+kVaBGSjiGn2EdTMrAvZKm5BW4CulJlOa+Qm2bnYGFP8jWPlX?= =?us-ascii?Q?tsppMVisCtjtctVd0z9pQGEUAG22/xpMnad0tSz6Xbp67fTH6G/8wCMljCft?= =?us-ascii?Q?5tOyTDHHQJUgjRkTc7sEiXb0/soqOEujKJ1YnYG2NuYMX1e2j5QElq3beoxA?= =?us-ascii?Q?oTt8GGgxBO7YFdpPfpWM/sL3ftaIz1+8W49KhWneVyfVmQcMJJZi1mP9YTg1?= =?us-ascii?Q?VWDpv+1hJVN3VE0Awk7z/zBY/aZPm7X/qFYiBb/HHO62l4+62uU+EK51KziZ?= =?us-ascii?Q?vx59D7u7c44PzYZ+1jBtmnGb0a1CcUqzqULGiZ4evA/77uY6hJYtUKQ14/qS?= =?us-ascii?Q?EyyAsVGRq3RWfAzKZ4EMA2w6Fx128bT7lVXfcHWXiUcuV9n/G6UAhL9WoYw2?= =?us-ascii?Q?K79QsycZ7KNwxlnFPsI77JfFc9+oyaC6jeryCk/0RQiMrrnHhct2Mdf8zW9t?= =?us-ascii?Q?kT0RmLZ7fe/iHzjf9e/KzFTuPjyj8pnQA2ouhG2nGw184QXXGKZPz0avYWWc?= =?us-ascii?Q?4bypP65MxnqmKwN/KTCcuAZM43B1ncW9byHBaGxodCSYGefMc5JxYIA29onn?= =?us-ascii?Q?7uZJHFrrKj/wHg4DjaLrbGlx30Th9Oc+Y+JzQMvSn7Ms3qiTc7zNdEyBLC1x?= =?us-ascii?Q?1madimcoxE09vLE6XnbkQYCuoCk0sEunE4hHOlyDpFLAh3a7PZ7I+Qmy1lh2?= =?us-ascii?Q?T0Ae1Wr0LqiSVg65sUxQxPE38DBvVXtOQbuswo6MdbWyn3dfgorR5A6Al37c?= =?us-ascii?Q?+H8=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: e359d495-f427-4470-ce6d-08d8e911f692 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Mar 2021 06:57:43.2047 (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: AGXvRkTTFZOPwH3vcqFIA5vx+4El3ZsWO+snaeRJoVOhcYdxVsng/dDy+UuXgw1urQng7S42kZWRcj4WJWgxsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1964 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 Pushed. 4bfc77a87b820cd585ba10ca28aa957ae315c3dc -----Original Message----- From: Yeh, GregX =20 Sent: Tuesday, March 16, 2021 9:55 AM To: Feng, Bob C ; devel@edk2.groups.io; Yunhua Feng <= fengyunhua@byosoft.com.cn> Cc: Liming Gao Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure wh= en FV level over 2 Hi Bob, I have created new patch file. PatchCheck is pass. Using Git send-email send to edk2.group.io=20 Thanks, Greg -----Original Message----- From: Feng, Bob C Sent: Monday, March 15, 2021 12:35 PM To: Yeh, GregX ; devel@edk2.groups.io; Yunhua Feng Cc: Liming Gao Subject: RE: [PATCH] [edk2-staging] BaseTools/FMMT: Replace file failure wh= en FV level over 2 Hi Greg, Please use BaseTools\Scripts\PatchCheck.py to check this patch. There are s= ome lines code format invalid. The logic looks good to me. Yunhua, could you please double check, I remember you have concerns about t= he previous version of this patch. Thanks, Bob -----Original Message----- From: Yeh, GregX Sent: Wednesday, March 10, 2021 10:05 AM 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 | 56 ++++++++++++++++++++++++++---------= ---- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/BaseTools/Source/C/FMMT/FmmtLib.c b/BaseTools/Source/C/FMMT/Fm= mtLib.c index b945e9b63d..26df0181c7 100644 --- a/BaseTools/Source/C/FMMT/FmmtLib.c +++ b/BaseTools/Source/C/FMMT/FmmtLib.c @@ -494,7 +494,7 @@ LibReadFvHeader ( if ((FvLevel -1) =3D=3D 0) { printf ("\n%s :\n", FvName); } else { - printf ("%sChild FV named FV%d of %s\n", BlankSpace, FvCount, FvName= ); + printf ("\n%sChild FV named FV%d of %s\n", BlankSpace, FvCount,=20 + FvName); } } =20 @@ -502,7 +502,7 @@ LibReadFvHeader ( // Print FV header information // if (ViewFlag) { - printf ("\n%sAttributes: %X\n", BlankSpace, (unsigned) Volu= meHeader->Attributes); + printf ("%sAttributes: %X\n", BlankSpace, (unsigned) Volume= Header->Attributes); printf ("%sTotal Volume Size: 0x%08X\n", BlankSpace, (unsigned) Vo= lumeHeader->FvLength); printf ("%sFree Volume Size: 0x%08X\n", BlankSpace, (unsigned) (V= olumeHeader->FvLength - GetFreeOffset(InputFv))); } @@ -789,7 +789,8 @@ LibParseSection ( UINT8 *FvCount, BOOLEAN ViewFlag, BOOLEAN ErasePolarity, - BOOLEAN *IsFfsGenerated + BOOLEAN *IsFfsGenerated, + BOOLEAN IsFfs ) { UINT32 ParsedLength; @@ -997,8 +998,12 @@ LibParseSection ( break; =20 case EFI_SECTION_COMPRESSION: - if (FirstInFlag) { - Level ++; + if (IsFfs){ + Level ++; + } else { + if (FirstInFlag) { + Level ++; + } } NumberOfSections ++; =20 @@ -1159,7 +1164,9 @@ LibParseSection ( FvCount, ViewFlag, ErasePolarity, - IsFfsGenerated); + IsFfsGenerated, + FALSE + ); =20 if (CompressionType =3D=3D EFI_STANDARD_COMPRESSION) { // @@ -1181,8 +1188,12 @@ LibParseSection ( // looks up the appropriate tool to use for extracting // a GUID defined FV section. // - if (FirstInFlag) { + if (IsFfs) { Level ++; + } else { + if (FirstInFlag) { + Level ++; + } } NumberOfSections++; EncapDataNeedUpdata =3D TRUE; @@ -1216,7 +1227,8 @@ LibParseSection ( FvCount, ViewFlag, ErasePolarity, - IsFfsGenerated + IsFfsGenerated, + FALSE ); if (EFI_ERROR(Status)) { Error(NULL, 0, 0003, "parse of decoded GUIDED section failed", N= ULL); @@ -1471,7 +1483,8 @@ LibParseSection ( FvCount, ViewFlag, ErasePolarity, - IsFfsGenerated + IsFfsGenerated, + FALSE ); if (EFI_ERROR (Status)) { Error (NULL, 0, 0003, "parse of decoded GUIDED section failed", = NULL); @@ -1491,7 +1504,8 @@ LibParseSection ( FvCount, ViewFlag, ErasePolarity, - IsFfsGenerated + IsFfsGenerated, + FALSE ); if (ExtractionTool !=3D NULL) { free (ExtractionTool); @@ -2016,7 +2030,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; @@ -2099,7 +2113,8 @@ LibGetFileInfo ( FvCount, ViewFlag, ErasePolarity, - &IsGeneratedFfs + &IsGeneratedFfs, + TRUE ); } if (EFI_ERROR (Status)) { @@ -4198,10 +4213,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 +4242,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 +4279,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 +4295,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 += 4350,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; @@ -4818,= 6 +4839,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 +5099,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