]>
Commit | Line | Data |
---|---|---|
88266859 JY |
1 | /** @file\r |
2 | Microcode update header file.\r | |
3 | \r | |
1779cf40 | 4 | Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r |
88266859 JY |
5 | This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _MICROCODE_FMP_H_\r | |
16 | #define _MICROCODE_FMP_H_\r | |
17 | \r | |
18 | #include <PiDxe.h>\r | |
19 | \r | |
20 | #include <Guid/SystemResourceTable.h>\r | |
21 | #include <Guid/MicrocodeFmp.h>\r | |
22 | \r | |
23 | #include <Protocol/FirmwareManagement.h>\r | |
31d060d9 | 24 | #include <Protocol/MpService.h>\r |
88266859 JY |
25 | \r |
26 | #include <Library/BaseLib.h>\r | |
27 | #include <Library/BaseMemoryLib.h>\r | |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/MemoryAllocationLib.h>\r | |
30 | #include <Library/PcdLib.h>\r | |
31 | #include <Library/UefiBootServicesTableLib.h>\r | |
32 | #include <Library/UefiLib.h>\r | |
33 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
34 | #include <Library/UefiDriverEntryPoint.h>\r | |
35 | #include <Library/DevicePathLib.h>\r | |
36 | #include <Library/HobLib.h>\r | |
37 | #include <Library/MicrocodeFlashAccessLib.h>\r | |
38 | \r | |
39 | #include <Register/Cpuid.h>\r | |
40 | #include <Register/Msr.h>\r | |
41 | #include <Register/Microcode.h>\r | |
42 | \r | |
43 | #define MICROCODE_FMP_PRIVATE_DATA_SIGNATURE SIGNATURE_32('M', 'C', 'U', 'F')\r | |
44 | \r | |
45 | //\r | |
46 | // Microcode FMP private data structure.\r | |
47 | //\r | |
48 | \r | |
49 | typedef struct {\r | |
50 | UINT32 LastAttemptVersion;\r | |
51 | UINT32 LastAttemptStatus;\r | |
52 | } MICROCODE_FMP_LAST_ATTEMPT_VARIABLE;\r | |
53 | \r | |
2ed65824 JY |
54 | typedef struct {\r |
55 | CPU_MICROCODE_HEADER *MicrocodeEntryPoint;\r | |
56 | UINTN TotalSize;\r | |
57 | BOOLEAN InUse;\r | |
58 | } MICROCODE_INFO;\r | |
59 | \r | |
31d060d9 JY |
60 | typedef struct {\r |
61 | UINTN CpuIndex;\r | |
62 | UINT32 ProcessorSignature;\r | |
63 | UINT8 PlatformId;\r | |
64 | UINT32 MicrocodeRevision;\r | |
65 | UINTN MicrocodeIndex;\r | |
66 | } PROCESSOR_INFO;\r | |
67 | \r | |
68 | typedef struct {\r | |
69 | UINT64 Address;\r | |
70 | UINT32 Revision;\r | |
71 | } MICROCODE_LOAD_BUFFER;\r | |
72 | \r | |
88266859 JY |
73 | struct _MICROCODE_FMP_PRIVATE_DATA {\r |
74 | UINT32 Signature;\r | |
75 | EFI_FIRMWARE_MANAGEMENT_PROTOCOL Fmp;\r | |
76 | EFI_HANDLE Handle;\r | |
2ed65824 JY |
77 | VOID *MicrocodePatchAddress;\r |
78 | UINTN MicrocodePatchRegionSize;\r | |
88266859 JY |
79 | UINT8 DescriptorCount;\r |
80 | EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageDescriptor;\r | |
2ed65824 | 81 | MICROCODE_INFO *MicrocodeInfo;\r |
88266859 JY |
82 | UINT32 PackageVersion;\r |
83 | CHAR16 *PackageVersionName;\r | |
84 | MICROCODE_FMP_LAST_ATTEMPT_VARIABLE LastAttempt;\r | |
31d060d9 JY |
85 | EFI_MP_SERVICES_PROTOCOL *MpService;\r |
86 | UINTN BspIndex;\r | |
87 | UINTN ProcessorCount;\r | |
88 | PROCESSOR_INFO *ProcessorInfo;\r | |
88266859 JY |
89 | };\r |
90 | \r | |
91 | typedef struct _MICROCODE_FMP_PRIVATE_DATA MICROCODE_FMP_PRIVATE_DATA;\r | |
92 | \r | |
93 | #define MICROCODE_FMP_LAST_ATTEMPT_VARIABLE_NAME L"MicrocodeLastAttempVar"\r | |
94 | \r | |
95 | /**\r | |
96 | Returns a pointer to the MICROCODE_FMP_PRIVATE_DATA structure from the input a as Fmp.\r | |
97 | \r | |
98 | If the signatures matches, then a pointer to the data structure that contains\r | |
99 | a specified field of that data structure is returned.\r | |
100 | \r | |
101 | @param a Pointer to the field specified by ServiceBinding within\r | |
102 | a data structure of type MICROCODE_FMP_PRIVATE_DATA.\r | |
103 | \r | |
104 | **/\r | |
105 | #define MICROCODE_FMP_PRIVATE_DATA_FROM_FMP(a) \\r | |
106 | CR ( \\r | |
107 | (a), \\r | |
108 | MICROCODE_FMP_PRIVATE_DATA, \\r | |
109 | Fmp, \\r | |
110 | MICROCODE_FMP_PRIVATE_DATA_SIGNATURE \\r | |
111 | )\r | |
112 | \r | |
113 | /**\r | |
2ed65824 | 114 | Get Microcode Region.\r |
88266859 | 115 | \r |
2ed65824 JY |
116 | @param[out] MicrocodePatchAddress The address of Microcode\r |
117 | @param[out] MicrocodePatchRegionSize The region size of Microcode\r | |
88266859 | 118 | \r |
2ed65824 JY |
119 | @retval TRUE The Microcode region is returned.\r |
120 | @retval FALSE No Microcode region.\r | |
88266859 | 121 | **/\r |
2ed65824 JY |
122 | BOOLEAN\r |
123 | GetMicrocodeRegion (\r | |
124 | OUT VOID **MicrocodePatchAddress,\r | |
125 | OUT UINTN *MicrocodePatchRegionSize\r | |
88266859 JY |
126 | );\r |
127 | \r | |
31d060d9 JY |
128 | /**\r |
129 | Collect processor information.\r | |
130 | The function prototype for invoking a function on an Application Processor.\r | |
131 | \r | |
132 | @param[in,out] Buffer The pointer to private data buffer.\r | |
133 | **/\r | |
134 | VOID\r | |
135 | EFIAPI\r | |
136 | CollectProcessorInfo (\r | |
137 | IN OUT VOID *Buffer\r | |
138 | );\r | |
139 | \r | |
88266859 | 140 | /**\r |
2ed65824 JY |
141 | Get current Microcode information.\r |
142 | \r | |
31d060d9 JY |
143 | The ProcessorInformation (BspIndex/ProcessorCount/ProcessorInfo)\r |
144 | in MicrocodeFmpPrivate must be initialized.\r | |
145 | \r | |
146 | The MicrocodeInformation (DescriptorCount/ImageDescriptor/MicrocodeInfo)\r | |
147 | in MicrocodeFmpPrivate may not be avaiable in this function.\r | |
88266859 | 148 | \r |
2ed65824 JY |
149 | @param[in] MicrocodeFmpPrivate The Microcode driver private data\r |
150 | @param[in] DescriptorCount The count of Microcode ImageDescriptor allocated.\r | |
151 | @param[out] ImageDescriptor Microcode ImageDescriptor\r | |
152 | @param[out] MicrocodeInfo Microcode information\r | |
88266859 | 153 | \r |
2ed65824 | 154 | @return Microcode count\r |
88266859 | 155 | **/\r |
2ed65824 JY |
156 | UINTN\r |
157 | GetMicrocodeInfo (\r | |
158 | IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate,\r | |
159 | IN UINTN DescriptorCount, OPTIONAL\r | |
160 | OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageDescriptor, OPTIONAL\r | |
161 | OUT MICROCODE_INFO *MicrocodeInfo OPTIONAL\r | |
88266859 JY |
162 | );\r |
163 | \r | |
31d060d9 JY |
164 | /**\r |
165 | Verify Microcode.\r | |
166 | \r | |
167 | Caution: This function may receive untrusted input.\r | |
168 | \r | |
169 | @param[in] MicrocodeFmpPrivate The Microcode driver private data\r | |
170 | @param[in] Image The Microcode image buffer.\r | |
171 | @param[in] ImageSize The size of Microcode image buffer in bytes.\r | |
172 | @param[in] TryLoad Try to load Microcode or not.\r | |
173 | @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
174 | @param[out] AbortReason A pointer to a pointer to a null-terminated string providing more\r | |
175 | details for the aborted operation. The buffer is allocated by this function\r | |
176 | with AllocatePool(), and it is the caller's responsibility to free it with a\r | |
177 | call to FreePool().\r | |
178 | @param[in, out] TargetCpuIndex On input, the index of target CPU which tries to match the Microcode. (UINTN)-1 means to try all.\r | |
179 | On output, the index of target CPU which matches the Microcode.\r | |
180 | \r | |
181 | @retval EFI_SUCCESS The Microcode image passes verification.\r | |
182 | @retval EFI_VOLUME_CORRUPTED The Microcode image is corrupt.\r | |
183 | @retval EFI_INCOMPATIBLE_VERSION The Microcode image version is incorrect.\r | |
184 | @retval EFI_UNSUPPORTED The Microcode ProcessorSignature or ProcessorFlags is incorrect.\r | |
185 | @retval EFI_SECURITY_VIOLATION The Microcode image fails to load.\r | |
186 | **/\r | |
187 | EFI_STATUS\r | |
188 | VerifyMicrocode (\r | |
189 | IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate,\r | |
190 | IN VOID *Image,\r | |
191 | IN UINTN ImageSize,\r | |
192 | IN BOOLEAN TryLoad,\r | |
193 | OUT UINT32 *LastAttemptStatus,\r | |
194 | OUT CHAR16 **AbortReason, OPTIONAL\r | |
195 | IN OUT UINTN *TargetCpuIndex OPTIONAL\r | |
196 | );\r | |
197 | \r | |
88266859 JY |
198 | /**\r |
199 | Write Microcode.\r | |
200 | \r | |
2ed65824 JY |
201 | @param[in] MicrocodeFmpPrivate The Microcode driver private data\r |
202 | @param[in] Image The Microcode image buffer.\r | |
203 | @param[in] ImageSize The size of Microcode image buffer in bytes.\r | |
204 | @param[out] LastAttemptVersion The last attempt version, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
205 | @param[out] LastAttemptStatus The last attempt status, which will be recorded in ESRT and FMP EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
206 | @param[out] AbortReason A pointer to a pointer to a null-terminated string providing more\r | |
207 | details for the aborted operation. The buffer is allocated by this function\r | |
208 | with AllocatePool(), and it is the caller's responsibility to free it with a\r | |
209 | call to FreePool().\r | |
88266859 JY |
210 | \r |
211 | @retval EFI_SUCCESS The Microcode image is written.\r | |
212 | @retval EFI_VOLUME_CORRUPTED The Microcode image is corrupt.\r | |
213 | @retval EFI_INCOMPATIBLE_VERSION The Microcode image version is incorrect.\r | |
214 | @retval EFI_SECURITY_VIOLATION The Microcode image fails to load.\r | |
2ed65824 | 215 | @retval EFI_WRITE_PROTECTED The flash device is read only.\r |
88266859 JY |
216 | **/\r |
217 | EFI_STATUS\r | |
218 | MicrocodeWrite (\r | |
2ed65824 JY |
219 | IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate,\r |
220 | IN VOID *Image,\r | |
221 | IN UINTN ImageSize,\r | |
222 | OUT UINT32 *LastAttemptVersion,\r | |
223 | OUT UINT32 *LastAttemptStatus,\r | |
224 | OUT CHAR16 **AbortReason\r | |
88266859 JY |
225 | );\r |
226 | \r | |
31d060d9 JY |
227 | /**\r |
228 | Dump private information.\r | |
229 | \r | |
230 | @param[in] MicrocodeFmpPrivate private data structure.\r | |
231 | **/\r | |
232 | VOID\r | |
233 | DumpPrivateInfo (\r | |
234 | IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate\r | |
235 | );\r | |
236 | \r | |
88266859 JY |
237 | /**\r |
238 | Returns information about the current firmware image(s) of the device.\r | |
239 | \r | |
240 | This function allows a copy of the current firmware image to be created and saved.\r | |
241 | The saved copy could later been used, for example, in firmware image recovery or rollback.\r | |
242 | \r | |
243 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
244 | @param[in, out] ImageInfoSize A pointer to the size, in bytes, of the ImageInfo buffer.\r | |
245 | On input, this is the size of the buffer allocated by the caller.\r | |
246 | On output, it is the size of the buffer returned by the firmware\r | |
247 | if the buffer was large enough, or the size of the buffer needed\r | |
248 | to contain the image(s) information if the buffer was too small.\r | |
249 | @param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)\r | |
250 | information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.\r | |
251 | @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number\r | |
252 | associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
253 | @param[out] DescriptorCount A pointer to the location in which firmware returns the number of\r | |
254 | descriptors or firmware images within this device.\r | |
255 | @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes,\r | |
256 | of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR.\r | |
257 | @param[out] PackageVersion A version number that represents all the firmware images in the device.\r | |
258 | The format is vendor specific and new version must have a greater value\r | |
259 | than the old version. If PackageVersion is not supported, the value is\r | |
260 | 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version comparison\r | |
261 | is to be performed using PackageVersionName. A value of 0xFFFFFFFD indicates\r | |
262 | that package version update is in progress.\r | |
263 | @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing the\r | |
264 | package version name. The buffer is allocated by this function with\r | |
265 | AllocatePool(), and it is the caller's responsibility to free it with a call\r | |
266 | to FreePool().\r | |
267 | \r | |
268 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
269 | @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size\r | |
270 | needed to hold the image(s) information is returned in ImageInfoSize.\r | |
271 | @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.\r | |
272 | @retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.\r | |
273 | \r | |
274 | **/\r | |
275 | EFI_STATUS\r | |
276 | EFIAPI\r | |
277 | FmpGetImageInfo (\r | |
278 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
279 | IN OUT UINTN *ImageInfoSize,\r | |
280 | IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,\r | |
281 | OUT UINT32 *DescriptorVersion,\r | |
282 | OUT UINT8 *DescriptorCount,\r | |
283 | OUT UINTN *DescriptorSize,\r | |
284 | OUT UINT32 *PackageVersion,\r | |
285 | OUT CHAR16 **PackageVersionName\r | |
286 | );\r | |
287 | \r | |
288 | /**\r | |
289 | Retrieves a copy of the current firmware image of the device.\r | |
290 | \r | |
291 | This function allows a copy of the current firmware image to be created and saved.\r | |
292 | The saved copy could later been used, for example, in firmware image recovery or rollback.\r | |
293 | \r | |
294 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
295 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
296 | The number is between 1 and DescriptorCount.\r | |
297 | @param[in,out] Image Points to the buffer where the current image is copied to.\r | |
298 | @param[in,out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.\r | |
299 | On return, points to the length of the image, in bytes.\r | |
300 | \r | |
301 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
302 | @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the\r | |
303 | image. The current buffer size needed to hold the image is returned\r | |
304 | in ImageSize.\r | |
305 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
306 | @retval EFI_NOT_FOUND The current image is not copied to the buffer.\r | |
307 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
1779cf40 | 308 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
88266859 JY |
309 | \r |
310 | **/\r | |
311 | EFI_STATUS\r | |
312 | EFIAPI\r | |
313 | FmpGetImage (\r | |
314 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
315 | IN UINT8 ImageIndex,\r | |
316 | IN OUT VOID *Image,\r | |
317 | IN OUT UINTN *ImageSize\r | |
318 | );\r | |
319 | \r | |
320 | /**\r | |
321 | Updates the firmware image of the device.\r | |
322 | \r | |
323 | This function updates the hardware with the new firmware image.\r | |
324 | This function returns EFI_UNSUPPORTED if the firmware image is not updatable.\r | |
325 | If the firmware image is updatable, the function should perform the following minimal validations\r | |
326 | before proceeding to do the firmware image update.\r | |
327 | - Validate the image authentication if image has attribute\r | |
328 | IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED. The function returns\r | |
329 | EFI_SECURITY_VIOLATION if the validation fails.\r | |
330 | - Validate the image is a supported image for this device. The function returns EFI_ABORTED if\r | |
331 | the image is unsupported. The function can optionally provide more detailed information on\r | |
332 | why the image is not a supported image.\r | |
333 | - Validate the data from VendorCode if not null. Image validation must be performed before\r | |
334 | VendorCode data validation. VendorCode data is ignored or considered invalid if image\r | |
335 | validation failed. The function returns EFI_ABORTED if the data is invalid.\r | |
336 | \r | |
337 | VendorCode enables vendor to implement vendor-specific firmware image update policy. Null if\r | |
338 | the caller did not specify the policy or use the default policy. As an example, vendor can implement\r | |
339 | a policy to allow an option to force a firmware image update when the abort reason is due to the new\r | |
340 | firmware image version is older than the current firmware image version or bad image checksum.\r | |
341 | Sensitive operations such as those wiping the entire firmware image and render the device to be\r | |
342 | non-functional should be encoded in the image itself rather than passed with the VendorCode.\r | |
343 | AbortReason enables vendor to have the option to provide a more detailed description of the abort\r | |
344 | reason to the caller.\r | |
345 | \r | |
346 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
347 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
348 | The number is between 1 and DescriptorCount.\r | |
349 | @param[in] Image Points to the new image.\r | |
350 | @param[in] ImageSize Size of the new image in bytes.\r | |
351 | @param[in] VendorCode This enables vendor to implement vendor-specific firmware image update policy.\r | |
352 | Null indicates the caller did not specify the policy or use the default policy.\r | |
353 | @param[in] Progress A function used by the driver to report the progress of the firmware update.\r | |
354 | @param[out] AbortReason A pointer to a pointer to a null-terminated string providing more\r | |
355 | details for the aborted operation. The buffer is allocated by this function\r | |
356 | with AllocatePool(), and it is the caller's responsibility to free it with a\r | |
357 | call to FreePool().\r | |
358 | \r | |
359 | @retval EFI_SUCCESS The device was successfully updated with the new image.\r | |
360 | @retval EFI_ABORTED The operation is aborted.\r | |
361 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
362 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
1779cf40 | 363 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
88266859 JY |
364 | \r |
365 | **/\r | |
366 | EFI_STATUS\r | |
367 | EFIAPI\r | |
368 | FmpSetImage (\r | |
369 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
370 | IN UINT8 ImageIndex,\r | |
371 | IN CONST VOID *Image,\r | |
372 | IN UINTN ImageSize,\r | |
373 | IN CONST VOID *VendorCode,\r | |
374 | IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress,\r | |
375 | OUT CHAR16 **AbortReason\r | |
376 | );\r | |
377 | \r | |
378 | /**\r | |
379 | Checks if the firmware image is valid for the device.\r | |
380 | \r | |
381 | This function allows firmware update application to validate the firmware image without\r | |
382 | invoking the SetImage() first.\r | |
383 | \r | |
384 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
385 | @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.\r | |
386 | The number is between 1 and DescriptorCount.\r | |
387 | @param[in] Image Points to the new image.\r | |
388 | @param[in] ImageSize Size of the new image in bytes.\r | |
389 | @param[out] ImageUpdatable Indicates if the new image is valid for update. It also provides,\r | |
390 | if available, additional information if the image is invalid.\r | |
391 | \r | |
392 | @retval EFI_SUCCESS The image was successfully checked.\r | |
393 | @retval EFI_INVALID_PARAMETER The Image was NULL.\r | |
394 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
1779cf40 | 395 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
88266859 JY |
396 | \r |
397 | **/\r | |
398 | EFI_STATUS\r | |
399 | EFIAPI\r | |
400 | FmpCheckImage (\r | |
401 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
402 | IN UINT8 ImageIndex,\r | |
403 | IN CONST VOID *Image,\r | |
404 | IN UINTN ImageSize,\r | |
405 | OUT UINT32 *ImageUpdatable\r | |
406 | );\r | |
407 | \r | |
408 | /**\r | |
409 | Returns information about the firmware package.\r | |
410 | \r | |
411 | This function returns package information.\r | |
412 | \r | |
413 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
414 | @param[out] PackageVersion A version number that represents all the firmware images in the device.\r | |
415 | The format is vendor specific and new version must have a greater value\r | |
416 | than the old version. If PackageVersion is not supported, the value is\r | |
417 | 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version\r | |
418 | comparison is to be performed using PackageVersionName. A value of\r | |
419 | 0xFFFFFFFD indicates that package version update is in progress.\r | |
420 | @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing\r | |
421 | the package version name. The buffer is allocated by this function with\r | |
422 | AllocatePool(), and it is the caller's responsibility to free it with a\r | |
423 | call to FreePool().\r | |
424 | @param[out] PackageVersionNameMaxLen The maximum length of package version name if device supports update of\r | |
425 | package version name. A value of 0 indicates the device does not support\r | |
426 | update of package version name. Length is the number of Unicode characters,\r | |
427 | including the terminating null character.\r | |
428 | @param[out] AttributesSupported Package attributes that are supported by this device. See 'Package Attribute\r | |
429 | Definitions' for possible returned values of this parameter. A value of 1\r | |
430 | indicates the attribute is supported and the current setting value is\r | |
431 | indicated in AttributesSetting. A value of 0 indicates the attribute is not\r | |
432 | supported and the current setting value in AttributesSetting is meaningless.\r | |
433 | @param[out] AttributesSetting Package attributes. See 'Package Attribute Definitions' for possible returned\r | |
434 | values of this parameter\r | |
435 | \r | |
436 | @retval EFI_SUCCESS The package information was successfully returned.\r | |
437 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
438 | \r | |
439 | **/\r | |
440 | EFI_STATUS\r | |
441 | EFIAPI\r | |
442 | FmpGetPackageInfo (\r | |
443 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
444 | OUT UINT32 *PackageVersion,\r | |
445 | OUT CHAR16 **PackageVersionName,\r | |
446 | OUT UINT32 *PackageVersionNameMaxLen,\r | |
447 | OUT UINT64 *AttributesSupported,\r | |
448 | OUT UINT64 *AttributesSetting\r | |
449 | );\r | |
450 | \r | |
451 | /**\r | |
452 | Updates information about the firmware package.\r | |
453 | \r | |
454 | This function updates package information.\r | |
455 | This function returns EFI_UNSUPPORTED if the package information is not updatable.\r | |
456 | VendorCode enables vendor to implement vendor-specific package information update policy.\r | |
457 | Null if the caller did not specify this policy or use the default policy.\r | |
458 | \r | |
459 | @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.\r | |
460 | @param[in] Image Points to the authentication image.\r | |
461 | Null if authentication is not required.\r | |
462 | @param[in] ImageSize Size of the authentication image in bytes.\r | |
463 | 0 if authentication is not required.\r | |
464 | @param[in] VendorCode This enables vendor to implement vendor-specific firmware\r | |
465 | image update policy.\r | |
466 | Null indicates the caller did not specify this policy or use\r | |
467 | the default policy.\r | |
468 | @param[in] PackageVersion The new package version.\r | |
469 | @param[in] PackageVersionName A pointer to the new null-terminated Unicode string representing\r | |
470 | the package version name.\r | |
471 | The string length is equal to or less than the value returned in\r | |
472 | PackageVersionNameMaxLen.\r | |
473 | \r | |
474 | @retval EFI_SUCCESS The device was successfully updated with the new package\r | |
475 | information.\r | |
476 | @retval EFI_INVALID_PARAMETER The PackageVersionName length is longer than the value\r | |
477 | returned in PackageVersionNameMaxLen.\r | |
478 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
1779cf40 | 479 | @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.\r |
88266859 JY |
480 | \r |
481 | **/\r | |
482 | EFI_STATUS\r | |
483 | EFIAPI\r | |
484 | FmpSetPackageInfo (\r | |
485 | IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,\r | |
486 | IN CONST VOID *Image,\r | |
487 | IN UINTN ImageSize,\r | |
488 | IN CONST VOID *VendorCode,\r | |
489 | IN UINT32 PackageVersion,\r | |
490 | IN CONST CHAR16 *PackageVersionName\r | |
491 | );\r | |
492 | \r | |
493 | #endif\r | |
494 | \r |