]> git.proxmox.com Git - mirror_edk2.git/blob - IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeFmp.c
bc1387b3dddda94d702587cb7d2ee67566dd5ed1
[mirror_edk2.git] / IntelSiliconPkg / Feature / Capsule / MicrocodeUpdateDxe / MicrocodeFmp.c
1 /** @file
2 Produce FMP instance for Microcode.
3
4 Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #include "MicrocodeUpdate.h"
16
17 //
18 // MicrocodeFmp driver private data
19 //
20 MICROCODE_FMP_PRIVATE_DATA *mMicrocodeFmpPrivate = NULL;
21
22 EFI_FIRMWARE_MANAGEMENT_PROTOCOL mFirmwareManagementProtocol = {
23 FmpGetImageInfo,
24 FmpGetImage,
25 FmpSetImage,
26 FmpCheckImage,
27 FmpGetPackageInfo,
28 FmpSetPackageInfo
29 };
30
31 /**
32 Initialize Microcode Descriptor.
33
34 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
35
36 @return EFI_SUCCESS Microcode Descriptor is initialized.
37 **/
38 EFI_STATUS
39 InitializeMicrocodeDescriptor (
40 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
41 );
42
43 /**
44 Returns information about the current firmware image(s) of the device.
45
46 This function allows a copy of the current firmware image to be created and saved.
47 The saved copy could later been used, for example, in firmware image recovery or rollback.
48
49 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
50 @param[in, out] ImageInfoSize A pointer to the size, in bytes, of the ImageInfo buffer.
51 On input, this is the size of the buffer allocated by the caller.
52 On output, it is the size of the buffer returned by the firmware
53 if the buffer was large enough, or the size of the buffer needed
54 to contain the image(s) information if the buffer was too small.
55 @param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
56 information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
57 @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
58 associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
59 @param[out] DescriptorCount A pointer to the location in which firmware returns the number of
60 descriptors or firmware images within this device.
61 @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes,
62 of an individual EFI_FIRMWARE_IMAGE_DESCRIPTOR.
63 @param[out] PackageVersion A version number that represents all the firmware images in the device.
64 The format is vendor specific and new version must have a greater value
65 than the old version. If PackageVersion is not supported, the value is
66 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version comparison
67 is to be performed using PackageVersionName. A value of 0xFFFFFFFD indicates
68 that package version update is in progress.
69 @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing the
70 package version name. The buffer is allocated by this function with
71 AllocatePool(), and it is the caller's responsibility to free it with a call
72 to FreePool().
73
74 @retval EFI_SUCCESS The device was successfully updated with the new image.
75 @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
76 needed to hold the image(s) information is returned in ImageInfoSize.
77 @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
78 @retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
79
80 **/
81 EFI_STATUS
82 EFIAPI
83 FmpGetImageInfo (
84 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
85 IN OUT UINTN *ImageInfoSize,
86 IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,
87 OUT UINT32 *DescriptorVersion,
88 OUT UINT8 *DescriptorCount,
89 OUT UINTN *DescriptorSize,
90 OUT UINT32 *PackageVersion,
91 OUT CHAR16 **PackageVersionName
92 )
93 {
94 MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate;
95 UINTN Index;
96
97 MicrocodeFmpPrivate = MICROCODE_FMP_PRIVATE_DATA_FROM_FMP(This);
98
99 if(ImageInfoSize == NULL) {
100 return EFI_INVALID_PARAMETER;
101 }
102
103 if (*ImageInfoSize < sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR) * MicrocodeFmpPrivate->DescriptorCount) {
104 *ImageInfoSize = sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR) * MicrocodeFmpPrivate->DescriptorCount;
105 return EFI_BUFFER_TOO_SMALL;
106 }
107
108 if (ImageInfo == NULL ||
109 DescriptorVersion == NULL ||
110 DescriptorCount == NULL ||
111 DescriptorSize == NULL ||
112 PackageVersion == NULL ||
113 PackageVersionName == NULL) {
114 return EFI_INVALID_PARAMETER;
115 }
116
117 *ImageInfoSize = sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR) * MicrocodeFmpPrivate->DescriptorCount;
118 *DescriptorSize = sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR);
119 *DescriptorCount = MicrocodeFmpPrivate->DescriptorCount;
120 *DescriptorVersion = EFI_FIRMWARE_IMAGE_DESCRIPTOR_VERSION;
121
122 //
123 // supports 1 ImageInfo descriptor
124 //
125 CopyMem(&ImageInfo[0], MicrocodeFmpPrivate->ImageDescriptor, sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR) * MicrocodeFmpPrivate->DescriptorCount);
126 for (Index = 0; Index < MicrocodeFmpPrivate->DescriptorCount; Index++) {
127 if ((ImageInfo[Index].AttributesSetting & IMAGE_ATTRIBUTE_IN_USE) != 0) {
128 ImageInfo[Index].LastAttemptVersion = MicrocodeFmpPrivate->LastAttempt.LastAttemptVersion;
129 ImageInfo[Index].LastAttemptStatus = MicrocodeFmpPrivate->LastAttempt.LastAttemptStatus;
130 }
131 }
132
133 //
134 // package version
135 //
136 *PackageVersion = MicrocodeFmpPrivate->PackageVersion;
137 if (MicrocodeFmpPrivate->PackageVersionName != NULL) {
138 *PackageVersionName = AllocateCopyPool(StrSize(MicrocodeFmpPrivate->PackageVersionName), MicrocodeFmpPrivate->PackageVersionName);
139 }
140
141 return EFI_SUCCESS;
142 }
143
144 /**
145 Retrieves a copy of the current firmware image of the device.
146
147 This function allows a copy of the current firmware image to be created and saved.
148 The saved copy could later been used, for example, in firmware image recovery or rollback.
149
150 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
151 @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
152 The number is between 1 and DescriptorCount.
153 @param[in,out] Image Points to the buffer where the current image is copied to.
154 @param[in,out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
155 On return, points to the length of the image, in bytes.
156
157 @retval EFI_SUCCESS The device was successfully updated with the new image.
158 @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
159 image. The current buffer size needed to hold the image is returned
160 in ImageSize.
161 @retval EFI_INVALID_PARAMETER The Image was NULL.
162 @retval EFI_NOT_FOUND The current image is not copied to the buffer.
163 @retval EFI_UNSUPPORTED The operation is not supported.
164 @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
165
166 **/
167 EFI_STATUS
168 EFIAPI
169 FmpGetImage (
170 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
171 IN UINT8 ImageIndex,
172 IN OUT VOID *Image,
173 IN OUT UINTN *ImageSize
174 )
175 {
176 MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate;
177 MICROCODE_INFO *MicrocodeInfo;
178
179 if (Image == NULL || ImageSize == NULL) {
180 return EFI_INVALID_PARAMETER;
181 }
182
183 MicrocodeFmpPrivate = MICROCODE_FMP_PRIVATE_DATA_FROM_FMP(This);
184
185 if (ImageIndex == 0 || ImageIndex > MicrocodeFmpPrivate->DescriptorCount || ImageSize == NULL || Image == NULL) {
186 return EFI_INVALID_PARAMETER;
187 }
188
189 MicrocodeInfo = &MicrocodeFmpPrivate->MicrocodeInfo[ImageIndex - 1];
190
191 if (*ImageSize < MicrocodeInfo->TotalSize) {
192 *ImageSize = MicrocodeInfo->TotalSize;
193 return EFI_BUFFER_TOO_SMALL;
194 }
195
196 *ImageSize = MicrocodeInfo->TotalSize;
197 CopyMem (Image, MicrocodeInfo->MicrocodeEntryPoint, MicrocodeInfo->TotalSize);
198 return EFI_SUCCESS;
199 }
200
201 /**
202 Updates the firmware image of the device.
203
204 This function updates the hardware with the new firmware image.
205 This function returns EFI_UNSUPPORTED if the firmware image is not updatable.
206 If the firmware image is updatable, the function should perform the following minimal validations
207 before proceeding to do the firmware image update.
208 - Validate the image authentication if image has attribute
209 IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED. The function returns
210 EFI_SECURITY_VIOLATION if the validation fails.
211 - Validate the image is a supported image for this device. The function returns EFI_ABORTED if
212 the image is unsupported. The function can optionally provide more detailed information on
213 why the image is not a supported image.
214 - Validate the data from VendorCode if not null. Image validation must be performed before
215 VendorCode data validation. VendorCode data is ignored or considered invalid if image
216 validation failed. The function returns EFI_ABORTED if the data is invalid.
217
218 VendorCode enables vendor to implement vendor-specific firmware image update policy. Null if
219 the caller did not specify the policy or use the default policy. As an example, vendor can implement
220 a policy to allow an option to force a firmware image update when the abort reason is due to the new
221 firmware image version is older than the current firmware image version or bad image checksum.
222 Sensitive operations such as those wiping the entire firmware image and render the device to be
223 non-functional should be encoded in the image itself rather than passed with the VendorCode.
224 AbortReason enables vendor to have the option to provide a more detailed description of the abort
225 reason to the caller.
226
227 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
228 @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
229 The number is between 1 and DescriptorCount.
230 @param[in] Image Points to the new image.
231 @param[in] ImageSize Size of the new image in bytes.
232 @param[in] VendorCode This enables vendor to implement vendor-specific firmware image update policy.
233 Null indicates the caller did not specify the policy or use the default policy.
234 @param[in] Progress A function used by the driver to report the progress of the firmware update.
235 @param[out] AbortReason A pointer to a pointer to a null-terminated string providing more
236 details for the aborted operation. The buffer is allocated by this function
237 with AllocatePool(), and it is the caller's responsibility to free it with a
238 call to FreePool().
239
240 @retval EFI_SUCCESS The device was successfully updated with the new image.
241 @retval EFI_ABORTED The operation is aborted.
242 @retval EFI_INVALID_PARAMETER The Image was NULL.
243 @retval EFI_UNSUPPORTED The operation is not supported.
244 @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
245
246 **/
247 EFI_STATUS
248 EFIAPI
249 FmpSetImage (
250 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
251 IN UINT8 ImageIndex,
252 IN CONST VOID *Image,
253 IN UINTN ImageSize,
254 IN CONST VOID *VendorCode,
255 IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress,
256 OUT CHAR16 **AbortReason
257 )
258 {
259 EFI_STATUS Status;
260 EFI_STATUS VarStatus;
261 MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate;
262
263 if (Image == NULL || AbortReason == NULL) {
264 return EFI_INVALID_PARAMETER;
265 }
266
267 MicrocodeFmpPrivate = MICROCODE_FMP_PRIVATE_DATA_FROM_FMP(This);
268 *AbortReason = NULL;
269
270 if (ImageIndex == 0 || ImageIndex > MicrocodeFmpPrivate->DescriptorCount || Image == NULL) {
271 return EFI_INVALID_PARAMETER;
272 }
273
274 Status = MicrocodeWrite(MicrocodeFmpPrivate, (VOID *)Image, ImageSize, &MicrocodeFmpPrivate->LastAttempt.LastAttemptVersion, &MicrocodeFmpPrivate->LastAttempt.LastAttemptStatus, AbortReason);
275 DEBUG((DEBUG_INFO, "SetImage - LastAttempt Version - 0x%x, Status - 0x%x\n", MicrocodeFmpPrivate->LastAttempt.LastAttemptVersion, MicrocodeFmpPrivate->LastAttempt.LastAttemptStatus));
276 VarStatus = gRT->SetVariable(
277 MICROCODE_FMP_LAST_ATTEMPT_VARIABLE_NAME,
278 &gEfiCallerIdGuid,
279 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,
280 sizeof(MicrocodeFmpPrivate->LastAttempt),
281 &MicrocodeFmpPrivate->LastAttempt
282 );
283 DEBUG((DEBUG_INFO, "SetLastAttempt - %r\n", VarStatus));
284
285 if (!EFI_ERROR(Status)) {
286 InitializeMicrocodeDescriptor(MicrocodeFmpPrivate);
287 DumpPrivateInfo (MicrocodeFmpPrivate);
288 }
289
290 return Status;
291 }
292
293 /**
294 Checks if the firmware image is valid for the device.
295
296 This function allows firmware update application to validate the firmware image without
297 invoking the SetImage() first.
298
299 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
300 @param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
301 The number is between 1 and DescriptorCount.
302 @param[in] Image Points to the new image.
303 @param[in] ImageSize Size of the new image in bytes.
304 @param[out] ImageUpdatable Indicates if the new image is valid for update. It also provides,
305 if available, additional information if the image is invalid.
306
307 @retval EFI_SUCCESS The image was successfully checked.
308 @retval EFI_INVALID_PARAMETER The Image was NULL.
309 @retval EFI_UNSUPPORTED The operation is not supported.
310 @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
311
312 **/
313 EFI_STATUS
314 EFIAPI
315 FmpCheckImage (
316 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
317 IN UINT8 ImageIndex,
318 IN CONST VOID *Image,
319 IN UINTN ImageSize,
320 OUT UINT32 *ImageUpdatable
321 )
322 {
323 return EFI_UNSUPPORTED;
324 }
325
326 /**
327 Returns information about the firmware package.
328
329 This function returns package information.
330
331 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
332 @param[out] PackageVersion A version number that represents all the firmware images in the device.
333 The format is vendor specific and new version must have a greater value
334 than the old version. If PackageVersion is not supported, the value is
335 0xFFFFFFFF. A value of 0xFFFFFFFE indicates that package version
336 comparison is to be performed using PackageVersionName. A value of
337 0xFFFFFFFD indicates that package version update is in progress.
338 @param[out] PackageVersionName A pointer to a pointer to a null-terminated string representing
339 the package version name. The buffer is allocated by this function with
340 AllocatePool(), and it is the caller's responsibility to free it with a
341 call to FreePool().
342 @param[out] PackageVersionNameMaxLen The maximum length of package version name if device supports update of
343 package version name. A value of 0 indicates the device does not support
344 update of package version name. Length is the number of Unicode characters,
345 including the terminating null character.
346 @param[out] AttributesSupported Package attributes that are supported by this device. See 'Package Attribute
347 Definitions' for possible returned values of this parameter. A value of 1
348 indicates the attribute is supported and the current setting value is
349 indicated in AttributesSetting. A value of 0 indicates the attribute is not
350 supported and the current setting value in AttributesSetting is meaningless.
351 @param[out] AttributesSetting Package attributes. See 'Package Attribute Definitions' for possible returned
352 values of this parameter
353
354 @retval EFI_SUCCESS The package information was successfully returned.
355 @retval EFI_UNSUPPORTED The operation is not supported.
356
357 **/
358 EFI_STATUS
359 EFIAPI
360 FmpGetPackageInfo (
361 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
362 OUT UINT32 *PackageVersion,
363 OUT CHAR16 **PackageVersionName,
364 OUT UINT32 *PackageVersionNameMaxLen,
365 OUT UINT64 *AttributesSupported,
366 OUT UINT64 *AttributesSetting
367 )
368 {
369 return EFI_UNSUPPORTED;
370 }
371
372 /**
373 Updates information about the firmware package.
374
375 This function updates package information.
376 This function returns EFI_UNSUPPORTED if the package information is not updatable.
377 VendorCode enables vendor to implement vendor-specific package information update policy.
378 Null if the caller did not specify this policy or use the default policy.
379
380 @param[in] This A pointer to the EFI_FIRMWARE_MANAGEMENT_PROTOCOL instance.
381 @param[in] Image Points to the authentication image.
382 Null if authentication is not required.
383 @param[in] ImageSize Size of the authentication image in bytes.
384 0 if authentication is not required.
385 @param[in] VendorCode This enables vendor to implement vendor-specific firmware
386 image update policy.
387 Null indicates the caller did not specify this policy or use
388 the default policy.
389 @param[in] PackageVersion The new package version.
390 @param[in] PackageVersionName A pointer to the new null-terminated Unicode string representing
391 the package version name.
392 The string length is equal to or less than the value returned in
393 PackageVersionNameMaxLen.
394
395 @retval EFI_SUCCESS The device was successfully updated with the new package
396 information.
397 @retval EFI_INVALID_PARAMETER The PackageVersionName length is longer than the value
398 returned in PackageVersionNameMaxLen.
399 @retval EFI_UNSUPPORTED The operation is not supported.
400 @retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
401
402 **/
403 EFI_STATUS
404 EFIAPI
405 FmpSetPackageInfo (
406 IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
407 IN CONST VOID *Image,
408 IN UINTN ImageSize,
409 IN CONST VOID *VendorCode,
410 IN UINT32 PackageVersion,
411 IN CONST CHAR16 *PackageVersionName
412 )
413 {
414 return EFI_UNSUPPORTED;
415 }
416
417 /**
418 Sort FIT microcode entries based upon MicrocodeEntryPoint, from low to high.
419
420 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
421
422 **/
423 VOID
424 SortFitMicrocodeInfo (
425 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
426 )
427 {
428 FIT_MICROCODE_INFO *FitMicrocodeEntry;
429 FIT_MICROCODE_INFO *NextFitMicrocodeEntry;
430 FIT_MICROCODE_INFO TempFitMicrocodeEntry;
431 FIT_MICROCODE_INFO *FitMicrocodeEntryEnd;
432
433 FitMicrocodeEntry = MicrocodeFmpPrivate->FitMicrocodeInfo;
434 NextFitMicrocodeEntry = FitMicrocodeEntry + 1;
435 FitMicrocodeEntryEnd = MicrocodeFmpPrivate->FitMicrocodeInfo + MicrocodeFmpPrivate->FitMicrocodeEntryCount;
436 while (FitMicrocodeEntry < FitMicrocodeEntryEnd) {
437 while (NextFitMicrocodeEntry < FitMicrocodeEntryEnd) {
438 if (FitMicrocodeEntry->MicrocodeEntryPoint > NextFitMicrocodeEntry->MicrocodeEntryPoint) {
439 CopyMem (&TempFitMicrocodeEntry, FitMicrocodeEntry, sizeof (FIT_MICROCODE_INFO));
440 CopyMem (FitMicrocodeEntry, NextFitMicrocodeEntry, sizeof (FIT_MICROCODE_INFO));
441 CopyMem (NextFitMicrocodeEntry, &TempFitMicrocodeEntry, sizeof (FIT_MICROCODE_INFO));
442 }
443
444 NextFitMicrocodeEntry = NextFitMicrocodeEntry + 1;
445 }
446
447 FitMicrocodeEntry = FitMicrocodeEntry + 1;
448 NextFitMicrocodeEntry = FitMicrocodeEntry + 1;
449 }
450 }
451
452 /**
453 Initialize FIT microcode information.
454
455 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
456
457 @return EFI_SUCCESS FIT microcode information is initialized.
458 @return EFI_OUT_OF_RESOURCES No enough resource for the initialization.
459 @return EFI_DEVICE_ERROR There is something wrong in FIT microcode entry.
460 **/
461 EFI_STATUS
462 InitializeFitMicrocodeInfo (
463 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
464 )
465 {
466 UINT64 FitPointer;
467 FIRMWARE_INTERFACE_TABLE_ENTRY *FitEntry;
468 UINT32 EntryNum;
469 UINT32 MicrocodeEntryNum;
470 UINT32 Index;
471 UINTN Address;
472 VOID *MicrocodePatchAddress;
473 UINTN MicrocodePatchRegionSize;
474 FIT_MICROCODE_INFO *FitMicrocodeInfo;
475 FIT_MICROCODE_INFO *FitMicrocodeInfoNext;
476 CPU_MICROCODE_HEADER *MicrocodeEntryPoint;
477 CPU_MICROCODE_HEADER *MicrocodeEntryPointNext;
478 UINTN FitMicrocodeIndex;
479 MICROCODE_INFO *MicrocodeInfo;
480 UINTN MicrocodeIndex;
481
482 if (MicrocodeFmpPrivate->FitMicrocodeInfo != NULL) {
483 FreePool (MicrocodeFmpPrivate->FitMicrocodeInfo);
484 MicrocodeFmpPrivate->FitMicrocodeInfo = NULL;
485 MicrocodeFmpPrivate->FitMicrocodeEntryCount = 0;
486 }
487
488 FitPointer = *(UINT64 *) (UINTN) FIT_POINTER_ADDRESS;
489 if ((FitPointer == 0) ||
490 (FitPointer == 0xFFFFFFFFFFFFFFFF) ||
491 (FitPointer == 0xEEEEEEEEEEEEEEEE)) {
492 //
493 // No FIT table.
494 //
495 return EFI_SUCCESS;
496 }
497 FitEntry = (FIRMWARE_INTERFACE_TABLE_ENTRY *) (UINTN) FitPointer;
498 if ((FitEntry[0].Type != FIT_TYPE_00_HEADER) ||
499 (FitEntry[0].Address != FIT_TYPE_00_SIGNATURE)) {
500 //
501 // Invalid FIT table, treat it as no FIT table.
502 //
503 return EFI_SUCCESS;
504 }
505
506 EntryNum = *(UINT32 *)(&FitEntry[0].Size[0]) & 0xFFFFFF;
507
508 //
509 // Calculate microcode entry number.
510 //
511 MicrocodeEntryNum = 0;
512 for (Index = 0; Index < EntryNum; Index++) {
513 if (FitEntry[Index].Type == FIT_TYPE_01_MICROCODE) {
514 MicrocodeEntryNum++;
515 }
516 }
517 if (MicrocodeEntryNum == 0) {
518 //
519 // No FIT microcode entry.
520 //
521 return EFI_SUCCESS;
522 }
523
524 //
525 // Allocate buffer.
526 //
527 MicrocodeFmpPrivate->FitMicrocodeInfo = AllocateZeroPool (MicrocodeEntryNum * sizeof (FIT_MICROCODE_INFO));
528 if (MicrocodeFmpPrivate->FitMicrocodeInfo == NULL) {
529 return EFI_OUT_OF_RESOURCES;
530 }
531
532 MicrocodeFmpPrivate->FitMicrocodeEntryCount = MicrocodeEntryNum;
533
534 MicrocodePatchAddress = MicrocodeFmpPrivate->MicrocodePatchAddress;
535 MicrocodePatchRegionSize = MicrocodeFmpPrivate->MicrocodePatchRegionSize;
536
537 //
538 // Collect microcode entry info.
539 //
540 MicrocodeEntryNum = 0;
541 for (Index = 0; Index < EntryNum; Index++) {
542 if (FitEntry[Index].Type == FIT_TYPE_01_MICROCODE) {
543 Address = (UINTN) FitEntry[Index].Address;
544 if ((Address < (UINTN) MicrocodePatchAddress) ||
545 (Address >= ((UINTN) MicrocodePatchAddress + MicrocodePatchRegionSize))) {
546 DEBUG ((
547 DEBUG_ERROR,
548 "InitializeFitMicrocodeInfo - Address (0x%x) is not in Microcode Region\n",
549 Address
550 ));
551 goto ErrorExit;
552 }
553 FitMicrocodeInfo = &MicrocodeFmpPrivate->FitMicrocodeInfo[MicrocodeEntryNum];
554 FitMicrocodeInfo->MicrocodeEntryPoint = (CPU_MICROCODE_HEADER *) Address;
555 if ((*(UINT32 *) Address) == 0xFFFFFFFF) {
556 //
557 // It is the empty slot as long as the first dword is 0xFFFF_FFFF.
558 //
559 FitMicrocodeInfo->Empty = TRUE;
560 } else {
561 FitMicrocodeInfo->Empty = FALSE;
562 }
563 MicrocodeEntryNum++;
564 }
565 }
566
567 //
568 // Every microcode should have a FIT microcode entry.
569 //
570 for (MicrocodeIndex = 0; MicrocodeIndex < MicrocodeFmpPrivate->DescriptorCount; MicrocodeIndex++) {
571 MicrocodeInfo = &MicrocodeFmpPrivate->MicrocodeInfo[MicrocodeIndex];
572 for (FitMicrocodeIndex = 0; FitMicrocodeIndex < MicrocodeFmpPrivate->FitMicrocodeEntryCount; FitMicrocodeIndex++) {
573 FitMicrocodeInfo = &MicrocodeFmpPrivate->FitMicrocodeInfo[FitMicrocodeIndex];
574 if (MicrocodeInfo->MicrocodeEntryPoint == FitMicrocodeInfo->MicrocodeEntryPoint) {
575 FitMicrocodeInfo->TotalSize = MicrocodeInfo->TotalSize;
576 FitMicrocodeInfo->InUse = MicrocodeInfo->InUse;
577 break;
578 }
579 }
580 if (FitMicrocodeIndex >= MicrocodeFmpPrivate->FitMicrocodeEntryCount) {
581 DEBUG ((
582 DEBUG_ERROR,
583 "InitializeFitMicrocodeInfo - There is no FIT microcode entry for Microcode (0x%x)\n",
584 MicrocodeInfo->MicrocodeEntryPoint
585 ));
586 goto ErrorExit;
587 }
588 }
589
590 SortFitMicrocodeInfo (MicrocodeFmpPrivate);
591
592 //
593 // Check overlap.
594 //
595 for (FitMicrocodeIndex = 0; FitMicrocodeIndex < MicrocodeFmpPrivate->FitMicrocodeEntryCount - 1; FitMicrocodeIndex++) {
596 FitMicrocodeInfo = &MicrocodeFmpPrivate->FitMicrocodeInfo[FitMicrocodeIndex];
597 MicrocodeEntryPoint = FitMicrocodeInfo->MicrocodeEntryPoint;
598 FitMicrocodeInfoNext = &MicrocodeFmpPrivate->FitMicrocodeInfo[FitMicrocodeIndex + 1];
599 MicrocodeEntryPointNext = FitMicrocodeInfoNext->MicrocodeEntryPoint;
600 if ((MicrocodeEntryPoint >= MicrocodeEntryPointNext) ||
601 ((FitMicrocodeInfo->TotalSize != 0) &&
602 ((UINTN) MicrocodeEntryPoint + FitMicrocodeInfo->TotalSize) >
603 (UINTN) MicrocodeEntryPointNext)) {
604 DEBUG ((
605 DEBUG_ERROR,
606 "InitializeFitMicrocodeInfo - There is overlap between FIT microcode entries (0x%x 0x%x)\n",
607 MicrocodeEntryPoint,
608 MicrocodeEntryPointNext
609 ));
610 goto ErrorExit;
611 }
612 }
613
614 return EFI_SUCCESS;
615
616 ErrorExit:
617 FreePool (MicrocodeFmpPrivate->FitMicrocodeInfo);
618 MicrocodeFmpPrivate->FitMicrocodeInfo = NULL;
619 MicrocodeFmpPrivate->FitMicrocodeEntryCount = 0;
620 return EFI_DEVICE_ERROR;
621 }
622
623 /**
624 Initialize Processor Microcode Index.
625
626 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
627 **/
628 VOID
629 InitializedProcessorMicrocodeIndex (
630 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
631 )
632 {
633 UINTN CpuIndex;
634 UINTN MicrocodeIndex;
635 UINTN TargetCpuIndex;
636 UINT32 AttemptStatus;
637 EFI_STATUS Status;
638
639 for (CpuIndex = 0; CpuIndex < MicrocodeFmpPrivate->ProcessorCount; CpuIndex++) {
640 if (MicrocodeFmpPrivate->ProcessorInfo[CpuIndex].MicrocodeIndex != (UINTN)-1) {
641 continue;
642 }
643 for (MicrocodeIndex = 0; MicrocodeIndex < MicrocodeFmpPrivate->DescriptorCount; MicrocodeIndex++) {
644 if (!MicrocodeFmpPrivate->MicrocodeInfo[MicrocodeIndex].InUse) {
645 continue;
646 }
647 TargetCpuIndex = CpuIndex;
648 Status = VerifyMicrocode(
649 MicrocodeFmpPrivate,
650 MicrocodeFmpPrivate->MicrocodeInfo[MicrocodeIndex].MicrocodeEntryPoint,
651 MicrocodeFmpPrivate->MicrocodeInfo[MicrocodeIndex].TotalSize,
652 FALSE,
653 &AttemptStatus,
654 NULL,
655 &TargetCpuIndex
656 );
657 if (!EFI_ERROR(Status)) {
658 MicrocodeFmpPrivate->ProcessorInfo[CpuIndex].MicrocodeIndex = MicrocodeIndex;
659 }
660 }
661 }
662 }
663
664 /**
665 Initialize Microcode Descriptor.
666
667 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
668
669 @return EFI_SUCCESS Microcode Descriptor is initialized.
670 @return EFI_OUT_OF_RESOURCES No enough resource for the initialization.
671 **/
672 EFI_STATUS
673 InitializeMicrocodeDescriptor (
674 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
675 )
676 {
677 EFI_STATUS Status;
678 UINT8 CurrentMicrocodeCount;
679
680 CurrentMicrocodeCount = (UINT8)GetMicrocodeInfo (MicrocodeFmpPrivate, 0, NULL, NULL);
681
682 if (CurrentMicrocodeCount > MicrocodeFmpPrivate->DescriptorCount) {
683 if (MicrocodeFmpPrivate->ImageDescriptor != NULL) {
684 FreePool(MicrocodeFmpPrivate->ImageDescriptor);
685 MicrocodeFmpPrivate->ImageDescriptor = NULL;
686 }
687 if (MicrocodeFmpPrivate->MicrocodeInfo != NULL) {
688 FreePool(MicrocodeFmpPrivate->MicrocodeInfo);
689 MicrocodeFmpPrivate->MicrocodeInfo = NULL;
690 }
691 } else {
692 ZeroMem(MicrocodeFmpPrivate->ImageDescriptor, MicrocodeFmpPrivate->DescriptorCount * sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR));
693 ZeroMem(MicrocodeFmpPrivate->MicrocodeInfo, MicrocodeFmpPrivate->DescriptorCount * sizeof(MICROCODE_INFO));
694 }
695
696 MicrocodeFmpPrivate->DescriptorCount = CurrentMicrocodeCount;
697
698 if (MicrocodeFmpPrivate->ImageDescriptor == NULL) {
699 MicrocodeFmpPrivate->ImageDescriptor = AllocateZeroPool(MicrocodeFmpPrivate->DescriptorCount * sizeof(EFI_FIRMWARE_IMAGE_DESCRIPTOR));
700 if (MicrocodeFmpPrivate->ImageDescriptor == NULL) {
701 return EFI_OUT_OF_RESOURCES;
702 }
703 }
704 if (MicrocodeFmpPrivate->MicrocodeInfo == NULL) {
705 MicrocodeFmpPrivate->MicrocodeInfo = AllocateZeroPool(MicrocodeFmpPrivate->DescriptorCount * sizeof(MICROCODE_INFO));
706 if (MicrocodeFmpPrivate->MicrocodeInfo == NULL) {
707 FreePool (MicrocodeFmpPrivate->ImageDescriptor);
708 return EFI_OUT_OF_RESOURCES;
709 }
710 }
711
712 CurrentMicrocodeCount = (UINT8)GetMicrocodeInfo (MicrocodeFmpPrivate, MicrocodeFmpPrivate->DescriptorCount, MicrocodeFmpPrivate->ImageDescriptor, MicrocodeFmpPrivate->MicrocodeInfo);
713 ASSERT(CurrentMicrocodeCount == MicrocodeFmpPrivate->DescriptorCount);
714
715 InitializedProcessorMicrocodeIndex (MicrocodeFmpPrivate);
716
717 Status = InitializeFitMicrocodeInfo (MicrocodeFmpPrivate);
718 if (EFI_ERROR(Status)) {
719 FreePool (MicrocodeFmpPrivate->ImageDescriptor);
720 FreePool (MicrocodeFmpPrivate->MicrocodeInfo);
721 DEBUG((DEBUG_ERROR, "InitializeFitMicrocodeInfo - %r\n", Status));
722 return Status;
723 }
724
725 return EFI_SUCCESS;
726 }
727
728 /**
729 Initialize MicrocodeFmpDriver multiprocessor information.
730
731 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
732
733 @return EFI_SUCCESS Processor information is initialized.
734 @return EFI_OUT_OF_RESOURCES No enough resource for the initialization.
735 **/
736 EFI_STATUS
737 InitializeProcessorInfo (
738 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
739 )
740 {
741 EFI_STATUS Status;
742 EFI_MP_SERVICES_PROTOCOL *MpService;
743 UINTN NumberOfProcessors;
744 UINTN NumberOfEnabledProcessors;
745 UINTN Index;
746 UINTN BspIndex;
747
748 Status = gBS->LocateProtocol (&gEfiMpServiceProtocolGuid, NULL, (VOID **)&MpService);
749 ASSERT_EFI_ERROR(Status);
750
751 MicrocodeFmpPrivate->MpService = MpService;
752 MicrocodeFmpPrivate->ProcessorCount = 0;
753 MicrocodeFmpPrivate->ProcessorInfo = NULL;
754
755 Status = MpService->GetNumberOfProcessors (MpService, &NumberOfProcessors, &NumberOfEnabledProcessors);
756 ASSERT_EFI_ERROR(Status);
757 MicrocodeFmpPrivate->ProcessorCount = NumberOfProcessors;
758
759 Status = MpService->WhoAmI (MpService, &BspIndex);
760 ASSERT_EFI_ERROR(Status);
761 MicrocodeFmpPrivate->BspIndex = BspIndex;
762
763 MicrocodeFmpPrivate->ProcessorInfo = AllocateZeroPool (sizeof(PROCESSOR_INFO) * MicrocodeFmpPrivate->ProcessorCount);
764 if (MicrocodeFmpPrivate->ProcessorInfo == NULL) {
765 return EFI_OUT_OF_RESOURCES;
766 }
767
768 for (Index = 0; Index < NumberOfProcessors; Index++) {
769 MicrocodeFmpPrivate->ProcessorInfo[Index].CpuIndex = Index;
770 MicrocodeFmpPrivate->ProcessorInfo[Index].MicrocodeIndex = (UINTN)-1;
771 if (Index == BspIndex) {
772 CollectProcessorInfo (&MicrocodeFmpPrivate->ProcessorInfo[Index]);
773 } else {
774 Status = MpService->StartupThisAP (
775 MpService,
776 CollectProcessorInfo,
777 Index,
778 NULL,
779 0,
780 &MicrocodeFmpPrivate->ProcessorInfo[Index],
781 NULL
782 );
783 ASSERT_EFI_ERROR(Status);
784 }
785 }
786
787 return EFI_SUCCESS;
788 }
789
790 /**
791 Dump private information.
792
793 @param[in] MicrocodeFmpPrivate private data structure.
794 **/
795 VOID
796 DumpPrivateInfo (
797 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
798 )
799 {
800 UINTN Index;
801 PROCESSOR_INFO *ProcessorInfo;
802 MICROCODE_INFO *MicrocodeInfo;
803 EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageDescriptor;
804 FIT_MICROCODE_INFO *FitMicrocodeInfo;
805
806 DEBUG ((DEBUG_INFO, "ProcessorInfo:\n"));
807 DEBUG ((DEBUG_INFO, " ProcessorCount - 0x%x\n", MicrocodeFmpPrivate->ProcessorCount));
808 DEBUG ((DEBUG_INFO, " BspIndex - 0x%x\n", MicrocodeFmpPrivate->BspIndex));
809
810 ProcessorInfo = MicrocodeFmpPrivate->ProcessorInfo;
811 for (Index = 0; Index < MicrocodeFmpPrivate->ProcessorCount; Index++) {
812 DEBUG ((
813 DEBUG_INFO,
814 " ProcessorInfo[0x%x] - 0x%08x, 0x%02x, 0x%08x, (0x%x)\n",
815 ProcessorInfo[Index].CpuIndex,
816 ProcessorInfo[Index].ProcessorSignature,
817 ProcessorInfo[Index].PlatformId,
818 ProcessorInfo[Index].MicrocodeRevision,
819 ProcessorInfo[Index].MicrocodeIndex
820 ));
821 }
822
823 DEBUG ((DEBUG_INFO, "MicrocodeInfo:\n"));
824 MicrocodeInfo = MicrocodeFmpPrivate->MicrocodeInfo;
825 DEBUG ((DEBUG_INFO, " MicrocodeRegion - 0x%x - 0x%x\n", MicrocodeFmpPrivate->MicrocodePatchAddress, MicrocodeFmpPrivate->MicrocodePatchRegionSize));
826 DEBUG ((DEBUG_INFO, " MicrocodeCount - 0x%x\n", MicrocodeFmpPrivate->DescriptorCount));
827 for (Index = 0; Index < MicrocodeFmpPrivate->DescriptorCount; Index++) {
828 DEBUG ((
829 DEBUG_INFO,
830 " MicrocodeInfo[0x%x] - 0x%08x, 0x%08x, (0x%x)\n",
831 Index,
832 MicrocodeInfo[Index].MicrocodeEntryPoint,
833 MicrocodeInfo[Index].TotalSize,
834 MicrocodeInfo[Index].InUse
835 ));
836 }
837
838 ImageDescriptor = MicrocodeFmpPrivate->ImageDescriptor;
839 DEBUG ((DEBUG_VERBOSE, "ImageDescriptor:\n"));
840 for (Index = 0; Index < MicrocodeFmpPrivate->DescriptorCount; Index++) {
841 DEBUG((DEBUG_VERBOSE, " ImageDescriptor (%d)\n", Index));
842 DEBUG((DEBUG_VERBOSE, " ImageIndex - 0x%x\n", ImageDescriptor[Index].ImageIndex));
843 DEBUG((DEBUG_VERBOSE, " ImageTypeId - %g\n", &ImageDescriptor[Index].ImageTypeId));
844 DEBUG((DEBUG_VERBOSE, " ImageId - 0x%lx\n", ImageDescriptor[Index].ImageId));
845 DEBUG((DEBUG_VERBOSE, " ImageIdName - %s\n", ImageDescriptor[Index].ImageIdName));
846 DEBUG((DEBUG_VERBOSE, " Version - 0x%x\n", ImageDescriptor[Index].Version));
847 DEBUG((DEBUG_VERBOSE, " VersionName - %s\n", ImageDescriptor[Index].VersionName));
848 DEBUG((DEBUG_VERBOSE, " Size - 0x%x\n", ImageDescriptor[Index].Size));
849 DEBUG((DEBUG_VERBOSE, " AttributesSupported - 0x%lx\n", ImageDescriptor[Index].AttributesSupported));
850 DEBUG((DEBUG_VERBOSE, " AttributesSetting - 0x%lx\n", ImageDescriptor[Index].AttributesSetting));
851 DEBUG((DEBUG_VERBOSE, " Compatibilities - 0x%lx\n", ImageDescriptor[Index].Compatibilities));
852 DEBUG((DEBUG_VERBOSE, " LowestSupportedImageVersion - 0x%x\n", ImageDescriptor[Index].LowestSupportedImageVersion));
853 DEBUG((DEBUG_VERBOSE, " LastAttemptVersion - 0x%x\n", ImageDescriptor[Index].LastAttemptVersion));
854 DEBUG((DEBUG_VERBOSE, " LastAttemptStatus - 0x%x\n", ImageDescriptor[Index].LastAttemptStatus));
855 DEBUG((DEBUG_VERBOSE, " HardwareInstance - 0x%lx\n", ImageDescriptor[Index].HardwareInstance));
856 }
857
858 if (MicrocodeFmpPrivate->FitMicrocodeInfo != NULL) {
859 DEBUG ((DEBUG_INFO, "FitMicrocodeInfo:\n"));
860 FitMicrocodeInfo = MicrocodeFmpPrivate->FitMicrocodeInfo;
861 DEBUG ((DEBUG_INFO, " FitMicrocodeEntryCount - 0x%x\n", MicrocodeFmpPrivate->FitMicrocodeEntryCount));
862 for (Index = 0; Index < MicrocodeFmpPrivate->FitMicrocodeEntryCount; Index++) {
863 DEBUG ((
864 DEBUG_INFO,
865 " FitMicrocodeInfo[0x%x] - 0x%08x, 0x%08x, (0x%x, 0x%x)\n",
866 Index,
867 FitMicrocodeInfo[Index].MicrocodeEntryPoint,
868 FitMicrocodeInfo[Index].TotalSize,
869 FitMicrocodeInfo[Index].InUse,
870 FitMicrocodeInfo[Index].Empty
871 ));
872 }
873 }
874 }
875
876 /**
877 Initialize MicrocodeFmpDriver private data structure.
878
879 @param[in] MicrocodeFmpPrivate private data structure to be initialized.
880
881 @return EFI_SUCCESS private data is initialized.
882 **/
883 EFI_STATUS
884 InitializePrivateData (
885 IN MICROCODE_FMP_PRIVATE_DATA *MicrocodeFmpPrivate
886 )
887 {
888 EFI_STATUS Status;
889 EFI_STATUS VarStatus;
890 UINTN VarSize;
891 BOOLEAN Result;
892
893 MicrocodeFmpPrivate->Signature = MICROCODE_FMP_PRIVATE_DATA_SIGNATURE;
894 MicrocodeFmpPrivate->Handle = NULL;
895 CopyMem(&MicrocodeFmpPrivate->Fmp, &mFirmwareManagementProtocol, sizeof(EFI_FIRMWARE_MANAGEMENT_PROTOCOL));
896
897 MicrocodeFmpPrivate->PackageVersion = 0x1;
898 MicrocodeFmpPrivate->PackageVersionName = L"Microcode";
899
900 MicrocodeFmpPrivate->LastAttempt.LastAttemptVersion = 0x0;
901 MicrocodeFmpPrivate->LastAttempt.LastAttemptStatus = 0x0;
902 VarSize = sizeof(MicrocodeFmpPrivate->LastAttempt);
903 VarStatus = gRT->GetVariable(
904 MICROCODE_FMP_LAST_ATTEMPT_VARIABLE_NAME,
905 &gEfiCallerIdGuid,
906 NULL,
907 &VarSize,
908 &MicrocodeFmpPrivate->LastAttempt
909 );
910 DEBUG((DEBUG_INFO, "GetLastAttempt - %r\n", VarStatus));
911 DEBUG((DEBUG_INFO, "GetLastAttempt Version - 0x%x, State - 0x%x\n", MicrocodeFmpPrivate->LastAttempt.LastAttemptVersion, MicrocodeFmpPrivate->LastAttempt.LastAttemptStatus));
912
913 Result = GetMicrocodeRegion(&MicrocodeFmpPrivate->MicrocodePatchAddress, &MicrocodeFmpPrivate->MicrocodePatchRegionSize);
914 if (!Result) {
915 DEBUG((DEBUG_ERROR, "Fail to get Microcode Region\n"));
916 return EFI_NOT_FOUND;
917 }
918
919 Status = InitializeProcessorInfo (MicrocodeFmpPrivate);
920 if (EFI_ERROR(Status)) {
921 DEBUG((DEBUG_ERROR, "InitializeProcessorInfo - %r\n", Status));
922 return Status;
923 }
924
925 Status = InitializeMicrocodeDescriptor(MicrocodeFmpPrivate);
926 if (EFI_ERROR(Status)) {
927 FreePool (MicrocodeFmpPrivate->ProcessorInfo);
928 DEBUG((DEBUG_ERROR, "InitializeMicrocodeDescriptor - %r\n", Status));
929 return Status;
930 }
931
932 DumpPrivateInfo (MicrocodeFmpPrivate);
933
934 return Status;
935 }
936
937 /**
938 Microcode FMP module entrypoint
939
940 @param[in] ImageHandle The firmware allocated handle for the EFI image.
941 @param[in] SystemTable A pointer to the EFI System Table.
942
943 @return EFI_SUCCESS Microcode FMP module is initialized.
944 **/
945 EFI_STATUS
946 EFIAPI
947 MicrocodeFmpMain (
948 IN EFI_HANDLE ImageHandle,
949 IN EFI_SYSTEM_TABLE *SystemTable
950 )
951 {
952 EFI_STATUS Status;
953
954 //
955 // Initialize MicrocodeFmpPrivateData
956 //
957 mMicrocodeFmpPrivate = AllocateZeroPool (sizeof(MICROCODE_FMP_PRIVATE_DATA));
958 if (mMicrocodeFmpPrivate == NULL) {
959 return EFI_OUT_OF_RESOURCES;
960 }
961
962 Status = InitializePrivateData(mMicrocodeFmpPrivate);
963 if (EFI_ERROR(Status)) {
964 FreePool(mMicrocodeFmpPrivate);
965 mMicrocodeFmpPrivate = NULL;
966 return Status;
967 }
968
969 //
970 // Install FMP protocol.
971 //
972 Status = gBS->InstallProtocolInterface (
973 &mMicrocodeFmpPrivate->Handle,
974 &gEfiFirmwareManagementProtocolGuid,
975 EFI_NATIVE_INTERFACE,
976 &mMicrocodeFmpPrivate->Fmp
977 );
978 if (EFI_ERROR (Status)) {
979 FreePool(mMicrocodeFmpPrivate);
980 mMicrocodeFmpPrivate = NULL;
981 return Status;
982 }
983
984 return Status;
985 }