]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFspWrapperPkg/FspNotifyDxe/FspNotifyDxe.c
BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / IntelFspWrapperPkg / FspNotifyDxe / FspNotifyDxe.c
index 859b26728d7c51852363b66bfdc7794e139b8575..1a1e4e625890e809fcde69a699a5f44532d7af32 100644 (file)
 #include <Library/UefiLib.h>\r
 #include <Library/FspApiLib.h>\r
 \r
 #include <Library/UefiLib.h>\r
 #include <Library/FspApiLib.h>\r
 \r
+/**\r
+  Relocate this image under 4G memory.\r
+\r
+  @param  ImageHandle  Handle of driver image.\r
+  @param  SystemTable  Pointer to system table.\r
+\r
+  @retval EFI_SUCCESS  Image successfully relocated.\r
+  @retval EFI_ABORTED  Failed to relocate image.\r
+\r
+**/\r
+EFI_STATUS\r
+RelocateImageUnder4GIfNeeded (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  );\r
+\r
 FSP_INFO_HEADER *mFspHeader = NULL;\r
 \r
 /**\r
 FSP_INFO_HEADER *mFspHeader = NULL;\r
 \r
 /**\r
@@ -120,7 +136,19 @@ FspDxeEntryPoint (
   VOID       *Registration;\r
   EFI_EVENT  ProtocolNotifyEvent;\r
 \r
   VOID       *Registration;\r
   EFI_EVENT  ProtocolNotifyEvent;\r
 \r
-  mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));\r
+  //\r
+  // Load this driver's image to memory\r
+  //\r
+  Status = RelocateImageUnder4GIfNeeded (ImageHandle, SystemTable);\r
+  if (EFI_ERROR (Status)) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
+  if (PcdGet32 (PcdFlashFvSecondFspBase) == 0) {\r
+    mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));\r
+  } else {\r
+    mFspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvSecondFspBase));\r
+  }\r
   DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", mFspHeader));\r
   if (mFspHeader == NULL) {\r
     return EFI_DEVICE_ERROR;\r
   DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", mFspHeader));\r
   if (mFspHeader == NULL) {\r
     return EFI_DEVICE_ERROR;\r