summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
diff options
context:
space:
mode:
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-05 09:53:37 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2011-09-05 09:53:37 +0000
commit4e4f13d245b1fbca55c03aca0b36848d8d50b57f (patch)
treef11237fcbdbfb13b329ef5e21b3710a06cd0e30b /MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
parent1abad90b73bfe991f98f8715bdf678f89f56160e (diff)
downloadedk2-platforms-4e4f13d245b1fbca55c03aca0b36848d8d50b57f.tar.xz
Update capsule pei module to pass IPF build.
Signed-off-by: li-elvin Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12280 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/CapsulePei/UefiCapsule.c')
-rw-r--r--MdeModulePkg/Universal/CapsulePei/UefiCapsule.c121
1 files changed, 62 insertions, 59 deletions
diff --git a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
index 5598755d46..da37e671fe 100644
--- a/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
+++ b/MdeModulePkg/Universal/CapsulePei/UefiCapsule.c
@@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "Capsule.h"
+#ifdef MDE_CPU_IA32
//
// Global Descriptor Table (GDT)
//
@@ -418,6 +419,67 @@ ModeSwitch (
}
/**
+ Locates the coalesce image entry point, and detects its machine type.
+
+ @param CoalesceImageEntryPoint Pointer to coalesce image entry point for output.
+ @param CoalesceImageMachineType Pointer to machine type of coalesce image.
+
+ @retval EFI_SUCCESS Coalesce image successfully located.
+ @retval Others Failed to locate the coalesce image.
+
+**/
+EFI_STATUS
+FindCapsuleCoalesceImage (
+ OUT EFI_PHYSICAL_ADDRESS *CoalesceImageEntryPoint,
+ OUT UINT16 *CoalesceImageMachineType
+ )
+{
+ EFI_STATUS Status;
+ UINTN Instance;
+ EFI_PEI_LOAD_FILE_PPI *LoadFile;
+ EFI_PEI_FV_HANDLE VolumeHandle;
+ EFI_PEI_FILE_HANDLE FileHandle;
+ EFI_PHYSICAL_ADDRESS CoalesceImageAddress;
+ UINT64 CoalesceImageSize;
+ UINT32 AuthenticationState;
+
+ Instance = 0;
+
+ while (TRUE) {
+ Status = PeiServicesFfsFindNextVolume (Instance++, &VolumeHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ Status = PeiServicesFfsFindFileByName (PcdGetPtr(PcdCapsuleCoalesceFile), VolumeHandle, &FileHandle);
+ if (!EFI_ERROR (Status)) {
+ Status = PeiServicesLocatePpi (&gEfiPeiLoadFilePpiGuid, 0, NULL, (VOID **) &LoadFile);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = LoadFile->LoadFile (
+ LoadFile,
+ FileHandle,
+ &CoalesceImageAddress,
+ &CoalesceImageSize,
+ CoalesceImageEntryPoint,
+ &AuthenticationState
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleRelocate image ffs %r!\n", Status));
+ return Status;
+ }
+ *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);
+ break;
+ } else {
+ continue;
+ }
+ }
+
+ return Status;
+}
+
+#endif
+
+/**
Checks for the presence of capsule descriptors.
Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...
and save to DescriptorBuffer.
@@ -527,65 +589,6 @@ GetCapsuleDescriptors (
}
/**
- Locates the coalesce image entry point, and detects its machine type.
-
- @param CoalesceImageEntryPoint Pointer to coalesce image entry point for output.
- @param CoalesceImageMachineType Pointer to machine type of coalesce image.
-
- @retval EFI_SUCCESS Coalesce image successfully located.
- @retval Others Failed to locate the coalesce image.
-
-**/
-EFI_STATUS
-FindCapsuleCoalesceImage (
- OUT EFI_PHYSICAL_ADDRESS *CoalesceImageEntryPoint,
- OUT UINT16 *CoalesceImageMachineType
- )
-{
- EFI_STATUS Status;
- UINTN Instance;
- EFI_PEI_LOAD_FILE_PPI *LoadFile;
- EFI_PEI_FV_HANDLE VolumeHandle;
- EFI_PEI_FILE_HANDLE FileHandle;
- EFI_PHYSICAL_ADDRESS CoalesceImageAddress;
- UINT64 CoalesceImageSize;
- UINT32 AuthenticationState;
-
- Instance = 0;
-
- while (TRUE) {
- Status = PeiServicesFfsFindNextVolume (Instance++, &VolumeHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = PeiServicesFfsFindFileByName (PcdGetPtr(PcdCapsuleCoalesceFile), VolumeHandle, &FileHandle);
- if (!EFI_ERROR (Status)) {
- Status = PeiServicesLocatePpi (&gEfiPeiLoadFilePpiGuid, 0, NULL, (VOID **) &LoadFile);
- ASSERT_EFI_ERROR (Status);
-
- Status = LoadFile->LoadFile (
- LoadFile,
- FileHandle,
- &CoalesceImageAddress,
- &CoalesceImageSize,
- CoalesceImageEntryPoint,
- &AuthenticationState
- );
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Unable to find PE32 section in CapsuleRelocate image ffs %r!\n", Status));
- return Status;
- }
- *CoalesceImageMachineType = PeCoffLoaderGetMachineType ((VOID *) (UINTN) CoalesceImageAddress);
- break;
- } else {
- continue;
- }
- }
-
- return Status;
-}
-
-/**
Gets the reserved long mode buffer.
@param LongModeBuffer Pointer to the long mode buffer for output.