summaryrefslogtreecommitdiff
path: root/MdePkg/Test/Mock/Library/GoogleTest/MockMmServicesTableLib/MockMmServicesTableLib.cpp
blob: 1ef343136b476947ea82ca76d5d752bd2799d3c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/** @file MockMmServicesTableLib.cpp
  Google Test mocks for MmServicesTableLib

  Copyright (c) Microsoft Corporation.
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <GoogleTest/Library/MockMmServicesTableLib.h>

MOCK_INTERFACE_DEFINITION (MockMmServicesTableLib);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmAllocatePool, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmFreePool, 1, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmAllocatePages, 4, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmFreePages, 2, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmStartupThisAp, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmInstallProtocolInterface, 4, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmUninstallProtocolInterface, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmHandleProtocol, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmRegisterProtocolNotify, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmLocateHandle, 5, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmLocateProtocol, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmiManage, 4, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmInterruptRegister, 3, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockMmServicesTableLib, gMmst_MmInterruptUnRegister, 1, EFIAPI);

static EFI_MM_SYSTEM_TABLE  LocalMmst = {
  { 0,    0, 0,    0, 0 },            // EFI_TABLE_HEADER
  NULL,                               // MmFirmwareVendor
  0,                                  // MmFirmwareRevision
  NULL,                               // EFI_MM_INSTALL_CONFIGURATION_TABLE
  {
    { NULL, NULL },{ NULL, NULL }
  },                                  // EFI_MM_CPU_IO_PROTOCOL
  gMmst_MmAllocatePool,               // EFI_ALLOCATE_POOL
  gMmst_MmFreePool,                   // EFI_FREE_POOL
  gMmst_MmAllocatePages,              // EFI_ALLOCATE_PAGES
  gMmst_MmFreePages,                  // EFI_FREE_PAGES
  gMmst_MmStartupThisAp,              // EFI_MM_STARTUP_THIS_AP
  0,                                  // CurrentlyExecutingCpu
  0,                                  // NumberOfCpus
  NULL,                               // CpuSaveStateSize
  NULL,                               // CpuSaveState
  0,                                  // NumberOfTableEntries
  NULL,                               // EFI_CONFIGURATION_TABLE
  gMmst_MmInstallProtocolInterface,   // EFI_INSTALL_PROTOCOL_INTERFACE
  gMmst_MmUninstallProtocolInterface, // EFI_UNINSTALL_PROTOCOL_INTERFACE
  gMmst_MmHandleProtocol,             // EFI_HANDLE_PROTOCOL
  gMmst_MmRegisterProtocolNotify,     // EFI_MM_REGISTER_PROTOCOL_NOTIFY
  gMmst_MmLocateHandle,               // EFI_LOCATE_HANDLE
  gMmst_MmLocateProtocol,             // EFI_LOCATE_PROTOCOL
  gMmst_MmiManage,                    // EFI_MM_INTERRUPT_MANAGE
  gMmst_MmInterruptRegister,          // EFI_MM_INTERRUPT_REGISTER
  gMmst_MmInterruptUnRegister         // EFI_MM_INTERRUPT_UNREGISTER
};

extern "C" {
  EFI_MM_SYSTEM_TABLE  *gMmst = &LocalMmst;
}