-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create PEI & DXE services for generalized policy management
Created PEI and DXE modules to enable creation, editing, and finalizing of generic system policy. The service is agnostic to the contents of the policy data, bur provides mechanisms to store and publish the policies for the duration of the pre-boot environment.
- Loading branch information
1 parent
54987dc
commit 30eba67
Showing
15 changed files
with
1,384 additions
and
0 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
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,84 @@ | ||
/** @file | ||
Common public header definitions for the policy interface. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef _POLICY_INTERFACE_H_ | ||
#define _POLICY_INTERFACE_H_ | ||
|
||
// Flag indicating the policy is not mutable. | ||
#define POLICY_ATTRIBUTE_FINALIZED BIT0 | ||
|
||
// Indicating the provided policy should not be available in DXE. | ||
#define POLICY_ATTRIBUTE_PEI_ONLY BIT1 | ||
|
||
/** | ||
Creates or updates a policy in the policy store. Will notify any applicable | ||
callbacks. | ||
@param[in] PolicyGuid The uniquely identifying GUID for the policy. | ||
@param[in] Attributes Attributes of the policy to be set. | ||
@param[in] Policy The policy data buffer. This buffer will be | ||
copied into the data store. | ||
@param[in] PolicySize The size of the provided policy data. | ||
@retval EFI_SUCCESS Policy was created or updated. | ||
@retval EFI_ACCESS_DENIED Policy was already finalized prior to this call. | ||
@retval EFI_OUT_OF_RESOURCES Failed to allocate space for policy structures. | ||
**/ | ||
typedef | ||
EFI_STATUS | ||
(EFIAPI *POLICY_SET_POLICY)( | ||
IN EFI_GUID *PolicyGuid, | ||
IN UINT64 Attributes, | ||
IN VOID *Policy, | ||
IN UINT16 PolicySize | ||
); | ||
|
||
/** | ||
Retrieves the policy descriptor, buffer, and size for a given policy GUID. | ||
@param[in] PolicyGuid The GUID of the policy being retrieved. | ||
@param[out] Attributes The attributes of the stored policy. | ||
@param[out] Policy The buffer where the policy data is copied. | ||
@param[in,out] PolicySize The size of the stored policy data buffer. | ||
On output, contains the size of the stored policy. | ||
@retval EFI_SUCCESS The policy was retrieved. | ||
@retval EFI_BUFFER_TOO_SMALL The provided buffer size was too small. | ||
@retval EFI_NOT_FOUND The policy does not exist. | ||
**/ | ||
typedef | ||
EFI_STATUS | ||
(EFIAPI *POLICY_GET_POLICY)( | ||
IN EFI_GUID *PolicyGuid, | ||
OUT UINT64 *Attributes OPTIONAL, | ||
OUT VOID *Policy, | ||
IN OUT UINT16 *PolicySize | ||
); | ||
|
||
/** | ||
Removes a policy from the policy store. The policy will be removed from the store | ||
and freed if possible. | ||
@param[in] PolicyGuid The GUID of the policy being retrieved. | ||
@retval EFI_SUCCESS The policy was removed. | ||
@retval EFI_NOT_FOUND The policy does not exist. | ||
**/ | ||
typedef | ||
EFI_STATUS | ||
(EFIAPI *POLICY_REMOVE_POLICY)( | ||
IN EFI_GUID *PolicyGuid | ||
); | ||
|
||
typedef struct _POLICY_INTERFACE { | ||
POLICY_SET_POLICY SetPolicy; | ||
POLICY_GET_POLICY GetPolicy; | ||
POLICY_REMOVE_POLICY RemovePolicy; | ||
} POLICY_INTERFACE; | ||
|
||
#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,21 @@ | ||
/** @file | ||
This PPI provides services to publish, update, and retrieve general policies in the PEI | ||
environment. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef _POLICY_PPI_H_ | ||
#define _POLICY_PPI_H_ | ||
|
||
#include <PolicyInterface.h> | ||
|
||
#define POLICY_PPI_GUID {0xa8b33630, 0xa1ae, 0x4e2d, { 0x8d, 0x0f, 0x3d, 0xf3, 0xe5, 0x87, 0x08, 0xce } } | ||
|
||
typedef struct _POLICY_INTERFACE POLICY_PPI; | ||
|
||
extern EFI_GUID gPeiPolicyPpiGuid; | ||
|
||
#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,21 @@ | ||
/** @file | ||
This protocol provides services to publish, update, and retrieve general policies in the DXE | ||
environment. | ||
Copyright (c) Microsoft Corporation | ||
SPDX-License-Identifier: BSD-2-Clause-Patent | ||
**/ | ||
|
||
#ifndef _POLICY_PROTOCOL_H_ | ||
#define _POLICY_PROTOCOL_H_ | ||
|
||
#include <PolicyInterface.h> | ||
|
||
#define POLICY_PROTOCOL_GUID {0xd7c9b744, 0x13a5, 0x4377, { 0x8d, 0x2a, 0x6b, 0x37, 0xad, 0x1f, 0xd8, 0x2a } } | ||
|
||
typedef struct _POLICY_INTERFACE POLICY_PROTOCOL; | ||
|
||
extern EFI_GUID gPolicyProtocolGuid; | ||
|
||
#endif |
Oops, something went wrong.