mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
MdeModulePkg/UefiBootManagerLib: Convert BmLoadOption to Variable Policy
Since the Variable Lock protocol is deprecated, convert locking of PlatformRecovery#### in EfiBootManagerLoadOptionToVariable to use the Variable Policy protocol. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
a867f3a704
commit
f4b7b473b4
@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "InternalBm.h"
|
#include "InternalBm.h"
|
||||||
|
|
||||||
|
#include <Library/VariablePolicyHelperLib.h>
|
||||||
|
|
||||||
GLOBAL_REMOVE_IF_UNREFERENCED
|
GLOBAL_REMOVE_IF_UNREFERENCED
|
||||||
CHAR16 *mBmLoadOptionName[] = {
|
CHAR16 *mBmLoadOptionName[] = {
|
||||||
L"Driver",
|
L"Driver",
|
||||||
@ -169,15 +171,15 @@ EfiBootManagerLoadOptionToVariable (
|
|||||||
IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Option
|
IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Option
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN VariableSize;
|
UINTN VariableSize;
|
||||||
UINT8 *Variable;
|
UINT8 *Variable;
|
||||||
UINT8 *Ptr;
|
UINT8 *Ptr;
|
||||||
CHAR16 OptionName[BM_OPTION_NAME_LEN];
|
CHAR16 OptionName[BM_OPTION_NAME_LEN];
|
||||||
CHAR16 *Description;
|
CHAR16 *Description;
|
||||||
CHAR16 NullChar;
|
CHAR16 NullChar;
|
||||||
EDKII_VARIABLE_LOCK_PROTOCOL *VariableLock;
|
EDKII_VARIABLE_POLICY_PROTOCOL *VariablePolicy;
|
||||||
UINT32 VariableAttributes;
|
UINT32 VariableAttributes;
|
||||||
|
|
||||||
if ((Option->OptionNumber == LoadOptionNumberUnassigned) ||
|
if ((Option->OptionNumber == LoadOptionNumberUnassigned) ||
|
||||||
(Option->FilePath == NULL) ||
|
(Option->FilePath == NULL) ||
|
||||||
@ -242,9 +244,18 @@ structure.
|
|||||||
//
|
//
|
||||||
// Lock the PlatformRecovery####
|
// Lock the PlatformRecovery####
|
||||||
//
|
//
|
||||||
Status = gBS->LocateProtocol (&gEdkiiVariableLockProtocolGuid, NULL, (VOID **)&VariableLock);
|
Status = gBS->LocateProtocol (&gEdkiiVariablePolicyProtocolGuid, NULL, (VOID **)&VariablePolicy);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = VariableLock->RequestToLock (VariableLock, OptionName, &gEfiGlobalVariableGuid);
|
Status = RegisterBasicVariablePolicy (
|
||||||
|
VariablePolicy,
|
||||||
|
&gEfiGlobalVariableGuid,
|
||||||
|
OptionName,
|
||||||
|
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);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Protocol/BootLogo.h>
|
#include <Protocol/BootLogo.h>
|
||||||
#include <Protocol/DriverHealth.h>
|
#include <Protocol/DriverHealth.h>
|
||||||
#include <Protocol/FormBrowser2.h>
|
#include <Protocol/FormBrowser2.h>
|
||||||
#include <Protocol/VariableLock.h>
|
|
||||||
#include <Protocol/RamDisk.h>
|
#include <Protocol/RamDisk.h>
|
||||||
#include <Protocol/DeferredImageLoad.h>
|
#include <Protocol/DeferredImageLoad.h>
|
||||||
#include <Protocol/PlatformBootManager.h>
|
#include <Protocol/PlatformBootManager.h>
|
||||||
|
@ -62,6 +62,7 @@
|
|||||||
PerformanceLib
|
PerformanceLib
|
||||||
HiiLib
|
HiiLib
|
||||||
SortLib
|
SortLib
|
||||||
|
VariablePolicyHelperLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
## SOMETIMES_CONSUMES ## SystemTable (The identifier of memory type information type in system table)
|
## SOMETIMES_CONSUMES ## SystemTable (The identifier of memory type information type in system table)
|
||||||
@ -99,7 +100,7 @@
|
|||||||
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiBootLogoProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiBootLogoProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiSimpleTextInputExProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEdkiiVariableLockProtocolGuid ## SOMETIMES_CONSUMES
|
gEdkiiVariablePolicyProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiGraphicsOutputProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiUsbIoProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiUsbIoProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
gEfiNvmExpressPassThruProtocolGuid ## SOMETIMES_CONSUMES
|
gEfiNvmExpressPassThruProtocolGuid ## SOMETIMES_CONSUMES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user