StandaloneMmPkg: Install gEfiMmCommunicationProtocolGuid

Install gEfiMmCommunicationProtocolGuid instance in the
MmCommunicationDxe driver.

Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
Dun Tan 2024-06-11 11:37:39 +08:00 committed by mergify[bot]
parent cf9b568405
commit a2a8558958
3 changed files with 83 additions and 1 deletions

View File

@ -16,6 +16,13 @@ EFI_MM_COMMUNICATION2_PROTOCOL mMmCommunication2 = {
MmCommunicate2
};
//
// PI 1.7 MM Communication Protocol instance
//
EFI_MM_COMMUNICATION_PROTOCOL mMmCommunication = {
MmCommunicate
};
MM_COMM_BUFFER mMmCommonBuffer;
EFI_SMM_CONTROL2_PROTOCOL *mSmmControl2;
@ -45,7 +52,7 @@ MmVirtualAddressChangeEvent (
Processes the communication buffer for Mm communication protocols.
This function encapsulates the common logic for handling communication buffers
used by MmCommunicate2 functions.
used by MmCommunicate2 and MmCommunicate functions.
@param[in, out] CommBuffer Pointer to the MM communication buffer
@param[in, out] CommSize The size of the data buffer being passed in. On exit, the size of data
@ -164,6 +171,40 @@ MmCommunicate2 (
return ProcessCommunicationBuffer (CommBufferVirtual, CommSize);
}
/**
Communicates with a registered handler.
This function provides a service to send and receive messages from a registered UEFI service.
@param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.
@param[in, out] CommBuffer Pointer to the MM communication buffer
@param[in, out] CommSize The size of the data buffer being passed in. On exit, the size of data
being returned. Zero if the handler does not wish to reply with any data.
This parameter is optional and may be NULL.
@retval EFI_SUCCESS The message was successfully posted.
@retval EFI_INVALID_PARAMETER The CommBuffer was NULL.
@retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.
If this error is returned, the MessageLength field
in the CommBuffer header or the integer pointed by
CommSize, are updated to reflect the maximum payload
size the implementation can accommodate.
@retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSize parameter,
if not omitted, are in address range that cannot be
accessed by the MM environment.
**/
EFI_STATUS
EFIAPI
MmCommunicate (
IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This,
IN OUT VOID *CommBuffer,
IN OUT UINTN *CommSize OPTIONAL
)
{
return ProcessCommunicationBuffer (CommBuffer, CommSize);
}
/**
The Entry Point for MmCommunicateDxe driver.
@ -209,6 +250,14 @@ MmCommunicationEntryPoint (
);
ASSERT_EFI_ERROR (Status);
Status = gBS->InstallProtocolInterface (
&Handle,
&gEfiMmCommunicationProtocolGuid,
EFI_NATIVE_INTERFACE,
&mMmCommunication
);
ASSERT_EFI_ERROR (Status);
//
// Register the event to convert the pointer for runtime.
//

View File

@ -22,6 +22,7 @@
#include <Protocol/SmmControl2.h>
#include <Protocol/MmCommunication2.h>
#include <Protocol/MmCommunication.h>
#include <Guid/MmCommBuffer.h>
#include <Guid/EventGroup.h>
@ -59,4 +60,35 @@ MmCommunicate2 (
IN OUT UINTN *CommSize OPTIONAL
);
/**
Communicates with a registered handler.
This function provides a service to send and receive messages from a registered UEFI service.
@param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.
@param[in, out] CommBufferPhysical Physical address of the MM communication buffer
@param[in, out] CommSize The size of the data buffer being passed in. On exit, the size of data
being returned. Zero if the handler does not wish to reply with any data.
This parameter is optional and may be NULL.
@retval EFI_SUCCESS The message was successfully posted.
@retval EFI_INVALID_PARAMETER The CommBuffer was NULL.
@retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.
If this error is returned, the MessageLength field
in the CommBuffer header or the integer pointed by
CommSize, are updated to reflect the maximum payload
size the implementation can accommodate.
@retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSize parameter,
if not omitted, are in address range that cannot be
accessed by the MM environment.
**/
EFI_STATUS
EFIAPI
MmCommunicate (
IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This,
IN OUT VOID *CommBufferPhysical,
IN OUT UINTN *CommSize OPTIONAL
);
#endif

View File

@ -45,6 +45,7 @@
[Protocols]
gEfiMmCommunication2ProtocolGuid
gEfiSmmControl2ProtocolGuid
gEfiMmCommunicationProtocolGuid
[Depex]
gEfiSmmControl2ProtocolGuid