From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (NAM12-BN8-obe.outbound.protection.outlook.com [40.92.21.68]) by mx.groups.io with SMTP id smtpd.web12.16301.1585327191886457836 for ; Fri, 27 Mar 2020 09:39:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=RZPRmybj; spf=pass (domain: outlook.com, ip: 40.92.21.68, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VnLxp3OkGNZRUHqoJdRvJXEy9b/NF3mhku/KJRnLH9GpUmPLJs/7Rn70l0BA6W3hh84FwBO0f1ipAMsPVJalDdxNQSAUnqE8GqIiau0FadmdTD010qjiqdefAmPCFHQ55XAA+v88crwtPTFHbCJx9dLJLHbZrcKUfOa2X20qd+DcBzS8nQmQ9pZL0OyTc6bl67AEPdhHy2ZWYN1ilQEloRpoL+zrheB/GiRfNGgGYfGxTKjkfc4awLisKsQNWsLfrfKUCM+oG9SCssceyFuMd823e99/N6LUQC7yi/oq7Is45qV1tnhk1rN5wS74KkiL/9nlkgvmQ7V3GMxk8ja5tw== 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-SenderADCheck; bh=7Fvp1NymH8R4B4EO33NQiiqx9lDRpwILNh3XtZ89A88=; b=f+HAQuuNHVkZYjh7Vs61n3ONdyXUH+nVycqKtX/ACfrm6zm1N9a+DQfe8TpDMEx4ODhsajOiMyxt1FZi2eEYn2bHSLUX1ckQlzJhXnt6qGnSfbRieL/xs3CUF4qrs6qGZXrNBr19SfDJRS5WK/TXsyIgk812bfPOtA/mBOZvCgXqqEA0nnGe5ywUMjyb2/T6Hq6uCm2mpoOOkaf4Alu4s8KxVdvjBTrEiUfDKNvFqRPWIYubibrHYUPMUqM0oDfHm8zCCxhuYY0XTZCClz6UGGQdTE5EAWLtFRBzZpi6aply4O+ntB5Hw+WhFxKqln5OCCO0Xl3Xmukl4xfuTP/OOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=outlook.com; dmarc=pass action=none header.from=outlook.com; dkim=pass header.d=outlook.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7Fvp1NymH8R4B4EO33NQiiqx9lDRpwILNh3XtZ89A88=; b=RZPRmybjLc9u/tlH5aNa6RdkpvU7Jx5BlncUN7WrLax32J/nTc6a/JblvVhA0NW8H9rl45RzloRvYSNPJea3XcPlpsQgpPRkB/fgBitLE3TumuYSoYbUEC/bmEfboZFUB/oYDRWUXhC2+YKrPUCmaUrk2WM8vQ/9q2Er+6nLyEBTMzzuFH7/g2tuo7P42M1GYAHCsPmc8jksgB8WCxkNFXDkTM0l5W8KLNzEg8CGB/9A6NXX+39cHGsNY8MM6S/4nkXU0PsauOnndGfb315QblyAiD9AszSb79BO48ui2t07qpmqSYhk0yHcZyIR+Y97623pC18l130HwP8GaSTY0A== Received: from MW2NAM12FT046.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::40) by MW2NAM12HT193.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc65::149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.14; Fri, 27 Mar 2020 16:39:50 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (10.13.180.51) by MW2NAM12FT046.mail.protection.outlook.com (10.13.181.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2878.9 via Frontend Transport; Fri, 27 Mar 2020 16:39:50 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:C1B9D2E42262A7D963272CA6E0EB5542064FC99FE0B1EB57A5CF1413C72DC39E;UpperCasedChecksum:A9CBDD379B55C030119360AEF262DCD70EC42E77D2146B428E4F7FEFF86DC8C5;SizeAsReceived:9272;Count:50 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::f5a7:e51b:e22a:959f%7]) with mapi id 15.20.2835.023; Fri, 27 Mar 2020 16:39:50 +0000 Subject: Re: [edk2-devel] [PATCH v2 1/2] MdeModulePkg/Variable: Return GetVariable() attr if EFI_BUFFER_TOO_SMALL To: devel@edk2.groups.io, jian.j.wang@intel.com Cc: Bret Barkelew , "Gao, Liming" , "Kinney, Michael D" , "Wu, Hao A" References: From: "Michael Kubacki" Message-ID: Date: Fri, 27 Mar 2020 09:39:49 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: X-ClientProxiedBy: MWHPR14CA0025.namprd14.prod.outlook.com (2603:10b6:300:12b::11) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <08336cb8-2d8b-0163-43ac-07fb9d66ec43@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4898:d8:39:117f:7c45:5fe:e7a4] (2001:4898:80e8:9:919e:7c45:5fe:e7a4) by MWHPR14CA0025.namprd14.prod.outlook.com (2603:10b6:300:12b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2856.20 via Frontend Transport; Fri, 27 Mar 2020 16:39:50 +0000 X-Microsoft-Original-Message-ID: <08336cb8-2d8b-0163-43ac-07fb9d66ec43@outlook.com> X-TMN: [vSdR1iEIbegMQzN6m400nx1t/3Lps9abJOa/1vZwwUrc6Qmvyu+mLkY8Ji6K7d+h] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 564a9751-aeec-4926-2208-08d7d26d77ec X-MS-TrafficTypeDiagnostic: MW2NAM12HT193: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +aLOcuhcWBfasReL9QYtn6d3aWl1CxYaUniFldMiLvKgMTjDBo2ra6SwmE5wLtWAY6XqQd77bKRR7P+V82b+iTtzLVr4Zwe3DM1E0/H7bstzRZEhGigqoLBqfkYXRxHW8GU4sxVmdiOlwjXT8uXN9mFbXrUlI/X2/XTahKQ3rExSfgJQYWmGmdZoWKgEkFOf6+0abwFciUNLdLFlyFZ5mZeTJ8czSQkD2S6bOXBRR4c= X-MS-Exchange-AntiSpam-MessageData: AYcdGhIPX9iHYErXbdz5TbmMWtIFhvIV3SSeYz8AlHjXDHrHgKfz95FbBPPhBx3pSLLX9UugaMa1et4hhA98HWMXAf6W3G6pqBTAaoUvcJDnc41Lb9hvhBUA+qPTpb1lzu0Q0UJ1h55GT2iijU9ZeXrM5uPZEcfAuRKECqMNZPfBhD+v8MYDrGEL0p3NsCKmcnmy5Wu2QPwx4zavbQiYSA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 564a9751-aeec-4926-2208-08d7d26d77ec X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2020 16:39:50.3315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2NAM12HT193 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit That's a good point. I will send a v3 with the change added to VariablePei. Thanks, Michael On 3/27/2020 7:39 AM, Wang, Jian J wrote: > Michael, > > I know this is related to UEFI spec. But I think the PEI variable driver should 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 >> >> From: Michael Kubacki >> >> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2062 >> >> The UEFI specification v2.8 Errata A Section 8.2 "GetVariable()" >> "Attributes" parameter description states: >> >> "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." >> >> 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. >> >> 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(-) >> >> 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 @@ >> >> 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 >> >> **/ >> @@ -2379,9 +2381,6 @@ VariableServiceGetVariable ( >> } >> >> CopyMem (Data, GetVariableDataPtr (Variable.CurrPtr, >> mVariableModuleGlobal->VariableGlobal.AuthFormat), VarDataSize); >> - if (Attributes != NULL) { >> - *Attributes = Variable.CurrPtr->Attributes; >> - } >> >> *DataSize = VarDataSize; >> UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile, TRUE, >> FALSE, FALSE, FALSE, &gVariableInfo); >> @@ -2395,6 +2394,11 @@ VariableServiceGetVariable ( >> } >> >> Done: >> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >> + if (Attributes != NULL && Variable.CurrPtr != NULL) { >> + *Attributes = 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. >> >> Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
>> +Copyright (c) Microsoft Corporation.
>> SPDX-License-Identifier: BSD-2-Clause-Patent >> >> **/ >> @@ -642,10 +643,6 @@ FindVariableInRuntimeCache ( >> } >> >> CopyMem (Data, GetVariableDataPtr (RtPtrTrack.CurrPtr, >> mVariableAuthFormat), TempDataSize); >> - if (Attributes != NULL) { >> - *Attributes = RtPtrTrack.CurrPtr->Attributes; >> - } >> - >> *DataSize = TempDataSize; >> >> UpdateVariableInfo (VariableName, VendorGuid, RtPtrTrack.Volatile, TRUE, >> FALSE, FALSE, TRUE, &mVariableInfo); >> @@ -661,6 +658,11 @@ FindVariableInRuntimeCache ( >> } >> >> Done: >> + if (Status == EFI_SUCCESS || Status == EFI_BUFFER_TOO_SMALL) { >> + if (Attributes != NULL && RtPtrTrack.CurrPtr != NULL) { >> + *Attributes = RtPtrTrack.CurrPtr->Attributes; >> + } >> + } >> mVariableRuntimeCacheReadLock = FALSE; >> >> return Status; >> -- >> 2.16.3.windows.1 >> >> >> > > > >