-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cherry-Pick] Declare mock SMM Access2 Protocol. (#1177)
Declare mock SMM Access2 Protocol for google test. - [ ] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? Run the google test. N/A
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockSmmAccess2.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/** @file MockSmmAccess2.h | ||
Declare mock SMM Access2 Protocol. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_SMM_ACCESS2_H_ | ||
#define MOCK_SMM_ACCESS2_H_ | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Pi/PiMultiPhase.h> | ||
#include <Protocol/SmmAccess2.h> | ||
} | ||
|
||
struct MockSmmAccess2Protocol { | ||
MOCK_INTERFACE_DECLARATION (MockSmmAccess2Protocol); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
Open, | ||
(IN EFI_MM_ACCESS_PROTOCOL *This) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
Close, | ||
(IN EFI_MM_ACCESS_PROTOCOL *This) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
Lock, | ||
(IN EFI_MM_ACCESS_PROTOCOL *This) | ||
); | ||
|
||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
GetCapabilities, | ||
(IN CONST EFI_MM_ACCESS_PROTOCOL *This, | ||
IN OUT UINTN *MmramMapSize, | ||
IN OUT EFI_MMRAM_DESCRIPTOR *MmramMap) | ||
); | ||
}; | ||
|
||
MOCK_INTERFACE_DEFINITION (MockSmmAccess2Protocol); | ||
MOCK_FUNCTION_DEFINITION (MockSmmAccess2Protocol, Open, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockSmmAccess2Protocol, Close, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockSmmAccess2Protocol, Lock, 1, EFIAPI); | ||
MOCK_FUNCTION_DEFINITION (MockSmmAccess2Protocol, GetCapabilities, 3, EFIAPI); | ||
|
||
EFI_SMM_ACCESS2_PROTOCOL SMM_ACCESS2_PROTOCOL_INSTANCE = { | ||
Open, | ||
Close, | ||
Lock, | ||
GetCapabilities, | ||
FALSE, | ||
FALSE | ||
}; | ||
|
||
extern "C" { | ||
EFI_SMM_ACCESS2_PROTOCOL *gSmmAccess2Protocol = &SMM_ACCESS2_PROTOCOL_INSTANCE; | ||
} | ||
|
||
#endif |