Skip to content

Commit 14e16b4

Browse files
committed
MdePkg: Add MockSmmSxDispatch2
1 parent bc71760 commit 14e16b4

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/** @file MockSmmSxDispatch2.h
2+
This file declares a mock of SMM Software Dispatch Protocol
3+
4+
Copyright (c) Microsoft Corporation.
5+
SPDX-License-Identifier: BSD-2-Clause-Patent
6+
**/
7+
8+
#ifndef MOCK_SMM_SX_DISPATCH2_H_
9+
#define MOCK_SMM_SX_DISPATCH2_H_
10+
11+
#include <Library/GoogleTestLib.h>
12+
#include <Library/FunctionMockLib.h>
13+
14+
extern "C" {
15+
#include <Uefi.h>
16+
#include <Protocol/SmmSxDispatch2.h>
17+
}
18+
19+
// Declarations to handle usage of the EFI_SMM_SX_DISPATCH2_PROTOCOL
20+
struct MockEfiSmmSxDispatch2Protocol {
21+
MOCK_INTERFACE_DECLARATION (MockEfiSmmSxDispatch2Protocol);
22+
23+
MOCK_FUNCTION_DECLARATION (
24+
EFI_STATUS,
25+
Register,
26+
(
27+
IN CONST EFI_MM_SX_DISPATCH_PROTOCOL *This,
28+
IN EFI_MM_HANDLER_ENTRY_POINT DispatchFunction,
29+
IN CONST EFI_MM_SX_REGISTER_CONTEXT *RegisterContext,
30+
OUT EFI_HANDLE *DispatchHandle)
31+
);
32+
33+
MOCK_FUNCTION_DECLARATION (
34+
EFI_STATUS,
35+
UnRegister,
36+
(
37+
IN CONST EFI_MM_SX_DISPATCH_PROTOCOL *This,
38+
IN EFI_HANDLE DispatchHandle)
39+
);
40+
};
41+
42+
MOCK_INTERFACE_DEFINITION (MockEfiSmmSxDispatch2Protocol);
43+
MOCK_FUNCTION_DEFINITION (MockEfiSmmSxDispatch2Protocol, Register, 4, EFIAPI);
44+
MOCK_FUNCTION_DEFINITION (MockEfiSmmSxDispatch2Protocol, UnRegister, 2, EFIAPI);
45+
46+
#define MOCK_EFI_SMM_SX_DISPATCH2_PROTOCOL_INSTANCE(NAME) \
47+
EFI_SMM_SX_DISPATCH2_PROTOCOL NAME##_INSTANCE = { \
48+
Register, \
49+
UnRegister }; \
50+
EFI_SMM_SX_DISPATCH2_PROTOCOL *NAME = &NAME##_INSTANCE;
51+
52+
#endif // MOCK_SMM_SW_DISPATCH2_H_

0 commit comments

Comments
 (0)