MdePkg: MmCommunication: Introduce EFI_MM_COMMUNICATE_HEADER_V3 to MdePkg
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3398 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3430 This change introduces a new definition for MM communicate header structure, intending to provide better portability between different architectures (IA32 & X64) and adapt to flexible array supported by modern compilers. The original MessageLength field of EFI_MM_COMMUNICATE_HEADER, as a generic definition, was used for both PEI and DXE MM communication. On a system that supports PEI MM launch, but operates PEI in 32bit mode and MM foundation in 64bit, the current EFI_MM_COMMUNICATE_HEADER definition will cause structure parse error due to UINTN used. This introduction removes the architecture dependent field by defining this field as UINT64. The new signature could help identifying whether the data received is compiliant with this new data structure, which will help for binary release modules to identify usage of legacy data structure. BufferSize field is also added to indicate the full range of communicate region available to the SMI handler. The data field of MM communicate message is replaced with flexible array to allow users not having to consume extra data during communicate and author code more intrinsically. Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Kun Qin <kuqin12@gmail.com>
This commit is contained in:
parent
59805c7697
commit
7d1b9d3c3c
|
@ -110,6 +110,14 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
#define EFI_SMRAM_CLOSED EFI_MMRAM_CLOSED
|
||||
#define EFI_SMRAM_LOCKED EFI_MMRAM_LOCKED
|
||||
|
||||
///
|
||||
/// MM Communicate header constants
|
||||
///
|
||||
#define COMMUNICATE_HEADER_V3_GUID \
|
||||
{ \
|
||||
0x68e8c853, 0x2ba9, 0x4dd7, { 0x9a, 0xc0, 0x91, 0xe1, 0x61, 0x55, 0xc9, 0x35 } \
|
||||
}
|
||||
|
||||
///
|
||||
/// Structure describing a MMRAM region and its accessibility attributes.
|
||||
///
|
||||
|
@ -156,6 +164,47 @@ typedef struct _EFI_MM_RESERVED_MMRAM_REGION {
|
|||
UINT64 MmramReservedSize;
|
||||
} EFI_MM_RESERVED_MMRAM_REGION;
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
///
|
||||
/// To avoid confusion in interpreting frames, the buffer communicating to MM core through
|
||||
/// EFI_MM_COMMUNICATE3 or later should always start with EFI_MM_COMMUNICATE_HEADER_V3.
|
||||
///
|
||||
typedef struct {
|
||||
///
|
||||
/// Indicator GUID for MM core that the communication buffer is compliant with this v3 header.
|
||||
/// Must be gEfiMmCommunicateHeaderV3Guid.
|
||||
///
|
||||
EFI_GUID HeaderGuid;
|
||||
///
|
||||
/// Describes the size of the entire buffer (in bytes) available for communication, including this communication header.
|
||||
///
|
||||
UINT64 BufferSize;
|
||||
///
|
||||
/// Reserved for future use.
|
||||
///
|
||||
UINT64 Reserved;
|
||||
///
|
||||
/// Allows for disambiguation of the message format.
|
||||
///
|
||||
EFI_GUID MessageGuid;
|
||||
///
|
||||
/// Describes the size of MessageData (in bytes) and does not include the size of the header.
|
||||
///
|
||||
UINT64 MessageSize;
|
||||
///
|
||||
/// Designates an array of bytes that is MessageSize in size.
|
||||
///
|
||||
UINT8 MessageData[];
|
||||
} EFI_MM_COMMUNICATE_HEADER_V3;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
STATIC_ASSERT (
|
||||
(sizeof (EFI_MM_COMMUNICATE_HEADER_V3) == OFFSET_OF (EFI_MM_COMMUNICATE_HEADER_V3, MessageData)), \
|
||||
"sizeof (EFI_MM_COMMUNICATE_HEADER_V3) does not align with the beginning of flexible array MessageData"
|
||||
);
|
||||
|
||||
typedef enum {
|
||||
EFI_PCD_TYPE_8,
|
||||
EFI_PCD_TYPE_16,
|
||||
|
@ -215,4 +264,6 @@ EFI_STATUS
|
|||
IN VOID *ProcedureArgument
|
||||
);
|
||||
|
||||
extern EFI_GUID gEfiMmCommunicateHeaderV3Guid;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -914,6 +914,11 @@
|
|||
## Include/Protocol/CcMeasurement.h
|
||||
gEfiCcFinalEventsTableGuid = { 0xdd4a4648, 0x2de7, 0x4665, { 0x96, 0x4d, 0x21, 0xd9, 0xef, 0x5f, 0xb4, 0x46 }}
|
||||
|
||||
#
|
||||
# GUID indicates the MM communication data is compliant with v3 communication header.
|
||||
#
|
||||
gEfiMmCommunicateHeaderV3Guid = { 0x68e8c853, 0x2ba9, 0x4dd7, { 0x9a, 0xc0, 0x91, 0xe1, 0x61, 0x55, 0xc9, 0x35 } }
|
||||
|
||||
[Guids.IA32, Guids.X64]
|
||||
## Include/Guid/Cper.h
|
||||
gEfiIa32X64ErrorTypeCacheCheckGuid = { 0xA55701F5, 0xE3EF, 0x43de, { 0xAC, 0x72, 0x24, 0x9B, 0x57, 0x3F, 0xAD, 0x2C }}
|
||||
|
|
Loading…
Reference in New Issue