2 UEFI variable support functions for Firmware Management Protocol based
5 Copyright (c) 2016, Microsoft Corporation. All rights reserved.<BR>
6 Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
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.
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.
29 #ifndef __VARIABLE_SUPPORT_H__
30 #define __VARIABLE_SUPPORT_H__
32 #define DEFAULT_VERSION 0x1
33 #define DEFAULT_LOWESTSUPPORTEDVERSION 0x0
34 #define DEFAULT_LASTATTEMPT 0x0
36 #define VARNAME_VERSION L"FmpVersion"
37 #define VARNAME_LSV L"FmpLsv"
39 #define VARNAME_LASTATTEMPTSTATUS L"LastAttemptStatus"
40 #define VARNAME_LASTATTEMPTVERSION L"LastAttemptVersion"
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
49 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"
51 @return The version of the firmware image in the firmware device.
55 GetVersionFromVariable (
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.
66 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
68 @return The lowest supported version of the firmware image in the firmware
73 GetLowestSupportedVersionFromVariable (
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.
84 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"
86 @return The last attempt status value for the most recent capsule update.
90 GetLastAttemptStatusFromVariable (
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.
101 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"
103 @return The last attempt version value for the most recent capsule update.
107 GetLastAttemptVersionFromVariable (
112 Saves the version current of the firmware image in the firmware device to a
115 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"
117 @param[in] Version The version of the firmware image in the firmware device.
121 SetVersionInVariable (
126 Saves the lowest supported version current of the firmware image in the
127 firmware device to a UEFI variable.
129 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
131 @param[in] LowestSupportedVersion The lowest supported version of the firmware image
132 in the firmware device.
136 SetLowestSupportedVersionInVariable (
137 UINT32 LowestSupportedVersion
141 Saves the last attempt status value of the most recent FMP capsule update to a
144 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"
146 @param[in] LastAttemptStatus The last attempt status of the most recent FMP
151 SetLastAttemptStatusInVariable (
152 UINT32 LastAttemptStatus
156 Saves the last attempt version value of the most recent FMP capsule update to
159 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"
161 @param[in] LastAttemptVersion The last attempt version value of the most
162 recent FMP capsule update.
166 SetLastAttemptVersionInVariable (
167 UINT32 LastAttemptVersion
171 Locks all the UEFI Variables that use gEfiCallerIdGuid of the currently
176 LockAllFmpVariables (