<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">I don’t entirely disagree with the name suggestion, but it’s pretty late in the process. If it’s not a hard-stop, I’d rather not.</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Other change has been made. </p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">- Bret<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="mso-element:para-border-div;border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="border:none;padding:0in"><b>From: </b><a href="mailto:lersek=redhat.com@groups.io">Laszlo Ersek via groups.io</a><br>
<b>Sent: </b>Tuesday, May 12, 2020 5:19 AM<br>
<b>To: </b><a href="mailto:devel@edk2.groups.io">devel@edk2.groups.io</a>; <a href="mailto:michael.kubacki@outlook.com">
michael.kubacki@outlook.com</a><br>
<b>Cc: </b><a href="mailto:jian.j.wang@intel.com">Jian J Wang</a>; <a href="mailto:hao.a.wu@intel.com">
Hao A Wu</a>; <a href="mailto:liming.gao@intel.com">liming.gao</a><br>
<b>Subject: </b>[EXTERNAL] Re: [edk2-devel] [PATCH v2 01/12] MdeModulePkg: Define the VariablePolicy protocol interface</p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">On 05/12/20 08:46, Michael Kubacki wrote:<br>
> From: Bret Barkelew <brbarkel@microsoft.com><br>
> <br>
> <a href="https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2522&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cf9d61ace6d7d42a2b9c008d7f66eb4b3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637248827657827126&amp;sdata=s80j2lvjZROfSb9GR6g0NO0FwGN2c18v9Im8pmRRenE%3D&amp;reserved=0">
https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D2522&amp;data=02%7C01%7CBret.Barkelew%40microsoft.com%7Cf9d61ace6d7d42a2b9c008d7f66eb4b3%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637248827657827126&amp;sdata=s80j2lvjZROfSb9GR6g0NO0FwGN2c18v9Im8pmRRenE%3D&amp;reserved=0</a><br>
> <br>
> VariablePolicy is an updated interface to<br>
> replace VarLock and VarCheckProtocol.<br>
> <br>
> Add the VariablePolicy protocol interface<br>
> header and add to the MdeModulePkg.dec file.<br>
> <br>
> Cc: Jian J Wang <jian.j.wang@intel.com><br>
> Cc: Hao A Wu <hao.a.wu@intel.com><br>
> Cc: Liming Gao <liming.gao@intel.com><br>
> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com><br>
> ---<br>
>  MdeModulePkg/Include/Protocol/VariablePolicy.h | 157 ++++++++++++++++++++<br>
>  MdeModulePkg/MdeModulePkg.dec                  |  14 +-<br>
>  2 files changed, 170 insertions(+), 1 deletion(-)<br>
> <br>
> diff --git a/MdeModulePkg/Include/Protocol/VariablePolicy.h b/MdeModulePkg/Include/Protocol/VariablePolicy.h<br>
> new file mode 100644<br>
> index 000000000000..2cd025860554<br>
> --- /dev/null<br>
> +++ b/MdeModulePkg/Include/Protocol/VariablePolicy.h<br>
> @@ -0,0 +1,157 @@<br>
> +/** @file -- VariablePolicy.h<br>
> +<br>
> +This protocol allows communication with Variable Policy Engine.<br>
> +<br>
> +Copyright (c) Microsoft Corporation.<br>
> +SPDX-License-Identifier: BSD-2-Clause-Patent<br>
> +**/<br>
> +<br>
> +#ifndef __VARIABLE_POLICY_PROTOCOL__<br>
> +#define __VARIABLE_POLICY_PROTOCOL__<br>
> +<br>
> +#define VARIABLE_POLICY_PROTOCOL_REVISION   0x0000000000010000<br>
> +<br>
> +#define VARIABLE_POLICY_PROTOCOL_GUID \<br>
> +  { \<br>
> +    0x81D1675C, 0x86F6, 0x48DF, { 0xBD, 0x95, 0x9A, 0x6E, 0x4F, 0x09, 0x25, 0xC3 } \<br>
> +  }<br>
> +<br>
> +#define VARIABLE_POLICY_ENTRY_REVISION      0x00010000<br>
> +<br>
> +#pragma pack(push, 1)<br>
> +typedef struct {<br>
> +  UINT32   Version;<br>
> +  UINT16   Size;<br>
> +  UINT16   OffsetToName;<br>
> +  EFI_GUID Namespace;<br>
> +  UINT32   MinSize;<br>
> +  UINT32   MaxSize;<br>
> +  UINT32   AttributesMustHave;<br>
> +  UINT32   AttributesCantHave;<br>
> +  UINT8    LockPolicyType;<br>
> +  UINT8    Padding[3];<br>
> +  // UINT8    LockPolicy[];     // Variable Length Field<br>
> +  // CHAR16   Name[]            // Variable Length Field<br>
> +} VARIABLE_POLICY_ENTRY;<br>
> +<br>
> +#define     VARIABLE_POLICY_NO_MIN_SIZE             0<br>
> +#define     VARIABLE_POLICY_NO_MAX_SIZE             MAX_UINT32<br>
> +#define     VARIABLE_POLICY_NO_MUST_ATTR            0<br>
> +#define     VARIABLE_POLICY_NO_CANT_ATTR            0<br>
> +<br>
> +#define     VARIABLE_POLICY_TYPE_NO_LOCK            0<br>
> +#define     VARIABLE_POLICY_TYPE_LOCK_NOW           1<br>
> +#define     VARIABLE_POLICY_TYPE_LOCK_ON_CREATE     2<br>
> +#define     VARIABLE_POLICY_TYPE_LOCK_ON_VAR_STATE  3<br>
> +<br>
> +typedef struct {<br>
> +  EFI_GUID Namespace;<br>
> +  UINT8    Value;<br>
> +  UINT8    Padding;<br>
> +  // CHAR16   Name[];           // Variable Length Field<br>
> +} VARIABLE_LOCK_ON_VAR_STATE_POLICY;<br>
> +#pragma pack(pop)<br>
> +<br>
> +/**<br>
> +  This API function disables the variable policy enforcement. If it's<br>
> +  already been called once, will return EFI_ALREADY_STARTED.<br>
> +<br>
> +  @retval     EFI_SUCCESS<br>
> +  @retval     EFI_ALREADY_STARTED   Has already been called once this boot.<br>
> +  @retval     EFI_WRITE_PROTECTED   Interface has been locked until reboot.<br>
> +  @retval     EFI_WRITE_PROTECTED   Interface option is disabled by platform PCD.<br>
> +<br>
> +**/<br>
> +typedef<br>
> +EFI_STATUS<br>
> +(EFIAPI *DISABLE_VARIABLE_POLICY)(<br>
> +  VOID<br>
> +  );<br>
> +<br>
> +/**<br>
> +  This API function returns whether or not the policy engine is<br>
> +  currently being enforced.<br>
> +<br>
> +  @param[out]   State       Pointer to a return value for whether the policy enforcement<br>
> +                            is currently enabled.<br>
> +<br>
> +  @retval     EFI_SUCCESS<br>
> +  @retval     Others        An error has prevented this command from completing.<br>
> +<br>
> +**/<br>
> +typedef<br>
> +EFI_STATUS<br>
> +(EFIAPI *IS_VARIABLE_POLICY_ENABLED)(<br>
> +  OUT BOOLEAN *State<br>
> +  );<br>
> +<br>
> +/**<br>
> +  This API function validates and registers a new policy with<br>
> +  the policy enforcement engine.<br>
> +<br>
> +  @param[in]  NewPolicy     Pointer to the incoming policy structure.<br>
> +<br>
> +  @retval     EFI_SUCCESS<br>
> +  @retval     EFI_INVALID_PARAMETER   NewPolicy is NULL or is internally inconsistent.<br>
> +  @retval     EFI_ALREADY_STARTED     An identical matching policy already exists.<br>
> +  @retval     EFI_WRITE_PROTECTED     The interface has been locked until the next reboot.<br>
> +  @retval     EFI_ABORTED             A calculation error has prevented this function from completing.<br>
> +  @retval     EFI_OUT_OF_RESOURCES    Cannot grow the table to hold any more policies.<br>
> +<br>
> +**/<br>
> +typedef<br>
> +EFI_STATUS<br>
> +(EFIAPI *REGISTER_VARIABLE_POLICY)(<br>
> +  IN VARIABLE_POLICY_ENTRY *PolicyEntry<br>
> +  );<br>
> +<br>
> +/**<br>
> +  This API function will dump the entire contents of the variable policy table.<br>
> +<br>
> +  Similar to GetVariable, the first call can be made with a 0 size and it will return<br>
> +  the size of the buffer required to hold the entire table.<br>
> +<br>
> +  @param[out]     Policy  Pointer to the policy buffer. Can be NULL if Size is 0.<br>
> +  @param[in,out]  Size    On input, the size of the output buffer. On output, the size<br>
> +                          of the data returned.<br>
> +<br>
> +  @retval     EFI_SUCCESS             Policy data is in the output buffer and Size has been updated.<br>
> +  @retval     EFI_INVALID_PARAMETER   Size is NULL, or Size is non-zero and Policy is NULL.<br>
> +  @retval     EFI_BUFFER_TOO_SMALL    Size is insufficient to hold policy. Size updated with required size.<br>
> +<br>
> +**/<br>
> +typedef<br>
> +EFI_STATUS<br>
> +(EFIAPI *DUMP_VARIABLE_POLICY)(<br>
> +  IN OUT UINT8  *Policy,<br>
> +  IN OUT UINT32 *Size<br>
> +  );<br>
> +<br>
> +/**<br>
> +  This API function locks the interface so that no more policy updates<br>
> +  can be performed or changes made to the enforcement until the next boot.<br>
> +<br>
> +  @retval     EFI_SUCCESS<br>
> +  @retval     Others        An error has prevented this command from completing.<br>
> +<br>
> +**/<br>
> +typedef<br>
> +EFI_STATUS<br>
> +(EFIAPI *LOCK_VARIABLE_POLICY)(<br>
> +  VOID<br>
> +  );<br>
> +<br>
> +typedef struct {<br>
> +  UINT64                     Revision;<br>
> +  DISABLE_VARIABLE_POLICY    DisableVariablePolicy;<br>
> +  IS_VARIABLE_POLICY_ENABLED IsVariablePolicyEnabled;<br>
> +  REGISTER_VARIABLE_POLICY   RegisterVariablePolicy;<br>
> +  DUMP_VARIABLE_POLICY       DumpVariablePolicy;<br>
> +  LOCK_VARIABLE_POLICY       LockVariablePolicy;<br>
> +} _VARIABLE_POLICY_PROTOCOL;<br>
> +<br>
> +typedef _VARIABLE_POLICY_PROTOCOL VARIABLE_POLICY_PROTOCOL;<br>
> +<br>
> +extern EFI_GUID gVariablePolicyProtocolGuid;<br>
> +<br>
> +#endif<br>
> diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec<br>
> index 4f44af694862..f74fea00b6e7 100644<br>
> --- a/MdeModulePkg/MdeModulePkg.dec<br>
> +++ b/MdeModulePkg/MdeModulePkg.dec<br>
> @@ -8,7 +8,7 @@<br>
>  # Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR><br>
>  # (C) Copyright 2016 - 2019 Hewlett Packard Enterprise Development LP<BR><br>
>  # Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR><br>
> -# Copyright (c) 2016, Microsoft Corporation<BR><br>
> +# Copyright (c) Microsoft Corporation.<BR><br>
>  # SPDX-License-Identifier: BSD-2-Clause-Patent<br>
>  #<br>
>  ##<br>
> @@ -624,6 +624,9 @@<br>
>  #   0x80000006 | Incorrect error code provided.<br>
>  #<br>
>  <br>
> +  ## Include/Protocol/VariablePolicy.h<br>
> +  gVariablePolicyProtocolGuid = { 0x81D1675C, 0x86F6, 0x48DF, { 0xBD, 0x95, 0x9A, 0x6E, 0x4F, 0x09, 0x25, 0xC3 } }<br>
> +<br>
<br>
(1) Should be called gEdkiiVariablePolicyProtocolGuid, IMO.<br>
<br>
Similarly, all VARIABLE_POLICY_PROTOCOL substrings should be<br>
EDKII_VARIABLE_POLICY_PROTOCOL, in the protocol header file, I believe.<br>
<br>
>  [PcdsFeatureFlag]<br>
>    ## Indicates if the platform can support update capsule across a system reset.<BR><BR><br>
>    #   TRUE  - Supports update capsule across a system reset.<BR><br>
> @@ -1129,6 +1132,15 @@<br>
>    # @Prompt Variable storage size.<br>
>    gEfiMdeModulePkgTokenSpaceGuid.PcdVariableStoreSize|0x10000|UINT32|0x30000005<br>
>  <br>
> +  ## Toggle for whether the VariablePolicy engine should allow disabling.<br>
> +  # The engine is enabled at power-on, but the interface allows the platform to<br>
> +  # disable enforcement for servicing flexibility. If this PCD is disabled, it will block the ability to<br>
> +  # disable the enforcement and VariablePolicy enforcement will always be ON.<br>
> +  #   TRUE - VariablePolicy can be disabled by request through the interface (until interface is locked)<br>
> +  #   FALSE - VariablePolicy interface will not accept requests to disable and is ALWAYS ON<br>
> +  # @Prompt Allow VariablePolicy enforcement to be disabled.<br>
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdAllowVariablePolicyEnforcementDisable|FALSE|BOOLEAN|0x30000020<br>
> +<br>
>    ## FFS filename to find the ACPI tables.<br>
>    # @Prompt FFS name of ACPI tables storage.<br>
>    gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile|{ 0x25, 0x4e, 0x37, 0x7e, 0x01, 0x8e, 0xee, 0x4f, 0x87, 0xf2, 0x39, 0xc, 0x23, 0xc6, 0x6, 0xcd }|VOID*|0x30000016<br>
> <br>
<br>
(2) This patch should update "MdeModulePkg.uni" in tandem with<br>
"MdeModulePkg.dec", I think.<br>
<br>
Thanks<br>
Laszlo<br>
<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>

<div width="1" style="color:white;clear:both">_._,_._,_</div>
<hr>
Groups.io Links:<p>


You receive all messages sent to this group.



<p>

<a target="_blank" href="https://edk2.groups.io/g/devel/message/59399">View/Reply Online (#59399)</a> |


  


|


  
    <a target="_blank" href="https://groups.io/mt/74175411/1813853">Mute This Topic</a>
  

| <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>



<br>

<a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> |
<a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |

<a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>

 [edk2-devel-archive@redhat.com]<br>
<div width="1" style="color:white;clear:both">_._,_._,_</div>