/** @file\r
\r
- Copyright (c) 2016-2018, ARM Limited. All rights reserved.\r
+ Copyright (c) 2016-2019, ARM Limited. All rights reserved.\r
\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
#include <Library/UefiBootServicesTableLib.h>\r
#include <Library/UefiRuntimeServicesTableLib.h>\r
\r
-#include <Protocol/MmCommunication.h>\r
+#include <Protocol/MmCommunication2.h>\r
\r
#include <IndustryStandard/ArmStdSmc.h>\r
\r
/**\r
Communicates with a registered handler.\r
\r
- This function provides an interface to send and receive messages to the\r
- Standalone MM environment on behalf of UEFI services. This function is part\r
- of the MM Communication Protocol that may be called in physical mode prior to\r
- SetVirtualAddressMap() and in virtual mode after SetVirtualAddressMap().\r
-\r
- @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL\r
- instance.\r
- @param[in, out] CommBuffer A pointer to the buffer to convey\r
- into MMRAM.\r
- @param[in, out] CommSize The size of the data buffer being\r
- passed in. This is optional.\r
-\r
- @retval EFI_SUCCESS The message was successfully posted.\r
- @retval EFI_INVALID_PARAMETER The CommBuffer was NULL.\r
- @retval EFI_BAD_BUFFER_SIZE The buffer size is incorrect for the MM\r
- implementation. If this error is\r
- returned, the MessageLength field in\r
- the CommBuffer header or the integer\r
- pointed by CommSize are updated to reflect\r
- the maximum payload size the\r
- implementation can accommodate.\r
- @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter\r
- or CommSize parameter, if not omitted,\r
- are in address range that cannot be\r
- accessed by the MM environment\r
+ This function provides a service to send and receive messages from a registered UEFI service.\r
+\r
+ @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.\r
+ @param[in] CommBufferPhysical Physical address of the MM communication buffer\r
+ @param[in] CommBufferVirtual Virtual address of the MM communication buffer\r
+ @param[in] CommSize The size of the data buffer being passed in. On exit, the size of data\r
+ being returned. Zero if the handler does not wish to reply with any data.\r
+ This parameter is optional and may be NULL.\r
+\r
+ @retval EFI_SUCCESS The message was successfully posted.\r
+ @retval EFI_INVALID_PARAMETER CommBufferPhysical was NULL or CommBufferVirtual was NULL.\r
+ @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.\r
+ If this error is returned, the MessageLength field\r
+ in the CommBuffer header or the integer pointed by\r
+ CommSize, are updated to reflect the maximum payload\r
+ size the implementation can accommodate.\r
+ @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSize parameter,\r
+ if not omitted, are in address range that cannot be\r
+ accessed by the MM environment.\r
+\r
**/\r
-STATIC\r
EFI_STATUS\r
EFIAPI\r
-MmCommunicationCommunicate (\r
- IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This,\r
- IN OUT VOID *CommBuffer,\r
- IN OUT UINTN *CommSize OPTIONAL\r
+MmCommunication2Communicate (\r
+ IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This,\r
+ IN OUT VOID *CommBufferPhysical,\r
+ IN OUT VOID *CommBufferVirtual,\r
+ IN OUT UINTN *CommSize OPTIONAL\r
)\r
{\r
EFI_MM_COMMUNICATE_HEADER *CommunicateHeader;\r
//\r
// Check parameters\r
//\r
- if (CommBuffer == NULL) {\r
+ if (CommBufferVirtual == NULL) {\r
return EFI_INVALID_PARAMETER;\r
}\r
\r
- CommunicateHeader = CommBuffer;\r
+ CommunicateHeader = CommBufferVirtual;\r
// CommBuffer is a mandatory parameter. Hence, Rely on\r
// MessageLength + Header to ascertain the\r
// total size of the communication payload rather than\r
CommunicateSmcArgs.Arg1 = 0;\r
\r
// Copy Communication Payload\r
- CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBuffer, BufferSize);\r
+ CopyMem ((VOID *)mNsCommBuffMemRegion.VirtualBase, CommBufferVirtual, BufferSize);\r
\r
// comm_buffer_address (64-bit physical address)\r
CommunicateSmcArgs.Arg2 = (UINTN)mNsCommBuffMemRegion.PhysicalBase;\r
\r
switch (CommunicateSmcArgs.Arg0) {\r
case ARM_SMC_MM_RET_SUCCESS:\r
- ZeroMem (CommBuffer, BufferSize);\r
+ ZeroMem (CommBufferVirtual, BufferSize);\r
// On successful return, the size of data being returned is inferred from\r
// MessageLength + Header.\r
CommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mNsCommBuffMemRegion.VirtualBase;\r
sizeof (CommunicateHeader->MessageLength);\r
\r
CopyMem (\r
- CommBuffer,\r
+ CommBufferVirtual,\r
(VOID *)mNsCommBuffMemRegion.VirtualBase,\r
BufferSize\r
);\r
//\r
// MM Communication Protocol instance\r
//\r
-EFI_MM_COMMUNICATION_PROTOCOL mMmCommunication = {\r
- MmCommunicationCommunicate\r
+STATIC EFI_MM_COMMUNICATION2_PROTOCOL mMmCommunication2 = {\r
+ MmCommunication2Communicate\r
};\r
\r
/**\r
Header.Data[0] = 0;\r
\r
Size = sizeof (Header);\r
- MmCommunicationCommunicate (&mMmCommunication, &Header, &Size);\r
+ MmCommunication2Communicate (&mMmCommunication2, &Header, &Header, &Size);\r
}\r
\r
/**\r
**/\r
EFI_STATUS\r
EFIAPI\r
-MmCommunicationInitialize (\r
+MmCommunication2Initialize (\r
IN EFI_HANDLE ImageHandle,\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
// Install the communication protocol\r
Status = gBS->InstallProtocolInterface (\r
&mMmCommunicateHandle,\r
- &gEfiMmCommunicationProtocolGuid,\r
+ &gEfiMmCommunication2ProtocolGuid,\r
EFI_NATIVE_INTERFACE,\r
- &mMmCommunication\r
+ &mMmCommunication2\r
);\r
if (EFI_ERROR(Status)) {\r
DEBUG ((DEBUG_ERROR, "MmCommunicationInitialize: "\r
UninstallProtocol:\r
gBS->UninstallProtocolInterface (\r
mMmCommunicateHandle,\r
- &gEfiMmCommunicationProtocolGuid,\r
- &mMmCommunication\r
+ &gEfiMmCommunication2ProtocolGuid,\r
+ &mMmCommunication2\r
);\r
\r
CleanAddedMemorySpace:\r