FmpDevicePkg: Add DISABLE_NEW_DEPRECATED_INTERFACES build options
[mirror_edk2.git] / FmpDevicePkg / FmpDxe / VariableSupport.h
CommitLineData
b0bacc00
KM
1/** @file\r
2 UEFI variable support functions for Firmware Management Protocol based\r
3 firmware updates.\r
4\r
5 Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>\r
6 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
7\r
8 Redistribution and use in source and binary forms, with or without\r
9 modification, are permitted provided that the following conditions are met:\r
10 1. Redistributions of source code must retain the above copyright notice,\r
11 this list of conditions and the following disclaimer.\r
12 2. Redistributions in binary form must reproduce the above copyright notice,\r
13 this list of conditions and the following disclaimer in the documentation\r
14 and/or other materials provided with the distribution.\r
15\r
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND\r
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\r
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
19 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\r
20 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
21 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\r
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE\r
24 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\r
25 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
26\r
27**/\r
28\r
29#ifndef __VARIABLE_SUPPORT_H__\r
30#define __VARIABLE_SUPPORT_H__\r
31\r
32#define DEFAULT_VERSION 0x1\r
33#define DEFAULT_LOWESTSUPPORTEDVERSION 0x0\r
34#define DEFAULT_LASTATTEMPT 0x0\r
35\r
36#define VARNAME_VERSION L"FmpVersion"\r
37#define VARNAME_LSV L"FmpLsv"\r
38\r
39#define VARNAME_LASTATTEMPTSTATUS L"LastAttemptStatus"\r
40#define VARNAME_LASTATTEMPTVERSION L"LastAttemptVersion"\r
41\r
42/**\r
43 Returns the value used to fill in the Version field of the\r
44 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
45 service of the Firmware Management Protocol. The value is read from a UEFI\r
46 variable. If the UEFI variables does not exist, then a default version value\r
47 is returned.\r
48\r
49 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"\r
50\r
51 @return The version of the firmware image in the firmware device.\r
52\r
53**/\r
54UINT32\r
55GetVersionFromVariable (\r
56 VOID\r
57 );\r
58\r
59/**\r
60 Returns the value used to fill in the LowestSupportedVersion field of the\r
61 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
62 service of the Firmware Management Protocol. The value is read from a UEFI\r
63 variable. If the UEFI variables does not exist, then a default lowest\r
64 supported version value is returned.\r
65\r
66 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"\r
67\r
68 @return The lowest supported version of the firmware image in the firmware\r
69 device.\r
70\r
71**/\r
72UINT32\r
73GetLowestSupportedVersionFromVariable (\r
74 VOID\r
75 );\r
76\r
77/**\r
78 Returns the value used to fill in the LastAttemptStatus field of the\r
79 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
80 service of the Firmware Management Protocol. The value is read from a UEFI\r
81 variable. If the UEFI variables does not exist, then a default last attempt\r
82 status value is returned.\r
83\r
84 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"\r
85\r
86 @return The last attempt status value for the most recent capsule update.\r
87\r
88**/\r
89UINT32\r
90GetLastAttemptStatusFromVariable (\r
91 VOID\r
92 );\r
93\r
94/**\r
95 Returns the value used to fill in the LastAttemptVersion field of the\r
96 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()\r
97 service of the Firmware Management Protocol. The value is read from a UEFI\r
98 variable. If the UEFI variables does not exist, then a default last attempt\r
99 version value is returned.\r
100\r
101 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"\r
102\r
103 @return The last attempt version value for the most recent capsule update.\r
104\r
105**/\r
106UINT32\r
107GetLastAttemptVersionFromVariable (\r
108 VOID\r
109 );\r
110\r
111/**\r
112 Saves the version current of the firmware image in the firmware device to a\r
113 UEFI variable.\r
114\r
115 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"\r
116\r
117 @param[in] Version The version of the firmware image in the firmware device.\r
118\r
119**/\r
120VOID\r
121SetVersionInVariable (\r
122 UINT32 Version\r
123 );\r
124\r
125/**\r
126 Saves the lowest supported version current of the firmware image in the\r
127 firmware device to a UEFI variable.\r
128\r
129 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"\r
130\r
131 @param[in] LowestSupported The lowest supported version of the firmware image\r
132 in the firmware device.\r
133\r
134**/\r
135VOID\r
136SetLowestSupportedVersionInVariable (\r
137 UINT32 LowestSupportedVersion\r
138 );\r
139\r
140/**\r
141 Saves the last attempt status value of the most recent FMP capsule update to a\r
142 UEFI variable.\r
143\r
144 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"\r
145\r
146 @param[in] LastAttemptStatus The last attempt status of the most recent FMP\r
147 capsule update.\r
148\r
149**/\r
150VOID\r
151SetLastAttemptStatusInVariable (\r
152 UINT32 LastAttemptStatus\r
153 );\r
154\r
155/**\r
156 Saves the last attempt version value of the most recent FMP capsule update to\r
157 a UEFI variable.\r
158\r
159 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"\r
160\r
161 @param[in] LastAttemptVersion The last attempt version value of the most\r
162 recent FMP capsule update.\r
163\r
164**/\r
165VOID\r
166SetLastAttemptVersionInVariable (\r
167 UINT32 LastAttemptVersion\r
168 );\r
169\r
170/**\r
171 Locks all the UEFI Variables that use gEfiCallerIdGuid of the currently\r
172 executing module.\r
173\r
174**/\r
175EFI_STATUS\r
176LockAllFmpVariables (\r
177 VOID\r
178 );\r
179\r
180#endif\r