From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.5249.1575646189745760030 for ; Fri, 06 Dec 2019 07:29:49 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6C00831B; Fri, 6 Dec 2019 07:29:49 -0800 (PST) Received: from e123331-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 1C21E3F718; Fri, 6 Dec 2019 07:29:48 -0800 (PST) From: Ard Biesheuvel To: devel@edk2.groups.io Cc: Ard Biesheuvel , Michael D Kinney , Leif Lindholm , Liming Gao , Hao A Wu , Eric Dong , Ray Ni , Achin Gupta , Jiewen Yao Subject: [PATCH 4/7] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol Date: Fri, 6 Dec 2019 15:29:43 +0000 Message-Id: <20191206152946.624-5-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191206152946.624-1-ard.biesheuvel@arm.com> References: <20191206152946.624-1-ard.biesheuvel@arm.com> From: Ard Biesheuvel Switch to the new MM communicate 2 protocol which supports both traditional and standalone MM. Signed-off-by: Ard Biesheuvel --- MdeModulePkg/Application/VariableInfo/VariableInfo.c | 19 +++++++++++-------- MdeModulePkg/Application/VariableInfo/VariableInfo.inf | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.c b/MdeModulePkg/Application/VariableInfo/VariableInfo.c index c04ba182132f..a7df365b5895 100644 --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.c +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.c @@ -20,10 +20,10 @@ #include #include #include -#include +#include #include -EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; +EFI_MM_COMMUNICATION2_PROTOCOL *mMmCommunication2 = NULL; /** This function get the variable statistics data from SMM variable driver. @@ -41,7 +41,7 @@ EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL; EFI_STATUS EFIAPI GetVariableStatisticsData ( - IN OUT EFI_SMM_COMMUNICATE_HEADER *SmmCommunicateHeader, + IN OUT EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader, IN OUT UINTN *SmmCommunicateSize ) { @@ -49,12 +49,15 @@ GetVariableStatisticsData ( SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid); - SmmCommunicateHeader->MessageLength = *SmmCommunicateSize - OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, Data); + SmmCommunicateHeader->MessageLength = *SmmCommunicateSize - OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data); SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *) &SmmCommunicateHeader->Data[0]; SmmVariableFunctionHeader->Function = SMM_VARIABLE_FUNCTION_GET_STATISTICS; - Status = mSmmCommunication->Communicate (mSmmCommunication, SmmCommunicateHeader, SmmCommunicateSize); + Status = mMmCommunication2->Communicate (mMmCommunication2, + SmmCommunicateHeader, + SmmCommunicateHeader, + SmmCommunicateSize); ASSERT_EFI_ERROR (Status); Status = SmmVariableFunctionHeader->ReturnStatus; @@ -76,7 +79,7 @@ PrintInfoFromSmm ( { EFI_STATUS Status; VARIABLE_INFO_ENTRY *VariableInfo; - EFI_SMM_COMMUNICATE_HEADER *CommBuffer; + EFI_MM_COMMUNICATE_HEADER *CommBuffer; UINTN RealCommSize; UINTN CommSize; SMM_VARIABLE_COMMUNICATE_HEADER *FunctionHeader; @@ -92,7 +95,7 @@ PrintInfoFromSmm ( return Status; } - Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication); + Status = gBS->LocateProtocol (&gEfiMmCommunication2ProtocolGuid, NULL, (VOID **) &mMmCommunication2); if (EFI_ERROR (Status)) { return Status; } @@ -117,7 +120,7 @@ PrintInfoFromSmm ( if (Size > MaxSize) { MaxSize = Size; RealCommSize = MaxSize; - CommBuffer = (EFI_SMM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart; + CommBuffer = (EFI_MM_COMMUNICATE_HEADER *) (UINTN) Entry->PhysicalStart; } } } diff --git a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf b/MdeModulePkg/Application/VariableInfo/VariableInfo.inf index 0706ea2ead59..f7c533b54641 100644 --- a/MdeModulePkg/Application/VariableInfo/VariableInfo.inf +++ b/MdeModulePkg/Application/VariableInfo/VariableInfo.inf @@ -41,7 +41,7 @@ [LibraryClasses] MemoryAllocationLib [Protocols] - gEfiSmmCommunicationProtocolGuid ## SOMETIMES_CONSUMES + gEfiMmCommunication2ProtocolGuid ## SOMETIMES_CONSUMES ## UNDEFINED # Used to do smm communication ## SOMETIMES_CONSUMES -- 2.17.1