<div dir="ltr">This needs more editorial changes so disregard for now and I'll resend it when it's better.  Sorry about that.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jun 16, 2021 at 10:35 AM Kenneth Lautner via <a href="http://groups.io">groups.io</a> <kenlautner3=<a href="mailto:gmail.com@groups.io">gmail.com@groups.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Ken Lautner <<a href="mailto:klautner@microsoft.com" target="_blank">klautner@microsoft.com</a>><br>
<br>
Changed BdsEntry.c to use Variable Policy instead of Variable Lock<br>
as Variable Lock will be Deprecated eventually<br>
<br>
Cc: Jian J Wang <<a href="mailto:jian.j.wang@intel.com" target="_blank">jian.j.wang@intel.com</a>><br>
Cc: Hao A Wu <<a href="mailto:hao.a.wu@intel.com" target="_blank">hao.a.wu@intel.com</a>><br>
Cc: Zhichao Gao <<a href="mailto:zhichao.gao@intel.com" target="_blank">zhichao.gao@intel.com</a>><br>
Cc: Ray Ni <<a href="mailto:ray.ni@intel.com" target="_blank">ray.ni@intel.com</a>><br>
Signed-off-by: Kenneth Lautner <<a href="mailto:kenlautner3@gmail.com" target="_blank">kenlautner3@gmail.com</a>><br>
<br>
Fixed Library References<br>
<br>
Quick revert<br>
<br>
MdeModulePkg/BdsDxe: Fixed Library References<br>
<br>
Fixed incorrect library reference in BdsEntry.c<br>
<br>
Cc: Jian J Wang <<a href="mailto:jian.j.wang@intel.com" target="_blank">jian.j.wang@intel.com</a>><br>
Cc: Hao A Wu <<a href="mailto:hao.a.wu@intel.com" target="_blank">hao.a.wu@intel.com</a>><br>
Cc: Zhichao Gao <<a href="mailto:zhichao.gao@intel.com" target="_blank">zhichao.gao@intel.com</a>><br>
Cc: Ray Ni <<a href="mailto:ray.ni@intel.com" target="_blank">ray.ni@intel.com</a>><br>
Cc: Liming Gao <<a href="mailto:gaoliming@byosoft.com.cn" target="_blank">gaoliming@byosoft.com.cn</a>><br>
Signed-off-by: Kenneth Lautner <<a href="mailto:kenlautner3@gmail.com" target="_blank">kenlautner3@gmail.com</a>><br>
---<br>
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-<br>
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++-----<br>
 2 files changed, 18 insertions(+), 6 deletions(-)<br>
<br>
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf<br>
index 9310b4dccb18..76ff6a0f5fc3 100644<br>
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf<br>
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf<br>
@@ -50,6 +50,8 @@<br>
   BaseMemoryLib<br>
   DebugLib<br>
   UefiBootManagerLib<br>
+  VariablePolicyLib<br>
+  VariablePolicyHelperLib<br>
   PlatformBootManagerLib<br>
   PcdLib<br>
   PrintLib<br>
@@ -77,7 +79,7 @@<br>
 [Protocols]<br>
   gEfiBdsArchProtocolGuid                       ## PRODUCES<br>
   gEfiSimpleTextInputExProtocolGuid             ## CONSUMES<br>
-  gEdkiiVariableLockProtocolGuid                ## SOMETIMES_CONSUMES<br>
+  gEdkiiVariablePolicyProtocolGuid              ## SOMETIMES_CONSUMES<br>
   gEfiDeferredImageLoadProtocolGuid             ## CONSUMES<br>
<br>
 [FeaturePcd]<br>
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c<br>
index 83b773a2fa5f..13c10bdc5bf8 100644<br>
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c<br>
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c<br>
@@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent<br>
 #include "Bds.h"<br>
 #include "Language.h"<br>
 #include "HwErrRecSupport.h"<br>
+#include <Library/VariablePolicyHelperLib.h><br>
<br>
 #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \<br>
       (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \<br>
@@ -670,7 +671,7 @@ BdsEntry (<br>
   EFI_STATUS                      Status;<br>
   UINT32                          BootOptionSupport;<br>
   UINT16                          BootTimeOut;<br>
-  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;<br>
+  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;<br>
   UINTN                           Index;<br>
   EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;<br>
   UINT16                          *BootNext;<br>
@@ -716,12 +717,21 @@ BdsEntry (<br>
   //<br>
   // Mark the read-only variables if the Variable Lock protocol exists<br>
   //<br>
-  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);<br>
-  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));<br>
+  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID**)&VariablePolicy);<br>
+  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", Status));<br>
   if (!EFI_ERROR (Status)) {<br>
     for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {<br>
-      Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);<br>
-      ASSERT_EFI_ERROR (Status);<br>
+      Status = RegisterBasicVariablePolicy(<br>
+                 VariablePolicy,<br>
+                 &gEfiGlobalVariableGuid,<br>
+                 mReadOnlyVariables[Index],<br>
+                 VARIABLE_POLICY_NO_MIN_SIZE,<br>
+                 VARIABLE_POLICY_NO_MAX_SIZE,<br>
+                 VARIABLE_POLICY_NO_MUST_ATTR,<br>
+                 VARIABLE_POLICY_NO_CANT_ATTR,<br>
+                 VARIABLE_POLICY_TYPE_LOCK_NOW<br>
+                 );<br>
+      ASSERT_EFI_ERROR(Status);<br>
     }<br>
   }<br>
<br>
-- <br>
2.31.1.windows.1<br>
<br>
<br>
<br>
------------<br>
Groups.io Links: You receive all messages sent to this group.<br>
View/Reply Online (#76602): <a href="https://edk2.groups.io/g/devel/message/76602" rel="noreferrer" target="_blank">https://edk2.groups.io/g/devel/message/76602</a><br>
Mute This Topic: <a href="https://groups.io/mt/83586104/6193780" rel="noreferrer" target="_blank">https://groups.io/mt/83586104/6193780</a><br>
Group Owner: <a href="mailto:devel%2Bowner@edk2.groups.io" target="_blank">devel+owner@edk2.groups.io</a><br>
Unsubscribe: <a href="https://edk2.groups.io/g/devel/unsub" rel="noreferrer" target="_blank">https://edk2.groups.io/g/devel/unsub</a> [<a href="mailto:kenlautner3@gmail.com" target="_blank">kenlautner3@gmail.com</a>]<br>
------------<br>
<br>
<br>
</blockquote></div>


 <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/76610">View/Reply Online (#76610)</a> |    |  <a target="_blank" href="https://groups.io/mt/83586104/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><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>