diff options
author | Dun Tan <dun.tan@intel.com> | 2024-06-11 11:37:39 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-28 15:25:27 +0000 |
commit | a2a8558958cee97efd132361a2b29f2ee8339d91 (patch) | |
tree | e7af6bee1a7408c7425abe8a05a657032a0ee977 | |
parent | cf9b5684059e9740ff63da9af7bbc8172c9247dd (diff) | |
download | edk2-a2a8558958cee97efd132361a2b29f2ee8339d91.tar.gz edk2-a2a8558958cee97efd132361a2b29f2ee8339d91.tar.bz2 edk2-a2a8558958cee97efd132361a2b29f2ee8339d91.zip |
StandaloneMmPkg: Install gEfiMmCommunicationProtocolGuid
Install gEfiMmCommunicationProtocolGuid instance in the
MmCommunicationDxe driver.
Signed-off-by: Dun Tan <dun.tan@intel.com>
3 files changed, 83 insertions, 1 deletions
diff --git a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.c b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.c index e216de529f..b4c634db77 100644 --- a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.c +++ b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.c @@ -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
@@ -165,6 +172,40 @@ MmCommunicate2 ( }
/**
+ 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.
@param ImageHandle The firmware allocated handle for the EFI image.
@@ -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.
//
diff --git a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.h b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.h index 90cab5e64f..603cc7691c 100644 --- a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.h +++ b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.h @@ -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
diff --git a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf index 55c6611258..c46a3ba8bb 100644 --- a/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf +++ b/StandaloneMmPkg/Drivers/MmCommunicationDxe/MmCommunicationDxe.inf @@ -45,6 +45,7 @@ [Protocols]
gEfiMmCommunication2ProtocolGuid
gEfiSmmControl2ProtocolGuid
+ gEfiMmCommunicationProtocolGuid
[Depex]
gEfiSmmControl2ProtocolGuid
|