]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/VarCheck.h
MdeModulePkg: Add match2 opcode support in SetupBrowserDxe and sample code in DriverS...
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / VarCheck.h
1 /** @file
2 Variable check definitions.
3
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _VARIABLE_CHECK_H_
16 #define _VARIABLE_CHECK_H_
17
18 #include <Uefi/UefiSpec.h>
19
20 typedef struct _EDKII_VAR_CHECK_PROTOCOL EDKII_VAR_CHECK_PROTOCOL;
21
22 #define EDKII_VAR_CHECK_PROTOCOL_GUID { \
23 0xaf23b340, 0x97b4, 0x4685, { 0x8d, 0x4f, 0xa3, 0xf2, 0x81, 0x69, 0xb2, 0x1d } \
24 };
25
26 typedef EFI_SET_VARIABLE VAR_CHECK_SET_VARIABLE_CHECK_HANDLER;
27
28 /**
29 Register SetVariable check handler.
30 Variable driver will call the handler to do check before
31 really setting the variable into variable storage.
32
33 @param[in] Handler Pointer to the check handler.
34
35 @retval EFI_SUCCESS The SetVariable check handler was registered successfully.
36 @retval EFI_INVALID_PARAMETER Handler is NULL.
37 @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has already been signaled.
38 @retval EFI_OUT_OF_RESOURCES There is not enough resource for the SetVariable check handler register request.
39 @retval EFI_UNSUPPORTED This interface is not implemented.
40 For example, it is unsupported in VarCheck protocol if both VarCheck and SmmVarCheck protocols are present.
41
42 **/
43 typedef
44 EFI_STATUS
45 (EFIAPI * EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER) (
46 IN VAR_CHECK_SET_VARIABLE_CHECK_HANDLER Handler
47 );
48
49 #define VAR_CHECK_VARIABLE_PROPERTY_REVISION 0x0001
50 //
51 // 1. Set by VariableLock PROTOCOL
52 // 2. Set by VarCheck PROTOCOL
53 //
54 // If set, other fields for check will be ignored.
55 //
56 #define VAR_CHECK_VARIABLE_PROPERTY_READ_ONLY BIT0
57
58 typedef struct {
59 UINT16 Revision;
60 UINT16 Property;
61 UINT32 Attributes;
62 UINTN MinSize;
63 UINTN MaxSize;
64 } VAR_CHECK_VARIABLE_PROPERTY;
65
66 /**
67 Variable property set.
68 Variable driver will do check according to the VariableProperty before
69 really setting the variable into variable storage.
70
71 @param[in] Name Pointer to the variable name.
72 @param[in] Guid Pointer to the vendor GUID.
73 @param[in] VariableProperty Pointer to the input variable property.
74
75 @retval EFI_SUCCESS The property of variable specified by the Name and Guid was set successfully.
76 @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string,
77 or the fields of VariableProperty are not valid.
78 @retval EFI_ACCESS_DENIED EFI_END_OF_DXE_EVENT_GROUP_GUID or EFI_EVENT_GROUP_READY_TO_BOOT has
79 already been signaled.
80 @retval EFI_OUT_OF_RESOURCES There is not enough resource for the variable property set request.
81
82 **/
83 typedef
84 EFI_STATUS
85 (EFIAPI * EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET) (
86 IN CHAR16 *Name,
87 IN EFI_GUID *Guid,
88 IN VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
89 );
90
91 /**
92 Variable property get.
93
94 @param[in] Name Pointer to the variable name.
95 @param[in] Guid Pointer to the vendor GUID.
96 @param[out] VariableProperty Pointer to the output variable property.
97
98 @retval EFI_SUCCESS The property of variable specified by the Name and Guid was got successfully.
99 @retval EFI_INVALID_PARAMETER Name, Guid or VariableProperty is NULL, or Name is an empty string.
100 @retval EFI_NOT_FOUND The property of variable specified by the Name and Guid was not found.
101
102 **/
103 typedef
104 EFI_STATUS
105 (EFIAPI * EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET) (
106 IN CHAR16 *Name,
107 IN EFI_GUID *Guid,
108 OUT VAR_CHECK_VARIABLE_PROPERTY *VariableProperty
109 );
110
111 struct _EDKII_VAR_CHECK_PROTOCOL {
112 EDKII_VAR_CHECK_REGISTER_SET_VARIABLE_CHECK_HANDLER RegisterSetVariableCheckHandler;
113 EDKII_VAR_CHECK_VARIABLE_PROPERTY_SET VariablePropertySet;
114 EDKII_VAR_CHECK_VARIABLE_PROPERTY_GET VariablePropertyGet;
115 };
116
117 extern EFI_GUID gEdkiiVarCheckProtocolGuid;
118
119 #endif
120