diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciPlatformProtocol.h b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciPlatformProtocol.h index 65c0fee224..aa450cf36b 100644 --- a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciPlatformProtocol.h +++ b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciPlatformProtocol.h @@ -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 diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciRootBridgeIoProtocol.h b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciRootBridgeIoProtocol.h index fade525cc4..c4d1a188ec 100644 --- a/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciRootBridgeIoProtocol.h +++ b/MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockPciRootBridgeIoProtocol.h @@ -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