diff options
Diffstat (limited to 'UefiCpuPkg/SecCore')
-rw-r--r-- | UefiCpuPkg/SecCore/FindPeiCore.c | 63 | ||||
-rw-r--r-- | UefiCpuPkg/SecCore/SecBist.c | 95 | ||||
-rw-r--r-- | UefiCpuPkg/SecCore/SecMain.c | 126 | ||||
-rw-r--r-- | UefiCpuPkg/SecCore/SecMain.h | 28 |
4 files changed, 159 insertions, 153 deletions
diff --git a/UefiCpuPkg/SecCore/FindPeiCore.c b/UefiCpuPkg/SecCore/FindPeiCore.c index ee063a1020..97adb68138 100644 --- a/UefiCpuPkg/SecCore/FindPeiCore.c +++ b/UefiCpuPkg/SecCore/FindPeiCore.c @@ -21,35 +21,34 @@ EFI_STATUS
EFIAPI
FindImageBase (
- IN EFI_FIRMWARE_VOLUME_HEADER *FirmwareVolumePtr,
- IN EFI_FV_FILETYPE FileType,
- OUT EFI_PHYSICAL_ADDRESS *CoreImageBase
+ IN EFI_FIRMWARE_VOLUME_HEADER *FirmwareVolumePtr,
+ IN EFI_FV_FILETYPE FileType,
+ OUT EFI_PHYSICAL_ADDRESS *CoreImageBase
)
{
- EFI_PHYSICAL_ADDRESS CurrentAddress;
- EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume;
- EFI_FFS_FILE_HEADER *File;
- UINT32 Size;
- EFI_PHYSICAL_ADDRESS EndOfFile;
- EFI_COMMON_SECTION_HEADER *Section;
- EFI_PHYSICAL_ADDRESS EndOfSection;
+ EFI_PHYSICAL_ADDRESS CurrentAddress;
+ EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume;
+ EFI_FFS_FILE_HEADER *File;
+ UINT32 Size;
+ EFI_PHYSICAL_ADDRESS EndOfFile;
+ EFI_COMMON_SECTION_HEADER *Section;
+ EFI_PHYSICAL_ADDRESS EndOfSection;
*CoreImageBase = 0;
- CurrentAddress = (EFI_PHYSICAL_ADDRESS)(UINTN) FirmwareVolumePtr;
+ CurrentAddress = (EFI_PHYSICAL_ADDRESS)(UINTN)FirmwareVolumePtr;
EndOfFirmwareVolume = CurrentAddress + FirmwareVolumePtr->FvLength;
//
// Loop through the FFS files in the Boot Firmware Volume
//
for (EndOfFile = CurrentAddress + FirmwareVolumePtr->HeaderLength; ; ) {
-
CurrentAddress = (EndOfFile + 7) & 0xfffffffffffffff8ULL;
if (CurrentAddress > EndOfFirmwareVolume) {
return EFI_NOT_FOUND;
}
- File = (EFI_FFS_FILE_HEADER*)(UINTN) CurrentAddress;
+ File = (EFI_FFS_FILE_HEADER *)(UINTN)CurrentAddress;
if (IS_FFS_FILE2 (File)) {
Size = FFS_FILE2_SIZE (File);
if (Size <= 0x00FFFFFF) {
@@ -78,13 +77,14 @@ FindImageBase ( // Loop through the FFS file sections within the FFS file
//
if (IS_FFS_FILE2 (File)) {
- EndOfSection = (EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) File + sizeof (EFI_FFS_FILE_HEADER2));
+ EndOfSection = (EFI_PHYSICAL_ADDRESS)(UINTN)((UINT8 *)File + sizeof (EFI_FFS_FILE_HEADER2));
} else {
- EndOfSection = (EFI_PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) File + sizeof (EFI_FFS_FILE_HEADER));
+ EndOfSection = (EFI_PHYSICAL_ADDRESS)(UINTN)((UINT8 *)File + sizeof (EFI_FFS_FILE_HEADER));
}
- for (;;) {
+
+ for ( ; ;) {
CurrentAddress = (EndOfSection + 3) & 0xfffffffffffffffcULL;
- Section = (EFI_COMMON_SECTION_HEADER*)(UINTN) CurrentAddress;
+ Section = (EFI_COMMON_SECTION_HEADER *)(UINTN)CurrentAddress;
if (IS_SECTION2 (Section)) {
Size = SECTION2_SIZE (Section);
@@ -106,14 +106,15 @@ FindImageBase ( //
// Look for executable sections
//
- if (Section->Type == EFI_SECTION_PE32 || Section->Type == EFI_SECTION_TE) {
+ if ((Section->Type == EFI_SECTION_PE32) || (Section->Type == EFI_SECTION_TE)) {
if (File->Type == FileType) {
if (IS_SECTION2 (Section)) {
- *CoreImageBase = (PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER2));
+ *CoreImageBase = (PHYSICAL_ADDRESS)(UINTN)((UINT8 *)Section + sizeof (EFI_COMMON_SECTION_HEADER2));
} else {
- *CoreImageBase = (PHYSICAL_ADDRESS) (UINTN) ((UINT8 *) Section + sizeof (EFI_COMMON_SECTION_HEADER));
+ *CoreImageBase = (PHYSICAL_ADDRESS)(UINTN)((UINT8 *)Section + sizeof (EFI_COMMON_SECTION_HEADER));
}
}
+
break;
}
}
@@ -141,15 +142,15 @@ FindImageBase ( VOID
EFIAPI
FindAndReportEntryPoints (
- IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
- IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
- OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
+ IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
+ IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
+ OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
)
{
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS SecCoreImageBase;
- EFI_PHYSICAL_ADDRESS PeiCoreImageBase;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS SecCoreImageBase;
+ EFI_PHYSICAL_ADDRESS PeiCoreImageBase;
+ PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
//
// Find SEC Core image base
@@ -157,12 +158,12 @@ FindAndReportEntryPoints ( Status = FindImageBase (SecCoreFirmwareVolumePtr, EFI_FV_FILETYPE_SECURITY_CORE, &SecCoreImageBase);
ASSERT_EFI_ERROR (Status);
- ZeroMem ((VOID *) &ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT));
+ ZeroMem ((VOID *)&ImageContext, sizeof (PE_COFF_LOADER_IMAGE_CONTEXT));
//
// Report SEC Core debug information when remote debug is enabled
//
ImageContext.ImageAddress = SecCoreImageBase;
- ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);
+ ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *)(UINTN)ImageContext.ImageAddress);
PeCoffLoaderRelocateImageExtraAction (&ImageContext);
//
@@ -175,13 +176,13 @@ FindAndReportEntryPoints ( // Report PEI Core debug information when remote debug is enabled
//
ImageContext.ImageAddress = PeiCoreImageBase;
- ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID*) (UINTN) ImageContext.ImageAddress);
+ ImageContext.PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *)(UINTN)ImageContext.ImageAddress);
PeCoffLoaderRelocateImageExtraAction (&ImageContext);
//
// Find PEI Core entry point
//
- Status = PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase, (VOID**) PeiCoreEntryPoint);
+ Status = PeCoffLoaderGetEntryPoint ((VOID *)(UINTN)PeiCoreImageBase, (VOID **)PeiCoreEntryPoint);
if (EFI_ERROR (Status)) {
*PeiCoreEntryPoint = 0;
}
diff --git a/UefiCpuPkg/SecCore/SecBist.c b/UefiCpuPkg/SecCore/SecBist.c index 440140f565..cd2e340171 100644 --- a/UefiCpuPkg/SecCore/SecBist.c +++ b/UefiCpuPkg/SecCore/SecBist.c @@ -8,21 +8,21 @@ #include "SecMain.h"
-EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformation = {
+EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformation = {
SecPlatformInformationBist
};
-EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation = {
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiSecPlatformInformationPpiGuid,
&mSecPlatformInformation
};
-EFI_SEC_PLATFORM_INFORMATION2_PPI mSecPlatformInformation2 = {
+EFI_SEC_PLATFORM_INFORMATION2_PPI mSecPlatformInformation2 = {
SecPlatformInformation2Bist
};
-EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation2 = {
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation2 = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiSecPlatformInformation2PpiGuid,
&mSecPlatformInformation2
@@ -40,13 +40,13 @@ EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformation2 = { **/
EFI_STATUS
GetBistFromHob (
- IN OUT UINT64 *StructureSize,
- IN OUT VOID *StructureBuffer
+ IN OUT UINT64 *StructureSize,
+ IN OUT VOID *StructureBuffer
)
{
- EFI_HOB_GUID_TYPE *GuidHob;
- VOID *DataInHob;
- UINTN DataSize;
+ EFI_HOB_GUID_TYPE *GuidHob;
+ VOID *DataInHob;
+ UINTN DataSize;
GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
if (GuidHob == NULL) {
@@ -60,12 +60,12 @@ GetBistFromHob ( //
// return the information from BistHob
//
- if ((*StructureSize) < (UINT64) DataSize) {
- *StructureSize = (UINT64) DataSize;
+ if ((*StructureSize) < (UINT64)DataSize) {
+ *StructureSize = (UINT64)DataSize;
return EFI_BUFFER_TOO_SMALL;
}
- *StructureSize = (UINT64) DataSize;
+ *StructureSize = (UINT64)DataSize;
CopyMem (StructureBuffer, DataInHob, DataSize);
return EFI_SUCCESS;
}
@@ -84,9 +84,9 @@ GetBistFromHob ( EFI_STATUS
EFIAPI
SecPlatformInformationBist (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN OUT UINT64 *StructureSize,
- OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
)
{
return GetBistFromHob (StructureSize, PlatformInformationRecord);
@@ -107,9 +107,9 @@ SecPlatformInformationBist ( EFI_STATUS
EFIAPI
SecPlatformInformation2Bist (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN OUT UINT64 *StructureSize,
- OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
)
{
return GetBistFromHob (StructureSize, PlatformInformationRecord2);
@@ -133,11 +133,11 @@ SecPlatformInformation2Bist ( **/
EFI_STATUS
GetBistInfoFromPpi (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN CONST EFI_GUID *Guid,
- OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
- OUT VOID **BistInformationData,
- OUT UINT64 *BistInformationSize OPTIONAL
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN CONST EFI_GUID *Guid,
+ OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor,
+ OUT VOID **BistInformationData,
+ OUT UINT64 *BistInformationSize OPTIONAL
)
{
EFI_STATUS Status;
@@ -161,15 +161,15 @@ GetBistInfoFromPpi ( //
InformationSize = 0;
SecPlatformInformation2 = NULL;
- Status = SecPlatformInformation2Ppi->PlatformInformation2 (
- PeiServices,
- &InformationSize,
- SecPlatformInformation2
- );
+ Status = SecPlatformInformation2Ppi->PlatformInformation2 (
+ PeiServices,
+ &InformationSize,
+ SecPlatformInformation2
+ );
if (Status == EFI_BUFFER_TOO_SMALL) {
Status = PeiServicesAllocatePool (
- (UINTN) InformationSize,
- (VOID **) &SecPlatformInformation2
+ (UINTN)InformationSize,
+ (VOID **)&SecPlatformInformation2
);
if (Status == EFI_SUCCESS) {
//
@@ -185,6 +185,7 @@ GetBistInfoFromPpi ( if (BistInformationSize != NULL) {
*BistInformationSize = InformationSize;
}
+
return EFI_SUCCESS;
}
}
@@ -203,25 +204,25 @@ RepublishSecPlatformInformationPpi ( VOID
)
{
- EFI_STATUS Status;
- CONST EFI_PEI_SERVICES **PeiServices;
- UINT64 BistInformationSize;
- VOID *BistInformationData;
- EFI_PEI_PPI_DESCRIPTOR *SecInformationDescriptor;
+ EFI_STATUS Status;
+ CONST EFI_PEI_SERVICES **PeiServices;
+ UINT64 BistInformationSize;
+ VOID *BistInformationData;
+ EFI_PEI_PPI_DESCRIPTOR *SecInformationDescriptor;
PeiServices = GetPeiServicesTablePointer ();
- Status = GetBistInfoFromPpi (
- PeiServices,
- &gEfiSecPlatformInformation2PpiGuid,
- &SecInformationDescriptor,
- &BistInformationData,
- &BistInformationSize
- );
+ Status = GetBistInfoFromPpi (
+ PeiServices,
+ &gEfiSecPlatformInformation2PpiGuid,
+ &SecInformationDescriptor,
+ &BistInformationData,
+ &BistInformationSize
+ );
if (Status == EFI_SUCCESS) {
BuildGuidDataHob (
&gEfiCallerIdGuid,
BistInformationData,
- (UINTN) BistInformationSize
+ (UINTN)BistInformationSize
);
//
// The old SecPlatformInformation2 data is on temporary memory.
@@ -232,7 +233,9 @@ RepublishSecPlatformInformationPpi ( SecInformationDescriptor,
&mPeiSecPlatformInformation2
);
- } if (Status == EFI_NOT_FOUND) {
+ }
+
+ if (Status == EFI_NOT_FOUND) {
Status = GetBistInfoFromPpi (
PeiServices,
&gEfiSecPlatformInformationPpiGuid,
@@ -244,7 +247,7 @@ RepublishSecPlatformInformationPpi ( BuildGuidDataHob (
&gEfiCallerIdGuid,
BistInformationData,
- (UINTN) BistInformationSize
+ (UINTN)BistInformationSize
);
//
// The old SecPlatformInformation data is on temporary memory.
@@ -260,5 +263,5 @@ RepublishSecPlatformInformationPpi ( }
}
- ASSERT_EFI_ERROR(Status);
+ ASSERT_EFI_ERROR (Status);
}
diff --git a/UefiCpuPkg/SecCore/SecMain.c b/UefiCpuPkg/SecCore/SecMain.c index 2416c4ce56..a7526be9dd 100644 --- a/UefiCpuPkg/SecCore/SecMain.c +++ b/UefiCpuPkg/SecCore/SecMain.c @@ -8,20 +8,20 @@ #include "SecMain.h"
-EFI_PEI_TEMPORARY_RAM_DONE_PPI gSecTemporaryRamDonePpi = {
+EFI_PEI_TEMPORARY_RAM_DONE_PPI gSecTemporaryRamDonePpi = {
SecTemporaryRamDone
};
EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = { SecPlatformInformation };
-EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformationPpi[] = {
+EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformInformationPpi[] = {
{
//
// SecPerformance PPI notify descriptor.
//
EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK,
&gPeiSecPerformancePpiGuid,
- (VOID *) (UINTN) SecPerformancePpiCallBack
+ (VOID *)(UINTN)SecPerformancePpiCallBack
},
{
EFI_PEI_PPI_DESCRIPTOR_PPI,
@@ -47,12 +47,12 @@ MigrateGdt ( VOID
)
{
- EFI_STATUS Status;
- UINTN GdtBufferSize;
- IA32_DESCRIPTOR Gdtr;
- VOID *GdtBuffer;
+ EFI_STATUS Status;
+ UINTN GdtBufferSize;
+ IA32_DESCRIPTOR Gdtr;
+ VOID *GdtBuffer;
- AsmReadGdtr ((IA32_DESCRIPTOR *) &Gdtr);
+ AsmReadGdtr ((IA32_DESCRIPTOR *)&Gdtr);
GdtBufferSize = sizeof (IA32_SEGMENT_DESCRIPTOR) -1 + Gdtr.Limit + 1;
Status = PeiServicesAllocatePool (
@@ -65,8 +65,8 @@ MigrateGdt ( }
GdtBuffer = ALIGN_POINTER (GdtBuffer, sizeof (IA32_SEGMENT_DESCRIPTOR));
- CopyMem (GdtBuffer, (VOID *) Gdtr.Base, Gdtr.Limit + 1);
- Gdtr.Base = (UINTN) GdtBuffer;
+ CopyMem (GdtBuffer, (VOID *)Gdtr.Base, Gdtr.Limit + 1);
+ Gdtr.Base = (UINTN)GdtBuffer;
AsmWriteGdtr (&Gdtr);
return EFI_SUCCESS;
@@ -90,8 +90,8 @@ UINT64 mIdtEntryTemplate = 0xffff8e000010ffe4ULL; VOID
NORETURN
EFIAPI
-SecStartupPhase2(
- IN VOID *Context
+SecStartupPhase2 (
+ IN VOID *Context
);
/**
@@ -114,18 +114,18 @@ SecPerformancePpiCallBack ( IN VOID *Ppi
)
{
- EFI_STATUS Status;
- PEI_SEC_PERFORMANCE_PPI *SecPerf;
- FIRMWARE_SEC_PERFORMANCE Performance;
+ EFI_STATUS Status;
+ PEI_SEC_PERFORMANCE_PPI *SecPerf;
+ FIRMWARE_SEC_PERFORMANCE Performance;
- SecPerf = (PEI_SEC_PERFORMANCE_PPI *) Ppi;
- Status = SecPerf->GetPerformance ((CONST EFI_PEI_SERVICES **) PeiServices, SecPerf, &Performance);
+ SecPerf = (PEI_SEC_PERFORMANCE_PPI *)Ppi;
+ Status = SecPerf->GetPerformance ((CONST EFI_PEI_SERVICES **)PeiServices, SecPerf, &Performance);
if (!EFI_ERROR (Status)) {
BuildGuidDataHob (
&gEfiFirmwarePerformanceGuid,
&Performance,
sizeof (FIRMWARE_SEC_PERFORMANCE)
- );
+ );
DEBUG ((DEBUG_INFO, "FPDT: SEC Performance Hob ResetEnd = %ld\n", Performance.ResetEnd));
}
@@ -147,17 +147,17 @@ VOID NORETURN
EFIAPI
SecStartup (
- IN UINT32 SizeOfRam,
- IN UINT32 TempRamBase,
- IN VOID *BootFirmwareVolume
+ IN UINT32 SizeOfRam,
+ IN UINT32 TempRamBase,
+ IN VOID *BootFirmwareVolume
)
{
- EFI_SEC_PEI_HAND_OFF SecCoreData;
- IA32_DESCRIPTOR IdtDescriptor;
- SEC_IDT_TABLE IdtTableInStack;
- UINT32 Index;
- UINT32 PeiStackSize;
- EFI_STATUS Status;
+ EFI_SEC_PEI_HAND_OFF SecCoreData;
+ IA32_DESCRIPTOR IdtDescriptor;
+ SEC_IDT_TABLE IdtTableInStack;
+ UINT32 Index;
+ UINT32 PeiStackSize;
+ EFI_STATUS Status;
//
// Report Status Code to indicate entering SEC core
@@ -201,11 +201,11 @@ SecStartup ( // |-------------------|----> TempRamBase
IdtTableInStack.PeiService = 0;
- for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index ++) {
- CopyMem ((VOID*)&IdtTableInStack.IdtTable[Index], (VOID*)&mIdtEntryTemplate, sizeof (UINT64));
+ for (Index = 0; Index < SEC_IDT_ENTRY_COUNT; Index++) {
+ CopyMem ((VOID *)&IdtTableInStack.IdtTable[Index], (VOID *)&mIdtEntryTemplate, sizeof (UINT64));
}
- IdtDescriptor.Base = (UINTN) &IdtTableInStack.IdtTable;
+ IdtDescriptor.Base = (UINTN)&IdtTableInStack.IdtTable;
IdtDescriptor.Limit = (UINT16)(sizeof (IdtTableInStack.IdtTable) - 1);
AsmWriteIdtr (&IdtDescriptor);
@@ -219,14 +219,14 @@ SecStartup ( //
// Update the base address and length of Pei temporary memory
//
- SecCoreData.DataSize = (UINT16) sizeof (EFI_SEC_PEI_HAND_OFF);
+ SecCoreData.DataSize = (UINT16)sizeof (EFI_SEC_PEI_HAND_OFF);
SecCoreData.BootFirmwareVolumeBase = BootFirmwareVolume;
- SecCoreData.BootFirmwareVolumeSize = (UINTN)((EFI_FIRMWARE_VOLUME_HEADER *) BootFirmwareVolume)->FvLength;
- SecCoreData.TemporaryRamBase = (VOID*)(UINTN) TempRamBase;
+ SecCoreData.BootFirmwareVolumeSize = (UINTN)((EFI_FIRMWARE_VOLUME_HEADER *)BootFirmwareVolume)->FvLength;
+ SecCoreData.TemporaryRamBase = (VOID *)(UINTN)TempRamBase;
SecCoreData.TemporaryRamSize = SizeOfRam;
SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
SecCoreData.PeiTemporaryRamSize = SizeOfRam - PeiStackSize;
- SecCoreData.StackBase = (VOID*)(UINTN)(TempRamBase + SecCoreData.PeiTemporaryRamSize);
+ SecCoreData.StackBase = (VOID *)(UINTN)(TempRamBase + SecCoreData.PeiTemporaryRamSize);
SecCoreData.StackSize = PeiStackSize;
//
@@ -253,18 +253,18 @@ SecStartup ( VOID
NORETURN
EFIAPI
-SecStartupPhase2(
- IN VOID *Context
+SecStartupPhase2 (
+ IN VOID *Context
)
{
- EFI_SEC_PEI_HAND_OFF *SecCoreData;
- EFI_PEI_PPI_DESCRIPTOR *PpiList;
- UINT32 Index;
- EFI_PEI_PPI_DESCRIPTOR *AllSecPpiList;
- EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;
+ EFI_SEC_PEI_HAND_OFF *SecCoreData;
+ EFI_PEI_PPI_DESCRIPTOR *PpiList;
+ UINT32 Index;
+ EFI_PEI_PPI_DESCRIPTOR *AllSecPpiList;
+ EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;
PeiCoreEntryPoint = NULL;
- SecCoreData = (EFI_SEC_PEI_HAND_OFF *) Context;
+ SecCoreData = (EFI_SEC_PEI_HAND_OFF *)Context;
//
// Perform platform specific initialization before entering PeiCore.
@@ -278,14 +278,15 @@ SecStartupPhase2( Index = 0;
do {
if (CompareGuid (PpiList[Index].Guid, &gEfiPeiCoreFvLocationPpiGuid) &&
- (((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation != 0)
- ) {
+ (((EFI_PEI_CORE_FV_LOCATION_PPI *)PpiList[Index].Ppi)->PeiCoreFvLocation != 0)
+ )
+ {
//
// In this case, SecCore is in BFV but PeiCore is in another FV reported by PPI.
//
FindAndReportEntryPoints (
- (EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase,
- (EFI_FIRMWARE_VOLUME_HEADER *) ((EFI_PEI_CORE_FV_LOCATION_PPI *) PpiList[Index].Ppi)->PeiCoreFvLocation,
+ (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolumeBase,
+ (EFI_FIRMWARE_VOLUME_HEADER *)((EFI_PEI_CORE_FV_LOCATION_PPI *)PpiList[Index].Ppi)->PeiCoreFvLocation,
&PeiCoreEntryPoint
);
if (PeiCoreEntryPoint != NULL) {
@@ -299,6 +300,7 @@ SecStartupPhase2( }
} while ((PpiList[Index++].Flags & EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST) != EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
}
+
//
// If EFI_PEI_CORE_FV_LOCATION_PPI not found, try to locate PeiCore from BFV.
//
@@ -307,8 +309,8 @@ SecStartupPhase2( // Both SecCore and PeiCore are in BFV.
//
FindAndReportEntryPoints (
- (EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase,
- (EFI_FIRMWARE_VOLUME_HEADER *) SecCoreData->BootFirmwareVolumeBase,
+ (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolumeBase,
+ (EFI_FIRMWARE_VOLUME_HEADER *)SecCoreData->BootFirmwareVolumeBase,
&PeiCoreEntryPoint
);
if (PeiCoreEntryPoint == NULL) {
@@ -317,13 +319,13 @@ SecStartupPhase2( }
if (PpiList != NULL) {
- AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *) SecCoreData->PeiTemporaryRamBase;
+ AllSecPpiList = (EFI_PEI_PPI_DESCRIPTOR *)SecCoreData->PeiTemporaryRamBase;
//
// Remove the terminal flag from the terminal PPI
//
CopyMem (AllSecPpiList, mPeiSecPlatformInformationPpi, sizeof (mPeiSecPlatformInformationPpi));
- Index = sizeof (mPeiSecPlatformInformationPpi) / sizeof (EFI_PEI_PPI_DESCRIPTOR) - 1;
+ Index = sizeof (mPeiSecPlatformInformationPpi) / sizeof (EFI_PEI_PPI_DESCRIPTOR) - 1;
AllSecPpiList[Index].Flags = AllSecPpiList[Index].Flags & (~EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST);
//
@@ -339,7 +341,7 @@ SecStartupPhase2( //
// Add the terminal PPI
//
- CopyMem (&AllSecPpiList[Index ++], PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ CopyMem (&AllSecPpiList[Index++], PpiList, sizeof (EFI_PEI_PPI_DESCRIPTOR));
//
// Set PpiList to the total PPI
@@ -350,13 +352,13 @@ SecStartupPhase2( // Adjust PEI TEMP RAM Range.
//
ASSERT (SecCoreData->PeiTemporaryRamSize > Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
- SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN) SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
+ SecCoreData->PeiTemporaryRamBase = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + Index * sizeof (EFI_PEI_PPI_DESCRIPTOR));
SecCoreData->PeiTemporaryRamSize = SecCoreData->PeiTemporaryRamSize - Index * sizeof (EFI_PEI_PPI_DESCRIPTOR);
//
// Adjust the Base and Size to be 8-byte aligned as HOB which has 8byte aligned requirement
// will be built based on them in PEI phase.
//
- SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07);
+ SecCoreData->PeiTemporaryRamBase = (VOID *)(((UINTN)SecCoreData->PeiTemporaryRamBase + 7) & ~0x07);
SecCoreData->PeiTemporaryRamSize &= ~(UINTN)0x07;
} else {
//
@@ -370,7 +372,7 @@ SecStartupPhase2( "%a() Stack Base: 0x%p, Stack Size: 0x%x\n",
__FUNCTION__,
SecCoreData->StackBase,
- (UINT32) SecCoreData->StackSize
+ (UINT32)SecCoreData->StackSize
));
//
@@ -385,7 +387,7 @@ SecStartupPhase2( // Transfer the control to the PEI core
//
ASSERT (PeiCoreEntryPoint != NULL);
- (*PeiCoreEntryPoint) (SecCoreData, PpiList);
+ (*PeiCoreEntryPoint)(SecCoreData, PpiList);
//
// Should not come here.
@@ -407,12 +409,12 @@ SecTemporaryRamDone ( VOID
)
{
- EFI_STATUS Status;
- EFI_STATUS Status2;
- UINTN Index;
- BOOLEAN State;
- EFI_PEI_PPI_DESCRIPTOR *PeiPpiDescriptor;
- REPUBLISH_SEC_PPI_PPI *RepublishSecPpiPpi;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ UINTN Index;
+ BOOLEAN State;
+ EFI_PEI_PPI_DESCRIPTOR *PeiPpiDescriptor;
+ REPUBLISH_SEC_PPI_PPI *RepublishSecPpiPpi;
//
// Republish Sec Platform Information(2) PPI
@@ -427,7 +429,7 @@ SecTemporaryRamDone ( &gRepublishSecPpiPpiGuid,
Index,
&PeiPpiDescriptor,
- (VOID **) &RepublishSecPpiPpi
+ (VOID **)&RepublishSecPpiPpi
);
if (!EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "Calling RepublishSecPpi instance %d.\n", Index));
diff --git a/UefiCpuPkg/SecCore/SecMain.h b/UefiCpuPkg/SecCore/SecMain.h index e20bcf8653..029bee3e7e 100644 --- a/UefiCpuPkg/SecCore/SecMain.h +++ b/UefiCpuPkg/SecCore/SecMain.h @@ -42,8 +42,8 @@ typedef struct _SEC_IDT_TABLE { // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
// EFI_PEI_SERVICES**
//
- UINT64 PeiService;
- UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];
+ UINT64 PeiService;
+ UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];
} SEC_IDT_TABLE;
/**
@@ -73,9 +73,9 @@ VOID NORETURN
EFIAPI
SecStartup (
- IN UINT32 SizeOfRam,
- IN UINT32 TempRamBase,
- IN VOID *BootFirmwareVolume
+ IN UINT32 SizeOfRam,
+ IN UINT32 TempRamBase,
+ IN VOID *BootFirmwareVolume
);
/**
@@ -92,9 +92,9 @@ SecStartup ( VOID
EFIAPI
FindAndReportEntryPoints (
- IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
- IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
- OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
+ IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
+ IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
+ OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
);
/**
@@ -123,9 +123,9 @@ ProcessLibraryConstructorList ( EFI_STATUS
EFIAPI
SecPlatformInformationBist (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN OUT UINT64 *StructureSize,
- OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
);
/**
@@ -143,9 +143,9 @@ SecPlatformInformationBist ( EFI_STATUS
EFIAPI
SecPlatformInformation2Bist (
- IN CONST EFI_PEI_SERVICES **PeiServices,
- IN OUT UINT64 *StructureSize,
- OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
+ IN CONST EFI_PEI_SERVICES **PeiServices,
+ IN OUT UINT64 *StructureSize,
+ OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
);
/**
|