]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmCommunication.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Protocol / MmCommunication.h
1 /** @file
2 EFI MM Communication Protocol as defined in the PI 1.5 specification.
3
4 This protocol provides a means of communicating between drivers outside of MM and MMI
5 handlers inside of MM.
6
7 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef _MM_COMMUNICATION_H_
13 #define _MM_COMMUNICATION_H_
14
15 #pragma pack(1)
16
17 ///
18 /// To avoid confusion in interpreting frames, the communication buffer should always
19 /// begin with EFI_MM_COMMUNICATE_HEADER
20 ///
21 typedef struct {
22 ///
23 /// Allows for disambiguation of the message format.
24 ///
25 EFI_GUID HeaderGuid;
26 ///
27 /// Describes the size of Data (in bytes) and does not include the size of the header.
28 ///
29 UINTN MessageLength;
30 ///
31 /// Designates an array of bytes that is MessageLength in size.
32 ///
33 UINT8 Data[1];
34 } EFI_MM_COMMUNICATE_HEADER;
35
36 #pragma pack()
37
38 #define EFI_MM_COMMUNICATION_PROTOCOL_GUID \
39 { \
40 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 } \
41 }
42
43 typedef struct _EFI_MM_COMMUNICATION_PROTOCOL EFI_MM_COMMUNICATION_PROTOCOL;
44
45 /**
46 Communicates with a registered handler.
47
48 This function provides a service to send and receive messages from a registered UEFI service.
49
50 @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.
51 @param[in] CommBuffer A pointer to the buffer to convey into MMRAM.
52 @param[in] CommSize The size of the data buffer being passed in. On exit, the size of data
53 being returned. Zero if the handler does not wish to reply with any data.
54 This parameter is optional and may be NULL.
55
56 @retval EFI_SUCCESS The message was successfully posted.
57 @retval EFI_INVALID_PARAMETER The CommBuffer was NULL.
58 @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.
59 If this error is returned, the MessageLength field
60 in the CommBuffer header or the integer pointed by
61 CommSize, are updated to reflect the maximum payload
62 size the implementation can accommodate.
63 @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSize parameter,
64 if not omitted, are in address range that cannot be
65 accessed by the MM environment.
66
67 **/
68 typedef
69 EFI_STATUS
70 (EFIAPI *EFI_MM_COMMUNICATE)(
71 IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This,
72 IN OUT VOID *CommBuffer,
73 IN OUT UINTN *CommSize OPTIONAL
74 );
75
76 ///
77 /// EFI MM Communication Protocol provides runtime services for communicating
78 /// between DXE drivers and a registered MMI handler.
79 ///
80 struct _EFI_MM_COMMUNICATION_PROTOCOL {
81 EFI_MM_COMMUNICATE Communicate;
82 };
83
84 extern EFI_GUID gEfiMmCommunicationProtocolGuid;
85
86 #endif
87