summaryrefslogtreecommitdiffstats
path: root/MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h
diff options
context:
space:
mode:
authorv-chhsieh <v-chhsieh@microsoft.com>2024-09-30 14:43:39 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-10-17 17:03:15 +0000
commit6e197a8ba5e349e511850fc52457992de88c8795 (patch)
tree13756b6d395ec6e1c42ce61084200fd5f34a1fad /MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h
parent866abb233817eb349fa5fe2b32283e990a8e5056 (diff)
downloadedk2-6e197a8ba5e349e511850fc52457992de88c8795.tar.gz
edk2-6e197a8ba5e349e511850fc52457992de88c8795.tar.bz2
edk2-6e197a8ba5e349e511850fc52457992de88c8795.zip
MdePkg: Add Google Test Library and Protocol
Mock Libraries: MdePkg\Test\Mock\Library\GoogleTest\MockCpuLib MdePkg\Test\Mock\Library\GoogleTest\MockPciSegmentLib MdePkg\Test\Mock\Library\GoogleTest\MockReportStatusCodeLib MdePkg\Test\Mock\Library\GoogleTest\MockSmmServicesTableLib Mock Protocol: MdePkg\Test\Mock\Include\GoogleTest\Protocol\MockMpService.h Signed-off-by: jack Hsieh <v-chhsieh@microsoft.com> Cc: Maintainer Shruti Gupta <shrugupt@microsoft.com> Cc: Reviewer Shruti Gupta <shrugupt@microsoft.com>
Diffstat (limited to 'MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h')
-rw-r--r--MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h166
1 files changed, 166 insertions, 0 deletions
diff --git a/MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h
new file mode 100644
index 0000000000..0a1cb238ab
--- /dev/null
+++ b/MdePkg/Test/Mock/Include/GoogleTest/Library/MockSmmServicesTableLib.h
@@ -0,0 +1,166 @@
+/** @file MockSmmServicesTableLib.h
+ Google Test mocks for SmmServicesTableLib
+
+ Copyright (c) Microsoft Corporation.
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef MOCK_SMM_SERVICES_TABLE_LIB_H_
+#define MOCK_SMM_SERVICES_TABLE_LIB_H_
+
+#include <Library/GoogleTestLib.h>
+#include <Library/FunctionMockLib.h>
+extern "C" {
+ #include <Uefi.h>
+ #include <Library/SmmServicesTableLib.h>
+}
+
+//
+// Declarations to handle usage of the SmmServicesTableLib by creating mock
+//
+struct MockSmmServicesTableLib {
+ MOCK_INTERFACE_DECLARATION (MockSmmServicesTableLib);
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmAllocatePool,
+ (
+ IN EFI_MEMORY_TYPE PoolType,
+ IN UINTN Size,
+ OUT VOID **Buffer
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmFreePool,
+ (
+ IN VOID *Buffer
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmAllocatePages,
+ (
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN Pages,
+ OUT EFI_PHYSICAL_ADDRESS *Memory
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmFreePages,
+ (
+ IN EFI_PHYSICAL_ADDRESS Memory,
+ IN UINTN Pages
+ )
+ );
+
+ // MP service
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmStartupThisAp,
+ (
+ IN EFI_AP_PROCEDURE Procedure,
+ IN UINTN CpuNumber,
+ IN OUT VOID *ProcArguments OPTIONAL
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmInstallProtocolInterface,
+ (
+ IN OUT EFI_HANDLE *Handle,
+ IN EFI_GUID *Protocol,
+ IN EFI_INTERFACE_TYPE InterfaceType,
+ IN VOID *Interface
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmUninstallProtocolInterface,
+ (
+ IN EFI_HANDLE Handle,
+ IN EFI_GUID *Protocol,
+ IN VOID *Interface
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmHandleProtocol,
+ (
+ IN EFI_HANDLE Handle,
+ IN EFI_GUID *Protocol,
+ OUT VOID **Interface
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmRegisterProtocolNotify,
+ (
+ IN CONST EFI_GUID *Protocol,
+ IN EFI_MM_NOTIFY_FN Function,
+ OUT VOID **Registration
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmLocateHandle,
+ (
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,
+ IN EFI_GUID *Protocol,
+ IN VOID *SearchKey,
+ IN OUT UINTN *BufferSize,
+ OUT EFI_HANDLE *Buffer
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmLocateProtocol,
+ (
+ IN EFI_GUID *Protocol,
+ IN VOID *Registration OPTIONAL,
+ OUT VOID **Interface
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmiManage,
+ (
+ IN CONST EFI_GUID *HandlerType,
+ IN CONST VOID *Context,
+ IN OUT VOID *CommBuffer,
+ IN OUT UINTN *CommBufferSize
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmInterruptRegister,
+ (
+ IN EFI_SMM_HANDLER_ENTRY_POINT2 Handler,
+ IN CONST EFI_GUID *HandlerType,
+ OUT EFI_HANDLE *DispatchHandle
+ )
+ );
+
+ MOCK_FUNCTION_DECLARATION (
+ EFI_STATUS,
+ gSmst_SmmInterruptUnRegister,
+ (
+ IN EFI_HANDLE DispatchHandle
+ )
+ );
+};
+
+#endif