From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.4034.1675907421665684535 for ; Wed, 08 Feb 2023 17:50:21 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=CWpsuCHW; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: chasel.chiu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675907421; x=1707443421; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=+z8UBjL+UyPTuyunOPmetEiTIh8B8AlVBK2AuW2mh3o=; b=CWpsuCHWnhtx57WZKClvKFjJNg9XQwPXJQd6jcaOecT2VAWQvZrMXniR GL1w5yg1/ni5iBmDek4TzICfE7Le5IvMs8HHZOET0f4tRVpxiOorBV429 RhgHy3/8JyidC2rcicywC9vCRkpsqf2bhSpk3C+4a5giPdnOX9vZ/LJyJ tiSUvbXA9YioHItbx1xgQP72m0Mr5h+aak14apvmXfOs0jVElqvZpz+WM T4HNfDFeMWXSuk5OOrREg5JoJscl0zbxRoK5HHeEHzyQUcz7u5HFkvOED gSkPYn3T0rDFYs14WqJ8sSF4VLfr1cjRNz9hDdooUL0HPhU1qDI+R/aX3 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10615"; a="331271071" X-IronPort-AV: E=Sophos;i="5.97,281,1669104000"; d="scan'208";a="331271071" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Feb 2023 17:50:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10615"; a="756249208" X-IronPort-AV: E=Sophos;i="5.97,281,1669104000"; d="scan'208";a="756249208" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by FMSMGA003.fm.intel.com with ESMTP; 08 Feb 2023 17:50:07 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) 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.2507.16; Wed, 8 Feb 2023 17:50:03 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 8 Feb 2023 17:50:03 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) 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.2507.16 via Frontend Transport; Wed, 8 Feb 2023 17:50:03 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) 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.2507.16; Wed, 8 Feb 2023 17:50:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lU+xGr6lGMf0awB8pWPhH/wcr0K5E5aBmSUGcDS98SijY6AwU8Ap3lgT1mcw+CGq1WMpT8BRnrbUT3/nL27tc23WnoAuy7ZP0r7Cq3ajJIZHQypfJchXbzygJnQzl1bziLI0zrqKl1ME8/RrCAWlr/00Yl5/p6nk7UxGe81N2BNj6Nbt6UFHR4d4ZTzezIWwqhxWgmWGptN91UwIADRUtrvwRfqSv/xRkHWSJt+LS5d4V1H7ZBJKzkYq4tVDthKicptt8m1XTM+FZf+fftbaxpdVJvAyd+8qzeCbXZcsasg2HQYbxuwSg0bYiOR0VWalZWoehbp1+oItQ/z3XdVv9Q== 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=8BT9uIDU0jrLnLZJI4IMGOcMQXHbDvXd3GNlbbV16d0=; b=aFWXoooMVAabDN6lhCyJ/qA8gefx8cUePbi50pBUvQFBBazMig07iu7ngL0ulc+mQEiLughKhdIpmcTBvCXB2i/DeJrRr68eWPOi0CUkX0Q/8jyWssHuVzNJ4hsCitppuTZa+1+G7D28ebQVMrdkM4dZOhQD/CG2CVGNuUTP2o4jgNdRyRke45cmVxRB4qljEWKb7aG9BJAOrKxY7pOcqOVqB57Jq0QbJVhvp9fZlGDY0kx6puYd4XFliYctMrn8JtOx0QqUrnOSvqP/2VXlq37rF1sRwhHa3uKdhrqTd3cT5AZs6YjQb3lr7YW7NgDGC+N0Dsx5J0t4fnoznecNjg== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DS0PR11MB6326.namprd11.prod.outlook.com (2603:10b6:8:ce::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Thu, 9 Feb 2023 01:50:00 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::ee18:f0d6:8983:5a24]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::ee18:f0d6:8983:5a24%3]) with mapi id 15.20.6086.017; Thu, 9 Feb 2023 01:50:00 +0000 From: "Chiu, Chasel" To: "devel@edk2.groups.io" , "Chiu, Chasel" CC: "S, Ashraf Ali" , "Oram, Isaac W" , "Chaganty, Rangasai V" , "Ni, Ray" , "Kubacki, Michael" Subject: Re: [edk2-devel] [edk2-platforms: PATCH v4] IntelSiliconPkg/SpiFvbServiceSmm: Rewrite VariableStore header. Thread-Topic: [edk2-devel] [edk2-platforms: PATCH v4] IntelSiliconPkg/SpiFvbServiceSmm: Rewrite VariableStore header. Thread-Index: AQHZPAtAYfPFwmBlREK3D8Oz8ixCOK7F2XMA Date: Thu, 9 Feb 2023 01:50:00 +0000 Message-ID: References: <1741F951181BEE58.3529@groups.io> In-Reply-To: <1741F951181BEE58.3529@groups.io> 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-traffictypediagnostic: BN9PR11MB5483:EE_|DS0PR11MB6326:EE_ x-ms-office365-filtering-correlation-id: 61e7201f-d74f-48b9-3822-08db0a3ff484 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: Wib1nICysGus4pZs/QYJqrF9Tjai/dgjHKl6e8DW9SDmaCdwbyJiQWpAx/vDwIqnrqXam/5mtNam2ZyR0nb3do1c7xUOJObEvvz3IoZfWuRpXwdsc7novueWgQL+f85LseccYSV43T1XKNJVEb+nYDgPo6t/kuJ9FrP+8oR0HIOoO79Cqpc1qGd5vfJWj5N+IepbNG0pvcWkfmtl2DJdVoSEjlKGziaNmtv4D7NBciUN6sxh5ur37DECvIUCxtjwryG+20P3ywBHSXA97wsuM2yjPh13v4CpPwjBwMoylth5ykMfLwsASo7+PvTq3mwpbuOdYNwDY/8mn1cRi8WhaX/lSlvt16Ba+J2qNi32t9BFGezgIp/5j6MQM+NBOZtlRtDKpOXiVirhHlLglGQwxHWZdsb8A4nxggp2VEGTfD/zOfGaMRaMJEWoFsz+foaoXA3yhjzKYyt0i5TF3F7a9ijiW+ow+3t2KIs2cHt+i0YyiFR/J7TiuohYz5O9P+NEANdaVmF56Z7M8Lawxr/E8ZvUKCVDSmDz/ZkOa3tNQC+JOnEHRupV4r/KLuWcTmuBgz5TeSAT+JXObAix2zBsSbxMH2pwoomJGxHyTwjgFM5afs+Or7LHEaCOlNM6roaQg0x3tCLxVi2Nh9MOxZe6JdfNSFTM9Q3yeCdLakaEiThJA6Y5QvZAiR/lntLhgIDoGjayRlsHnuHSmuaZeAWT65e5KZkxAaseVzbCO/MPCrHvN5tD5Kohx3ofZUhrSikpy0ABsIZlEqpLKgS4dVziYQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5483.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(346002)(366004)(396003)(136003)(39860400002)(376002)(451199018)(122000001)(66899018)(82960400001)(38100700002)(966005)(8936002)(186003)(5660300002)(26005)(9686003)(52536014)(38070700005)(71200400001)(19627235002)(41300700001)(33656002)(6506007)(53546011)(76116006)(8676002)(4326008)(316002)(64756008)(66946007)(66556008)(478600001)(86362001)(66476007)(66446008)(2906002)(54906003)(110136005)(7696005)(55016003)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?W855ofnQELonUflrFfJb3x22BOFTcZUp4MepX3P8CA64qtZ3lRxvgbZegr/w?= =?us-ascii?Q?ENvWtJFLBknZFOqoELj5KpHSUVEJZAmu6AykB0Glx0GdVK/KkxbRKjvLx0qF?= =?us-ascii?Q?yl7VLHGCD1tBivGbJtJlrRGRKa2BANv1j7iEc5XT7IRhANraJnMCy9Ae19Hr?= =?us-ascii?Q?Jht8/CIT2BI9u8AW82ZRp5ezuLo/CNPyzkwIHKfXePW9e2bVLZ/gegdeFFZp?= =?us-ascii?Q?8G2zBC5qwRPjGDMn8giVmnqLoVYzkqMB1R59HIcdreHyan4LNg/aH/scF+4O?= =?us-ascii?Q?qbheyt/F96pTZIPGvDPukBWwQm0O+CoM+TQMF5zvfg3dL3FyYaxuGvjoSgwU?= =?us-ascii?Q?toYBKkt3nB1p5lLkAxnvXWkPVWhX1FWNig5JzQNGPxdO+aGsw9htmM5V68A3?= =?us-ascii?Q?6gBwWe9Es7Vm6sdsQ7k7alEBvM6mF1igNojQAtmkdxLIpU3nCTW3Iu/Pkalk?= =?us-ascii?Q?Oc2LyHBxMZMZ/702If8/+AKsRmrbSBR19+INHsq6WntJtmBV7fv2EJF/ECA5?= =?us-ascii?Q?9typVPDNGEQQ8oIs/EN8veDr1qkHe+ICTD0LYhcuY8xmifi3mL2ETTcx20pH?= =?us-ascii?Q?TEK/4RFaW9KoGiVECWdICQ69b5l6XIsv7J7XvXMTAgbWPPp6mV+b9QXXN+MW?= =?us-ascii?Q?ZOamiSsotxn25lJaGAzGDhEh1kHnET5puqM4NdYXYT3iIqfQEw60NRPZ8UN2?= =?us-ascii?Q?OL8ujL+68bHuIffViRcn7xSjmyqU0Bkmsbwn3bg3h+VVyo0C5Lt59DtoEygw?= =?us-ascii?Q?Or8uq64tst+wC59ZFb0HtXaIRdFI443KCRRTQYletHGQtHgkgxoZqXr58q3h?= =?us-ascii?Q?5QPkm0ItKKYqgirFsjmh1GF8Z9jfDD7OJiiKdbhZ7rGIL+8/+pE/QXVbYhl/?= =?us-ascii?Q?ZXrq2kqwmtGh8RNoPzXyD2y0wdJxknSceHdr8GRKTjHcm9lAt0QzJuvi3+1Z?= =?us-ascii?Q?4M/yRwYgsbXs26ta3vI3766SR2JMwJB7qmxqaIq5sQsKF7V7vUytOhuphiSn?= =?us-ascii?Q?371rVwTuOr3N3Ca7vK2WvHDzvD6YvdlS51rhadCCAWCbWw6MfVczifkTz9z6?= =?us-ascii?Q?7Se3fOgpSsazXh7WlfshdOfnONdv8dbEQRGwTsnTcMVr6Y7FbW3I0mQsZMSv?= =?us-ascii?Q?6hQiEBgDncdt3pd+GghTY1Ct/0ke2DRE+R6s4phIZkzprwzGyESIhP2v0mh6?= =?us-ascii?Q?JG5AJFNgx5vmLDkarSs601Kacjp7mcKtLXg0ajLh0F7lnRRGgq69Yy5Ck0+4?= =?us-ascii?Q?GC3iLxPGkDm7AYkoI2WSOBCmnM+mCf22zF29WYlYdw7hEdDjaWB/5RJUX04Z?= =?us-ascii?Q?c8FFg9gNgf2C3eFG3qTDvPchXEVmPrjSNYgmnY2Luj+z6QocJC3PY21ZNhtQ?= =?us-ascii?Q?vtJJLHOcbG68wY7ba2hkI2SkdQWpqgwtkBaA+xH9HrLSYFLpfCo+bLQRYc/4?= =?us-ascii?Q?R8slFjgBt5f436wOobslQ7MBVesDAbn73xQOhFRukbm8scJ9fFFrjDcC5EHZ?= =?us-ascii?Q?GsCDVhK016aj5IEuAhuB1BrhmWjK/IbeuIt+Bu/e5V8opdp6QVgBWaPPeSD5?= =?us-ascii?Q?7wjyeFuceWKMgOe6DdEr0bwOP2VPACfaEmHl8u8d?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 61e7201f-d74f-48b9-3822-08db0a3ff484 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Feb 2023 01:50:00.4111 (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: 21wlGEPLT/ozoTvJ7oC1QTsG2KYtQcyR45/JKMHleoVLuxjEH1Pn/fv6xc+/ccPlu7TmYZ2WFJpZClFcMj6fFg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6326 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Bug fix patch has been merged: https://github.com/tianocore/edk2-platforms/= commit/e95c7988994c73918ffa282e2d2f5af11f8addc4 Thanks, Chasel > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chiu, Chas= el > Sent: Wednesday, February 8, 2023 2:17 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; S, Ashraf Ali ; > Oram, Isaac W ; Chaganty, Rangasai V > ; Ni, Ray ; Kubacki, > Michael > Subject: [edk2-devel] [edk2-platforms: PATCH v4] > IntelSiliconPkg/SpiFvbServiceSmm: Rewrite VariableStore header. >=20 > When invalid VariableStore FV header detected, current SpiFvbService will= erase > both FV and VariableStore headers from flash, however, it will only rewri= te FV > header back and cause invalid VariableStore header. >=20 > This patch adding the support for rewriting both FV header and VariableSt= ore > header when VariableStore corruption happened. > The Corrupted variable content should be taken care by FaultTolerantWrite > driver later. >=20 > Platform has to set PcdFlashVariableStoreType to inform SpiFvbService whi= ch > VariableStoreType should be rewritten. >=20 > Cc: Ashraf Ali S > Cc: Isaac Oram > Cc: Rangasai V Chaganty > Cc: Ray Ni > Cc: Michael Kubacki > Signed-off-by: Chasel Chiu > --- > Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceM= m.c | > 69 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- > --- > Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbServiceS= mm.inf > | 3 +++ > Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec = | 8 ++++++++ > 3 files changed, 75 insertions(+), 5 deletions(-) >=20 > diff --git > a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Mm.c > b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Mm.c > index 6b4bcdcfe3..052be97872 100644 > --- > a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Mm.c > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSe > +++ rviceMm.c > @@ -12,6 +12,7 @@ > #include #include > #include > +#include > /** The function installs EFI_FIRMWARE_VOLUME_BLOCK protocol@@ -113,7 > +114,12 @@ FvbInitialize ( > UINT32 MaxLbaSize; UINT32 = BytesWritten; > UINTN BytesErased;+ EFI_PHYSICAL_ADDRESS > NvStorageBaseAddress; UINT64 NvStorageFv= Size;+ UINT32 > ExpectedBytesWritten;+ VARIABLE_STORE_HEADER > *VariableStoreHeader;+ UINT8 VariableSto= reType;+ UINT8 > *NvStoreBuffer; Status =3D GetVariableFlashNvStorageInfo (&BaseAddress= , > &NvStorageFvSize); if (EFI_ERROR (Status)) {@@ -124,12 +130,14 @@ > FvbInitialize ( > // Stay within the current UINT32 size assumptions in the variable st= ack. > Status =3D SafeUint64ToUint32 (BaseAddress, > &mPlatformFvBaseAddress[0].FvBase);+ NvStorageBaseAddress =3D > mPlatformFvBaseAddress[0].FvBase; if (EFI_ERROR (Status)) > { ASSERT_EFI_ERROR (Status); DEBUG ((DEBUG_ERROR, "[%a] - 64-bit > variable storage base address not supported.\n", __FUNCTION__)); retu= rn; } > Status =3D SafeUint64ToUint32 (NvStorageFvSize, > &mPlatformFvBaseAddress[0].FvSize);+ NvStorageFvSize =3D > mPlatformFvBaseAddress[0].FvSize; if (EFI_ERROR (Status)) > { ASSERT_EFI_ERROR (Status); DEBUG ((DEBUG_ERROR, "[%a] - 64-bit > variable storage size not supported.\n", __FUNCTION__));@@ -186,8 +194,59 > @@ FvbInitialize ( > } continue; }- BytesWritten =3D FvHea= der->HeaderLength;- > Status =3D SpiFlashWrite ((UINTN)BaseAddress, &BytesWritten, > (UINT8*)FvHeader);++ BytesWritten =3D FvHeader->HeaderLeng= th;+ > ExpectedBytesWritten =3D BytesWritten;+ if (BaseAddress !=3D > NvStorageBaseAddress) {+ Status =3D SpiFlashWrite ((UINTN)BaseAd= dress, > &BytesWritten, (UINT8 *)FvHeader);+ } else {+ //+ = // This is > Variable Store, rewrite both EFI_FIRMWARE_VOLUME_HEADER and > VARIABLE_STORE_HEADER.+ // The corrupted Variable content should= be > taken care by FaultTolerantWrite driver later.+ //+ NvS= toreBuffer =3D > NULL;+ NvStoreBuffer =3D AllocateZeroPool (sizeof > (VARIABLE_STORE_HEADER) + FvHeader->HeaderLength);+ if > (NvStoreBuffer !=3D NULL) {+ //+ // Combine FV head= er and > VariableStore header into the buffer.+ //+ CopyMem = (NvStoreBuffer, > FvHeader, FvHeader->HeaderLength);+ VariableStoreHeader =3D > (VARIABLE_STORE_HEADER *)(NvStoreBuffer + FvHeader->HeaderLength);+ > VariableStoreType =3D PcdGet8 (PcdFlashVariableStoreType);+ = switch > (VariableStoreType) {+ case 0:+ DEBUG ((DEBUG= _ERROR, "Type: > gEfiVariableGuid\n"));+ CopyGuid (&VariableStoreHeader->Si= gnature, > &gEfiVariableGuid);+ break;+ case 1:+ = DEBUG > ((DEBUG_ERROR, "Type: gEfiAuthenticatedVariableGuid\n"));+ = CopyGuid > (&VariableStoreHeader->Signature, &gEfiAuthenticatedVariableGuid);+ > break;+ default:+ break;+ }++ = //+ // Initialize > common VariableStore header fields+ //+ VariableSto= reHeader- > >Size =3D (UINT32) (NvStorageFvSize - FvHeader->HeaderLength);+ > VariableStoreHeader->Format =3D VARIABLE_STORE_FORMATTED;+ > VariableStoreHeader->State =3D VARIABLE_STORE_HEALTHY;+ > VariableStoreHeader->Reserved =3D 0;+ VariableStoreHeader->Re= served1 =3D > 0;++ //+ // Write buffer to flash+ //+ = BytesWritten =3D > FvHeader->HeaderLength + sizeof (VARIABLE_STORE_HEADER);+ > ExpectedBytesWritten =3D BytesWritten;+ Status = =3D SpiFlashWrite > ((UINTN)BaseAddress, &BytesWritten, NvStoreBuffer);+ FreePool > (NvStoreBuffer);+ } else {+ Status =3D > EFI_OUT_OF_RESOURCES;+ }+ }+ if (EFI_ERROR (Statu= s)) > { DEBUG ((DEBUG_WARN, "ERROR - SpiFlashWrite Error %r\n", Stat= us)); > if (FvHeader !=3D NULL) {@@ -195,9 +254,9 @@ FvbInitialize ( > } continue; }- if (BytesWritten !=3D = FvHeader->HeaderLength) > {- DEBUG ((DEBUG_WARN, "ERROR - BytesWritten !=3D HeaderLength\n= "));- > DEBUG ((DEBUG_INFO, " BytesWritten =3D 0x%X\n HeaderLength =3D 0x%X\n", > BytesWritten, FvHeader->HeaderLength));+ if (BytesWritten !=3D > ExpectedBytesWritten) {+ DEBUG ((DEBUG_WARN, "ERROR - > BytesWritten !=3D ExpectedBytesWritten\n"));+ DEBUG ((DEBUG_INFO= , " > BytesWritten =3D 0x%X\n ExpectedBytesWritten =3D 0x%X\n", BytesWritten, > ExpectedBytesWritten)); if (FvHeader !=3D NULL) { F= reePool > (FvHeader); }diff --git > a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Smm.in > f > b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Smm.in > f > index 0cfa3f909b..73049eceb2 100644 > --- > a/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbService= Smm.in > f > +++ b/Silicon/Intel/IntelSiliconPkg/Feature/Flash/SpiFvbService/SpiFvbSe > +++ rviceSmm.inf > @@ -45,6 +45,7 @@ > [Pcd] gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvBase #= # > CONSUMES gIntelSiliconPkgTokenSpaceGuid.PcdFlashMicrocodeFvSize = ## > CONSUMES+ gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType = ## > SOMETIMES_CONSUMES [Sources] FvbInfo.c@@ -61,6 +62,8 @@ > [Guids] gEfiFirmwareFileSystem2Guid ## CONSUMES > gEfiSystemNvDataFvGuid ## CONSUMES+ gEfiVariableG= uid > ## SOMETIMES_CONSUMES+ gEfiAuthenticatedVariableGuid ## > SOMETIMES_CONSUMES [Depex] TRUEdiff --git > a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > index 485cb3e80a..63dae756ad 100644 > --- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > +++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec > @@ -186,3 +186,11 @@ > # @Prompt VTd abort DMA mode support. > gIntelSiliconPkgTokenSpaceGuid.PcdVTdSupportAbortDmaMode|FALSE|BOOLE > AN|0x0000000C + ## Define Flash Variable Store type.

+ # When > Flash Variable Store corruption happened, the SpiFvbService will recreate > Variable Store+ # with valid header information provided by this PCD > value.
+ # 0: Variable Store is gEfiVariableGuid type.
+ # 1: V= ariable > Store is gEfiAuthenticatedVariableGuid type.
+ # Other value: reserv= ed for > future use.
+ # @Prompt Flash Variable Store type.+ > gIntelSiliconPkgTokenSpaceGuid.PcdFlashVariableStoreType|0x00|UINT8|0x000 > 0000E-- > 2.35.0.windows.1 >=20 >=20 >=20 > -=3D-=3D-=3D-=3D-=3D-=3D > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#99818): https://edk2.groups.io/g/devel/message/99818 > Mute This Topic: https://groups.io/mt/96841486/1777047 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [chasel.chiu@intel.com]= -=3D- > =3D-=3D-=3D-=3D-=3D >=20