-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Standalone MM Policy Service (#390)
## Description Introduces the service modules, test, and library implementation for a standalone MM policy service. - [x] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [x] Includes tests? - [x] Includes documentation? ## How This Was Tested Tested using the test module for MM and regression tested PEI and DXE. ## Integration Instructions PolicyDxe was moved to the DxeMm folder. Consumers should update their DSCs. (cherry picked from commit a296f04)
- Loading branch information
1 parent
c149b3f
commit a8dee78
Showing
18 changed files
with
839 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** @file | ||
This protocol provides services to publish, update, and retrieve general policies in the MM | ||
environment. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef _MM_POLICY_PROTOCOL_H_ | ||
#define _MM_POLICY_PROTOCOL_H_ | ||
|
||
#include <PolicyInterface.h> | ||
|
||
#define MM_POLICY_PROTOCOL_GUID { 0xe55ad3a1, 0xbd34, 0x46f4, { 0xbb, 0x6e, 0x72, 0x28, 0x0b, 0xdc, 0xbf, 0xd9 } } | ||
|
||
typedef struct _POLICY_INTERFACE MM_POLICY_PROTOCOL; | ||
|
||
extern EFI_GUID gMmPolicyProtocolGuid; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/** @file | ||
Implementation of the Verified Policy library for MM. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#include <Uefi.h> | ||
#include <Library/MmServicesTableLib.h> | ||
#include <Library/DebugLib.h> | ||
#include <Library/BaseLib.h> | ||
|
||
#include <Protocol/MmPolicy.h> | ||
#include <Library/VerifiedPolicy.h> | ||
|
||
#include "../PolicyLibCommon.h" | ||
|
||
/** | ||
A private helper function to retrieve the policy service protocol. | ||
@param[out] PolicyInterface Returns with the pointer to the protocol. | ||
@retval EFI_SUCCESS Policy protocol was found. | ||
@retval EFI_NOT_FOUND Policy protocol was not found. | ||
**/ | ||
EFI_STATUS | ||
GetPolicyInterface ( | ||
OUT POLICY_INTERFACE **PolicyInterface | ||
) | ||
{ | ||
EFI_STATUS Status; | ||
STATIC MM_POLICY_PROTOCOL *mPolicyProtocol = NULL; | ||
|
||
Status = EFI_SUCCESS; | ||
if (mPolicyProtocol == NULL) { | ||
Status = gMmst->MmLocateProtocol ( | ||
&gMmPolicyProtocolGuid, | ||
NULL, | ||
(VOID **)&mPolicyProtocol | ||
); | ||
|
||
if (EFI_ERROR (Status)) { | ||
mPolicyProtocol = NULL; | ||
} | ||
} | ||
|
||
if (mPolicyProtocol != NULL) { | ||
*PolicyInterface = mPolicyProtocol; | ||
} | ||
|
||
return Status; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## @file | ||
# MM instance of verified policy library. | ||
# | ||
# Copyright (c) Microsoft Corporation. | ||
# | ||
# SPDX-License-Identifier: BSD-2-Clause-Patent | ||
# | ||
## | ||
|
||
[Defines] | ||
INF_VERSION = 1.26 | ||
PI_SPECIFICATION_VERSION = 0x00010032 | ||
BASE_NAME = MmPolicyLib | ||
FILE_GUID = C2A9C781-8D58-46DA-BC39-5385AB8D5C8A | ||
MODULE_TYPE = MM_STANDALONE | ||
VERSION_STRING = 1.0 | ||
LIBRARY_CLASS = PolicyLib | MM_STANDALONE | ||
|
||
[Sources] | ||
../PolicyLibCommon.c | ||
../PolicyLibCommon.h | ||
MmPolicy.c | ||
|
||
[Packages] | ||
MdePkg/MdePkg.dec | ||
PolicyServicePkg/PolicyServicePkg.dec | ||
|
||
[LibraryClasses] | ||
BaseLib | ||
DebugLib | ||
MmServicesTableLib | ||
|
||
[Protocols] | ||
gMmPolicyProtocolGuid ## CONSUMES | ||
|
||
[Pcd] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.