Move FW update uCode structure check to its own function

Signed-off-by: Sean McGinn <sean.mcginn@intel.com>
This commit is contained in:
Sean McGinn 2022-05-10 17:07:09 -07:00 committed by Guo Dong
parent a52a054333
commit 7fca88c50d
2 changed files with 69 additions and 34 deletions

View File

@ -1162,7 +1162,7 @@ Reboot (
}
/**
Verify the firmware internal structure.
Verify uCode internal structure
@param[in] ImageHdr Pointer to the fw mgmt capsule image header
@ -1170,7 +1170,7 @@ Reboot (
@retval others There is error happening.
**/
EFI_STATUS
VerifyFwStruct (
VerifyUcodeStruct (
IN EFI_FW_MGMT_CAP_IMAGE_HEADER *ImageHdr
)
{
@ -1179,8 +1179,6 @@ VerifyFwStruct (
CPU_MICROCODE_HEADER *UCodeHdr;
UINT8 *ImageByte;
if ((UINT32)ImageHdr->UpdateHardwareInstance == FLASH_MAP_SIG_UCODE) {
// Update is only supported for platforms that slot their uCode
if (PcdGet32 (PcdUcodeSlotSize) == 0) {
DEBUG((DEBUG_ERROR, "Existing image does not contain uCode slots!!\n"));
@ -1211,6 +1209,30 @@ VerifyFwStruct (
++ImageOffset;
ImageByte = (UINT8*)(ImageBase + ImageOffset);
}
return EFI_SUCCESS;
}
/**
Verify the firmware internal structure.
@param[in] ImageHdr Pointer to the fw mgmt capsule image header
@retval EFI_SUCCESS The operation completed successfully.
@retval others There is error happening.
**/
EFI_STATUS
VerifyFwStruct (
IN EFI_FW_MGMT_CAP_IMAGE_HEADER *ImageHdr
)
{
EFI_STATUS Status;
if ((UINT32)ImageHdr->UpdateHardwareInstance == FLASH_MAP_SIG_UCODE) {
Status = VerifyUcodeStruct (ImageHdr);
if (EFI_ERROR (Status)) {
return Status;
}
}
return EFI_SUCCESS;

View File

@ -98,6 +98,19 @@ VerifyFwVersion (
IN FIRMWARE_UPDATE_POLICY FwPolicy
);
/**
Verify uCode internal structure
@param[in] ImageHdr Pointer to the fw mgmt capsule image header
@retval EFI_SUCCESS The operation completed successfully.
@retval others There is error happening.
**/
EFI_STATUS
VerifyUcodeStruct (
IN EFI_FW_MGMT_CAP_IMAGE_HEADER *ImageHdr
);
/**
Verify the firmware internal structure.