Skip to content

Commit a5b77a1

Browse files
authored
MdePkg: Add Google Mock Protocol for MmCommunication2 (#1288)
1 parent 1f986bd commit a5b77a1

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/** @file MockMmCommunication2.h
2+
Declare mock MM Communication Protocol 2.
3+
4+
Copyright (c) Microsoft Corporation.
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
**/
7+
8+
#ifndef MOCK_MM_COMMUNICATION2_H_
9+
#define MOCK_MM_COMMUNICATION2_H_
10+
11+
#include <Library/GoogleTestLib.h>
12+
#include <Library/FunctionMockLib.h>
13+
extern "C" {
14+
#include <Uefi.h>
15+
#include <Pi/PiMultiPhase.h>
16+
#include <Protocol/MmCommunication2.h>
17+
}
18+
19+
struct MockMmCommunication2Protocol {
20+
MOCK_INTERFACE_DECLARATION (MockMmCommunication2Protocol);
21+
22+
MOCK_FUNCTION_DECLARATION (
23+
EFI_STATUS,
24+
Communicate,
25+
(
26+
IN CONST EFI_MM_COMMUNICATION2_PROTOCOL *This,
27+
IN OUT VOID *CommBufferPhysical,
28+
IN OUT VOID *CommBufferVirtual,
29+
IN OUT UINTN *CommSize OPTIONAL
30+
)
31+
);
32+
};
33+
34+
MOCK_INTERFACE_DEFINITION (MockMmCommunication2Protocol);
35+
MOCK_FUNCTION_DEFINITION (MockMmCommunication2Protocol, Communicate, 4, EFIAPI);
36+
37+
#define MOCK_MM_COMMUNICATION2_PROTOCOL_INSTANCE(NAME) \
38+
EFI_MM_COMMUNICATION2_PROTOCOL NAME##_INSTANCE = { \
39+
Communicate \
40+
}; \
41+
EFI_MM_COMMUNICATION2_PROTOCOL *NAME = &NAME##_INSTANCE;
42+
43+
#endif

0 commit comments

Comments
 (0)