-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7ce51f9
commit 31dca79
Showing
1 changed file
with
94 additions
and
0 deletions.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciPlatformProtocol.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,94 @@ | ||
/** @file | ||
This file declares a mock of PCI Platform Protocol. | ||
Copyright (c) Microsoft Corporation. | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef MOCK_PCIPLATFORMPROTOCOL_H | ||
#define MOCK_PCIPLATFORMPROTOCOL_H | ||
|
||
#include <Library/GoogleTestLib.h> | ||
#include <Library/FunctionMockLib.h> | ||
|
||
extern "C" { | ||
#include <Uefi.h> | ||
#include <Protocol/PciPlatform.h> | ||
} | ||
|
||
struct MockPciPlatformPhaseNotify { | ||
MOCK_INTERFACE_DECLARATION (MockPciPlatformPhaseNotify); | ||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
MockPlatformNotify, | ||
(IN EFI_PCI_PLATFORM_PROTOCOL *This, | ||
IN EFI_HANDLE HostBridge, | ||
IN EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PHASE Phase, | ||
IN EFI_PCI_EXECUTION_PHASE ExecPhase | ||
) | ||
); | ||
}; | ||
|
||
struct MockPciPlatformPreprocessController { | ||
MOCK_INTERFACE_DECLARATION (MockPciPlatformPreprocessController); | ||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
MockPlatformPrepController, | ||
( | ||
IN EFI_PCI_PLATFORM_PROTOCOL *This, | ||
IN EFI_HANDLE HostBridge, | ||
IN EFI_HANDLE RootBridge, | ||
IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS PciAddress, | ||
IN EFI_PCI_CONTROLLER_RESOURCE_ALLOCATION_PHASE Phase, | ||
IN EFI_PCI_EXECUTION_PHASE ExecPhase | ||
) | ||
); | ||
}; | ||
|
||
struct MockPciPlatformGetPlatformPolicy { | ||
MOCK_INTERFACE_DECLARATION (MockPciPlatformGetPlatformPolicy); | ||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
MockGetPlatformPolicy, | ||
( | ||
IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, | ||
OUT EFI_PCI_PLATFORM_POLICY *PciPolicy | ||
) | ||
); | ||
}; | ||
|
||
struct MockPciPlatformGetPciRom { | ||
MOCK_INTERFACE_DECLARATION (MockPciPlatformGetPciRom); | ||
MOCK_FUNCTION_DECLARATION ( | ||
EFI_STATUS, | ||
MockGetPciRom, | ||
( | ||
IN CONST EFI_PCI_PLATFORM_PROTOCOL *This, | ||
IN EFI_HANDLE PciHandle, | ||
OUT VOID **RomImage, | ||
OUT UINTN *RomSize | ||
) | ||
); | ||
}; | ||
|
||
MOCK_INTERFACE_DEFINITION (MockPciPlatformPhaseNotify); | ||
MOCK_FUNCTION_DEFINITION (MockPciPlatformPhaseNotify, MockPlatformNotify, 4, EFIAPI); | ||
MOCK_INTERFACE_DEFINITION (MockPciPlatformPreprocessController); | ||
MOCK_FUNCTION_DEFINITION (MockPciPlatformPreprocessController, MockPlatformPrepController, 6, EFIAPI); | ||
MOCK_INTERFACE_DEFINITION (MockPciPlatformGetPlatformPolicy); | ||
MOCK_FUNCTION_DEFINITION (MockPciPlatformGetPlatformPolicy, MockGetPlatformPolicy, 2, EFIAPI); | ||
MOCK_INTERFACE_DEFINITION (MockPciPlatformGetPciRom); | ||
MOCK_FUNCTION_DEFINITION (MockPciPlatformGetPciRom, MockGetPciRom, 4, EFIAPI); | ||
|
||
EFI_PCI_PLATFORM_PROTOCOL EFI_PCI_PLATFORM_PROTOCOL_MOCK = { | ||
MockPlatformNotify, // EFI_PCI_PLATFORM_PHASE_NOTIFY | ||
MockPlatformPrepController, // EFI_PCI_PLATFORM_PREPROCESS_CONTROLLER | ||
MockGetPlatformPolicy, // EFI_PCI_PLATFORM_GET_PLATFORM_POLICY | ||
MockGetPciRom, // EFI_PCI_PLATFORM_GET_PCI_ROM | ||
}; | ||
|
||
extern "C" { | ||
extern EFI_PCI_PLATFORM_PROTOCOL *gPciPlatformProtocol = &EFI_PCI_PLATFORM_PROTOCOL_MOCK; | ||
} | ||
|
||
#endif // MOCK_PCIPLATFORMPROTOCOL_H |