Switch to the new MM communicate 2 protocol which supports both
traditional and standalone MM.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
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 <Guid/VariableFormat.h>
#include <Guid/SmmVariableCommon.h>
#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Protocol/SmmCommunication.h>
+#include <Protocol/MmCommunication2.h>
#include <Protocol/SmmVariable.h>
-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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58730): https://edk2.groups.io/g/devel/message/58730
Mute This Topic: https://groups.io/mt/74033571/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Note that the VariablePolicy code that is still out for review also uses Mm communication and would need to be updated if it lands first.
- Bret
From: Ard Biesheuvel via groups.io<mailto:ard.biesheuvel=arm.com@groups.io>
Sent: Wednesday, May 6, 2020 10:28 AM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Cc: Ard Biesheuvel<mailto:ard.biesheuvel@arm.com>; Kinney, Michael D<mailto:michael.d.kinney@intel.com>; Liming Gao<mailto:liming.gao@intel.com>; Jian J Wang<mailto:jian.j.wang@intel.com>; Hao A Wu<mailto:hao.a.wu@intel.com>; Leif Lindholm<mailto:leif@nuviainc.com>; Sami Mujawar<mailto:sami.mujawar@arm.com>; Yao, Jiewen<mailto:jiewen.yao@intel.com>
Subject: [EXTERNAL] [edk2-devel] [PATCH resend 4/7] MdeModulePkg/VariableInfo: switch to MM communicate 2 protocol
Switch to the new MM communicate 2 protocol which supports both
traditional and standalone MM.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
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 <Guid/VariableFormat.h>
#include <Guid/SmmVariableCommon.h>
#include <Guid/PiSmmCommunicationRegionTable.h>
-#include <Protocol/SmmCommunication.h>
+#include <Protocol/MmCommunication2.h>
#include <Protocol/SmmVariable.h>
-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
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#58734): https://edk2.groups.io/g/devel/message/58734
Mute This Topic: https://groups.io/mt/74034122/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com> Regards, Sami Mujawar -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59340): https://edk2.groups.io/g/devel/message/59340 Mute This Topic: https://groups.io/mt/74033571/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2026 Red Hat, Inc.