]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/MmCommunication.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[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 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17
18 #ifndef _MM_COMMUNICATION_H_
19 #define _MM_COMMUNICATION_H_
20
21 #pragma pack(1)
22
23 ///
24 /// To avoid confusion in interpreting frames, the communication buffer should always
25 /// begin with EFI_MM_COMMUNICATE_HEADER
26 ///
27 typedef struct {
28 ///
29 /// Allows for disambiguation of the message format.
30 ///
31 EFI_GUID HeaderGuid;
32 ///
33 /// Describes the size of Data (in bytes) and does not include the size of the header.
34 ///
35 UINTN MessageLength;
36 ///
37 /// Designates an array of bytes that is MessageLength in size.
38 ///
39 UINT8 Data[1];
40 } EFI_MM_COMMUNICATE_HEADER;
41
42 #pragma pack()
43
44 #define EFI_MM_COMMUNICATION_PROTOCOL_GUID \
45 { \
46 0xc68ed8e2, 0x9dc6, 0x4cbd, { 0x9d, 0x94, 0xdb, 0x65, 0xac, 0xc5, 0xc3, 0x32 } \
47 }
48
49 typedef struct _EFI_MM_COMMUNICATION_PROTOCOL EFI_MM_COMMUNICATION_PROTOCOL;
50
51 /**
52 Communicates with a registered handler.
53
54 This function provides a service to send and receive messages from a registered UEFI service.
55
56 @param[in] This The EFI_MM_COMMUNICATION_PROTOCOL instance.
57 @param[in] CommBuffer A pointer to the buffer to convey into MMRAM.
58 @param[in] CommSize The size of the data buffer being passed in. On exit, the size of data
59 being returned. Zero if the handler does not wish to reply with any data.
60 This parameter is optional and may be NULL.
61
62 @retval EFI_SUCCESS The message was successfully posted.
63 @retval EFI_INVALID_PARAMETER The CommBuffer was NULL.
64 @retval EFI_BAD_BUFFER_SIZE The buffer is too large for the MM implementation.
65 If this error is returned, the MessageLength field
66 in the CommBuffer header or the integer pointed by
67 CommSize, are updated to reflect the maximum payload
68 size the implementation can accommodate.
69 @retval EFI_ACCESS_DENIED The CommunicateBuffer parameter or CommSize parameter,
70 if not omitted, are in address range that cannot be
71 accessed by the MM environment.
72
73 **/
74 typedef
75 EFI_STATUS
76 (EFIAPI *EFI_MM_COMMUNICATE)(
77 IN CONST EFI_MM_COMMUNICATION_PROTOCOL *This,
78 IN OUT VOID *CommBuffer,
79 IN OUT UINTN *CommSize OPTIONAL
80 );
81
82 ///
83 /// EFI MM Communication Protocol provides runtime services for communicating
84 /// between DXE drivers and a registered MMI handler.
85 ///
86 struct _EFI_MM_COMMUNICATION_PROTOCOL {
87 EFI_MM_COMMUNICATE Communicate;
88 };
89
90 extern EFI_GUID gEfiMmCommunicationProtocolGuid;
91
92 #endif
93