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
This commit is contained in:
@ -38,6 +38,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <IndustryStandard/PeImage.h>
|
#include <IndustryStandard/PeImage.h>
|
||||||
#include "Common/CommonHeader.h"
|
#include "Common/CommonHeader.h"
|
||||||
|
|
||||||
|
#ifdef MDE_CPU_IA32
|
||||||
|
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -99,3 +101,5 @@ EFI_STATUS
|
|||||||
);
|
);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
@ -49,22 +49,26 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
PeiServicesTablePointerLib
|
PeiServicesTablePointerLib
|
||||||
PrintLib
|
PrintLib
|
||||||
PeCoffLib
|
ReportStatusCodeLib
|
||||||
|
|
||||||
|
[LibraryClasses.IA32]
|
||||||
PeCoffGetEntryPointLib
|
PeCoffGetEntryPointLib
|
||||||
PcdLib
|
PcdLib
|
||||||
ReportStatusCodeLib
|
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiCapsuleVendorGuid # ALWAYS_CONSUMED
|
gEfiCapsuleVendorGuid # ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
|
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
|
||||||
gPeiCapsulePpiGuid # PPI ALWAYS_CONSUMED
|
gPeiCapsulePpiGuid # PPI ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
[Ppis.IA32]
|
||||||
gEfiPeiLoadFilePpiGuid # PPI ALWAYS_CONSUMED
|
gEfiPeiLoadFilePpiGuid # PPI ALWAYS_CONSUMED
|
||||||
|
|
||||||
[Pcd]
|
[Pcd.IA32]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleCoalesceFile
|
gEfiMdeModulePkgTokenSpaceGuid.PcdCapsuleCoalesceFile
|
||||||
|
|
||||||
|
[FeaturePcd.IA32]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
|
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
|
@ -12,11 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _CAPSULE_THUNK_32_TO_64_
|
#ifndef _CAPSULE_COMMON_HEADER_
|
||||||
#define _CAPSULE_THUNK_32_TO_64_
|
#define _CAPSULE_COMMON_HEADER_
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
#include "PiPei.h"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// This capsule PEIM puts its private data at the start of the
|
// This capsule PEIM puts its private data at the start of the
|
||||||
@ -31,6 +28,7 @@ typedef struct {
|
|||||||
|
|
||||||
#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
|
#define CAPSULE_TEST_SIGNATURE SIGNATURE_32('T', 'E', 'S', 'T')
|
||||||
|
|
||||||
|
#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_PHYSICAL_ADDRESS EntryPoint;
|
EFI_PHYSICAL_ADDRESS EntryPoint;
|
||||||
EFI_PHYSICAL_ADDRESS StackBufferBase;
|
EFI_PHYSICAL_ADDRESS StackBufferBase;
|
||||||
@ -47,6 +45,7 @@ typedef struct {
|
|||||||
UINT64 ReturnStatus;
|
UINT64 ReturnStatus;
|
||||||
IA32_DESCRIPTOR Gdtr;
|
IA32_DESCRIPTOR Gdtr;
|
||||||
} SWITCH_64_TO_32_CONTEXT;
|
} SWITCH_64_TO_32_CONTEXT;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The function to coalesce a fragmented capsule in memory.
|
The function to coalesce a fragmented capsule in memory.
|
||||||
|
@ -16,6 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#include "Capsule.h"
|
#include "Capsule.h"
|
||||||
|
|
||||||
|
#ifdef MDE_CPU_IA32
|
||||||
//
|
//
|
||||||
// Global Descriptor Table (GDT)
|
// Global Descriptor Table (GDT)
|
||||||
//
|
//
|
||||||
@ -417,6 +418,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.
|
Checks for the presence of capsule descriptors.
|
||||||
Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...
|
Get capsule descriptors from variable CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...
|
||||||
@ -526,65 +588,6 @@ GetCapsuleDescriptors (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
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.
|
Gets the reserved long mode buffer.
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include "CommonHeader.h"
|
#include "CommonHeader.h"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user