]> git.proxmox.com Git - mirror_edk2.git/blob - FmpDevicePkg/FmpDxe/VariableSupport.h
FmpDevicePkg: Replace BSD License with BSD+Patent License
[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 SPDX-License-Identifier: BSD-2-Clause-Patent
9
10 **/
11
12 #ifndef __VARIABLE_SUPPORT_H__
13 #define __VARIABLE_SUPPORT_H__
14
15 #define DEFAULT_VERSION 0x1
16 #define DEFAULT_LOWESTSUPPORTEDVERSION 0x0
17 #define DEFAULT_LASTATTEMPT 0x0
18
19 #define VARNAME_VERSION L"FmpVersion"
20 #define VARNAME_LSV L"FmpLsv"
21
22 #define VARNAME_LASTATTEMPTSTATUS L"LastAttemptStatus"
23 #define VARNAME_LASTATTEMPTVERSION L"LastAttemptVersion"
24
25 /**
26 Returns the value used to fill in the Version field of the
27 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()
28 service of the Firmware Management Protocol. The value is read from a UEFI
29 variable. If the UEFI variables does not exist, then a default version value
30 is returned.
31
32 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"
33
34 @return The version of the firmware image in the firmware device.
35
36 **/
37 UINT32
38 GetVersionFromVariable (
39 VOID
40 );
41
42 /**
43 Returns the value used to fill in the LowestSupportedVersion 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 lowest
47 supported version value is returned.
48
49 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
50
51 @return The lowest supported version of the firmware image in the firmware
52 device.
53
54 **/
55 UINT32
56 GetLowestSupportedVersionFromVariable (
57 VOID
58 );
59
60 /**
61 Returns the value used to fill in the LastAttemptStatus field of the
62 EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo()
63 service of the Firmware Management Protocol. The value is read from a UEFI
64 variable. If the UEFI variables does not exist, then a default last attempt
65 status value is returned.
66
67 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"
68
69 @return The last attempt status value for the most recent capsule update.
70
71 **/
72 UINT32
73 GetLastAttemptStatusFromVariable (
74 VOID
75 );
76
77 /**
78 Returns the value used to fill in the LastAttemptVersion 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 version value is returned.
83
84 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"
85
86 @return The last attempt version value for the most recent capsule update.
87
88 **/
89 UINT32
90 GetLastAttemptVersionFromVariable (
91 VOID
92 );
93
94 /**
95 Saves the version current of the firmware image in the firmware device to a
96 UEFI variable.
97
98 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpVersion"
99
100 @param[in] Version The version of the firmware image in the firmware device.
101
102 **/
103 VOID
104 SetVersionInVariable (
105 UINT32 Version
106 );
107
108 /**
109 Saves the lowest supported version current of the firmware image in the
110 firmware device to a UEFI variable.
111
112 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"FmpLsv"
113
114 @param[in] LowestSupportedVersion The lowest supported version of the firmware image
115 in the firmware device.
116
117 **/
118 VOID
119 SetLowestSupportedVersionInVariable (
120 UINT32 LowestSupportedVersion
121 );
122
123 /**
124 Saves the last attempt status value of the most recent FMP capsule update to a
125 UEFI variable.
126
127 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptStatus"
128
129 @param[in] LastAttemptStatus The last attempt status of the most recent FMP
130 capsule update.
131
132 **/
133 VOID
134 SetLastAttemptStatusInVariable (
135 UINT32 LastAttemptStatus
136 );
137
138 /**
139 Saves the last attempt version value of the most recent FMP capsule update to
140 a UEFI variable.
141
142 UEFI Variable accessed: GUID = gEfiCallerIdGuid, Name = L"LastAttemptVersion"
143
144 @param[in] LastAttemptVersion The last attempt version value of the most
145 recent FMP capsule update.
146
147 **/
148 VOID
149 SetLastAttemptVersionInVariable (
150 UINT32 LastAttemptVersion
151 );
152
153 /**
154 Locks all the UEFI Variables that use gEfiCallerIdGuid of the currently
155 executing module.
156
157 **/
158 EFI_STATUS
159 LockAllFmpVariables (
160 VOID
161 );
162
163 #endif