From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx.groups.io with SMTP id smtpd.web12.13022.1585319974526941885 for ; Fri, 27 Mar 2020 07:39:34 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: jian.j.wang@intel.com) IronPort-SDR: FF0Q7We6n1UcDEhZR7LyE9+ou9rFjlRolAZNDZzz17PVlzptrkPu4rCrXRZPE3UOE4N1kRiJeH OlQoDsyi8gVQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2020 07:39:34 -0700 IronPort-SDR: ATXywcpp2Al6veoB8AA0t6aDuId8Qlh8ucurtTNd3QGVjbkxXlkDfzQnELxrwXON6H7JSrYjru 2AYQwqTKLI6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,312,1580803200"; d="scan'208";a="282862472" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga002.fm.intel.com with ESMTP; 27 Mar 2020 07:39:34 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Mar 2020 07:39:33 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.439.0; Fri, 27 Mar 2020 07:39:33 -0700 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.232]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.137]) with mapi id 14.03.0439.000; Fri, 27 Mar 2020 22:39:31 +0800 From: "Wang, Jian J" To: "devel@edk2.groups.io" , "michael.kubacki@outlook.com" CC: Bret Barkelew , "Gao, Liming" , "Kinney, Michael D" , "Wu, Hao A" Subject: Re: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Topic: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL Thread-Index: AQHWAlF7+UHDlMzwjU6GQMRZ6envuKhchLxA Date: Fri, 27 Mar 2020 14:39:31 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: jian.j.wang@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Michael, I know this is related to UEFI spec. But I think the PEI variable driver s= hould be consistent with RT driver's behavior. Otherwise it will cause confusion. I= suggest to make similar change to PEI variable driver. Regards, Jian > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Michael > Kubacki > Sent: Wednesday, March 25, 2020 11:00 AM > To: devel@edk2.groups.io > Cc: Bret Barkelew ; Gao, Liming > ; Kinney, Michael D ; > Wang, Jian J ; Wu, Hao A > Subject: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Variable: Return > GetVariable() attr if EFI_BUFFER_TOO_SMALL >=20 > From: Michael Kubacki >=20 > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2062 >=20 > The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" > "Attributes" parameter description states: >=20 > "If not NULL, a pointer to the memory location to return the > attributes bitmask for the variable. See 'Related Definitions.' > If not NULL, then Attributes is set on output both when > EFI_SUCCESS and when EFI_BUFFER_TOO_SMALL is returned." >=20 > The attributes were previously only returned from the implementation > in Variable.c on EFI_SUCCESS. They are now returned on EFI_SUCCESS or > EFI_BUFFER_TOO_SMALL according to spec. >=20 > Cc: Bret Barkelew > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Jian J Wang > Cc: Hao A Wu > Signed-off-by: Michael Kubacki > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 10 > +++++++--- > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | > 10 ++++++---- > 2 files changed, 13 insertions(+), 7 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index d23aea4bc712..1e71fc642c76 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -18,6 +18,8 @@ >=20 > Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.
> (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
> +Copyright (c) Microsoft Corporation.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -2379,9 +2381,6 @@ VariableServiceGetVariable ( > } >=20 > CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, > mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); > - if (Attributes !=3D NULL) { > - *Attributes =3D Variable.CurrPtr->Attributes; > - } >=20 > *DataSize =3D VarDataSize; > UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TR= UE, > FALSE, FALSE, FALSE, &gVariableInfo); > @@ -2395,6 +2394,11 @@ VariableServiceGetVariable ( > } >=20 > Done: > + if (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_BUFFER_TOO_SMALL) = { > + if (Attributes !=3D NULL && Variable.CurrPtr !=3D NULL) { > + *Attributes =3D Variable.CurrPtr->Attributes; > + } > + } > ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal- > >VariableGlobal.VariableServicesLock); > return Status; > } > diff --git > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > index 2cf0ed32ae55..ca833fb0244d 100644 > --- > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c > @@ -14,6 +14,7 @@ > InitCommunicateBuffer() is really function to check the variable data= size. >=20 > Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
> +Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -642,10 +643,6 @@ FindVariableInRuntimeCache ( > } >=20 > CopyMem (Data, GetVariableDataPtr (RtPtrTrack.CurrPtr, > mVariableAuthFormat), TempDataSize); > - if (Attributes !=3D NULL) { > - *Attributes =3D RtPtrTrack.CurrPtr->Attributes; > - } > - > *DataSize =3D TempDataSize; >=20 > UpdateVariableInfo (VariableName, VendorGuid, RtPtrTrack.Volati= le, TRUE, > FALSE, FALSE, TRUE, &mVariableInfo); > @@ -661,6 +658,11 @@ FindVariableInRuntimeCache ( > } >=20 > Done: > + if (Status =3D=3D EFI_SUCCESS || Status =3D=3D EFI_BUFFER_TOO_SMALL) = { > + if (Attributes !=3D NULL && RtPtrTrack.CurrPtr !=3D NULL) { > + *Attributes =3D RtPtrTrack.CurrPtr->Attributes; > + } > + } > mVariableRuntimeCacheReadLock =3D FALSE; >=20 > return Status; > -- > 2.16.3.windows.1 >=20 >=20 >=20