Skip to content

Commit

Permalink
Update Protocol instance define
Browse files Browse the repository at this point in the history
  • Loading branch information
v-boscochen authored and v-boscochen committed Dec 11, 2024
1 parent 257269a commit 0102403
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ MOCK_FUNCTION_DEFINITION (MockPciPlatformGetPlatformPolicy, MockGetPlatformPolic
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;
}
#define MOCK_EFI_PCI_PLATFORM_PROTOCOL_INSTANCE(NAME) \
EFI_PCI_PLATFORM_PROTOCOL NAME##_INSTANCE = { \
MockPlatformNotify, \
MockPlatformPrepController, \
MockGetPlatformPolicy, \
MockGetPciRom, \
}; \
EFI_PCI_PLATFORM_PROTOCOL *NAME = &NAME##_INSTANCE;

#endif // MOCK_PCIPLATFORMPROTOCOL_H
Original file line number Diff line number Diff line change
Expand Up @@ -239,27 +239,24 @@ MOCK_FUNCTION_DEFINITION (MockPciRootBridgeIoSetAttributes, MockPciRootBridgeSet
MOCK_INTERFACE_DEFINITION (MockPciRootBridgeIoConfiguration);
MOCK_FUNCTION_DEFINITION (MockPciRootBridgeIoConfiguration, MockPciRootBridgeConfiguration, 2, EFIAPI);

EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL PCI_ROOT_BRIDGE_IO_PROTOCOL_MOCK = {
NULL, // EFI_HANDLE ParentHandle;
MockPciRootBridgePollMem, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollMem;
MockPciRootBridgePollIo, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_POLL_IO_MEM PollIo;
{ MockPciRootBridgeMemRead, MockPciRootBridgeMemWrite }, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Mem;
{ MockPciRootBridgeIoRead, MockPciRootBridgeIoWrite }, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Io;
{ MockPciRootBridgePciRead, MockPciRootBridgePciWrite }, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ACCESS Pci;
MockPciRootBridgeCopyMem, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_COPY_MEM CopyMem;
MockPciRootBridgeMap, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_MAP Map;
MockPciRootBridgeUnMap, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_UNMAP Unmap;
MockPciRootBridgeAllocateBuffer, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;
MockPciRootBridgeFreeBuffer, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FREE_BUFFER FreeBuffer;
MockPciRootBridgeFlush, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_FLUSH Flush;
MockPciRootBridgeGetAttributes, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GET_ATTRIBUTES GetAttributes;
MockPciRootBridgeSetAttributes, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_SET_ATTRIBUTES SetAttributes;
MockPciRootBridgeConfiguration, // EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_CONFIGURATION Configuration;
};

extern "C"
{
extern EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *gPciRootBridgeIoProtocol = &PCI_ROOT_BRIDGE_IO_PROTOCOL_MOCK;
}
#define MOCK_PCI_ROOT_BRIDGE_IO_PROTOCOL_INSTANCE(NAME) \
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL NAME##_INSTANCE = { \
NULL, \
MockPciRootBridgePollMem, \
MockPciRootBridgePollIo, \
{ MockPciRootBridgeMemRead, MockPciRootBridgeMemWrite },\
{ MockPciRootBridgeIoRead, MockPciRootBridgeIoWrite },\
{ MockPciRootBridgePciRead, MockPciRootBridgePciWrite },\
MockPciRootBridgeCopyMem, \
MockPciRootBridgeMap, \
MockPciRootBridgeUnMap, \
MockPciRootBridgeAllocateBuffer, \
MockPciRootBridgeFreeBuffer, \
MockPciRootBridgeFlush, \
MockPciRootBridgeGetAttributes, \
MockPciRootBridgeSetAttributes, \
MockPciRootBridgeConfiguration, \
}; \
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *NAME = &NAME##_INSTANCE;

#endif // MOCK_PCIIOPROTOCOL_H

0 comments on commit 0102403

Please sign in to comment.