X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=IntelFspWrapperPkg%2FFspNotifyDxe%2FFspNotifyDxe.c;h=1a1e4e625890e809fcde69a699a5f44532d7af32;hp=859b26728d7c51852363b66bfdc7794e139b8575;hb=f33d5d68abc02727dc828c1079e72ab65e1d63af;hpb=d8043ce905a5832f911361ef30be28765afbdc6b diff --git a/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c b/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c index 859b26728d..1a1e4e6258 100644 --- a/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c +++ b/IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c @@ -23,6 +23,22 @@ #include #include +/** + Relocate this image under 4G memory. + + @param ImageHandle Handle of driver image. + @param SystemTable Pointer to system table. + + @retval EFI_SUCCESS Image successfully relocated. + @retval EFI_ABORTED Failed to relocate image. + +**/ +EFI_STATUS +RelocateImageUnder4GIfNeeded ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ); + FSP_INFO_HEADER *mFspHeader = NULL; /** @@ -120,7 +136,19 @@ FspDxeEntryPoint ( VOID *Registration; EFI_EVENT ProtocolNotifyEvent; - mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase)); + // + // Load this driver's image to memory + // + Status = RelocateImageUnder4GIfNeeded (ImageHandle, SystemTable); + if (EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + + if (PcdGet32 (PcdFlashFvSecondFspBase) == 0) { + mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase)); + } else { + mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvSecondFspBase)); + } DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", mFspHeader)); if (mFspHeader == NULL) { return EFI_DEVICE_ERROR;