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