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