@@ -140,6 +140,7 @@ [LibraryClasses.common.DXE_RUNTIME_DRIVER]
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
LockBoxLib|MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeRuntimeCapsuleLib.inf
+ MmCommunicateLib|MdeModulePkg/Library/RuntimeDxeMmCommunicateLib/RuntimeDxeMmCommunicateLib.inf
[LibraryClasses.common.SMM_CORE]
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
@@ -56,13 +56,13 @@ [LibraryClasses]
DebugLib
UefiRuntimeLib
DxeServicesTableLib
+ MmCommunicateLib
UefiDriverEntryPoint
TpmMeasurementLib
[Protocols]
gEfiVariableWriteArchProtocolGuid ## PRODUCES
gEfiVariableArchProtocolGuid ## PRODUCES
- gEfiSmmCommunicationProtocolGuid ## CONSUMES
## CONSUMES
## NOTIFY
## UNDEFINED # Used to do smm communication
@@ -88,7 +88,7 @@ [Guids]
gEfiImageSecurityDatabaseGuid
[Depex]
- gEfiSmmCommunicationProtocolGuid
+ TRUE
[UserExtensions.TianoCore."ExtraFiles"]
VariableSmmRuntimeDxeExtra.uni
@@ -34,6 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
+#include <Library/MmCommunicateLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/BaseMemoryLib.h>
@@ -49,7 +50,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
EFI_HANDLE mHandle = NULL;
EFI_SMM_VARIABLE_PROTOCOL *mSmmVariable = NULL;
EFI_EVENT mVirtualAddressChangeEvent = NULL;
-EFI_SMM_COMMUNICATION_PROTOCOL *mSmmCommunication = NULL;
UINT8 *mVariableBuffer = NULL;
UINT8 *mVariableBufferPhysical = NULL;
UINTN mVariableBufferSize;
@@ -179,7 +179,7 @@ SendCommunicateBuffer (
SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader;
CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
- Status = mSmmCommunication->Communicate (mSmmCommunication, mVariableBufferPhysical, &CommSize);
+ Status = MmCommunicate (mVariableBufferPhysical, mVariableBuffer, &CommSize);
ASSERT_EFI_ERROR (Status);
SmmCommunicateHeader = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer;
@@ -898,7 +898,6 @@ VariableAddressChangeEvent (
)
{
EfiConvertPointer (0x0, (VOID **) &mVariableBuffer);
- EfiConvertPointer (0x0, (VOID **) &mSmmCommunication);
}
/**
@@ -954,7 +953,7 @@ GetVariablePayloadSize (
//
// Send data to SMM.
//
- Status = mSmmCommunication->Communicate (mSmmCommunication, CommBuffer, &CommSize);
+ Status = MmCommunicate (CommBuffer, CommBuffer, &CommSize);
ASSERT_EFI_ERROR (Status);
Status = SmmVariableFunctionHeader->ReturnStatus;
@@ -996,9 +995,6 @@ SmmVariableReady (
return;
}
- Status = gBS->LocateProtocol (&gEfiSmmCommunicationProtocolGuid, NULL, (VOID **) &mSmmCommunication);
- ASSERT_EFI_ERROR (Status);
-
//
// Allocate memory for variable communicate buffer.
//
Replace direct calls to the EFI_SMM_COMMUNICATE protocol with calls to the MmCommunicateLib library, which abstracts differences between traditional MM and standalone MM. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> --- MdeModulePkg/MdeModulePkg.dsc | 1 + MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf | 4 ++-- MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c | 10 +++------- 3 files changed, 6 insertions(+), 9 deletions(-) -- 2.20.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel