|
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_ |
| 1 | +/** @file MockSxDispatch.h |
| 2 | + This file declares a mock of SMM/MM Sx Dispatch Protocol |
| 3 | +
|
| 4 | + Copyright (c) Microsoft Corporation. |
| 5 | + SPDX-License-Identifier: BSD-2-Clause-Patent |
| 6 | +**/ |
| 7 | + |
| 8 | +#ifndef MOCK_SX_DISPATCH_H_ |
| 9 | +#define MOCK_SX_DISPATCH_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 Sx Dispatch Protocol |
| 20 | +struct MockEfiSxDispatch2Protocol { |
| 21 | + MOCK_INTERFACE_DECLARATION (MockEfiSxDispatch2Protocol); |
| 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 (MockEfiSxDispatch2Protocol); |
| 43 | +MOCK_FUNCTION_DEFINITION (MockEfiSxDispatch2Protocol, Register, 4, EFIAPI); |
| 44 | +MOCK_FUNCTION_DEFINITION (MockEfiSxDispatch2Protocol, 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 | +#define MOCK_EFI_MM_SX_DISPATCH_PROTOCOL_INSTANCE(NAME) \ |
| 53 | + EFI_MM_SX_DISPATCH_PROTOCOL NAME##_INSTANCE = { \ |
| 54 | + Register, \ |
| 55 | + UnRegister }; \ |
| 56 | + EFI_MM_SX_DISPATCH_PROTOCOL *NAME = &NAME##_INSTANCE; |
| 57 | +#endif // MOCK_SX_DISPATCH_H_ |
0 commit comments