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