Skip to content

Commit

Permalink
Add Mock for Mock Smm Sw Dispatch2 Protocol (#1217)
Browse files Browse the repository at this point in the history
## Description

Add Mock for Mock Smm Sw Dispatch2 Protocol

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

Incorporated into GoogleTest

## Integration Instructions

N/A

---------

Signed-off-by: Rasheed Yusuf <[email protected]>
Signed-off-by: Rasheed-Yusuf <[email protected]>
Co-authored-by: Michael Kubacki <[email protected]>
Co-authored-by: Vivian Nowka-Keane <[email protected]>
  • Loading branch information
3 people authored and ProjectMuBot committed Dec 12, 2024
1 parent 24fe301 commit 5f4484f
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions MdePkg/Test/Mock/Include/GoogleTest/Protocol/MockSmmSwDispatch2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/** @file MockSmmSwDispatch2.h
This file declares a mock of SMM Software Dispatch Protocol
Copyright (c) Microsoft Corporation.
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef MOCK_SMM_SW_DISPATCH2_H_
#define MOCK_SMM_SW_DISPATCH2_H_

#include <Library/GoogleTestLib.h>
#include <Library/FunctionMockLib.h>

extern "C" {
#include <Uefi.h>
#include <Protocol/SmmSwDispatch2.h>
}

// Declarations to handle usage of the EFI_SMM_SW_DISPATCH2_PROTOCOL
struct MockEfiSmmSwDispatch2Protocol {
MOCK_INTERFACE_DECLARATION (MockEfiSmmSwDispatch2Protocol);

MOCK_FUNCTION_DECLARATION (
EFI_STATUS,
MockRegister,
(
IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,
IN EFI_SMM_HANDLER_ENTRY_POINT2 DispatchFunction,
IN OUT EFI_SMM_SW_REGISTER_CONTEXT *RegisterContext,
OUT EFI_HANDLE *DispatchHandle)
);

MOCK_FUNCTION_DECLARATION (
EFI_STATUS,
MockUnRegister,
(
IN CONST EFI_SMM_SW_DISPATCH2_PROTOCOL *This,
IN EFI_HANDLE DispatchHandle)
);
};

MOCK_INTERFACE_DEFINITION (MockEfiSmmSwDispatch2Protocol);
MOCK_FUNCTION_DEFINITION (MockEfiSmmSwDispatch2Protocol, MockRegister, 4, EFIAPI);
MOCK_FUNCTION_DEFINITION (MockEfiSmmSwDispatch2Protocol, MockUnRegister, 2, EFIAPI);

#define MOCK_EFI_SMM_SW_DISPATCH2_PROTOCOL_INSTANCE(NAME) \
EFI_SMM_SW_DISPATCH2_PROTOCOL NAME##_INSTANCE = { \
MockRegister, \
MockUnRegister }; \
EFI_SMM_SW_DISPATCH2_PROTOCOL *NAME = &NAME##_INSTANCE;

#endif // MOCK_SMM_SW_DISPATCH2_H_

0 comments on commit 5f4484f

Please sign in to comment.