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