and variable lock protocol based on VarCheckLib.\r
\r
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) Microsoft Corporation.\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include "Variable.h"\r
\r
-/**\r
- Mark a variable that will become read-only after leaving the DXE phase of execution.\r
- Write request coming from SMM environment through EFI_SMM_VARIABLE_PROTOCOL is allowed.\r
-\r
- @param[in] This The VARIABLE_LOCK_PROTOCOL instance.\r
- @param[in] VariableName A pointer to the variable name that will be made read-only subsequently.\r
- @param[in] VendorGuid A pointer to the vendor GUID that will be made read-only subsequently.\r
-\r
- @retval EFI_SUCCESS The variable specified by the VariableName and the VendorGuid was marked\r
- as pending to be read-only.\r
- @retval EFI_INVALID_PARAMETER VariableName or VendorGuid is NULL.\r
- Or VariableName is an empty string.\r
- @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
- already been signaled.\r
- @retval EFI_OUT_OF_RESOURCES There is not enough resource to hold the lock request.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-VariableLockRequestToLock (\r
- IN CONST EDKII_VARIABLE_LOCK_PROTOCOL *This,\r
- IN CHAR16 *VariableName,\r
- IN EFI_GUID *VendorGuid\r
- )\r
-{\r
- EFI_STATUS Status;\r
- VAR_CHECK_VARIABLE_PROPERTY Property;\r
-\r
- AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
-\r
- Status = VarCheckLibVariablePropertyGet (VariableName, VendorGuid, &Property);\r
- if (!EFI_ERROR (Status)) {\r
- Property.Property |= VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY;\r
- } else {\r
- Property.Revision = VAR_CHECK_VARIABLE_PROPERTY_REVISION;\r
- Property.Property = VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY;\r
- Property.Attributes = 0;\r
- Property.MinSize = 1;\r
- Property.MaxSize = MAX_UINTN;\r
- }\r
- Status = VarCheckLibVariablePropertySet (VariableName, VendorGuid, &Property);\r
-\r
- DEBUG ((EFI_D_INFO, "[Variable] Lock: %g:%s %r\n", VendorGuid, VariableName, Status));\r
-\r
- ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
-\r
- return Status;\r
-}\r
-\r
/**\r
Register SetVariable check handler.\r
\r