From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from na01-obe.outbound.protection.outlook.com (na01-obe.outbound.protection.outlook.com [40.93.8.7]) by mx.groups.io with SMTP id smtpd.web08.19301.1631140431006738615 for ; Wed, 08 Sep 2021 15:33:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=JnsjQAtR; spf=pass (domain: microsoft.com, ip: 40.93.8.7, mailfrom: bret.barkelew@microsoft.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZS3mEwbXSd6D3xtYshM1chsxRfOpdfV2OzFvdgFhXvxu4FuesjPxUZusrjUR0f4j7nXg6oAt76AZHMGJeQOJg+dGVd5ORTILzhj1Ef2ftqzOr+5B9NG3ihRMfpD49ZbKUq7G7cFRgim4GcfYOzjeg5CvwcFFuo6chF7wzNAgbF3vmIRJt6eOSm/i0juICUeEBouREq6LLDBv0sJGhF63Iwxa1LJruNOECBAMsfppJJMSmRwM7+4zr4ZRGOD+dT/Y0dEitQH6FHQYJLK2lN++70rkEjul632YsXNwImgttOWT06bgzzVFkrKQP4XhsaZ3419SewpeHQJAEk62l3X9w== 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; bh=2C3EOz/F9OiuAblbe9Ttd+ijbKdE+ckD8i6nTWYDCo4=; b=OVv6jIbWKGbO0I/h2Xo/IuhUSdkSY/eH/mz7PU2WKsP9QrZk3d2e9BRMVaxfjOWbaqKzUFXeGxRYHZlOCRUnE6yJ23gpZblRQcdxTR2bZB9zKGlXg6ruDvg4AHIngdI7RU5+FG4Dn8MyRoMpjLm1mQmumpXOR/2rliTfXv85KepbJ0WpIiFq959IdsF0pNNIjBXrYpGtCPfGJVoN6TfhaYJrntudEc7yrwBXDpN3hir/UACz7BlV/kd0wWVmSQDnXdN7aV4zfnDQXTj8UBcV3/NaLJs0daIoJX6dOR56QLMSDNedb6RnQhiTno6+C8MtZA1GHz3UDV9pvohUc8bPbA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2C3EOz/F9OiuAblbe9Ttd+ijbKdE+ckD8i6nTWYDCo4=; b=JnsjQAtREYO12zQjyldgCSaSjVDY9tFl58a5yMEZFEMCVeIOMHSBmMUBFCsm2aEayqNTWsSxNvbUE+UQcqDdoh1i52IW/DcqpgnPsr+skGJ3doNqAg/AYce+UxfJsCAsOYO47c5f/BpPcEKul/YPdgCJmCJrq8nMHBOuJi/1E8Y= Received: from MW4PR21MB1907.namprd21.prod.outlook.com (2603:10b6:303:71::8) by MWHPR21MB0144.namprd21.prod.outlook.com (2603:10b6:300:78::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.4; Wed, 8 Sep 2021 22:33:48 +0000 Received: from MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::990e:bdcc:2f44:93df]) by MW4PR21MB1907.namprd21.prod.outlook.com ([fe80::990e:bdcc:2f44:93df%3]) with mapi id 15.20.4523.006; Wed, 8 Sep 2021 22:33:48 +0000 From: "Bret Barkelew" To: "devel@edk2.groups.io" , "Oram, Isaac W" CC: Chasel Chiu , "Desimone, Nathaniel L" , Liming Gao , "Dong, Eric" Subject: Re: [EXTERNAL] [edk2-devel][edk2-platforms][PATCH V1 1/1] MinPlatformPkg/Variable*Lib: Build VariableRead and VariableWrite libs Thread-Topic: [EXTERNAL] [edk2-devel][edk2-platforms][PATCH V1 1/1] MinPlatformPkg/Variable*Lib: Build VariableRead and VariableWrite libs Thread-Index: AQHXpQEI5x+dFsJNbESvD0/tzz75h6uauEvk Date: Wed, 8 Sep 2021 22:33:48 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-09-08T22:30:39.5564074Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 19d6b284-6038-409f-cdab-08d97318b9f8 x-ms-traffictypediagnostic: MWHPR21MB0144: x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: AKaDAkgIXweCfubmKYkN13Pb2G3l3OGRl0Z6qd9YX1VHh7sEiUG85MtXlv9+EmfQBmSyamVRr8nfmLjIOU367n4Xv5J2JH6a2ZEsLoAkAQ2g64gCBXHD5PA1IUrFnIu2xG0WgKKpmT9PWIKUQKY0cB3IWrj6m4hWOXioG4/9xwEr+n3diw7BsS8cxzzep7lFdKyrTSswJOnmKkDh2xHspJkMNB0sY4k7FLO2vFD+NisH66M/Qa2da9gc+CEHTDT2kt6ZH647XcHNFWEIM6nKxpnw/yHln1hEi9rUVrChalGCxXbG4xE4rqigoTmiIcGVNVDqjJ9PERMVv7ezu9UVEtm2hjLud4Tb9mz0MUl0BjcCKbqmLcQ1FdKNead9fb0mfEzfyNW5BjjlP2iKwsag4GbGx5vQ+Jx7ETfZcegwuALYbTWXso6js3r5kYId11OSiqpfGL2tx/RhbqBDV65pjSXTDX6/6DFlv41WPkssL1a4z/IWdOL4cJqTZCBE9xCbJSPQwD2bGV/WBcSE/SPe+677bPGQtDTbcY3bg0wl5Q1hEWNtcujWqqWoYVqWneETgjV6yqFXNxHiECsMaaI0IPr8lc9C9XyNLc0gAin1PA1JDN4OYPrW4wdP7o5WacGoQFSIqaJ7QVBHNUE642t7vlDBiImIA26wrLdB7VI4bdzv9V+CRaulIgpqgjUV3Ec+pipfDUqvzrLLEHikDygMZkYO6/XUbOyZaXM+IHziUQG7d4M9lQ2NeIQPP8s6BSINAmsh6b8P0Am+GNw1BdP4sr7U/hMbolVvAF7y37Eanmg= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR21MB1907.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(186003)(4326008)(38100700002)(38070700005)(52536014)(82960400001)(7696005)(26005)(66946007)(8936002)(66476007)(122000001)(66446008)(6506007)(64756008)(10290500003)(966005)(53546011)(76116006)(316002)(508600001)(33656002)(66556008)(110136005)(8676002)(83380400001)(86362001)(8990500004)(55016002)(9686003)(166002)(71200400001)(5660300002)(82950400001)(2906002)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?Windows-1252?Q?mQriTM3tXuc/mulbpmxewioJRwpSMBGyAYlDio+rXRBx06x3Yqtm+7jd?= =?Windows-1252?Q?byf8SFpHBd5+EKOpXA9KqKzlhpKiN58mde3w9TvrEQOAlmIfT3Maim50?= =?Windows-1252?Q?994ABgu5FMXYzzvIbg0BdjgSo26OhTwUdrtn4krsSoNTziBUOMXoBX9P?= =?Windows-1252?Q?lAk5Ae3y+KPeto1XebYuRUs/7P+luNw3zGVmFtUvCp5YATZVZgMYXBYS?= =?Windows-1252?Q?hpiiljfubPl/W3QatKPYRJCXkVnb/uUV00MtdpHWaiIarW2n6EqKt4Ht?= =?Windows-1252?Q?r5LZY7g08FJVeHZecvll9DfqXM8HZ9P0PGJQL8yD7A9DQXuA4i4ywv0Y?= =?Windows-1252?Q?HSCmwxGaagYVSECu/VRwf+kChjoPVgQ8hWCoc63JpGeSkL7PoyGaBv8f?= =?Windows-1252?Q?piixGIhkUhyB/kY9s5WAov9ShyOHS+UlcCVXvFmFZz6Xv+OxrFp400Pj?= =?Windows-1252?Q?uWu+j6NJ5Pe+QlBdJ6ijBdNm2uek0+BHQTlmEa7M5ensDyKbZZza1njf?= =?Windows-1252?Q?tH6vEJ65LVj2VqvzNFVxLiDPr54mYmwu+Y/civl2FBISyg47cxZ9U1Sa?= =?Windows-1252?Q?IlIO8hfxqoRdNS/RpzMD/OmxyGBQnFmcnAl+wcKUubukuaFPXYikDhRN?= =?Windows-1252?Q?O3tv7H8xYnrv7490XZ4HVFWfw1MRe1uOuAOAdjFizSXs/r73b1m9LnBg?= =?Windows-1252?Q?3vbWsdIngJByeDoHnt8KMtdwb05UAXsQSAjbnCa266aKeZDDZQ8R2rgB?= =?Windows-1252?Q?nBi9Mi+VD+JhtuHYlTUVkZtJC3bwnZaLSpHlLcb1Vox+xLp2d9KKpXJ6?= =?Windows-1252?Q?2eUjSQlYeInKkHfXFP52O33kofMg80iPu5LJWS3AXCrTiwlc50Zvi2E5?= =?Windows-1252?Q?GPV6S1QCEAAG2niIBtvvFA4jQYf/T7eyB4iEYExnVbmweGTyY+h0cdee?= =?Windows-1252?Q?3jBmd1CL0YglEse53rEyRvUPIWhaF7dPEddh+NLcCwS1MX7a/uqiYTI0?= =?Windows-1252?Q?yL1WqgirPmDEAHBhLWTwCNVwR6Ji3vGKqs4hRWWEOA2PtAVw9kt+wYi8?= =?Windows-1252?Q?bmykXtqENvuMcq48tLLB1fFcPSQzlWo+EVegn0PYldsRNBAhAs4X7UKq?= =?Windows-1252?Q?n59b/sQx2g9h6I/m63ahC0NHOZ7tpHjRLtg3xDSBwjZiciHx8GzgljZn?= =?Windows-1252?Q?yyl0Hcve5Vu+fU5I54cZg20BgCysUTLOHfCrmA5+3txSBR+Tjp+H4+tM?= =?Windows-1252?Q?G8u4TSQx89n6Rm8hQMDxwRF0jHVFPvI50trfAC3Bb2OLFzc5h5/yu7AW?= =?Windows-1252?Q?lEK/WFBSSU9mQZniPBQ/GcfwpFhv2TtARuymG8WD6hnJE0NLSzVTaS76?= =?Windows-1252?Q?U64lu6M4W/0JBTaFjPebMoVpaa1aXZmAhKPdzAhL6IEHAi57x76svDFe?= =?Windows-1252?Q?HIozvtbNoXXDVBbqUbjdLQ=3D=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR21MB1907.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19d6b284-6038-409f-cdab-08d97318b9f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Sep 2021 22:33:48.5010 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mGxkp8RAJp3aOuAlmEtx9GOnHePbmnD2oj7GILUEbBQ9ZJM8uVqERaUEFN8AcUuFnLS0PM3iUSrLcBVIJ9ks+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR21MB0144 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MW4PR21MB190783F005FABCA93A0D2388EFD49MW4PR21MB1907namp_" --_000_MW4PR21MB190783F005FABCA93A0D2388EFD49MW4PR21MB1907namp_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable Question: I=92ve recently brought up with some that the GetVariable##() functions in = UefiLib are probably incorrect as they are written (because they assume thi= ngs like gRT and gBS availability). Would it perhaps make sense to move thi= s interface up into the MdePkg scope and leverage it to start removing some= of those assumptions? I already have a TODO to start splitting UefiLib along phase lines (PEI, DX= E, MM, etc), but that work could largely be obviated with this abstraction. - Bret From: Oram, Isaac W via groups.io Sent: Wednesday, September 8, 2021 3:29 PM To: devel@edk2.groups.io Cc: Chasel Chiu; Desimone, Nathaniel L; Liming Gao; Dong, Eric Subject: [EXTERNAL] [edk2-devel][edk2-platforms][PATCH V1 1/1] MinPlatformP= kg/Variable*Lib: Build VariableRead and VariableWrite libs Add the VariableReadLib and VariableWriteLib instances to Components to ensure build when building MinPlatformPkg.dsc. Add a NULL library instance that provides the non-functional library instance for VariableReadLib designed for all phase use. Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: Isaac Oram --- Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariable= ReadLibNull.c | 75 ++++++++++++++++++++ Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariable= ReadLibNull.inf | 37 ++++++++++ Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc = | 6 +- 3 files changed, 117 insertions(+), 1 deletion(-) diff --git a/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/= BaseVariableReadLibNull.c b/Platform/Intel/MinPlatformPkg/Library/BaseVaria= bleReadLibNull/BaseVariableReadLibNull.c new file mode 100644 index 0000000000..f276b7b6b4 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.c @@ -0,0 +1,75 @@ +/** @file + NULL implementation of Variable Read Lib + + This library provides phase agnostic access to the UEFI Variable Service= s. + This is done by implementing a wrapper on top of the phase specific mech= anism + for reading from UEFI variables. For example, the PEI implementation of = this + library uses EFI_PEI_READ_ONLY_VARIABLE2_PPI. The DXE implementation acc= esses + the UEFI Runtime Services Table, and the SMM implementation uses + EFI_SMM_VARIABLE_PROTOCOL. + + Using this library allows code to be written in a generic manner that ca= n be + used in PEI, DXE, or SMM without modification. + + @copyright + Copyright 2021 Intel Corporation.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include + +/** + Returns the value of a variable. + + @param[in] VariableName A Null-terminated string that is the name= of the vendor's + variable. + @param[in] VendorGuid A unique identifier for the vendor. + @param[out] Attributes If not NULL, a pointer to the memory loca= tion to return the + attributes bitmask for the variable. + @param[in, out] DataSize On input, the size in bytes of the return= Data buffer. + On output the size of data returned in Da= ta. + @param[out] Data The buffer to return the contents of the = variable. May be NULL + with a zero DataSize in order to determin= e the size buffer needed. + + @retval EFI_UNSUPPORTED This function is not implemented by this = instance of the LibraryClass + +**/ +EFI_STATUS +EFIAPI +VarLibGetVariable ( + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT UINT32 *Attributes, OPTIONAL + IN OUT UINTN *DataSize, + OUT VOID *Data OPTIONAL + ) +{ + return EFI_UNSUPPORTED; +} + +/** + Enumerates the current variable names. + + @param[in, out] VariableNameSize The size of the VariableName buffer. T= he size must be large + enough to fit input string supplied in= VariableName buffer. + @param[in, out] VariableName On input, supplies the last VariableNa= me that was returned + by GetNextVariableName(). On output, r= eturns the Nullterminated + string of the current variable. + @param[in, out] VendorGuid On input, supplies the last VendorGuid= that was returned by + GetNextVariableName(). On output, retu= rns the + VendorGuid of the current variable. + + @retval EFI_UNSUPPORTED This function is not implemented by th= is instance of the LibraryClass + +**/ +EFI_STATUS +EFIAPI +VarLibGetNextVariableName ( + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VendorGuid + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/= BaseVariableReadLibNull.inf b/Platform/Intel/MinPlatformPkg/Library/BaseVar= iableReadLibNull/BaseVariableReadLibNull.inf new file mode 100644 index 0000000000..3a397998a9 --- /dev/null +++ b/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.inf @@ -0,0 +1,37 @@ +## @file +# Component description file for NULL implementation of Variable Read Lib +# +# This library provides phase agnostic access to the UEFI Variable Service= s. +# This is done by implementing a wrapper on top of the phase specific mech= anism +# for reading from UEFI variables. For example, the PEI implementation of = this +# library uses EFI_PEI_READ_ONLY_VARIABLE2_PPI. The DXE implementation acc= esses +# the UEFI Runtime Services Table, and the SMM implementation uses +# EFI_SMM_VARIABLE_PROTOCOL. +# +# Using this library allows code to be written in a generic manner that ca= n be +# used in PEI, DXE, or SMM without modification. +# +# @copyright +# Copyright 2021 Intel Corporation.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +## +## NOTICE: This library is also available in MinPlatformPkg. This copy was= added +## for the convience of those that are using an older MinPlatformP= kg. +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BaseVariableReadLibNull + FILE_GUID =3D 5C9E2489-329F-4D2A-90F1-F5CB2A88A3E6 + VERSION_STRING =3D 1.0 + MODULE_TYPE =3D BASE + LIBRARY_CLASS =3D VariableReadLib + +[Packages] + MdePkg/MdePkg.dec + +[Sources] + BaseVariableReadLibNull.c diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dsc index 07b776cecd..a09f8db3ab 100644 --- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc +++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc @@ -74,7 +74,7 @@ FspWrapperApiTestLib|IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib= /PeiFspWrapperApiTestLib.inf FspWrapperHobProcessLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperH= obProcessLib/PeiFspWrapperHobProcessLib.inf PlatformSecLib|MinPlatformPkg/FspWrapper/Library/SecFspWrapperPlatformSe= cLib/SecFspWrapperPlatformSecLib.inf - + VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVaria= bleReadLibNull.inf FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFspWrapperPla= tformLib/PeiFspWrapperPlatformLib.inf BoardInitLib|MinPlatformPkg/PlatformInit/Library/BoardInitLibNull/BoardI= nitLibNull.inf @@ -214,5 +214,9 @@ MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf + MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibNull.i= nf + MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadLib.in= f + MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWriteLib.= inf + [BuildOptions] *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES -- 2.27.0.windows.1 --_000_MW4PR21MB190783F005FABCA93A0D2388EFD49MW4PR21MB1907namp_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable

Question:

 

I=92ve recently brought up with some that the GetVar= iable##() functions in UefiLib are probably incorrect as they are written (= because they assume things like gRT and gBS availability). Would it perhaps= make sense to move this interface up into the MdePkg scope and leverage it to start removing some of those assu= mptions?

 

I already have a TODO to start splitting UefiLib alo= ng phase lines (PEI, DXE, MM, etc), but that work could largely be obviated= with this abstraction.

 

- Bret

 

From: Oram, Isaac W via groups.i= o
Sent: Wednesday, September 8, 2021 3:29 PM
To: devel@edk2.groups.io=
Cc: Chasel Chiu; Desimone, Nathaniel L; Limi= ng Gao; Dong, Eric
Subject: [EXTERNAL] [edk2-devel][edk2-platforms][PATCH V1 1/1] MinPl= atformPkg/Variable*Lib: Build VariableRead and VariableWrite libs

 

Add the VariableReadL= ib and VariableWriteLib instances to Components to
ensure build when building MinPlatformPkg.dsc.
Add a NULL library instance that provides the non-functional library
instance for VariableReadLib designed for all phase use.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Isaac Oram <isaac.w.oram@intel.com>
---
 Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.c   | 75 ++++++++++++++++++++
 Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.inf | 37 ++++++++++
 Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc   &nb= sp;            =             &nb= sp;            = |  6 +-
 3 files changed, 117 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/= BaseVariableReadLibNull.c b/Platform/Intel/MinPlatformPkg/Library/BaseVaria= bleReadLibNull/BaseVariableReadLibNull.c
new file mode 100644
index 0000000000..f276b7b6b4
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.c
@@ -0,0 +1,75 @@
+/** @file
+  NULL implementation of Variable Read Lib
+
+  This library provides phase agnostic access to the UEFI Variable Se= rvices.
+  This is done by implementing a wrapper on top of the phase specific= mechanism
+  for reading from UEFI variables. For example, the PEI implementatio= n of this
+  library uses EFI_PEI_READ_ONLY_VARIABLE2_PPI. The DXE implementatio= n accesses
+  the UEFI Runtime Services Table, and the SMM implementation uses +  EFI_SMM_VARIABLE_PROTOCOL.
+
+  Using this library allows code to be written in a generic manner th= at can be
+  used in PEI, DXE, or SMM without modification.
+
+  @copyright
+  Copyright 2021 Intel Corporation. <BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#include <Uefi/UefiBaseType.h>
+
+/**
+  Returns the value of a variable.
+
+  @param[in]       VariableName  A= Null-terminated string that is the name of the vendor's
+            &n= bsp;            = ;        variable.
+  @param[in]       VendorGuid &nbs= p;  A unique identifier for the vendor.
+  @param[out]      Attributes  &nb= sp; If not NULL, a pointer to the memory location to return the
+            &n= bsp;            = ;        attributes bitmask for the vari= able.
+  @param[in, out]  DataSize      On inp= ut, the size in bytes of the return Data buffer.
+            &n= bsp;            = ;        On output the size of data retu= rned in Data.
+  @param[out]      Data   &nb= sp;      The buffer to return the contents of the = variable. May be NULL
+            &n= bsp;            = ;        with a zero DataSize in order t= o determine the size buffer needed.
+
+  @retval EFI_UNSUPPORTED        T= his function is not implemented by this instance of the LibraryClass
+
+**/
+EFI_STATUS
+EFIAPI
+VarLibGetVariable (
+  IN     CHAR16     &nbs= p;            &= nbsp;   *VariableName,
+  IN     EFI_GUID     &n= bsp;            = ;  *VendorGuid,
+  OUT    UINT32      &nb= sp;            =    *Attributes,    OPTIONAL
+  IN OUT UINTN         &= nbsp;           &nbs= p; *DataSize,
+  OUT    VOID       = ;            &n= bsp;    *Data        = ;   OPTIONAL
+  )
+{
+  return EFI_UNSUPPORTED;
+}
+
+/**
+  Enumerates the current variable names.
+
+  @param[in, out]  VariableNameSize The size of the VariableName= buffer. The size must be large
+            &n= bsp;            = ;           enough to fit= input string supplied in VariableName buffer.
+  @param[in, out]  VariableName     On input= , supplies the last VariableName that was returned
+            &n= bsp;            = ;           by GetNextVar= iableName(). On output, returns the Nullterminated
+            &n= bsp;            = ;           string of the= current variable.
+  @param[in, out]  VendorGuid      = ; On input, supplies the last VendorGuid that was returned by
+            &n= bsp;            = ;           GetNextVariab= leName(). On output, returns the
+            &n= bsp;            = ;           VendorGuid of= the current variable.
+
+  @retval EFI_UNSUPPORTED       &n= bsp;   This function is not implemented by this instance of the L= ibraryClass
+
+**/
+EFI_STATUS
+EFIAPI
+VarLibGetNextVariableName (
+  IN OUT UINTN         &= nbsp;          *VariableNameSi= ze,
+  IN OUT CHAR16         =           *VariableName,
+  IN OUT EFI_GUID        &nbs= p;        *VendorGuid
+  )
+{
+  return EFI_UNSUPPORTED;
+}
diff --git a/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/= BaseVariableReadLibNull.inf b/Platform/Intel/MinPlatformPkg/Library/BaseVar= iableReadLibNull/BaseVariableReadLibNull.inf
new file mode 100644
index 0000000000..3a397998a9
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVar= iableReadLibNull.inf
@@ -0,0 +1,37 @@
+## @file
+# Component description file for NULL implementation of Variable Read Lib<= br> +#
+# This library provides phase agnostic access to the UEFI Variable Service= s.
+# This is done by implementing a wrapper on top of the phase specific mech= anism
+# for reading from UEFI variables. For example, the PEI implementation of = this
+# library uses EFI_PEI_READ_ONLY_VARIABLE2_PPI. The DXE implementation acc= esses
+# the UEFI Runtime Services Table, and the SMM implementation uses
+# EFI_SMM_VARIABLE_PROTOCOL.
+#
+# Using this library allows code to be written in a generic manner that ca= n be
+# used in PEI, DXE, or SMM without modification.
+#
+# @copyright
+# Copyright 2021 Intel Corporation. <BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+
+##
+## NOTICE: This library is also available in MinPlatformPkg. This copy was= added
+##         for the convience of th= ose that are using an older MinPlatformPkg.
+##
+
+[Defines]
+  INF_VERSION         &n= bsp;          =3D 0x00010005 +  BASE_NAME         &nbs= p;            =3D Ba= seVariableReadLibNull
+  FILE_GUID         &nbs= p;            =3D 5C= 9E2489-329F-4D2A-90F1-F5CB2A88A3E6
+  VERSION_STRING         = ;        =3D 1.0
+  MODULE_TYPE         &n= bsp;          =3D BASE
+  LIBRARY_CLASS         =          =3D VariableReadLib
+
+[Packages]
+  MdePkg/MdePkg.dec
+
+[Sources]
+  BaseVariableReadLibNull.c
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/In= tel/MinPlatformPkg/MinPlatformPkg.dsc
index 07b776cecd..a09f8db3ab 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -74,7 +74,7 @@
   FspWrapperApiTestLib|IntelFsp2WrapperPkg/Library/PeiFspWrapper= ApiTestLib/PeiFspWrapperApiTestLib.inf
   FspWrapperHobProcessLib|MinPlatformPkg/FspWrapper/Library/PeiF= spWrapperHobProcessLib/PeiFspWrapperHobProcessLib.inf
   PlatformSecLib|MinPlatformPkg/FspWrapper/Library/SecFspWrapper= PlatformSecLib/SecFspWrapperPlatformSecLib.inf
-
+  VariableReadLib|MinPlatformPkg/Library/BaseVariableReadLibNull/Base= VariableReadLibNull.inf
   FspWrapperPlatformLib|MinPlatformPkg/FspWrapper/Library/PeiFsp= WrapperPlatformLib/PeiFspWrapperPlatformLib.inf
 
   BoardInitLib|MinPlatformPkg/PlatformInit/Library/BoardInitLibN= ull/BoardInitLibNull.inf
@@ -214,5 +214,9 @@
   MinPlatformPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
   MinPlatformPkg/Tcg/Tcg2PlatformDxe/Tcg2PlatformDxe.inf
 
+  MinPlatformPkg/Library/BaseVariableReadLibNull/BaseVariableReadLibN= ull.inf
+  MinPlatformPkg/Library/SmmVariableReadLib/StandaloneMmVariableReadL= ib.inf
+  MinPlatformPkg/Library/SmmVariableWriteLib/StandaloneMmVariableWrit= eLib.inf
+
 [BuildOptions]
   *_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES
--
2.27.0.windows.1





 

--_000_MW4PR21MB190783F005FABCA93A0D2388EFD49MW4PR21MB1907namp_--