]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
Update capsule pei module to pass IPF build.
[mirror_edk2.git] / MdeModulePkg / Universal / CapsulePei / UefiCapsule.c
index 5598755d4623c964c8ad874b29f3fb454d88dccf..da37e671fea5e4e63e6ab530e02a8be542c11df8 100644 (file)
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "Capsule.h"\r
 \r
+#ifdef MDE_CPU_IA32\r
 //\r
 // Global Descriptor Table (GDT)\r
 //\r
@@ -417,6 +418,67 @@ ModeSwitch (
 \r
 }\r
 \r
+/**\r
+  Locates the coalesce image entry point, and detects its machine type.\r
+\r
+  @param CoalesceImageEntryPoint   Pointer to coalesce image entry point for output.\r
+  @param CoalesceImageMachineType  Pointer to machine type of coalesce image.\r
+\r
+  @retval EFI_SUCCESS     Coalesce image successfully located.\r
+  @retval Others          Failed to locate the coalesce image.\r
+\r
+**/\r
+EFI_STATUS\r
+FindCapsuleCoalesceImage (\r
+  OUT EFI_PHYSICAL_ADDRESS    *CoalesceImageEntryPoint,\r
+  OUT UINT16                  *CoalesceImageMachineType\r
+  )\r
+{\r
+  EFI_STATUS                           Status;\r
+  UINTN                                Instance;\r
+  EFI_PEI_LOAD_FILE_PPI                *LoadFile;\r
+  EFI_PEI_FV_HANDLE                    VolumeHandle;\r
+  EFI_PEI_FILE_HANDLE                  FileHandle;\r
+  EFI_PHYSICAL_ADDRESS                 CoalesceImageAddress;\r
+  UINT64                               CoalesceImageSize;\r
+  UINT32                               AuthenticationState;\r
+\r
+  Instance = 0;\r
+\r
+  while (TRUE) {\r
+    Status = PeiServicesFfsFindNextVolume (Instance++, &VolumeHandle);\r
+    if (EFI_ERROR (Status)) {\r
+      return Status;\r
+    }\r
+    Status = PeiServicesFfsFindFileByName (PcdGetPtr(PcdCapsuleCoalesceFile), VolumeHandle, &FileHandle);\r
+    if (!EFI_ERROR (Status)) {\r
+      Status = PeiServicesLocatePpi (&gEfiPeiLoadFilePpiGuid, 0, NULL, (VOID **) &LoadFile);\r
+      ASSERT_EFI_ERROR (Status);\r
+\r
+      Status = LoadFile->LoadFile (\r
+                           LoadFile,\r
+                           FileHandle,\r
+                           &CoalesceImageAddress,\r
+                           &CoalesceImageSize,\r
+                           CoalesceImageEntryPoint,\r
+                           &AuthenticationState\r
+                           );\r
+      if (EFI_ERROR (Status)) {\r
+        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleRelocate image ffs %r!\n", Status));\r
+        return Status;\r
+      }\r
+      *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);\r
+      break;\r
+    } else {\r
+      continue;\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
+#endif\r
+\r
 /**\r
   Checks for the presence of capsule descriptors.\r
   Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...\r
@@ -526,65 +588,6 @@ GetCapsuleDescriptors (
   return EFI_SUCCESS;\r
 }\r
 \r
-/**\r
-  Locates the coalesce image entry point, and detects its machine type.\r
-\r
-  @param CoalesceImageEntryPoint   Pointer to coalesce image entry point for output.\r
-  @param CoalesceImageMachineType  Pointer to machine type of coalesce image.\r
-\r
-  @retval EFI_SUCCESS     Coalesce image successfully located.\r
-  @retval Others          Failed to locate the coalesce image.\r
-\r
-**/\r
-EFI_STATUS\r
-FindCapsuleCoalesceImage (\r
-  OUT EFI_PHYSICAL_ADDRESS    *CoalesceImageEntryPoint,\r
-  OUT UINT16                  *CoalesceImageMachineType\r
-  )\r
-{\r
-  EFI_STATUS                           Status;\r
-  UINTN                                Instance;\r
-  EFI_PEI_LOAD_FILE_PPI                *LoadFile;\r
-  EFI_PEI_FV_HANDLE                    VolumeHandle;\r
-  EFI_PEI_FILE_HANDLE                  FileHandle;\r
-  EFI_PHYSICAL_ADDRESS                 CoalesceImageAddress;\r
-  UINT64                               CoalesceImageSize;\r
-  UINT32                               AuthenticationState;\r
-\r
-  Instance = 0;\r
-\r
-  while (TRUE) {\r
-    Status = PeiServicesFfsFindNextVolume (Instance++, &VolumeHandle);\r
-    if (EFI_ERROR (Status)) {\r
-      return Status;\r
-    }\r
-    Status = PeiServicesFfsFindFileByName (PcdGetPtr(PcdCapsuleCoalesceFile), VolumeHandle, &FileHandle);\r
-    if (!EFI_ERROR (Status)) {\r
-      Status = PeiServicesLocatePpi (&gEfiPeiLoadFilePpiGuid, 0, NULL, (VOID **) &LoadFile);\r
-      ASSERT_EFI_ERROR (Status);\r
-\r
-      Status = LoadFile->LoadFile (\r
-                           LoadFile,\r
-                           FileHandle,\r
-                           &CoalesceImageAddress,\r
-                           &CoalesceImageSize,\r
-                           CoalesceImageEntryPoint,\r
-                           &AuthenticationState\r
-                           );\r
-      if (EFI_ERROR (Status)) {\r
-        DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleRelocate image ffs %r!\n", Status));\r
-        return Status;\r
-      }\r
-      *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);\r
-      break;\r
-    } else {\r
-      continue;\r
-    }\r
-  }\r
-\r
-  return Status;\r
-}\r
-\r
 /**\r
   Gets the reserved long mode buffer.\r
 \r