public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
@ 2021-06-16 22:45 Kenneth Lautner
  2021-06-17  0:58 ` 回复: " gaoliming
  0 siblings, 1 reply; 5+ messages in thread
From: Kenneth Lautner @ 2021-06-16 22:45 UTC (permalink / raw)
  To: devel; +Cc: Jian J Wang, Hao A Wu, Zhichao Gao, Ray Ni, Liming Gao

From: Ken Lautner <klautner@microsoft.com>

Changed BdsEntry.c to use Variable Policy instead of Variable Lock
as Variable Lock will be Deprecated eventually

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>

Reviewed-by Liming Gao <gaoliming@byosoft.com.cn>
---
 MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-
 MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
index 9310b4dccb18..76ff6a0f5fc3 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
+++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
@@ -50,6 +50,8 @@
   BaseMemoryLib
   DebugLib
   UefiBootManagerLib
+  VariablePolicyLib
+  VariablePolicyHelperLib
   PlatformBootManagerLib
   PcdLib
   PrintLib
@@ -77,7 +79,7 @@
 [Protocols]
   gEfiBdsArchProtocolGuid                       ## PRODUCES
   gEfiSimpleTextInputExProtocolGuid             ## CONSUMES
-  gEdkiiVariableLockProtocolGuid                ## SOMETIMES_CONSUMES
+  gEdkiiVariablePolicyProtocolGuid              ## SOMETIMES_CONSUMES
   gEfiDeferredImageLoadProtocolGuid             ## CONSUMES
 
 [FeaturePcd]
diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
index 83b773a2fa5f..13c10bdc5bf8 100644
--- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
+++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
@@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include "Bds.h"
 #include "Language.h"
 #include "HwErrRecSupport.h"
+#include <Library/VariablePolicyHelperLib.h>
 
 #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
       (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) << LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) & EFI_BOOT_OPTION_SUPPORT_COUNT); \
@@ -670,7 +671,7 @@ BdsEntry (
   EFI_STATUS                      Status;
   UINT32                          BootOptionSupport;
   UINT16                          BootTimeOut;
-  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;
+  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;
   UINTN                           Index;
   EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;
   UINT16                          *BootNext;
@@ -716,12 +717,21 @@ BdsEntry (
   //
   // Mark the read-only variables if the Variable Lock protocol exists
   //
-  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **) &VariableLock);
-  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n", Status));
+  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID**)&VariablePolicy);
+  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n", Status));
   if (!EFI_ERROR (Status)) {
     for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
-      Status = VariableLock->RequestToLock (VariableLock, mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
-      ASSERT_EFI_ERROR (Status);
+      Status = RegisterBasicVariablePolicy(
+                 VariablePolicy,
+                 &gEfiGlobalVariableGuid,
+                 mReadOnlyVariables[Index],
+                 VARIABLE_POLICY_NO_MIN_SIZE,
+                 VARIABLE_POLICY_NO_MAX_SIZE,
+                 VARIABLE_POLICY_NO_MUST_ATTR,
+                 VARIABLE_POLICY_NO_CANT_ATTR,
+                 VARIABLE_POLICY_TYPE_LOCK_NOW
+                 );
+      ASSERT_EFI_ERROR(Status);
     }
   }
 
-- 
2.31.1.windows.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
  2021-06-16 22:45 [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy Kenneth Lautner
@ 2021-06-17  0:58 ` gaoliming
  2022-01-19  0:18   ` [edk2-devel] " Rebecca Cran
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2021-06-17  0:58 UTC (permalink / raw)
  To: kenlautner3, devel
  Cc: 'Jian J Wang', 'Hao A Wu', 'Zhichao Gao',
	'Ray Ni'

Ken:
  Thanks for your update. Please also update
MdeModulePkg\Universal\BdsDxe\Bds.h to remove #include
<Protocol/VariableLock.h>, because EDKII_VARIABLE_LOCK_PROTOCOL is not used
any more. 

Thanks
Liming
> -----邮件原件-----
> 发件人: kenlautner3@gmail.com <kenlautner3@gmail.com>
> 发送时间: 2021年6月17日 6:45
> 收件人: devel@edk2.groups.io
> 抄送: Jian J Wang <jian.j.wang@intel.com>; Hao A Wu
> <hao.a.wu@intel.com>; Zhichao Gao <zhichao.gao@intel.com>; Ray Ni
> <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
> 主题: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use
> Variable Policy
> 
> From: Ken Lautner <klautner@microsoft.com>
> 
> Changed BdsEntry.c to use Variable Policy instead of Variable Lock
> as Variable Lock will be Deprecated eventually
> 
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
> 
> Reviewed-by Liming Gao <gaoliming@byosoft.com.cn>
> ---
>  MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-
>  MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++-----
>  2 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> index 9310b4dccb18..76ff6a0f5fc3 100644
> --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> @@ -50,6 +50,8 @@
>    BaseMemoryLib
> 
>    DebugLib
> 
>    UefiBootManagerLib
> 
> +  VariablePolicyLib
> 
> +  VariablePolicyHelperLib
> 
>    PlatformBootManagerLib
> 
>    PcdLib
> 
>    PrintLib
> 
> @@ -77,7 +79,7 @@
>  [Protocols]
> 
>    gEfiBdsArchProtocolGuid                       ## PRODUCES
> 
>    gEfiSimpleTextInputExProtocolGuid             ## CONSUMES
> 
> -  gEdkiiVariableLockProtocolGuid                ##
> SOMETIMES_CONSUMES
> 
> +  gEdkiiVariablePolicyProtocolGuid              ##
> SOMETIMES_CONSUMES
> 
>    gEfiDeferredImageLoadProtocolGuid             ## CONSUMES
> 
> 
> 
>  [FeaturePcd]
> 
> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> index 83b773a2fa5f..13c10bdc5bf8 100644
> --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include "Bds.h"
> 
>  #include "Language.h"
> 
>  #include "HwErrRecSupport.h"
> 
> +#include <Library/VariablePolicyHelperLib.h>
> 
> 
> 
>  #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
> 
>        (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) <<
> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) &
> EFI_BOOT_OPTION_SUPPORT_COUNT); \
> 
> @@ -670,7 +671,7 @@ BdsEntry (
>    EFI_STATUS                      Status;
> 
>    UINT32                          BootOptionSupport;
> 
>    UINT16                          BootTimeOut;
> 
> -  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;
> 
> +  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;
> 
>    UINTN                           Index;
> 
>    EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;
> 
>    UINT16                          *BootNext;
> 
> @@ -716,12 +717,21 @@ BdsEntry (
>    //
> 
>    // Mark the read-only variables if the Variable Lock protocol exists
> 
>    //
> 
> -  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL,
> (VOID **) &VariableLock);
> 
> -  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n",
> Status));
> 
> +  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL,
> (VOID**)&VariablePolicy);
> 
> +  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n",
> Status));
> 
>    if (!EFI_ERROR (Status)) {
> 
>      for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
> 
> -      Status = VariableLock->RequestToLock (VariableLock,
> mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
> 
> -      ASSERT_EFI_ERROR (Status);
> 
> +      Status = RegisterBasicVariablePolicy(
> 
> +                 VariablePolicy,
> 
> +                 &gEfiGlobalVariableGuid,
> 
> +                 mReadOnlyVariables[Index],
> 
> +                 VARIABLE_POLICY_NO_MIN_SIZE,
> 
> +                 VARIABLE_POLICY_NO_MAX_SIZE,
> 
> +                 VARIABLE_POLICY_NO_MUST_ATTR,
> 
> +                 VARIABLE_POLICY_NO_CANT_ATTR,
> 
> +                 VARIABLE_POLICY_TYPE_LOCK_NOW
> 
> +                 );
> 
> +      ASSERT_EFI_ERROR(Status);
> 
>      }
> 
>    }
> 
> 
> 
> --
> 2.31.1.windows.1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
  2021-06-17  0:58 ` 回复: " gaoliming
@ 2022-01-19  0:18   ` Rebecca Cran
  2022-01-19  6:30     ` 回复: " gaoliming
  0 siblings, 1 reply; 5+ messages in thread
From: Rebecca Cran @ 2022-01-19  0:18 UTC (permalink / raw)
  To: devel, gaoliming, kenlautner3
  Cc: 'Jian J Wang', 'Hao A Wu', 'Zhichao Gao',
	'Ray Ni'

It looks like the BZ associated with this change is 
https://bugzilla.tianocore.org/show_bug.cgi?id=3421 .

It would be nice to get this fix committed, to stop the loud deprecated 
interface messages.


-- 
Rebecca Cran


On 6/16/21 18:58, gaoliming wrote:
> Ken:
>    Thanks for your update. Please also update
> MdeModulePkg\Universal\BdsDxe\Bds.h to remove #include
> <Protocol/VariableLock.h>, because EDKII_VARIABLE_LOCK_PROTOCOL is not used
> any more.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: kenlautner3@gmail.com <kenlautner3@gmail.com>
>> 发送时间: 2021年6月17日 6:45
>> 收件人: devel@edk2.groups.io
>> 抄送: Jian J Wang <jian.j.wang@intel.com>; Hao A Wu
>> <hao.a.wu@intel.com>; Zhichao Gao <zhichao.gao@intel.com>; Ray Ni
>> <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
>> 主题: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use
>> Variable Policy
>>
>> From: Ken Lautner <klautner@microsoft.com>
>>
>> Changed BdsEntry.c to use Variable Policy instead of Variable Lock
>> as Variable Lock will be Deprecated eventually
>>
>> Cc: Jian J Wang <jian.j.wang@intel.com>
>> Cc: Hao A Wu <hao.a.wu@intel.com>
>> Cc: Zhichao Gao <zhichao.gao@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
>>
>> Reviewed-by Liming Gao <gaoliming@byosoft.com.cn>
>> ---
>>   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-
>>   MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20 +++++++++++++++-----
>>   2 files changed, 18 insertions(+), 6 deletions(-)
>>
>> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> index 9310b4dccb18..76ff6a0f5fc3 100644
>> --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>> @@ -50,6 +50,8 @@
>>     BaseMemoryLib
>>
>>     DebugLib
>>
>>     UefiBootManagerLib
>>
>> +  VariablePolicyLib
>>
>> +  VariablePolicyHelperLib
>>
>>     PlatformBootManagerLib
>>
>>     PcdLib
>>
>>     PrintLib
>>
>> @@ -77,7 +79,7 @@
>>   [Protocols]
>>
>>     gEfiBdsArchProtocolGuid                       ## PRODUCES
>>
>>     gEfiSimpleTextInputExProtocolGuid             ## CONSUMES
>>
>> -  gEdkiiVariableLockProtocolGuid                ##
>> SOMETIMES_CONSUMES
>>
>> +  gEdkiiVariablePolicyProtocolGuid              ##
>> SOMETIMES_CONSUMES
>>
>>     gEfiDeferredImageLoadProtocolGuid             ## CONSUMES
>>
>>
>>
>>   [FeaturePcd]
>>
>> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>> b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>> index 83b773a2fa5f..13c10bdc5bf8 100644
>> --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>> +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>> @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>>   #include "Bds.h"
>>
>>   #include "Language.h"
>>
>>   #include "HwErrRecSupport.h"
>>
>> +#include <Library/VariablePolicyHelperLib.h>
>>
>>
>>
>>   #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
>>
>>         (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) <<
>> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) &
>> EFI_BOOT_OPTION_SUPPORT_COUNT); \
>>
>> @@ -670,7 +671,7 @@ BdsEntry (
>>     EFI_STATUS                      Status;
>>
>>     UINT32                          BootOptionSupport;
>>
>>     UINT16                          BootTimeOut;
>>
>> -  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;
>>
>> +  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;
>>
>>     UINTN                           Index;
>>
>>     EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;
>>
>>     UINT16                          *BootNext;
>>
>> @@ -716,12 +717,21 @@ BdsEntry (
>>     //
>>
>>     // Mark the read-only variables if the Variable Lock protocol exists
>>
>>     //
>>
>> -  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL,
>> (VOID **) &VariableLock);
>>
>> -  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n",
>> Status));
>>
>> +  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL,
>> (VOID**)&VariablePolicy);
>>
>> +  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol - %r\n",
>> Status));
>>
>>     if (!EFI_ERROR (Status)) {
>>
>>       for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++) {
>>
>> -      Status = VariableLock->RequestToLock (VariableLock,
>> mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
>>
>> -      ASSERT_EFI_ERROR (Status);
>>
>> +      Status = RegisterBasicVariablePolicy(
>>
>> +                 VariablePolicy,
>>
>> +                 &gEfiGlobalVariableGuid,
>>
>> +                 mReadOnlyVariables[Index],
>>
>> +                 VARIABLE_POLICY_NO_MIN_SIZE,
>>
>> +                 VARIABLE_POLICY_NO_MAX_SIZE,
>>
>> +                 VARIABLE_POLICY_NO_MUST_ATTR,
>>
>> +                 VARIABLE_POLICY_NO_CANT_ATTR,
>>
>> +                 VARIABLE_POLICY_TYPE_LOCK_NOW
>>
>> +                 );
>>
>> +      ASSERT_EFI_ERROR(Status);
>>
>>       }
>>
>>     }
>>
>>
>>
>> --
>> 2.31.1.windows.1
>
>
>
>
> 
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* 回复: [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
  2022-01-19  0:18   ` [edk2-devel] " Rebecca Cran
@ 2022-01-19  6:30     ` gaoliming
  2022-01-19 21:03       ` Rebecca Cran
  0 siblings, 1 reply; 5+ messages in thread
From: gaoliming @ 2022-01-19  6:30 UTC (permalink / raw)
  To: 'Rebecca Cran', devel, kenlautner3
  Cc: 'Jian J Wang', 'Hao A Wu', 'Zhichao Gao',
	'Ray Ni'

Rebecca:
  It has been merged @ d9a7612f8d1da197883bd1cb9f91f229522d39b1

Thanks
Liming
> -----邮件原件-----
> 发件人: Rebecca Cran <quic_rcran@quicinc.com>
> 发送时间: 2022年1月19日 8:18
> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn;
> kenlautner3@gmail.com
> 抄送: 'Jian J Wang' <jian.j.wang@intel.com>; 'Hao A Wu'
> <hao.a.wu@intel.com>; 'Zhichao Gao' <zhichao.gao@intel.com>; 'Ray Ni'
> <ray.ni@intel.com>
> 主题: Re: [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe:
> Update BdsEntry to use Variable Policy
> 
> It looks like the BZ associated with this change is
> https://bugzilla.tianocore.org/show_bug.cgi?id=3421 .
> 
> It would be nice to get this fix committed, to stop the loud deprecated
> interface messages.
> 
> 
> --
> Rebecca Cran
> 
> 
> On 6/16/21 18:58, gaoliming wrote:
> > Ken:
> >    Thanks for your update. Please also update
> > MdeModulePkg\Universal\BdsDxe\Bds.h to remove #include
> > <Protocol/VariableLock.h>, because EDKII_VARIABLE_LOCK_PROTOCOL is
> not used
> > any more.
> >
> > Thanks
> > Liming
> >> -----邮件原件-----
> >> 发件人: kenlautner3@gmail.com <kenlautner3@gmail.com>
> >> 发送时间: 2021年6月17日 6:45
> >> 收件人: devel@edk2.groups.io
> >> 抄送: Jian J Wang <jian.j.wang@intel.com>; Hao A Wu
> >> <hao.a.wu@intel.com>; Zhichao Gao <zhichao.gao@intel.com>; Ray Ni
> >> <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
> >> 主题: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use
> >> Variable Policy
> >>
> >> From: Ken Lautner <klautner@microsoft.com>
> >>
> >> Changed BdsEntry.c to use Variable Policy instead of Variable Lock
> >> as Variable Lock will be Deprecated eventually
> >>
> >> Cc: Jian J Wang <jian.j.wang@intel.com>
> >> Cc: Hao A Wu <hao.a.wu@intel.com>
> >> Cc: Zhichao Gao <zhichao.gao@intel.com>
> >> Cc: Ray Ni <ray.ni@intel.com>
> >> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> >> Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
> >>
> >> Reviewed-by Liming Gao <gaoliming@byosoft.com.cn>
> >> ---
> >>   MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-
> >>   MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20
> +++++++++++++++-----
> >>   2 files changed, 18 insertions(+), 6 deletions(-)
> >>
> >> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >> b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >> index 9310b4dccb18..76ff6a0f5fc3 100644
> >> --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >> +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
> >> @@ -50,6 +50,8 @@
> >>     BaseMemoryLib
> >>
> >>     DebugLib
> >>
> >>     UefiBootManagerLib
> >>
> >> +  VariablePolicyLib
> >>
> >> +  VariablePolicyHelperLib
> >>
> >>     PlatformBootManagerLib
> >>
> >>     PcdLib
> >>
> >>     PrintLib
> >>
> >> @@ -77,7 +79,7 @@
> >>   [Protocols]
> >>
> >>     gEfiBdsArchProtocolGuid                       ## PRODUCES
> >>
> >>     gEfiSimpleTextInputExProtocolGuid             ## CONSUMES
> >>
> >> -  gEdkiiVariableLockProtocolGuid                ##
> >> SOMETIMES_CONSUMES
> >>
> >> +  gEdkiiVariablePolicyProtocolGuid              ##
> >> SOMETIMES_CONSUMES
> >>
> >>     gEfiDeferredImageLoadProtocolGuid             ## CONSUMES
> >>
> >>
> >>
> >>   [FeaturePcd]
> >>
> >> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> >> b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> >> index 83b773a2fa5f..13c10bdc5bf8 100644
> >> --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> >> +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
> >> @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> >>   #include "Bds.h"
> >>
> >>   #include "Language.h"
> >>
> >>   #include "HwErrRecSupport.h"
> >>
> >> +#include <Library/VariablePolicyHelperLib.h>
> >>
> >>
> >>
> >>   #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
> >>
> >>         (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) <<
> >> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) &
> >> EFI_BOOT_OPTION_SUPPORT_COUNT); \
> >>
> >> @@ -670,7 +671,7 @@ BdsEntry (
> >>     EFI_STATUS                      Status;
> >>
> >>     UINT32                          BootOptionSupport;
> >>
> >>     UINT16                          BootTimeOut;
> >>
> >> -  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;
> >>
> >> +  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;
> >>
> >>     UINTN                           Index;
> >>
> >>     EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;
> >>
> >>     UINT16                          *BootNext;
> >>
> >> @@ -716,12 +717,21 @@ BdsEntry (
> >>     //
> >>
> >>     // Mark the read-only variables if the Variable Lock protocol exists
> >>
> >>     //
> >>
> >> -  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL,
> >> (VOID **) &VariableLock);
> >>
> >> -  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n",
> >> Status));
> >>
> >> +  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL,
> >> (VOID**)&VariablePolicy);
> >>
> >> +  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol
> - %r\n",
> >> Status));
> >>
> >>     if (!EFI_ERROR (Status)) {
> >>
> >>       for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++)
> {
> >>
> >> -      Status = VariableLock->RequestToLock (VariableLock,
> >> mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
> >>
> >> -      ASSERT_EFI_ERROR (Status);
> >>
> >> +      Status = RegisterBasicVariablePolicy(
> >>
> >> +                 VariablePolicy,
> >>
> >> +                 &gEfiGlobalVariableGuid,
> >>
> >> +                 mReadOnlyVariables[Index],
> >>
> >> +                 VARIABLE_POLICY_NO_MIN_SIZE,
> >>
> >> +                 VARIABLE_POLICY_NO_MAX_SIZE,
> >>
> >> +                 VARIABLE_POLICY_NO_MUST_ATTR,
> >>
> >> +                 VARIABLE_POLICY_NO_CANT_ATTR,
> >>
> >> +                 VARIABLE_POLICY_TYPE_LOCK_NOW
> >>
> >> +                 );
> >>
> >> +      ASSERT_EFI_ERROR(Status);
> >>
> >>       }
> >>
> >>     }
> >>
> >>
> >>
> >> --
> >> 2.31.1.windows.1
> >
> >
> >
> >
> > 
> >
> >



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 回复: [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy
  2022-01-19  6:30     ` 回复: " gaoliming
@ 2022-01-19 21:03       ` Rebecca Cran
  0 siblings, 0 replies; 5+ messages in thread
From: Rebecca Cran @ 2022-01-19 21:03 UTC (permalink / raw)
  To: gaoliming, devel, kenlautner3
  Cc: 'Jian J Wang', 'Hao A Wu', 'Zhichao Gao',
	'Ray Ni'

Oh, thanks! It turns out there was one remaining use in MdeModulePkg, by 
UefiBootManagerLib.

I've sent the following patch to fix it: [PATCH 1/1] 
MdeModulePkg/UefiBootManagerLib: Convert BmLoadOption to Variable Policy .


-- 
Rebecca Cran


On 1/18/22 23:30, gaoliming wrote:
> Rebecca:
>    It has been merged @ d9a7612f8d1da197883bd1cb9f91f229522d39b1
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: Rebecca Cran <quic_rcran@quicinc.com>
>> 发送时间: 2022年1月19日 8:18
>> 收件人: devel@edk2.groups.io; gaoliming@byosoft.com.cn;
>> kenlautner3@gmail.com
>> 抄送: 'Jian J Wang' <jian.j.wang@intel.com>; 'Hao A Wu'
>> <hao.a.wu@intel.com>; 'Zhichao Gao' <zhichao.gao@intel.com>; 'Ray Ni'
>> <ray.ni@intel.com>
>> 主题: Re: [edk2-devel] 回复: [PATCH v2 1/1] MdeModulePkg/BdsDxe:
>> Update BdsEntry to use Variable Policy
>>
>> It looks like the BZ associated with this change is
>> https://bugzilla.tianocore.org/show_bug.cgi?id=3421 .
>>
>> It would be nice to get this fix committed, to stop the loud deprecated
>> interface messages.
>>
>>
>> --
>> Rebecca Cran
>>
>>
>> On 6/16/21 18:58, gaoliming wrote:
>>> Ken:
>>>     Thanks for your update. Please also update
>>> MdeModulePkg\Universal\BdsDxe\Bds.h to remove #include
>>> <Protocol/VariableLock.h>, because EDKII_VARIABLE_LOCK_PROTOCOL is
>> not used
>>> any more.
>>>
>>> Thanks
>>> Liming
>>>> -----邮件原件-----
>>>> 发件人: kenlautner3@gmail.com <kenlautner3@gmail.com>
>>>> 发送时间: 2021年6月17日 6:45
>>>> 收件人: devel@edk2.groups.io
>>>> 抄送: Jian J Wang <jian.j.wang@intel.com>; Hao A Wu
>>>> <hao.a.wu@intel.com>; Zhichao Gao <zhichao.gao@intel.com>; Ray Ni
>>>> <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>
>>>> 主题: [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use
>>>> Variable Policy
>>>>
>>>> From: Ken Lautner <klautner@microsoft.com>
>>>>
>>>> Changed BdsEntry.c to use Variable Policy instead of Variable Lock
>>>> as Variable Lock will be Deprecated eventually
>>>>
>>>> Cc: Jian J Wang <jian.j.wang@intel.com>
>>>> Cc: Hao A Wu <hao.a.wu@intel.com>
>>>> Cc: Zhichao Gao <zhichao.gao@intel.com>
>>>> Cc: Ray Ni <ray.ni@intel.com>
>>>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>>>> Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
>>>>
>>>> Reviewed-by Liming Gao <gaoliming@byosoft.com.cn>
>>>> ---
>>>>    MdeModulePkg/Universal/BdsDxe/BdsDxe.inf |  4 +++-
>>>>    MdeModulePkg/Universal/BdsDxe/BdsEntry.c | 20
>> +++++++++++++++-----
>>>>    2 files changed, 18 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>>> b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>>> index 9310b4dccb18..76ff6a0f5fc3 100644
>>>> --- a/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>>> +++ b/MdeModulePkg/Universal/BdsDxe/BdsDxe.inf
>>>> @@ -50,6 +50,8 @@
>>>>      BaseMemoryLib
>>>>
>>>>      DebugLib
>>>>
>>>>      UefiBootManagerLib
>>>>
>>>> +  VariablePolicyLib
>>>>
>>>> +  VariablePolicyHelperLib
>>>>
>>>>      PlatformBootManagerLib
>>>>
>>>>      PcdLib
>>>>
>>>>      PrintLib
>>>>
>>>> @@ -77,7 +79,7 @@
>>>>    [Protocols]
>>>>
>>>>      gEfiBdsArchProtocolGuid                       ## PRODUCES
>>>>
>>>>      gEfiSimpleTextInputExProtocolGuid             ## CONSUMES
>>>>
>>>> -  gEdkiiVariableLockProtocolGuid                ##
>>>> SOMETIMES_CONSUMES
>>>>
>>>> +  gEdkiiVariablePolicyProtocolGuid              ##
>>>> SOMETIMES_CONSUMES
>>>>
>>>>      gEfiDeferredImageLoadProtocolGuid             ## CONSUMES
>>>>
>>>>
>>>>
>>>>    [FeaturePcd]
>>>>
>>>> diff --git a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>>>> b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>>>> index 83b773a2fa5f..13c10bdc5bf8 100644
>>>> --- a/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>>>> +++ b/MdeModulePkg/Universal/BdsDxe/BdsEntry.c
>>>> @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>>>>    #include "Bds.h"
>>>>
>>>>    #include "Language.h"
>>>>
>>>>    #include "HwErrRecSupport.h"
>>>>
>>>> +#include <Library/VariablePolicyHelperLib.h>
>>>>
>>>>
>>>>
>>>>    #define SET_BOOT_OPTION_SUPPORT_KEY_COUNT(a, c) {  \
>>>>
>>>>          (a) = ((a) & ~EFI_BOOT_OPTION_SUPPORT_COUNT) | (((c) <<
>>>> LowBitSet32 (EFI_BOOT_OPTION_SUPPORT_COUNT)) &
>>>> EFI_BOOT_OPTION_SUPPORT_COUNT); \
>>>>
>>>> @@ -670,7 +671,7 @@ BdsEntry (
>>>>      EFI_STATUS                      Status;
>>>>
>>>>      UINT32                          BootOptionSupport;
>>>>
>>>>      UINT16                          BootTimeOut;
>>>>
>>>> -  EDKII_VARIABLE_LOCK_PROTOCOL    *VariableLock;
>>>>
>>>> +  EDKII_VARIABLE_POLICY_PROTOCOL  *VariablePolicy;
>>>>
>>>>      UINTN                           Index;
>>>>
>>>>      EFI_BOOT_MANAGER_LOAD_OPTION    LoadOption;
>>>>
>>>>      UINT16                          *BootNext;
>>>>
>>>> @@ -716,12 +717,21 @@ BdsEntry (
>>>>      //
>>>>
>>>>      // Mark the read-only variables if the Variable Lock protocol exists
>>>>
>>>>      //
>>>>
>>>> -  Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL,
>>>> (VOID **) &VariableLock);
>>>>
>>>> -  DEBUG ((EFI_D_INFO, "[BdsDxe] Locate Variable Lock protocol - %r\n",
>>>> Status));
>>>>
>>>> +  Status = gBS->LocateProtocol(&gEdkiiVariablePolicyProtocolGuid, NULL,
>>>> (VOID**)&VariablePolicy);
>>>>
>>>> +  DEBUG((DEBUG_INFO, "[BdsDxe] Locate Variable Policy protocol
>> - %r\n",
>>>> Status));
>>>>
>>>>      if (!EFI_ERROR (Status)) {
>>>>
>>>>        for (Index = 0; Index < ARRAY_SIZE (mReadOnlyVariables); Index++)
>> {
>>>> -      Status = VariableLock->RequestToLock (VariableLock,
>>>> mReadOnlyVariables[Index], &gEfiGlobalVariableGuid);
>>>>
>>>> -      ASSERT_EFI_ERROR (Status);
>>>>
>>>> +      Status = RegisterBasicVariablePolicy(
>>>>
>>>> +                 VariablePolicy,
>>>>
>>>> +                 &gEfiGlobalVariableGuid,
>>>>
>>>> +                 mReadOnlyVariables[Index],
>>>>
>>>> +                 VARIABLE_POLICY_NO_MIN_SIZE,
>>>>
>>>> +                 VARIABLE_POLICY_NO_MAX_SIZE,
>>>>
>>>> +                 VARIABLE_POLICY_NO_MUST_ATTR,
>>>>
>>>> +                 VARIABLE_POLICY_NO_CANT_ATTR,
>>>>
>>>> +                 VARIABLE_POLICY_TYPE_LOCK_NOW
>>>>
>>>> +                 );
>>>>
>>>> +      ASSERT_EFI_ERROR(Status);
>>>>
>>>>        }
>>>>
>>>>      }
>>>>
>>>>
>>>>
>>>> --
>>>> 2.31.1.windows.1
>>>
>>>
>>>
>>> 
>>>
>>>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-19 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-16 22:45 [PATCH v2 1/1] MdeModulePkg/BdsDxe: Update BdsEntry to use Variable Policy Kenneth Lautner
2021-06-17  0:58 ` 回复: " gaoliming
2022-01-19  0:18   ` [edk2-devel] " Rebecca Cran
2022-01-19  6:30     ` 回复: " gaoliming
2022-01-19 21:03       ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox