From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web11.41905.1656700458405733538 for ; Fri, 01 Jul 2022 11:34:18 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=ayHewBMG; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656700458; x=1688236458; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=PYIwt0/dCNPVOf8GmCJMlF0lfhNWAPnTZt5BmkCn10Y=; b=ayHewBMG0v80GvzsKUiJzwbqhBxWMZ3oPOjb7JfVvngPGleCR2AzUpVj 60IA1Ln6vXCaX89DxmVq8U2YlPZF3j+aEome4JnFfKPzA/BUXdbaxZ1tw yuCmpDnMbrQzYng2vPTWGyl0zmIIPbQhIDvghdxz/oSlaMMjHVBP5FVeM I00AXHroH/bsZcZNvnomq9FJNHfV36n3ct6+N6mVitWpkOOtAtNo/rV5H 9d+xXdWlh5Bs+4PsdycpQYSRAqgA4pb4yWcowd73VLnqfD0wqK4iN5WkB +LOBM4DN7E4+WfBlEaN6090O9fuxZrnyv8M5ekQJi+F4Uh3pKy/c51Qgd g==; X-IronPort-AV: E=McAfee;i="6400,9594,10395"; a="346701735" X-IronPort-AV: E=Sophos;i="5.92,237,1650956400"; d="scan'208";a="346701735" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2022 11:34:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,237,1650956400"; d="scan'208";a="659522292" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga004.fm.intel.com with ESMTP; 01 Jul 2022 11:34:17 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) 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.2308.27; Fri, 1 Jul 2022 11:34:16 -0700 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Fri, 1 Jul 2022 11:34:16 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Fri, 1 Jul 2022 11:34:16 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.172) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Fri, 1 Jul 2022 11:34:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JNfTrdm85lM8393XC84xOLEDzj0txnj+wrXjXUv+cHePt6F3EYav9reO+cxo/CoidfWS42jgHVH5vt2swGN2Wohk1tzyZYrHKq22/kf9wIYJljzMqYcOwwc73hnh0kS2rlNdwu+rjAtrzKGiNaBdcyu1gkzHA8t5dWM56pZOlUBEiu64aRWfYxGGMvw20MKnCffsKj2YELtR8gg13zI69Ry3KZpoWX44Zl8XwGKyL8YOmDJXXhDKWC4WkoP/ubeq0Xtf79ay+e9vPQ9xNtYpdKxS0Pz5rs8fGGiXtZRH/Gx72NbOFbELImNAd0kGJlZXfi2IidRrb6DWHsgX3GRBUA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gmndBFKEdqOpKEqyraZfQe6Wilm4IShVUznnldZsOiA=; b=OOFKmvNucwHD2npRHacN3A4BFCOEKhMbeUwRUxHblDk/o7w8U1SnKZvpWn9UvJE6Pmde3/Bk7VQLOMOF5sN0/jEyh8/0abM/gY30dfObQ0fBCELxJIGRv2V8RyMS2IqQnCWDXEswC80xEmRtZ/WcpnA6U+rp5A/pz6jVOgRiCQ5b5s6ZnnsZp4pVoQFtlbyItTeWJiXnFSDe5cNGTaBxdmkLJduksgttWU57vxDodJhXZq7WjPtCwquKjaVoX0SfU4oDFuQIz1Jpvb94dg3iNo5ZXZ42cgS1oQaTGfh6WRFL9y5BI224PD9Sr07Ac3fA/IjbXp80kJ5tT7TM6z/F3Q== 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 Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by PH0PR11MB5593.namprd11.prod.outlook.com (2603:10b6:510:e0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Fri, 1 Jul 2022 18:34:08 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::38f6:5a89:7ca7:9b9a]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::38f6:5a89:7ca7:9b9a%4]) with mapi id 15.20.5395.017; Fri, 1 Jul 2022 18:34:08 +0000 From: "Oram, Isaac W" To: "Lin, Jason1" , "devel@edk2.groups.io" CC: "Feng, Bob C" , "Gao, Liming" , "Chen, Christine" , "Chaganty, Rangasai V" , "Chiang, Dakota" Subject: Re: [PATCH v3 2/3] [edk2-platforms] Silicon/Intel/FitGen: Reduce the typecasting and pointer usage Thread-Topic: [PATCH v3 2/3] [edk2-platforms] Silicon/Intel/FitGen: Reduce the typecasting and pointer usage Thread-Index: AQHYjVyxiJyu1UW9wU6poUmFTyBq5q1p14sw Date: Fri, 1 Jul 2022 18:34:08 +0000 Message-ID: References: <20220701151005.189-1-jason1.lin@intel.com> <20220701151005.189-2-jason1.lin@intel.com> In-Reply-To: <20220701151005.189-2-jason1.lin@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c740efd3-b90e-461d-03ea-08da5b9048f6 x-ms-traffictypediagnostic: PH0PR11MB5593:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fpuvvpw4Yb/+ABEn2+f4PObkyJiHjuaMm3Y4yjiZeT1O8WIPnj9+YDfOXuHarZ9hZRI3aQri9iJ1p/Z+VOu1FbRI4qW7c4ayA+Iel4ZH1+xoFy9D5JIfeDg0zTrO48tj2xuEFwoMYJwqnAOc84WvFNDS6JwxAQqE68/9KTx9rKuzjN6Dqq62fIQMZtbFIeFCgFCBvW5XGm8n2KC7AdV0wNRwxh0japCZ+H2i4yX80ZXESnwhvY3eVC39OxMV8U+YZlI8HOKfZvHPs9xT/2gs2R8IosMhKG3GJIQJWckQ5Tf8z0SuEr9jYM1Dd/biMpYYrn5rQuvQBCY/Lye2DZIiUpRcfBJwZeWbjXjvQRKY9NdX77BPP5tGyAI6yr6yLtjX8QbFvswGu1yNH9ggN64g0pVoNc7nVGfDbpGKXqsDHzjzvyD1eqGQg+un9Umw7zIAcjPWMt2YjzHAEPULsrjkcl5yscODQy3oZEhitYkFKimQ+QCCUsCDt6G54kmbuCgUKDRoNEz0i/jUV/4eMf56Sj/n8IkluAbsRhy5PKNbUQIOw5oXFR1zmMfW5dZ+VyB7kBXnpfqPQIXzgq/340SZf7Y1Uu8t23Ejn1FqacfalLaQlO1AkiUMtn2+HSuTj+nL+QocejHfFfu6JbaYeoKfqVly6+j45sfdXosZMFR9JfFlJuj0SbtK1cIeAsxrOAU46CgnUDg0qt7prd7iCPSoFgd+awaLtq0dyig+n/o2o843YC1i3CYepGKaahCh1aSfKATfLnVFhCnPi+e/qzKsCLpi913lVuPj+v3MLnFFXc/iEnBsao/sFK5buc4QgvrxaiTwDy99tutUg1WzeJTF2VaGa9wMPRYzAe7wCBSPU6E= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(136003)(376002)(396003)(366004)(39860400002)(5660300002)(64756008)(66446008)(30864003)(66556008)(66946007)(66476007)(8936002)(52536014)(2906002)(4326008)(8676002)(76116006)(55016003)(38100700002)(86362001)(33656002)(122000001)(38070700005)(82960400001)(478600001)(71200400001)(41300700001)(966005)(316002)(54906003)(110136005)(7696005)(186003)(83380400001)(53546011)(26005)(6506007)(107886003)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?SHhm7OWoO13FAByfUpWlwhypRBuJ7bn9pu7ZoHtjLi6MiqkVOXekaATZxCsQ?= =?us-ascii?Q?7DJfzSS1RMcjPZxT+6Ob5xpg3RgIu+h8SZ6McJbnRuNX02xgAbRSgjM39nHA?= =?us-ascii?Q?5a8SeGJdPuhGsGKrp2ozM7kh1L5dxFsaZjT4sG+WtkUb6WuLIltg+WvSonf3?= =?us-ascii?Q?Vai3RtevZF41XDwjOyvuiMMMUyCCvUYl7fKODTY7Um6vN9D8hA4jdDHK3cvE?= =?us-ascii?Q?BYSjqTlAYjoGvim5dYlDp9mXj4qYmW3wYjOd9EBxBSX3Os6ts9AGO2bXsFNa?= =?us-ascii?Q?kJpKS1WME33aWLZlSw8s1wvDFdD0ViNTg6raytjDX2ce3MzS6DbDYNQnzHZO?= =?us-ascii?Q?I/kPH3hEHaE2wCGTcApKeSO+UAkwxHIjyIrc7tjuIzolmWU0Sy0YH1mldaZz?= =?us-ascii?Q?NpZEsH+QwDUIj+rYb1thelVNzTxMynvI8oBE9E/929OqubXiI/j3T2olVAmA?= =?us-ascii?Q?MIAlmgA7FfTDzPwo31RWK2Cdl/Au1gi+oYZUlA4ipsFUZii4KM2+qgopuc+8?= =?us-ascii?Q?XNAULB9kU7lYXLoorCkYe38x1vx7JlJJwSgQRbHB4g6fyploKpj8VH3zaaGI?= =?us-ascii?Q?Z+zhGWKyBo0TGKT7hJVgiG6S0gD+fEdyiTPcVssOYnNk7nbBkX+IURWww1yQ?= =?us-ascii?Q?D2hmKxnLVkEciZF2dxd1OWo+Nf0acXAV2Y2Xy69b3+Xe+TNEUQ6cabGCy5Vk?= =?us-ascii?Q?LZ+rk3RA+9ic29r+AyaLIM9djjb7BvZ6ubyMlpvTWlY+bPCggCmUOZciyKYK?= =?us-ascii?Q?3fHn/7Wz0KV9q8FzCvdBBzgF91iqv6McROv/KpRvo4Q/ctY4NOcXCP31j56S?= =?us-ascii?Q?iZ1AJE2B5DeMC4bBXkmZBmJAPYARt6TlnNnOBclEVhyZl383U8qeNREl24Ji?= =?us-ascii?Q?3dKJd57YJ/lp8tN/RDLvVsLSmNxCFl2WWxTzZruhiIZnRUiISoGJlXtZqFwA?= =?us-ascii?Q?JOFetQUBeGhMj+t73ieYrMjbDfZsj37yVLaV+QBgvA/av3NDeAQLRatW5A41?= =?us-ascii?Q?OPztbKAOyuhlYU2MZncutTeSt0aF3RqNQi5NvXdBkwJs2j4l/wTtamTlwXTK?= =?us-ascii?Q?to2epeIo8Ij6k/P0HbFnC9iuD48DBUFF/HCEHKp8I1i7dqVUAk3vQEOGgG08?= =?us-ascii?Q?rckv08vktbmWuwGP268T5wimtuWYdvrL9uC86lvm12xWaDjGuT6o/dRUuf9T?= =?us-ascii?Q?ObzNmsmMSbB2XnCGBnh11O6T0dczWrzvDbbmK8Oyz0n+lGEUahp1fse4gZ6y?= =?us-ascii?Q?S2S9yjsfcZwl3Iq+2FkptT7IxROKUORDlko+BghqVo3xB92qcLBmeN7x3enB?= =?us-ascii?Q?QC4e8AG3UT21IdtPjL1N55Ms19GAyZ4X+kLGFk69JKfOaxflhmr0MiOyLM8l?= =?us-ascii?Q?zvNPvtfADHd6ml5RWOhsG1KqVLyovnA2+5qohXncDm1MWT8Owr+GvyGNm85d?= =?us-ascii?Q?Zk0Wxe3zNNMX+rQYSGylvcAYDmevGC5tNESvRUlxODs10npIifrj09K5+5iq?= =?us-ascii?Q?enKnVUmQqUEwQATL0VKXb91iw/1zsuDTR5yd+TfgMIKjSv3UWrNM0f8pISrh?= =?us-ascii?Q?MyOHdK9hVFTrGj9gJmFvysTXJfbVbJpkCQrJtanE?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c740efd3-b90e-461d-03ea-08da5b9048f6 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Jul 2022 18:34:08.3690 (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: wfvIsWEzOJOrETjY25iQJfZ+nSpnZLD3ozG0UMRgQKH1g2CLpdODqqkAtr9VVllWk4iRNDBFn5sfoRnr3+/LgQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5593 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Isaac W Oram -----Original Message----- From: Lin, Jason1 =20 Sent: Friday, July 1, 2022 8:10 AM To: devel@edk2.groups.io Cc: Lin, Jason1 ; Feng, Bob C ;= Gao, Liming ; Chen, Christine ; Oram, Isaac W ; Chaganty, Rangasai V ; Chiang, Dakota Subject: [PATCH v3 2/3] [edk2-platforms] Silicon/Intel/FitGen: Reduce the t= ypecasting and pointer usage From: Jason1 Lin REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3958 FitGen tool exists lots of typecasting and pointer usage. This code change is used to reduce these in FillFitTable () and GetFitEntry= Info (). To make code more clearly and easy to read. Signed-off-by: Jason1 Lin Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Cc: Isaac W Oram Cc: Rangasai V Chaganty Cc: Dakota Chiang --- Silicon/Intel/Tools/FitGen/FitGen.c | 125 ++++++++++++-------- 1 file changed, 78 insertions(+), 47 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index eac8fa8715..01b4f82518 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -2768,6 +2768,7 @@ Returns: { FIRMWARE_INTERFACE_TABLE_ENTRY *FitEntry; UINT32 = FitIndex;+ UINT32 FitEntrySizeValue; UINT= 32 Index; UINT8 Checks= um; UINTN SubIndex;@@ -2788,27 +2789,35 @@ Retu= rns: // // 2. FitHeader //- FitEntry[FitIndex].Address =3D *= (UINT64 *)"_FIT_ ";- *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D gFitTabl= eContext.FitEntryNumber;- FitEntry[FitIndex].Version =3D (UINT= 16)gFitTableContext.FitHeaderVersion;- FitEntry[FitIndex].Type = =3D FIT_TABLE_TYPE_HEADER;- FitEntry[FitIndex].C_V =3D= 1;+ FitEntrySizeValue =3D gFitTableContext.FitEntryNumber;+ Fi= tEntry[FitIndex].Address =3D *(UINT64 *)"_FIT_ ";+ FitEntry[FitIndex].S= ize[0] =3D (UINT8)FitEntrySizeValue;+ FitEntry[FitIndex].Size[1] =3D (UI= NT8)(FitEntrySizeValue >> 8);+ FitEntry[FitIndex].Size[2] =3D (UINT8)(Fit= EntrySizeValue >> 16);+ FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[FitI= ndex].Version =3D (UINT16)gFitTableContext.FitHeaderVersion;+ FitEntry[Fi= tIndex].Type =3D FIT_TABLE_TYPE_HEADER;+ FitEntry[FitIndex].C_V = =3D 1; // // Checksum will be updated later... //- FitEntry[FitIndex= ].Checksum =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; // /= / 3. Microcode // FitIndex++; for (Index =3D 0; Index < gFitTableCont= ext.MicrocodeNumber; Index++) {- FitEntry[FitIndex].Address = =3D gFitTableContext.Microcode[Index].Address;- *(UINT32 *)&FitEntry[Fit= Index].Size[0] =3D 0; //gFitTableContext.Microcode[Index].Size / 16;- Fi= tEntry[FitIndex].Version =3D (UINT16)gFitTableContext.Microcode= Version;- FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_MICR= OCODE;- FitEntry[FitIndex].C_V =3D 0;- FitEntry[FitIn= dex].Checksum =3D 0;+ FitEntrySizeValue =3D 0; // g= FitTableContext.Microcode[Index].Size / 16+ FitEntry[FitIndex].Address = =3D gFitTableContext.Microcode[Index].Address;+ FitEntry[FitIndex].Size[= 0] =3D (UINT8)FitEntrySizeValue;+ FitEntry[FitIndex].Size[1] =3D (UINT= 8)(FitEntrySizeValue >> 8);+ FitEntry[FitIndex].Size[2] =3D (UINT8)(Fit= EntrySizeValue >> 16);+ FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[= FitIndex].Version =3D (UINT16)gFitTableContext.MicrocodeVersion;+ FitEn= try[FitIndex].Type =3D FIT_TABLE_TYPE_MICROCODE;+ FitEntry[FitIndex]= .C_V =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; FitIndex++; }= @@ -2816,12 +2825,16 @@ Returns: // 4. StartupAcm // for (Index =3D 0; Index < gFitTableContext.Start= upAcmNumber; Index++) {- FitEntry[FitIndex].Address =3D gFit= TableContext.StartupAcm[Index].Address;- *(UINT32 *)&FitEntry[FitIndex].= Size[0] =3D 0; //gFitTableContext.StartupAcm.Size / 16;- FitEntry[FitInd= ex].Version =3D (UINT16)gFitTableContext.StartupAcmVersion;- = FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_STARTUP_ACM;- = FitEntry[FitIndex].C_V =3D 0;- FitEntry[FitIndex].Check= sum =3D 0;+ FitEntrySizeValue =3D 0; // gFitTableCo= ntext.StartupAcm.Size / 16+ FitEntry[FitIndex].Address =3D gFitTableCon= text.StartupAcm[Index].Address;+ FitEntry[FitIndex].Size[0] =3D (UINT8)= FitEntrySizeValue;+ FitEntry[FitIndex].Size[1] =3D (UINT8)(FitEntrySize= Value >> 8);+ FitEntry[FitIndex].Size[2] =3D (UINT8)(FitEntrySizeValue = >> 16);+ FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[FitIndex].Versi= on =3D (UINT16)gFitTableContext.StartupAcmVersion;+ FitEntry[FitIndex].= Type =3D FIT_TABLE_TYPE_STARTUP_ACM;+ FitEntry[FitIndex].C_V = =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; FitIndex++; } @@ -2829,= 19 +2842,23 @@ Returns: // 4.5. DiagnosticAcm // if (gFitTableContext.DiagnstAcm.Address != =3D 0) {- FitEntry[FitIndex].Address =3D gFitTableContext.Di= agnstAcm.Address;- *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0;- Fit= Entry[FitIndex].Version =3D (UINT16)gFitTableContext.DiagnstAcm= Version;- FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_DIAG= NST_ACM;- FitEntry[FitIndex].C_V =3D 0;- FitEntry[Fit= Index].Checksum =3D 0;+ FitEntrySizeValue =3D 0; //= gFitTableContext.DiagnstAcmVersion.Size / 16+ FitEntry[FitIndex].Addres= s =3D gFitTableContext.DiagnstAcm.Address;+ FitEntry[FitIndex].Size[0] = =3D (UINT8)FitEntrySizeValue;+ FitEntry[FitIndex].Size[1] =3D (UINT8)(= FitEntrySizeValue >> 8);+ FitEntry[FitIndex].Size[2] =3D (UINT8)(FitEnt= rySizeValue >> 16);+ FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[Fit= Index].Version =3D (UINT16)gFitTableContext.DiagnstAcmVersion;+ FitEntr= y[FitIndex].Type =3D FIT_TABLE_TYPE_DIAGNST_ACM;+ FitEntry[FitIndex]= .C_V =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; FitIndex++; }= // // 5. BiosModule // //- // BiosModule segments order needs to = be put from low addresss to high for Btg requirement+ // BiosModule segmen= ts order needs to be put from low address to high for Btg requirement // = if (gFitTableContext.BiosModuleNumber > 1) { for (Index =3D 0; Index = < (UINTN)gFitTableContext.BiosModuleNumber - 1; Index++){@@ -2855,12 +2872,= 16 @@ Returns: } } for (Index =3D 0; Index < gFitTableContext.BiosModuleNumber; I= ndex++) {- FitEntry[FitIndex].Address =3D gFitTableContext.B= iosModule[Index].Address;- *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D gF= itTableContext.BiosModule[Index].Size / 16;- FitEntry[FitIndex].Version = =3D (UINT16)gFitTableContext.BiosModuleVersion;- FitEntry[Fi= tIndex].Type =3D FIT_TABLE_TYPE_BIOS_MODULE;- FitEntry[Fi= tIndex].C_V =3D 0;- FitEntry[FitIndex].Checksum = =3D 0;+ FitEntrySizeValue =3D gFitTableContext.BiosModule[I= ndex].Size / 16;+ FitEntry[FitIndex].Address =3D gFitTableContext.BiosM= odule[Index].Address;+ FitEntry[FitIndex].Size[0] =3D (UINT8)FitEntrySi= zeValue;+ FitEntry[FitIndex].Size[1] =3D (UINT8)(FitEntrySizeValue >> 8= );+ FitEntry[FitIndex].Size[2] =3D (UINT8)(FitEntrySizeValue >> 16);+ = FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[FitIndex].Version =3D (U= INT16)gFitTableContext.BiosModuleVersion;+ FitEntry[FitIndex].Type = =3D FIT_TABLE_TYPE_BIOS_MODULE;+ FitEntry[FitIndex].C_V =3D 0;+ = FitEntry[FitIndex].Checksum =3D 0; FitIndex++; } @@ -2868,15 +2889,18= @@ Returns: // 6. Optional module // for (Index =3D 0; Index < gFitTableContext.= OptionalModuleNumber; Index++) {- FitEntry[FitIndex].Address = =3D gFitTableContext.OptionalModule[Index].Address;- *(UINT32 *)&FitEnt= ry[FitIndex].Size[0] =3D gFitTableContext.OptionalModule[Index].Size;- F= itEntry[FitIndex].Version =3D (UINT16)gFitTableContext.Optional= Module[Index].Version;- FitEntry[FitIndex].Type =3D (UINT= 8)gFitTableContext.OptionalModule[Index].Type;+ FitEntrySizeValue = =3D gFitTableContext.OptionalModule[Index].Size;+ FitEntry[FitIndex]= .Address =3D gFitTableContext.OptionalModule[Index].Address;+ FitEntry[= FitIndex].Size[0] =3D (UINT8)FitEntrySizeValue;+ FitEntry[FitIndex].Siz= e[1] =3D (UINT8)(FitEntrySizeValue >> 8);+ FitEntry[FitIndex].Size[2] = =3D (UINT8)(FitEntrySizeValue >> 16);+ FitEntry[FitIndex].Version =3D (= UINT16)gFitTableContext.OptionalModule[Index].Version;+ FitEntry[FitInde= x].Type =3D (UINT8)gFitTableContext.OptionalModule[Index].Type; if = (FitEntry[FitIndex].Type =3D=3D FIT_TABLE_TYPE_CSE_SECURE_BOOT) {- Fit= Entry[FitIndex].Rsvd =3D (UINT8)gFitTableContext.OptionalModul= e[Index].SubType;+ FitEntry[FitIndex].Rsvd =3D (UINT8)gFitTableConte= xt.OptionalModule[Index].SubType; }- FitEntry[FitIndex].C_V = =3D 0;- FitEntry[FitIndex].Checksum =3D 0;+ FitEnt= ry[FitIndex].C_V =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; Fit= Index++; } @@ -2884,12 +2908,16 @@ Returns: // 7. Port module // for (Index =3D 0; Index < gFitTableContext.Port= ModuleNumber; Index++) {- FitEntry[FitIndex].Address =3D gFi= tTableContext.PortModule[Index].Address + ((UINT64)gFitTableContext.PortMod= ule[Index].Size << 32);- *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0;- = FitEntry[FitIndex].Version =3D (UINT16)gFitTableContext.Port= Module[Index].Version;- FitEntry[FitIndex].Type =3D (UINT= 8)gFitTableContext.PortModule[Index].Type;- FitEntry[FitIndex].C_V = =3D 0;- FitEntry[FitIndex].Checksum =3D 0;+ Fit= EntrySizeValue =3D 0;+ FitEntry[FitIndex].Address =3D gFitTab= leContext.PortModule[Index].Address + ((UINT64)gFitTableContext.PortModule[= Index].Size << 32);+ FitEntry[FitIndex].Size[0] =3D (UINT8)FitEntrySize= Value;+ FitEntry[FitIndex].Size[1] =3D (UINT8)(FitEntrySizeValue >> 8);= + FitEntry[FitIndex].Size[2] =3D (UINT8)(FitEntrySizeValue >> 16);+ = FitEntry[FitIndex].Rsvd =3D 0;+ FitEntry[FitIndex].Version =3D (UIN= T16)gFitTableContext.PortModule[Index].Version;+ FitEntry[FitIndex].Type= =3D (UINT8)gFitTableContext.PortModule[Index].Type;+ FitEntry[FitIn= dex].C_V =3D 0;+ FitEntry[FitIndex].Checksum =3D 0; FitIndex++;= } @@ -3130,6 +3158,7 @@ Returns: --*/ { FIRMWARE_INTERFACE_TABLE_ENTRY *FitEntry;+ UINT32 = FitEntrySizeValue; UINT32 FitIndex; = UINT32 FitTableOffset; @@ -3155,7 +3184,8 @@ Retu= rns: if (FitEntry[FitIndex].Type !=3D FIT_TABLE_TYPE_HEADER) { return 0; = }- gFitTableContext.FitEntryNumber =3D *(UINT32 *)&FitEntry[FitIndex].Si= ze[0];+ FitEntrySizeValue =3D (((UINT32)FitEntry[FitIndex].Size[2]) << 16)= + (((UINT32)FitEntry[FitIndex].Size[1]) << 8) + ((UINT32)FitEntry[FitIndex= ].Size[0]);+ gFitTableContext.FitEntryNumber =3D FitEntrySizeValue; gFit= TableContext.FitHeaderVersion =3D FitEntry[FitIndex].Version; //@@ -3163= ,6 +3193,7 @@ Returns: // FitIndex++; for (; FitIndex < gFitTableContext.FitEntryNumber; Fi= tIndex++) {+ FitEntrySizeValue =3D (((UINT32)FitEntry[FitIndex].Size[2])= << 16) + (((UINT32)FitEntry[FitIndex].Size[1]) << 8) + ((UINT32)FitEntry[F= itIndex].Size[0]); switch (FitEntry[FitIndex].Type) { case FIT_TABL= E_TYPE_MICROCODE: gFitTableContext.Microcode[gFitTableContext.Microco= deNumber].Address =3D (UINT32)FitEntry[FitIndex].Address;@@ -3175,7 +3206,7= @@ Returns: break; case FIT_TABLE_TYPE_BIOS_MODULE: gFitTableContext.B= iosModule[gFitTableContext.BiosModuleNumber].Address =3D (UINT32)FitEntry[F= itIndex].Address;- gFitTableContext.BiosModule[gFitTableContext.BiosMo= duleNumber].Size =3D *(UINT32 *)&FitEntry[FitIndex].Size[0] * 16;+ = gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Size =3D = FitEntrySizeValue * 16; gFitTableContext.BiosModuleVersion = =3D FitEntry[FitIndex].Version; gFitTableCo= ntext.BiosModuleNumber ++; break;@@ -3192,7 +3223,7 @@ Returns: // Not Port Configure, pass through default: // Others gFi= tTableContext.OptionalModule[gFitTableContext.OptionalModuleNumber].Address= =3D (UINT32)FitEntry[FitIndex].Address;- gFitTableContext.OptionalMod= ule[gFitTableContext.OptionalModuleNumber].Size =3D *(UINT32 *)&FitEntry= [FitIndex].Size[0];+ gFitTableContext.OptionalModule[gFitTableContext.= OptionalModuleNumber].Size =3D FitEntrySizeValue; gFitTableContext= .OptionalModule[gFitTableContext.OptionalModuleNumber].Version =3D FitEntry= [FitIndex].Version; gFitTableContext.OptionalModule[gFitTableContext.= OptionalModuleNumber].Type =3D FitEntry[FitIndex].Type; gFitTableC= ontext.OptionalModuleNumber ++;--=20 2.37.0.windows.1