From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.5165.1633988805397767708 for ; Mon, 11 Oct 2021 14:46:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=etH7fuvx; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: nathaniel.l.desimone@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10134"; a="207780884" X-IronPort-AV: E=Sophos;i="5.85,365,1624345200"; d="scan'208";a="207780884" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2021 14:46:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,365,1624345200"; d="scan'208";a="480045025" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga007.jf.intel.com with ESMTP; 11 Oct 2021 14:46:41 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 11 Oct 2021 14:46:41 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 11 Oct 2021 14:46:40 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 11 Oct 2021 14:46:40 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.172) 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.2242.12; Mon, 11 Oct 2021 14:46:39 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QO4hzZHPcy9Eracs6ZcBnU5Eo4OLihqyuCtSAcfnBSaufWDHq2HPGgvAZfSaz6UJze8bcijdfltOOkoo+oTDiQXzavz2RTxuQwByf8AYLN075f9bx8dwwRalFhpoppKKho83QCLmScwor2PVocj4OYCM6Og4tK9+8aorYM3MI44Vb04bdkMpLfPU5CaUpk6BOhO0fmeh9UwC+AeQThQBEHHqIhVvVmbZByavhQZuRoGX1iFWbus5iOfyB5mJCbvAjfENoYiJ65g5o+5g+i2RQ2CWJyHunBDtGRy6YU/HGHkIAIe/QkMdQTaVn0ry8rVJtD9PvyUzD022r80JT6nEXQ== 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=ufp0mYl76g2j3pUzqmEaYwH5firogIME9h8mICBb0mY=; b=M/YwdIaJbvIgBk3BCaotxObWnlZk6nuTGxh3Uh42X8VtukZqUOguvUs1dxo0OtVCi4+RMH3gagaarZdU8MAilKJ0og0aWDeNUQaebndDjmyRWWmyz2YOFowgaHKK1lRJE9q4FaeB+tByVJ5C3jgA0E3VFc7noD0nvtH23hkrN74vTTecGCUnm8P+N81QEEax+8wwKyUfFErU3aSFCaOJ1TrIa3Sm+G15NDLvjwbeA+nDHTp45NW5N0J8KqMH5BsJGOKFy3XBqKdJpOj/BAUCcPkG/ElqO3hIKBBdqvG9l5o5HopdHUpyOnt9gG5/Hbbs3yoII9QvXcBuxtBR4XDj5w== 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=ufp0mYl76g2j3pUzqmEaYwH5firogIME9h8mICBb0mY=; b=etH7fuvxpnIMuwU1J4e9aRCf8cAvRlwS3REs8zk52Gj6JLMJype/eG7OaBn4wMq8HYoVXztsxbgbyycUrkz/Kh2eslT4RFVUEwgUI+2Y5mgDz6oz/EG8zH07l6nYMv5ZkmCifvvlD4JvSZE6ig8p2lTU5XvZnbo6Tj5xt+1kOA4= Received: from MWHPR1101MB2160.namprd11.prod.outlook.com (2603:10b6:301:5b::12) by CO1PR11MB5057.namprd11.prod.outlook.com (2603:10b6:303:6c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Mon, 11 Oct 2021 21:46:38 +0000 Received: from MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::f07d:7a97:3b68:92ed]) by MWHPR1101MB2160.namprd11.prod.outlook.com ([fe80::f07d:7a97:3b68:92ed%11]) with mapi id 15.20.4587.026; Mon, 11 Oct 2021 21:46:38 +0000 From: "Nate DeSimone" To: "Chiu, Chasel" , "devel@edk2.groups.io" CC: Liming Gao , "Dong, Eric" Subject: Re: [edk2-platforms: PATCH v3 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. Thread-Topic: [edk2-platforms: PATCH v3 1/9] MinPlatformPkg: Support FSP 2.3 FSP_NON_VOLATILE_STORAGE_HOB2. Thread-Index: AQHXvA/Tus+nT4DAxkWjMgMy6SnVi6vOV7Nw Date: Mon, 11 Oct 2021 21:46:38 +0000 Message-ID: References: <20211008064317.1371-1-chasel.chiu@intel.com> <20211008064317.1371-2-chasel.chiu@intel.com> In-Reply-To: <20211008064317.1371-2-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.6.200.16 dlp-product: dlpe-windows authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 56128b4a-91fb-4a13-84e5-08d98d009af6 x-ms-traffictypediagnostic: CO1PR11MB5057: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: XYmceLd5YWfYNOoyAzpj77PlZrhHf2yDT+aCYAiTIAAo0YM0oWndH8bPfHObBHXLFloOMmfUPQcaCN03PEGMGymeXDaIhDh0DdD+lv9tS2BHAPi+MWl9COE4qPevagOYhECW/Uc84iRKMor6qpU1EG/hPtSWmoHcDCATP/tSEDFAMrqtxnO4xq8DJd1eSnQ0iOmeXDCvn6EzPHPQ3zlDO+97AkLqkYrAGYQSCG/281nrq4Aq7nVeGrXuRyywPNjWyWHumjGDvGx/2zsHhqW5N9bCXm1pmofH/kuCDFQx8yW7AHY5OOJXZrMZxbU+Z29b/5p+Kp/BVXpfCGMRBJ0S8FwInnQ7L492jaJfpKDPPNg8/9Sm53oxTnSMgn+OaOlPh6dMIzZKMny3M//iG5H6wldJrm2XeeUzhb2uAkN6y/iDIxy/Z3CobpJLSWQwmuxQtI3CoxD5VE0tLW/cK/o0VobP5mED3NgVypeSi1PztBHa+RUQdXs3OsGMArfWA5OaPKjrrli1NAJhyYANQAEuJNRQ+qHboYALiQ2AmKHNrDBQFNUUpzgxoNHvWOqP8tRx8ivZju6aRc7BLVqMNT/hNLbwBpLabn504KzKbgrK4diRLg7sRVD8po7gzj436VMXdRxs/166uVzyT0v5zrLTljTsZWqxSLCz6Adaa+meRek3F/vu73B4fXBVtzYAkyF4glWfVTGCzq0Bsyf16X1lrRSa7EU/8a0Vv7+c7Ls2TtPx+yOateyfHTU0yO90RO6jOyPIEw2BQRAgkh8nC+Hun5ftY5jmxpeFxrvV53lzbB4= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2160.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(86362001)(64756008)(38070700005)(33656002)(83380400001)(30864003)(186003)(8936002)(66556008)(4326008)(2906002)(66476007)(107886003)(122000001)(26005)(66946007)(52536014)(7696005)(5660300002)(316002)(8676002)(9686003)(76116006)(71200400001)(6506007)(55016002)(966005)(38100700002)(508600001)(54906003)(53546011)(66446008)(19627235002)(110136005);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?pGdOGnGmxbst4XQ1DDMSww11LICLKmaEEvSOmQ9pdU0anKFCXbCWUrFAEXsB?= =?us-ascii?Q?FJNIHyACyg9m115DUvl3Wdh3rU9z7feF5GGxdN2FnuOKmOTz2tNTOwgw1yUn?= =?us-ascii?Q?QHWr8S4mxAGXKzzamnebqUsPQjzX2vx6C+zHbCP2QWbFy3BtAK86lxMkG2pi?= =?us-ascii?Q?EvcQgZWoHswPOxt3A9DG69mHKD3w9IO1sNaWw/ctyGMy4e9JUHtcbuzNOWjq?= =?us-ascii?Q?sjfCtUtPwEaI6gjVZ4/p38Nx+rQDOvJH5+jRgBfPH4hZjHmMlDjQjPkx7UZE?= =?us-ascii?Q?4nFceS7zzbM3Rv0musQlXDZykAVmgOZOPMvSTK9xdSJ/3hPeegxdDagfjkc0?= =?us-ascii?Q?hnasSpGifYQDpdBcToqBYAJZsHl0lM989Kth/Ch9K34eLahUQ+iEIMh3cZME?= =?us-ascii?Q?NolFCtxsFqzKIOa7u8bcMbDj4cIEoh/NuUnTXmNEzjML5Ybzus6aNfmSlKza?= =?us-ascii?Q?0g8abiuazgknfG5H1AIorPnRB5McJxeh2+FvbhihllgukHyGXCtiFRpwj4Od?= =?us-ascii?Q?2TZHkGMeEx+0m1sPEIY0oGfMG26wP6yLFr+9MzC1A9nGQzLOdOdREgMsmIuG?= =?us-ascii?Q?/mn3I794KzZWXkQY4oxsMvgdAkn8qXDRoMmGmbFWFd/+TjLKovHXQtoXlbGw?= =?us-ascii?Q?c0lrZWJPWliNzu0zSlWZQH7xeK7FxMEZ8+vz6nHiHx3BWBHFrIV+rJ4F+3P8?= =?us-ascii?Q?zD9KUYFKgFL+m0TmoiztoCNS6yBGm9xlRfTZeWcha+8ajhVejcvI1t3M5Yv+?= =?us-ascii?Q?/9txhbg0tj0+TGFR3LU+bbkr2gFEDldo8joy4jS4X0t7vhn+v7KiLeZmo0pe?= =?us-ascii?Q?BfFZHXZF1xkoeMgspeopwhl6pE/h9yQsUGBdvOITgsLAHheY3I3ImyJJyPn5?= =?us-ascii?Q?pszGRKdmuIicB8jpgfg9TXCTBSObVQZjTbGilu7FsUOBvE0Yj+HoXlqCsvM4?= =?us-ascii?Q?G6dY6KRdkbq0tN6Q99LSZtbjdBxY2ysGNyvi8GLwO1s/k8JW3XMTjtzJNfjI?= =?us-ascii?Q?NOYMF2VZAg0tJflngHFz5663uCdWOhudL0/PqoZxxQUSDZtOmvXwVViV395M?= =?us-ascii?Q?5O0AVsbNn33zfBNiZvBcCWmWCHu650do4eA3z4RzUMb8VgDSQysrj+ilogXw?= =?us-ascii?Q?xj2Bx0CcDXEDMS5duZ/qxpy3rQCHHhCRaIcj230Arn4z+2vOMzPKAPZsYKQM?= =?us-ascii?Q?pTIn2IfhGlKQf511quDhkVBu0gk1fTB/fmsCIs9JDgFd6AArcSpAcc8CCvQe?= =?us-ascii?Q?kz8XNqv8ENy+JXotxQQxSAJKFHz1bIdG0i62CmdCD3FZBeV6nu8InfiCS1Mc?= =?us-ascii?Q?dxnCF077gRBOTUO9xmgu4q/K?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2160.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 56128b4a-91fb-4a13-84e5-08d98d009af6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2021 21:46:38.7600 (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: GYQkak17yizgJNqAxHj78lmH0TO9OGp5j5FJ8Iyq67W0OsOK8tNTELtum7iWGTFe3X3frsnXNktBV97HXmLA86G7mP+TmE84TeYnpdoGsk0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5057 Return-Path: nathaniel.l.desimone@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Chasel, Please see feedback inline. Thanks, Nate > -----Original Message----- > From: Chiu, Chasel > Sent: Thursday, October 7, 2021 11:43 PM > To: devel@edk2.groups.io > Cc: Chiu, Chasel ; Desimone, Nathaniel L > ; Liming Gao > ; Dong, Eric > Subject: [edk2-platforms: PATCH v3 1/9] MinPlatformPkg: Support FSP 2.3 > FSP_NON_VOLATILE_STORAGE_HOB2. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3678 >=20 > Implementation should search FSP_NON_VOLATILE_STORAGE_HOB2 firstly > and only search FSP_NON_VOLATILE_STORAGE_HOB when former one is > not found. >=20 > Also added PeiGetLargeVariable () to support the scenarios where the > variable data size is bigger than a single variable size limit. >=20 > Cc: Nate DeSimone > Cc: Liming Gao > Cc: Eric Dong > Signed-off-by: Chasel Chiu > --- > Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConf= ig.c | 39 ++++++++++++++++++++++++++++----------- > Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c = | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++= +++++- > Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariableRead= Lib.c | 4 ++-- > Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemoryConf= ig.inf | 5 ++++- > Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h = | 33 ++++++++++++++++++++++++++++++++- > Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf = | 4 +++- > Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec = | 1 + > 7 files changed, 138 insertions(+), 17 deletions(-) >=20 > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/Sa= veMemoryConfig.c b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfi= g/SaveMemoryConfig.c > index 41ed2550bd..401e02a7a9 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor= yConfig.c > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor= yConfig.c > @@ -2,7 +2,7 @@ > This is the driver that locates the MemoryConfigurationData HOB, if it > exists, and saves the data to nvRAM. > =20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include > #include > #include > +#include > =20 > /** > This is the standard EFI driver point that detects whether there is a > @@ -50,11 +51,27 @@ SaveMemoryConfigEntryPoint ( > // > // Search for the Memory Configuration GUID HOB. If it is not present= , then > // there's nothing we can do. It may not exist on the update path. > + // Firstly check version2 FspNvsHob. > // > - GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); > + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHob2Guid); > if (GuidHob !=3D NULL) { > - HobData =3D GET_GUID_HOB_DATA (GuidHob); > - DataSize =3D GET_GUID_HOB_DATA_SIZE(GuidHob); > + HobData =3D (VOID *) (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UIN= TN) GuidHob)->NvsDataPtr; > + DataSize =3D (UINTN) ((FSP_NON_VOLATILE_STORAGE_HOB2 *) (UINTN) Guid= Hob)->NvsDataLength; > + } else { > + // > + // Fall back to version1 FspNvsHob > + // > + GuidHob =3D GetFirstGuidHob (&gFspNonVolatileStorageHobGuid); > + if (GuidHob !=3D NULL) { > + HobData =3D GET_GUID_HOB_DATA (GuidHob); > + DataSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); > + } > + } > + > + if (HobData !=3D NULL) { > + DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataLength:%d\n", DataSize)); > + DEBUG ((DEBUG_INFO, "FspNvsHob.NvsDataPtr : 0x%x\n", HobData)); > + > if (DataSize > 0) { > // > // Use the HOB to save Memory Configuration Data > @@ -65,8 +82,8 @@ SaveMemoryConfigEntryPoint ( > return EFI_UNSUPPORTED; > } > Status =3D gRT->GetVariable ( > - L"MemoryConfig", > - &gFspNonVolatileStorageHobGuid, > + L"FspNvsBuffer", > + &gFspNvsBufferVariableGuid, This needs to be updated to use LargeVariableLib as well. > NULL, > &BufferSize, > VariableData > @@ -80,8 +97,8 @@ SaveMemoryConfigEntryPoint ( > } > =20 > Status =3D gRT->GetVariable ( > - L"MemoryConfig", > - &gFspNonVolatileStorageHobGuid, > + L"FspNvsBuffer", > + &gFspNvsBufferVariableGuid, > NULL, > &BufferSize, > VariableData > @@ -90,8 +107,8 @@ SaveMemoryConfigEntryPoint ( > =20 > if ( (EFI_ERROR(Status)) || BufferSize !=3D DataSize || 0 !=3D Com= pareMem (HobData, VariableData, DataSize)) { > Status =3D gRT->SetVariable ( > - L"MemoryConfig", > - &gFspNonVolatileStorageHobGuid, > + L"FspNvsBuffer", > + &gFspNvsBufferVariableGuid, > (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSE= RVICE_ACCESS), > DataSize, > HobData > @@ -106,7 +123,7 @@ SaveMemoryConfigEntryPoint ( > // > Status =3D gBS->LocateProtocol(&gEdkiiVariableLockProtocolGuid, NU= LL, (VOID **)&VariableLock); > if (!EFI_ERROR(Status)) { > - Status =3D VariableLock->RequestToLock(VariableLock, L"MemoryCon= fig", &gFspNonVolatileStorageHobGuid); > + Status =3D VariableLock->RequestToLock(VariableLock, L"FspNvsBuf= fer", &gFspNvsBufferVariableGuid); > ASSERT_EFI_ERROR(Status); > } > =20 > diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c b/Plat= form/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c > index 96dfd588dc..9e92387761 100644 > --- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c > +++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.c > @@ -1,6 +1,6 @@ > /** @file > =20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -9,6 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include > #include > #include > +#include > #include > =20 > /** > @@ -108,6 +109,72 @@ PeiGetVariable ( > return Status; > } > =20 > +/** > + Returns the status whether get the large variable success. When variab= le size > + is bigger than single UEFI variable size limit, The variable will be s= aved in > + multiple UEFI variables. This function retrieves such large variable t= hrough the > + ReadOnlyVariable2 PPI GetVariable(). > + The returned buffer is allocated using AllocatePage() to support > 64K= B and this > + buffer cannot be Free(). > + > + If Name is NULL, then ASSERT(). > + If Guid is NULL, then ASSERT(). > + If Value is NULL, then ASSERT(). > + > + @param[in] Name The pointer to a Null-terminated Unicode string. > + @param[in] Guid The pointer to an EFI_GUID structure > + @param[out] Value The buffer point saved the variable info. > + @param[out] Size The buffer size of the variable. > + > + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. > + @return EFI_SUCCESS Find the specified variable. > + @return Others Errors Return errors from call to gRT->GetV= ariable. > + > +**/ > +EFI_STATUS > +EFIAPI > +PeiGetLargeVariable ( > + IN CHAR16 *Name, > + IN EFI_GUID *Guid, > + OUT VOID **Value, > + OUT UINTN *Size OPTIONAL > + ) > +{ > + EFI_STATUS Status; > + UINTN VariableSize; > + VOID *VariableData; > + > + ASSERT (Name !=3D NULL); > + ASSERT (Guid !=3D NULL); > + ASSERT (Value !=3D NULL); > + > + VariableSize =3D 0; > + VariableData =3D NULL; > + Status =3D GetLargeVariable (Name, Guid, &VariableSize, NULL); > + if (Status =3D=3D EFI_BUFFER_TOO_SMALL) { > + VariableData =3D AllocatePages (EFI_SIZE_TO_PAGES (VariableSize)); > + if (VariableData =3D=3D NULL) { > + DEBUG ((DEBUG_ERROR, "Error: Cannot create VariableData, out of me= mory!\n")); > + ASSERT (FALSE); > + return EFI_OUT_OF_RESOURCES; > + } > + Status =3D GetLargeVariable (Name, Guid, &VariableSize, VariableData= ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "Error: Unable to read UEFI variable Status: = %r\n", Status)); > + ASSERT_EFI_ERROR (Status); > + return Status; > + } > + if (Value !=3D NULL) { > + *Value =3D VariableData; > + } > + if (Size !=3D NULL) { > + *Size =3D VariableSize; > + } > + return EFI_SUCCESS; > + } > + return Status; > +} > + > EFI_PEI_FILE_HANDLE > InternalGetFfsHandleFromAnyFv ( > IN CONST EFI_GUID *NameGuid > diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/Pei= VariableReadLib.c b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLi= b/PeiVariableReadLib.c > index 5eeee12a3c..b7885dd6c2 100644 > --- a/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariabl= eReadLib.c > +++ b/Platform/Intel/MinPlatformPkg/Library/PeiVariableReadLib/PeiVariabl= eReadLib.c > @@ -67,7 +67,7 @@ VarLibGetVariable ( > &gEfiPeiReadOnlyVariable2PpiGuid, > 0, > NULL, > - &VariablePpi > + (VOID **) &VariablePpi > ); > ASSERT_EFI_ERROR (Status); > if (EFI_ERROR (Status)) { > @@ -134,7 +134,7 @@ VarLibGetNextVariableName ( > &gEfiPeiReadOnlyVariable2PpiGuid, > 0, > NULL, > - &VariablePpi > + (VOID **) &VariablePpi > ); > ASSERT_EFI_ERROR (Status); > if (EFI_ERROR (Status)) { > diff --git a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/Sa= veMemoryConfig.inf b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryCon= fig/SaveMemoryConfig.inf > index 0c8689a6f6..eac0880504 100644 > --- a/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor= yConfig.inf > +++ b/Platform/Intel/MinPlatformPkg/FspWrapper/SaveMemoryConfig/SaveMemor= yConfig.inf > @@ -1,7 +1,7 @@ > ### @file > # Component information file for SaveMemoryConfig module > # > -# Copyright (c) 2017, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -28,6 +28,7 @@ > MdePkg/MdePkg.dec > MdeModulePkg/MdeModulePkg.dec > IntelFsp2Pkg/IntelFsp2Pkg.dec > + MinPlatformPkg/MinPlatformPkg.dec > =20 > [Sources] > SaveMemoryConfig.c > @@ -39,6 +40,8 @@ > =20 > [Guids] > gFspNonVolatileStorageHobGuid ## CONSUMES > + gFspNonVolatileStorageHob2Guid ## CONSUMES > + gFspNvsBufferVariableGuid ## PRODUCES > =20 > [Depex] > gEfiVariableArchProtocolGuid AND > diff --git a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h b/Pla= tform/Intel/MinPlatformPkg/Include/Library/PeiLib.h > index d8b1a47c58..86ffb378ec 100644 > --- a/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h > +++ b/Platform/Intel/MinPlatformPkg/Include/Library/PeiLib.h > @@ -1,6 +1,6 @@ > /** @file > =20 > -Copyright (c) 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent > =20 > **/ > @@ -38,6 +38,37 @@ PeiGetVariable ( > OUT UINTN *Size > ); > =20 > +/** > + Returns the status whether get the large variable success. When variab= le size > + is bigger than single UEFI variable size limit, The variable will be s= aved in > + multiple UEFI variables. This function retrieves such large variable t= hrough the > + ReadOnlyVariable2 PPI GetVariable(). > + The returned buffer is allocated using AllocatePage() to support > 64K= B and this > + buffer cannot be Free(). > + > + If Name is NULL, then ASSERT(). > + If Guid is NULL, then ASSERT(). > + If Value is NULL, then ASSERT(). > + > + @param[in] Name The pointer to a Null-terminated Unicode string. > + @param[in] Guid The pointer to an EFI_GUID structure > + @param[out] Value The buffer point saved the variable info. > + @param[out] Size The buffer size of the variable. > + > + @return EFI_OUT_OF_RESOURCES Allocate buffer failed. > + @return EFI_SUCCESS Find the specified variable. > + @return Others Errors Return errors from call to gRT->GetV= ariable. > + > +**/ > +EFI_STATUS > +EFIAPI > +PeiGetLargeVariable ( > + IN CHAR16 *Name, > + IN EFI_GUID *Guid, > + OUT VOID **Value, > + OUT UINTN *Size OPTIONAL > + ); > + > /** > Finds the file in any FV and gets file Address and Size > =20 > diff --git a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf b/Pl= atform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf > index 7e740172a0..bd57cf7870 100644 > --- a/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf > +++ b/Platform/Intel/MinPlatformPkg/Library/PeiLib/PeiLib.inf > @@ -1,7 +1,7 @@ > ## @file > # Component information file for Board Init Test Library > # > -# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.
> +# Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
> # > # SPDX-License-Identifier: BSD-2-Clause-Patent > # > @@ -20,9 +20,11 @@ > PeiServicesLib > MemoryAllocationLib > DebugLib > + LargeVariableReadLib > =20 > [Packages] > MdePkg/MdePkg.dec > + MinPlatformPkg/MinPlatformPkg.dec > =20 > [Sources] > PeiLib.c > diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec b/Platform/= Intel/MinPlatformPkg/MinPlatformPkg.dec > index bcb42f0ef9..d6e80a66ce 100644 > --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec > +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dec > @@ -50,6 +50,7 @@ > gBdsEventBeforeConsoleAfterTrustedConsoleGuid =3D {0x51e49ff5, 0x28a9= , 0x4159, { 0xac, 0x8a, 0xb8, 0xc4, 0x88, 0xa7, 0xfd, 0xee}} > gBdsEventBeforeConsoleBeforeEndOfDxeGuid =3D {0xfcf26e41, 0xbda6= , 0x4633, { 0xb5, 0x73, 0xd4, 0xb8, 0x0e, 0x6d, 0xd0, 0x78}} > gBdsEventAfterConsoleReadyBeforeBootOptionGuid =3D {0x8eb3d5dc, 0xf4e7= , 0x4b57, { 0xa9, 0xe7, 0x27, 0x39, 0x10, 0xf2, 0x18, 0x9f}} > + gFspNvsBufferVariableGuid =3D {0x9c7715cd, 0x8d66= , 0x4d2a, { 0x90, 0x0d, 0x01, 0x45, 0x9a, 0x57, 0x59, 0x6b}} > =20 > [LibraryClasses] > =20 > --=20 > 2.28.0.windows.1