https://bugzilla.tianocore.org/show_bug.cgi?id=2522 Now that everything should be moved to VariablePolicy, drop support for the deprecated VarLock SMI interface and associated functions from variable RuntimeDxe. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bret Barkelew <brbarkel@microsoft.com> Signed-off-by: Bret Barkelew <brbarkel@microsoft.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Acked-by: Jian J Wang <jian.j.wang@intel.com>
		
			
				
	
	
		
			103 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			3.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/** @file
 | 
						|
  Implementation functions and structures for var check protocol
 | 
						|
  and variable lock protocol based on VarCheckLib.
 | 
						|
 | 
						|
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
 | 
						|
Copyright (c) Microsoft Corporation.
 | 
						|
SPDX-License-Identifier: BSD-2-Clause-Patent
 | 
						|
 | 
						|
**/
 | 
						|
 | 
						|
#include "Variable.h"
 | 
						|
 | 
						|
/**
 | 
						|
  Register SetVariable check handler.
 | 
						|
 | 
						|
  @param[in] Handler            Pointer to check handler.
 | 
						|
 | 
						|
  @retval EFI_SUCCESS           The SetVariable check handler was registered successfully.
 | 
						|
  @retval EFI_INVALID_PARAMETER Handler is NULL.
 | 
						|
  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
 | 
						|
                                already been signaled.
 | 
						|
  @retval EFI_OUT_OF_RESOURCES  There is not enough resource for the SetVariable check handler register request.
 | 
						|
  @retval EFI_UNSUPPORTED       This interface is not implemented.
 | 
						|
                                For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
 | 
						|
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
EFIAPI
 | 
						|
VarCheckRegisterSetVariableCheckHandler (
 | 
						|
  IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER   Handler
 | 
						|
  )
 | 
						|
{
 | 
						|
  EFI_STATUS    Status;
 | 
						|
 | 
						|
  AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
  Status = VarCheckLibRegisterSetVariableCheckHandler (Handler);
 | 
						|
  ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
 | 
						|
  return Status;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
  Variable property set.
 | 
						|
 | 
						|
  @param[in] Name               Pointer to the variable name.
 | 
						|
  @param[in] Guid               Pointer to the vendor GUID.
 | 
						|
  @param[in] VariableProperty   Pointer to the input variable property.
 | 
						|
 | 
						|
  @retval EFI_SUCCESS           The property of variable specified by the Name and Guid was set successfully.
 | 
						|
  @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
 | 
						|
                                or the fields of VariableProperty are not valid.
 | 
						|
  @retval EFI_ACCESS_DENIED     EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
 | 
						|
                                already been signaled.
 | 
						|
  @retval EFI_OUT_OF_RESOURCES  There is not enough resource for the variable property set request.
 | 
						|
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
EFIAPI
 | 
						|
VarCheckVariablePropertySet (
 | 
						|
  IN CHAR16                         *Name,
 | 
						|
  IN EFI_GUID                       *Guid,
 | 
						|
  IN VAR_CHECK_VARIABLE_PROPERTY    *VariableProperty
 | 
						|
  )
 | 
						|
{
 | 
						|
  EFI_STATUS    Status;
 | 
						|
 | 
						|
  AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
  Status = VarCheckLibVariablePropertySet (Name, Guid, VariableProperty);
 | 
						|
  ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
 | 
						|
  return Status;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
  Variable property get.
 | 
						|
 | 
						|
  @param[in]  Name              Pointer to the variable name.
 | 
						|
  @param[in]  Guid              Pointer to the vendor GUID.
 | 
						|
  @param[out] VariableProperty  Pointer to the output variable property.
 | 
						|
 | 
						|
  @retval EFI_SUCCESS           The property of variable specified by the Name and Guid was got successfully.
 | 
						|
  @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
 | 
						|
  @retval EFI_NOT_FOUND         The property of variable specified by the Name and Guid was not found.
 | 
						|
 | 
						|
**/
 | 
						|
EFI_STATUS
 | 
						|
EFIAPI
 | 
						|
VarCheckVariablePropertyGet (
 | 
						|
  IN CHAR16                         *Name,
 | 
						|
  IN EFI_GUID                       *Guid,
 | 
						|
  OUT VAR_CHECK_VARIABLE_PROPERTY   *VariableProperty
 | 
						|
  )
 | 
						|
{
 | 
						|
  EFI_STATUS    Status;
 | 
						|
 | 
						|
  AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
  Status = VarCheckLibVariablePropertyGet (Name, Guid, VariableProperty);
 | 
						|
  ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
 | 
						|
 | 
						|
  return Status;
 | 
						|
}
 | 
						|
 |