From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=217.140.101.70; helo=foss.arm.com; envelope-from=jagadeesh.ujja@arm.com; receiver=edk2-devel@lists.01.org Received: from foss.arm.com (usa-sjc-mx-foss1.foss.arm.com [217.140.101.70]) by ml01.01.org (Postfix) with ESMTP id D5B2B21962301 for ; Wed, 2 Jan 2019 05:14:18 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E56180D; Wed, 2 Jan 2019 05:14:18 -0800 (PST) Received: from usa.arm.com (a075555-lin.blr.arm.com [10.162.2.152]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id CA5BE3F5CF; Wed, 2 Jan 2019 05:14:15 -0800 (PST) From: Jagadeesh Ujja To: edk2-devel@lists.01.org, liming.gao@intel.com, chao.b.zhang@intel.com, leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, Achin.Gupta@arm.com, Supreeth.Venkatesh@arm.com, jian.j.wang@intel.com Date: Wed, 2 Jan 2019 18:43:43 +0530 Message-Id: <1546434828-24405-7-git-send-email-jagadeesh.ujja@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546434828-24405-1-git-send-email-jagadeesh.ujja@arm.com> References: <1546434828-24405-1-git-send-email-jagadeesh.ujja@arm.com> Subject: [PATCH v2 06/11] MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM Standalone X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 X-List-Received-Date: Wed, 02 Jan 2019 13:14:19 -0000 Adapt the VariableSmmRuntimeDxe driver to communicate with a VariableSmm driver that is implemented as a MM Standalone driver. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jagadeesh Ujja --- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf | 1 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 31 +++++++++++++------- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 3 ++ 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf index 7ef8a97..6bb35bb 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf @@ -131,6 +131,7 @@ gEfiMdeModulePkgTokenSpaceGuid.PcdMaxUserNvVariableSpaceSize ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdBoottimeReservedNvVariableSpaceSize ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe ## CONSUMES + gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics ## CONSUMES # statistic the information of variable. diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c index 85d655d..1902348 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c @@ -14,6 +14,8 @@ InitCommunicateBuffer() is really function to check the variable data size. Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -179,7 +181,11 @@ SendCommunicateBuffer ( SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; - Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize); + if (PcdGetBool (PcdStandaloneMmVariableEnabled)) { + Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBuffer, &CommSize); + } else { + Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize); + } ASSERT_EFI_ERROR (Status); SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer; @@ -991,9 +997,11 @@ SmmVariableReady ( { EFI_STATUS Status; - Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable); - if (EFI_ERROR (Status)) { - return; + if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) { + Status = gBS->LocateProtocol (&gEfiSmmVariableProtocolGuid, NULL, (VOID **)&mSmmVariable); + if (EFI_ERROR (Status)) { + return; + } } Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); @@ -1069,13 +1077,14 @@ SmmVariableWriteReady ( { EFI_STATUS Status; VOID *ProtocolOps; - - // - // Check whether the protocol is installed or not. - // - Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **) &ProtocolOps); - if (EFI_ERROR (Status)) { - return; + if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) { + // + // Check whether the protocol is installed or not. + // + Status = gBS->LocateProtocol (&gSmmVariableWriteGuid, NULL, (VOID **) &ProtocolOps); + if (EFI_ERROR (Status)) { + return; + } } // diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf index bd73f7a..c84dd2d 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf @@ -87,6 +87,9 @@ ## SOMETIMES_CONSUMES ## Variable:L"dbt" gEfiImageSecurityDatabaseGuid +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled + [Depex] gEfiSmmCommunicationProtocolGuid -- 2.7.4