]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Variable/RuntimeDxe/VarCheck.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / Variable / RuntimeDxe / VarCheck.c
CommitLineData
efb01a10 1/** @file\r
8021f4c7
SZ
2 Implementation functions and structures for var check protocol\r
3 and variable lock protocol based on VarCheckLib.\r
efb01a10
SZ
4\r
5Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
124b3f92 6Copyright (c) Microsoft Corporation.\r
9d510e61 7SPDX-License-Identifier: BSD-2-Clause-Patent\r
efb01a10
SZ
8\r
9**/\r
10\r
11#include "Variable.h"\r
efb01a10 12\r
efb01a10
SZ
13/**\r
14 Register SetVariable check handler.\r
15\r
16 @param[in] Handler Pointer to check handler.\r
17\r
18 @retval EFI_SUCCESS The SetVariable check handler was registered successfully.\r
19 @retval EFI_INVALID_PARAMETER Handler is NULL.\r
20 @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
21 already been signaled.\r
22 @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.\r
23 @retval EFI_UNSUPPORTED This interface is not implemented.\r
24 For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.\r
25\r
26**/\r
27EFI_STATUS\r
28EFIAPI\r
29VarCheckRegisterSetVariableCheckHandler (\r
1436aea4 30 IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler\r
efb01a10
SZ
31 )\r
32{\r
1436aea4 33 EFI_STATUS Status;\r
efb01a10 34\r
fa0737a8 35 AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
8021f4c7 36 Status = VarCheckLibRegisterSetVariableCheckHandler (Handler);\r
fa0737a8
SZ
37 ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
38\r
39 return Status;\r
efb01a10
SZ
40}\r
41\r
efb01a10
SZ
42/**\r
43 Variable property set.\r
44\r
45 @param[in] Name Pointer to the variable name.\r
46 @param[in] Guid Pointer to the vendor GUID.\r
47 @param[in] VariableProperty Pointer to the input variable property.\r
48\r
49 @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.\r
50 @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,\r
51 or the fields of VariableProperty are not valid.\r
52 @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has\r
53 already been signaled.\r
54 @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.\r
55\r
56**/\r
57EFI_STATUS\r
58EFIAPI\r
59VarCheckVariablePropertySet (\r
1436aea4
MK
60 IN CHAR16 *Name,\r
61 IN EFI_GUID *Guid,\r
62 IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty\r
efb01a10
SZ
63 )\r
64{\r
1436aea4 65 EFI_STATUS Status;\r
efb01a10 66\r
efb01a10 67 AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
8021f4c7 68 Status = VarCheckLibVariablePropertySet (Name, Guid, VariableProperty);\r
efb01a10
SZ
69 ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
70\r
71 return Status;\r
72}\r
73\r
4edb1866
SZ
74/**\r
75 Variable property get.\r
76\r
77 @param[in] Name Pointer to the variable name.\r
78 @param[in] Guid Pointer to the vendor GUID.\r
79 @param[out] VariableProperty Pointer to the output variable property.\r
80\r
81 @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.\r
82 @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.\r
83 @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.\r
84\r
85**/\r
86EFI_STATUS\r
87EFIAPI\r
88VarCheckVariablePropertyGet (\r
1436aea4
MK
89 IN CHAR16 *Name,\r
90 IN EFI_GUID *Guid,\r
91 OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty\r
4edb1866
SZ
92 )\r
93{\r
1436aea4 94 EFI_STATUS Status;\r
4edb1866 95\r
4edb1866 96 AcquireLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
8021f4c7 97 Status = VarCheckLibVariablePropertyGet (Name, Guid, VariableProperty);\r
efb01a10
SZ
98 ReleaseLockOnlyAtBootTime (&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);\r
99\r
4edb1866 100 return Status;\r
efb01a10 101}\r