IntelFsp2WrapperPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the IntelFsp2WrapperPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
This commit is contained in:
committed by
mergify[bot]
parent
111f2228dd
commit
7c7184e201
@ -25,7 +25,7 @@
|
||||
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI * ADD_PERFORMANCE_RECORDS)(
|
||||
(EFIAPI *ADD_PERFORMANCE_RECORDS)(
|
||||
IN CONST VOID *HobStart
|
||||
);
|
||||
|
||||
@ -84,26 +84,26 @@ OnPciEnumerationComplete (
|
||||
&Interface
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
|
||||
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_POST_PCIE_ENUM_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
if (Status != EFI_SUCCESS) {
|
||||
DEBUG((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_ERROR, "FSP NotifyPhase AfterPciEnumeration failed, status: 0x%x\n", Status));
|
||||
} else {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration Success.\n"));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase AfterPciEnumeration Success.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,22 +131,22 @@ OnReadyToBoot (
|
||||
gBS->CloseEvent (Event);
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
|
||||
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_READY_TO_BOOT_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
if (Status != EFI_SUCCESS) {
|
||||
DEBUG((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_ERROR, "FSP NotifyPhase ReadyToBoot failed, status: 0x%x\n", Status));
|
||||
} else {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot Success.\n"));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase ReadyToBoot Success.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -175,30 +175,31 @@ OnEndOfFirmware (
|
||||
gBS->CloseEvent (Event);
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;
|
||||
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_END_OF_FIRMWARE_NOTIFICATION | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
if (Status != EFI_SUCCESS) {
|
||||
DEBUG((DEBUG_ERROR, "FSP NotifyPhase EndOfFirmware failed, status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_ERROR, "FSP NotifyPhase EndOfFirmware failed, status: 0x%x\n", Status));
|
||||
} else {
|
||||
DEBUG((DEBUG_INFO, "FSP NotifyPhase EndOfFirmware Success.\n"));
|
||||
DEBUG ((DEBUG_INFO, "FSP NotifyPhase EndOfFirmware Success.\n"));
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gAddPerfRecordProtocolGuid,
|
||||
NULL,
|
||||
(VOID**) &AddPerfRecordInterface
|
||||
(VOID **)&AddPerfRecordInterface
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG((DEBUG_INFO, "gAddPerfRecordProtocolGuid - Locate protocol failed\n"));
|
||||
DEBUG ((DEBUG_INFO, "gAddPerfRecordProtocolGuid - Locate protocol failed\n"));
|
||||
return;
|
||||
} else {
|
||||
Hob.Raw = GetFirstGuidHob (&gFspHobGuid);
|
||||
@ -274,4 +275,3 @@ FspWrapperNotifyDxeEntryPoint (
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ RelocateImageUnder4GIfNeeded (
|
||||
&gEfiCallerIdGuid,
|
||||
EFI_SECTION_PE32,
|
||||
0,
|
||||
(VOID **) &Buffer,
|
||||
(VOID **)&Buffer,
|
||||
&BufferSize
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
@ -91,10 +91,11 @@ RelocateImageUnder4GIfNeeded (
|
||||
Status = PeCoffLoaderGetImageInfo (&ImageContext);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
if (ImageContext.SectionAlignment > EFI_PAGE_SIZE) {
|
||||
Pages = EFI_SIZE_TO_PAGES ((UINTN) (ImageContext.ImageSize + ImageContext.SectionAlignment));
|
||||
Pages = EFI_SIZE_TO_PAGES ((UINTN)(ImageContext.ImageSize + ImageContext.SectionAlignment));
|
||||
} else {
|
||||
Pages = EFI_SIZE_TO_PAGES ((UINTN) ImageContext.ImageSize);
|
||||
Pages = EFI_SIZE_TO_PAGES ((UINTN)ImageContext.ImageSize);
|
||||
}
|
||||
|
||||
FfsBuffer = 0xFFFFFFFF;
|
||||
Status = gBS->AllocatePages (
|
||||
AllocateMaxAddress,
|
||||
@ -132,7 +133,7 @@ RelocateImageUnder4GIfNeeded (
|
||||
InvalidateInstructionCacheRange ((VOID *)(UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.ImageSize);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "Loading driver at 0x%08x EntryPoint=0x%08x\n", (UINTN)ImageContext.ImageAddress, (UINTN)ImageContext.EntryPoint));
|
||||
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint)) (NewImageHandle, gST);
|
||||
Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)(ImageContext.EntryPoint))(NewImageHandle, gST);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "Error: Image at 0x%08x start failed: %r\n", ImageContext.ImageAddress, Status));
|
||||
gBS->FreePages (FfsBuffer, Pages);
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
@ -62,13 +61,13 @@ PeiFspMemoryInit (
|
||||
FspHobListPtr = NULL;
|
||||
FspmUpdDataPtr = NULL;
|
||||
|
||||
FspmHeaderPtr = (FSP_INFO_HEADER *) FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
|
||||
FspmHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
|
||||
DEBUG ((DEBUG_INFO, "FspmHeaderPtr - 0x%x\n", FspmHeaderPtr));
|
||||
if (FspmHeaderPtr == NULL) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (PcdGet32 (PcdFspmUpdDataAddress) == 0 && (FspmHeaderPtr->CfgRegionSize != 0) && (FspmHeaderPtr->CfgRegionOffset != 0)) {
|
||||
if ((PcdGet32 (PcdFspmUpdDataAddress) == 0) && (FspmHeaderPtr->CfgRegionSize != 0) && (FspmHeaderPtr->CfgRegionOffset != 0)) {
|
||||
//
|
||||
// Copy default FSP-M UPD data from Flash
|
||||
//
|
||||
@ -96,24 +95,24 @@ PeiFspMemoryInit (
|
||||
TimeStampCounterStart = AsmReadTsc ();
|
||||
Status = CallFspMemoryInit (FspmUpdDataPtr, &FspHobListPtr);
|
||||
// Create hobs after memory initialization and not in temp RAM. Hence passing the recorded timestamp here
|
||||
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, TimeStampCounterStart, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_MEMORY_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
DEBUG ((DEBUG_INFO, "Total time spent executing FspMemoryInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FspMemoryInitApi requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FspMemoryInitApi requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspMemoryInitApi(), Status = %r\n", Status));
|
||||
}
|
||||
DEBUG((DEBUG_INFO, "FspMemoryInit status: 0x%x\n", Status));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "FspMemoryInit status: 0x%x\n", Status));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = TestFspMemoryInitApiOutput (FspmUpdDataPtr, &FspHobListPtr);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -154,14 +153,14 @@ FspmWrapperInit (
|
||||
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *MeasurementExcludedFvPpi;
|
||||
EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList;
|
||||
|
||||
MeasurementExcludedFvPpi = AllocatePool (sizeof(*MeasurementExcludedFvPpi));
|
||||
ASSERT(MeasurementExcludedFvPpi != NULL);
|
||||
MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
|
||||
ASSERT (MeasurementExcludedFvPpi != NULL);
|
||||
MeasurementExcludedFvPpi->Count = 1;
|
||||
MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspmBaseAddress);
|
||||
MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspmBaseAddress))->FvLength;
|
||||
MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength;
|
||||
|
||||
MeasurementExcludedPpiList = AllocatePool (sizeof(*MeasurementExcludedPpiList));
|
||||
ASSERT(MeasurementExcludedPpiList != NULL);
|
||||
MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList));
|
||||
ASSERT (MeasurementExcludedPpiList != NULL);
|
||||
MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
|
||||
MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
|
||||
MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;
|
||||
@ -177,8 +176,8 @@ FspmWrapperInit (
|
||||
|
||||
PeiServicesInstallFvInfoPpi (
|
||||
NULL,
|
||||
(VOID *)(UINTN) PcdGet32 (PcdFspmBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspmBaseAddress))->FvLength,
|
||||
(VOID *)(UINTN)PcdGet32 (PcdFspmBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
@ -236,13 +235,21 @@ TcgPpiNotify (
|
||||
FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);
|
||||
|
||||
if ((FspMeasureMask & FSP_MEASURE_FSPT) != 0) {
|
||||
MeasureFspFirmwareBlob (0, "FSPT", PcdGet32(PcdFsptBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFsptBaseAddress))->FvLength);
|
||||
MeasureFspFirmwareBlob (
|
||||
0,
|
||||
"FSPT",
|
||||
PcdGet32 (PcdFsptBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFsptBaseAddress))->FvLength
|
||||
);
|
||||
}
|
||||
|
||||
if ((FspMeasureMask & FSP_MEASURE_FSPM) != 0) {
|
||||
MeasureFspFirmwareBlob (0, "FSPM", PcdGet32(PcdFspmBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspmBaseAddress))->FvLength);
|
||||
MeasureFspFirmwareBlob (
|
||||
0,
|
||||
"FSPM",
|
||||
PcdGet32 (PcdFspmBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspmBaseAddress))->FvLength
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
@ -265,7 +272,7 @@ FspmWrapperPeimEntryPoint (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG((DEBUG_INFO, "FspmWrapperPeimEntryPoint\n"));
|
||||
DEBUG ((DEBUG_INFO, "FspmWrapperPeimEntryPoint\n"));
|
||||
|
||||
Status = PeiServicesNotifyPpi (&mTcgPpiNotifyDesc);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@ -52,7 +52,7 @@ extern EFI_GUID gFspHobGuid;
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
S3EndOfPeiNotify(
|
||||
S3EndOfPeiNotify (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
|
||||
IN VOID *Ppi
|
||||
@ -76,7 +76,7 @@ EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
S3EndOfPeiNotify(
|
||||
S3EndOfPeiNotify (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
|
||||
IN VOID *Ppi
|
||||
@ -85,41 +85,41 @@ S3EndOfPeiNotify(
|
||||
NOTIFY_PHASE_PARAMS NotifyPhaseParams;
|
||||
EFI_STATUS Status;
|
||||
|
||||
DEBUG((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
|
||||
DEBUG ((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
NotifyPhaseParams.Phase = EnumInitPhaseEndOfFirmware;
|
||||
Status = CallFspNotifyPhase (&NotifyPhaseParams);
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware status: 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware status: 0x%x\n", Status));
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FSP S3NotifyPhase EndOfFirmware requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ FspSiliconInitDoneGetFspHobList (
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gFspHobGuid);
|
||||
if (GuidHob != NULL) {
|
||||
*FspHobList = *(VOID **)GET_GUID_HOB_DATA(GuidHob);
|
||||
*FspHobList = *(VOID **)GET_GUID_HOB_DATA (GuidHob);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
return EFI_NOT_FOUND;
|
||||
@ -213,7 +213,7 @@ FspsWrapperEndOfPeiNotify (
|
||||
// Install FspSiliconInitDonePpi so that any other driver can consume this info.
|
||||
//
|
||||
Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -283,7 +283,7 @@ PeiMemoryDiscoveredNotify (
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (PcdGet32 (PcdFspsUpdDataAddress) == 0 && (FspsHeaderPtr->CfgRegionSize != 0) && (FspsHeaderPtr->CfgRegionOffset != 0)) {
|
||||
if ((PcdGet32 (PcdFspsUpdDataAddress) == 0) && (FspsHeaderPtr->CfgRegionSize != 0) && (FspsHeaderPtr->CfgRegionOffset != 0)) {
|
||||
//
|
||||
// Copy default FSP-S UPD data from Flash
|
||||
//
|
||||
@ -299,23 +299,24 @@ PeiMemoryDiscoveredNotify (
|
||||
UpdateFspsUpdData ((VOID *)FspsUpdDataPtr);
|
||||
|
||||
TimeStampCounterStart = AsmReadTsc ();
|
||||
PERF_START_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
PERF_START_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_ENTRY);
|
||||
Status = CallFspSiliconInit ((VOID *)FspsUpdDataPtr);
|
||||
PERF_END_EX(&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
PERF_END_EX (&gFspApiPerformanceGuid, "EventRec", NULL, 0, FSP_STATUS_CODE_SILICON_INIT | FSP_STATUS_CODE_COMMON_CODE | FSP_STATUS_CODE_API_EXIT);
|
||||
DEBUG ((DEBUG_INFO, "Total time spent executing FspSiliconInitApi: %d millisecond\n", DivU64x32 (GetTimeInNanoSecond (AsmReadTsc () - TimeStampCounterStart), 1000000)));
|
||||
|
||||
//
|
||||
// Reset the system if FSP API returned FSP_STATUS_RESET_REQUIRED status
|
||||
//
|
||||
if ((Status >= FSP_STATUS_RESET_REQUIRED_COLD) && (Status <= FSP_STATUS_RESET_REQUIRED_8)) {
|
||||
DEBUG((DEBUG_INFO, "FspSiliconInitApi requested reset 0x%x\n", Status));
|
||||
DEBUG ((DEBUG_INFO, "FspSiliconInitApi requested reset 0x%x\n", Status));
|
||||
CallFspWrapperResetSystem ((UINT32)Status);
|
||||
}
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "ERROR - Failed to execute FspSiliconInitApi(), Status = %r\n", Status));
|
||||
}
|
||||
DEBUG((DEBUG_INFO, "FspSiliconInit status: 0x%x\n", Status));
|
||||
|
||||
DEBUG ((DEBUG_INFO, "FspSiliconInit status: 0x%x\n", Status));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
Status = TestFspSiliconInitApiOutput ((VOID *)NULL);
|
||||
@ -336,7 +337,7 @@ PeiMemoryDiscoveredNotify (
|
||||
// Install FspSiliconInitDonePpi so that any other driver can consume this info.
|
||||
//
|
||||
Status = PeiServicesInstallPpi (&mPeiFspSiliconInitDonePpi);
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
@ -386,14 +387,14 @@ FspsWrapperInitDispatchMode (
|
||||
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *MeasurementExcludedFvPpi;
|
||||
EFI_PEI_PPI_DESCRIPTOR *MeasurementExcludedPpiList;
|
||||
|
||||
MeasurementExcludedFvPpi = AllocatePool (sizeof(*MeasurementExcludedFvPpi));
|
||||
ASSERT(MeasurementExcludedFvPpi != NULL);
|
||||
MeasurementExcludedFvPpi = AllocatePool (sizeof (*MeasurementExcludedFvPpi));
|
||||
ASSERT (MeasurementExcludedFvPpi != NULL);
|
||||
MeasurementExcludedFvPpi->Count = 1;
|
||||
MeasurementExcludedFvPpi->Fv[0].FvBase = PcdGet32 (PcdFspsBaseAddress);
|
||||
MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspsBaseAddress))->FvLength;
|
||||
MeasurementExcludedFvPpi->Fv[0].FvLength = ((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength;
|
||||
|
||||
MeasurementExcludedPpiList = AllocatePool (sizeof(*MeasurementExcludedPpiList));
|
||||
ASSERT(MeasurementExcludedPpiList != NULL);
|
||||
MeasurementExcludedPpiList = AllocatePool (sizeof (*MeasurementExcludedPpiList));
|
||||
ASSERT (MeasurementExcludedPpiList != NULL);
|
||||
MeasurementExcludedPpiList->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
|
||||
MeasurementExcludedPpiList->Guid = &gEfiPeiFirmwareVolumeInfoMeasurementExcludedPpiGuid;
|
||||
MeasurementExcludedPpiList->Ppi = MeasurementExcludedFvPpi;
|
||||
@ -406,8 +407,8 @@ FspsWrapperInitDispatchMode (
|
||||
//
|
||||
PeiServicesInstallFvInfoPpi (
|
||||
NULL,
|
||||
(VOID *)(UINTN) PcdGet32 (PcdFspsBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspsBaseAddress))->FvLength,
|
||||
(VOID *)(UINTN)PcdGet32 (PcdFspsBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
@ -468,8 +469,12 @@ TcgPpiNotify (
|
||||
FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);
|
||||
|
||||
if ((FspMeasureMask & FSP_MEASURE_FSPS) != 0) {
|
||||
MeasureFspFirmwareBlob (0, "FSPS", PcdGet32(PcdFspsBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) PcdGet32 (PcdFspsBaseAddress))->FvLength);
|
||||
MeasureFspFirmwareBlob (
|
||||
0,
|
||||
"FSPS",
|
||||
PcdGet32 (PcdFspsBaseAddress),
|
||||
(UINT32)((EFI_FIRMWARE_VOLUME_HEADER *)(UINTN)PcdGet32 (PcdFspsBaseAddress))->FvLength
|
||||
);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@ -36,4 +36,5 @@ MeasureFspFirmwareBlob (
|
||||
IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase,
|
||||
IN UINT64 FirmwareBlobLength
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -56,13 +56,13 @@ TpmMeasureAndLogDataWithFlags (
|
||||
EDKII_TCG_PPI *TcgPpi;
|
||||
TCG_PCR_EVENT_HDR TcgEventHdr;
|
||||
|
||||
Status = PeiServicesLocatePpi(
|
||||
Status = PeiServicesLocatePpi (
|
||||
&gEdkiiTcgPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID**)&TcgPpi
|
||||
(VOID **)&TcgPpi
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -121,38 +121,39 @@ MeasureFspFirmwareBlobWithCfg (
|
||||
FvName = TpmMeasurementGetFvName (FirmwareBlobBase, FirmwareBlobLength);
|
||||
|
||||
if (((Description != NULL) || (FvName != NULL)) &&
|
||||
(PcdGet32(PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105)) {
|
||||
(PcdGet32 (PcdTcgPfpMeasurementRevision) >= TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2_REV_105))
|
||||
{
|
||||
if (Description != NULL) {
|
||||
AsciiSPrint((CHAR8*)FvBlob2.BlobDescription, sizeof(FvBlob2.BlobDescription), "%a", Description);
|
||||
AsciiSPrint((CHAR8*)UpdBlob2.BlobDescription, sizeof(UpdBlob2.BlobDescription), "%aUDP", Description);
|
||||
AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription), "%a", Description);
|
||||
AsciiSPrint ((CHAR8 *)UpdBlob2.BlobDescription, sizeof (UpdBlob2.BlobDescription), "%aUDP", Description);
|
||||
} else {
|
||||
AsciiSPrint((CHAR8*)FvBlob2.BlobDescription, sizeof(FvBlob2.BlobDescription), "Fv(%g)", FvName);
|
||||
AsciiSPrint((CHAR8*)UpdBlob2.BlobDescription, sizeof(UpdBlob2.BlobDescription), "(%g)UDP", FvName);
|
||||
AsciiSPrint ((CHAR8 *)FvBlob2.BlobDescription, sizeof (FvBlob2.BlobDescription), "Fv(%g)", FvName);
|
||||
AsciiSPrint ((CHAR8 *)UpdBlob2.BlobDescription, sizeof (UpdBlob2.BlobDescription), "(%g)UDP", FvName);
|
||||
}
|
||||
|
||||
FvBlob2.BlobDescriptionSize = sizeof(FvBlob2.BlobDescription);
|
||||
FvBlob2.BlobDescriptionSize = sizeof (FvBlob2.BlobDescription);
|
||||
FvBlob2.BlobBase = FirmwareBlobBase;
|
||||
FvBlob2.BlobLength = FirmwareBlobLength;
|
||||
FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB2;
|
||||
FvEventLog = &FvBlob2;
|
||||
FvEventLogSize = sizeof(FvBlob2);
|
||||
FvEventLogSize = sizeof (FvBlob2);
|
||||
|
||||
UpdBlob2.BlobDescriptionSize = sizeof(UpdBlob2.BlobDescription);
|
||||
UpdBlob2.BlobDescriptionSize = sizeof (UpdBlob2.BlobDescription);
|
||||
UpdBlob2.BlobBase = CfgRegionOffset;
|
||||
UpdBlob2.BlobLength = CfgRegionSize;
|
||||
UpdEventLog = &UpdBlob2;
|
||||
UpdEventLogSize = sizeof(UpdBlob2);
|
||||
UpdEventLogSize = sizeof (UpdBlob2);
|
||||
} else {
|
||||
FvBlob.BlobBase = FirmwareBlobBase;
|
||||
FvBlob.BlobLength = FirmwareBlobLength;
|
||||
FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB;
|
||||
FvEventLog = &FvBlob;
|
||||
FvEventLogSize = sizeof(FvBlob);
|
||||
FvEventLogSize = sizeof (FvBlob);
|
||||
|
||||
UpdBlob.BlobBase = CfgRegionOffset;
|
||||
UpdBlob.BlobLength = CfgRegionSize;
|
||||
UpdEventLog = &UpdBlob;
|
||||
UpdEventLogSize = sizeof(UpdBlob);
|
||||
UpdEventLogSize = sizeof (UpdBlob);
|
||||
}
|
||||
|
||||
/** Initialize a SHA hash context. **/
|
||||
@ -163,8 +164,8 @@ MeasureFspFirmwareBlobWithCfg (
|
||||
}
|
||||
|
||||
/** Hash FSP binary before UDP **/
|
||||
HashBase = (UINT8 *) (UINTN) FirmwareBlobBase;
|
||||
HashSize = (UINTN) CfgRegionOffset;
|
||||
HashBase = (UINT8 *)(UINTN)FirmwareBlobBase;
|
||||
HashSize = (UINTN)CfgRegionOffset;
|
||||
Status = HashUpdate (HashHandle, HashBase, HashSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "HashUpdate failed - %r\n", Status));
|
||||
@ -172,7 +173,7 @@ MeasureFspFirmwareBlobWithCfg (
|
||||
}
|
||||
|
||||
/** Hash FSP binary after UDP **/
|
||||
HashBase = (UINT8 *) (UINTN) FirmwareBlobBase + CfgRegionOffset + CfgRegionSize;
|
||||
HashBase = (UINT8 *)(UINTN)FirmwareBlobBase + CfgRegionOffset + CfgRegionSize;
|
||||
HashSize = (UINTN)(FirmwareBlobLength - CfgRegionOffset - CfgRegionSize);
|
||||
Status = HashUpdate (HashHandle, HashBase, HashSize);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -192,8 +193,8 @@ MeasureFspFirmwareBlobWithCfg (
|
||||
FvEventType,
|
||||
FvEventLog,
|
||||
FvEventLogSize,
|
||||
(UINT8 *) &DigestList,
|
||||
(UINTN) sizeof(DigestList),
|
||||
(UINT8 *)&DigestList,
|
||||
(UINTN)sizeof (DigestList),
|
||||
EDKII_TCG_PRE_HASH_LOG_ONLY
|
||||
);
|
||||
|
||||
@ -202,7 +203,7 @@ MeasureFspFirmwareBlobWithCfg (
|
||||
EV_PLATFORM_CONFIG_FLAGS,
|
||||
UpdEventLog,
|
||||
UpdEventLogSize,
|
||||
(UINT8 *) (UINTN) FirmwareBlobBase + CfgRegionOffset,
|
||||
(UINT8 *)(UINTN)FirmwareBlobBase + CfgRegionOffset,
|
||||
CfgRegionSize
|
||||
);
|
||||
|
||||
@ -236,13 +237,17 @@ MeasureFspFirmwareBlob (
|
||||
|
||||
FspMeasureMask = PcdGet32 (PcdFspMeasurementConfig);
|
||||
if ((FspMeasureMask & FSP_MEASURE_FSPUPD) != 0) {
|
||||
FspHeaderPtr = (FSP_INFO_HEADER *) FspFindFspHeader (FirmwareBlobBase);
|
||||
FspHeaderPtr = (FSP_INFO_HEADER *)FspFindFspHeader (FirmwareBlobBase);
|
||||
if (FspHeaderPtr != NULL) {
|
||||
return MeasureFspFirmwareBlobWithCfg(Description, FirmwareBlobBase, FirmwareBlobLength,
|
||||
FspHeaderPtr->CfgRegionOffset, FspHeaderPtr->CfgRegionSize);
|
||||
return MeasureFspFirmwareBlobWithCfg (
|
||||
Description,
|
||||
FirmwareBlobBase,
|
||||
FirmwareBlobLength,
|
||||
FspHeaderPtr->CfgRegionOffset,
|
||||
FspHeaderPtr->CfgRegionSize
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return MeasureFirmwareBlob (PcrIndex, Description, FirmwareBlobBase, FirmwareBlobLength);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ FspFindFspHeader (
|
||||
{
|
||||
UINT8 *CheckPointer;
|
||||
|
||||
CheckPointer = (UINT8 *) (UINTN) FlashFvFspBase;
|
||||
CheckPointer = (UINT8 *)(UINTN)FlashFvFspBase;
|
||||
|
||||
if (((EFI_FIRMWARE_VOLUME_HEADER *)CheckPointer)->Signature != EFI_FVH_SIGNATURE) {
|
||||
return NULL;
|
||||
@ -53,12 +53,11 @@ FspFindFspHeader (
|
||||
if (((EFI_FIRMWARE_VOLUME_HEADER *)CheckPointer)->ExtHeaderOffset != 0) {
|
||||
CheckPointer = CheckPointer + ((EFI_FIRMWARE_VOLUME_HEADER *)CheckPointer)->ExtHeaderOffset;
|
||||
CheckPointer = CheckPointer + ((EFI_FIRMWARE_VOLUME_EXT_HEADER *)CheckPointer)->ExtHeaderSize;
|
||||
CheckPointer = (UINT8 *) ALIGN_POINTER (CheckPointer, 8);
|
||||
CheckPointer = (UINT8 *)ALIGN_POINTER (CheckPointer, 8);
|
||||
} else {
|
||||
CheckPointer = CheckPointer + ((EFI_FIRMWARE_VOLUME_HEADER *)CheckPointer)->HeaderLength;
|
||||
}
|
||||
|
||||
|
||||
CheckPointer = CheckPointer + sizeof (EFI_FFS_FILE_HEADER);
|
||||
|
||||
if (((EFI_RAW_SECTION *)CheckPointer)->Type != EFI_SECTION_RAW) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(EFIAPI *FSP_FUNCTION) (
|
||||
(EFIAPI *FSP_FUNCTION)(
|
||||
IN VOID *Param1,
|
||||
IN VOID *Param2
|
||||
);
|
||||
@ -44,9 +44,8 @@ Execute32BitCode (
|
||||
FSP_FUNCTION EntryFunc;
|
||||
EFI_STATUS Status;
|
||||
|
||||
EntryFunc = (FSP_FUNCTION) (UINTN) (Function);
|
||||
EntryFunc = (FSP_FUNCTION)(UINTN)(Function);
|
||||
Status = EntryFunc ((VOID *)(UINTN)Param1, (VOID *)(UINTN)Param2);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -34,11 +34,21 @@ typedef union {
|
||||
#pragma pack()
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
|
||||
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0x0: reserve */
|
||||
{{0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 0, 1, 1, 0}}, /* 0x8: compatibility mode */
|
||||
{{0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 1, 0, 1, 0}}, /* 0x10: for long mode */
|
||||
{{0xFFFF, 0, 0, 0x3, 1, 0, 1, 0xF, 0, 0, 1, 1, 0}}, /* 0x18: data */
|
||||
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0x20: reserve */
|
||||
{
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
}, /* 0x0: reserve */
|
||||
{
|
||||
{ 0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 0, 1, 1, 0 }
|
||||
}, /* 0x8: compatibility mode */
|
||||
{
|
||||
{ 0xFFFF, 0, 0, 0xB, 1, 0, 1, 0xF, 0, 1, 0, 1, 0 }
|
||||
}, /* 0x10: for long mode */
|
||||
{
|
||||
{ 0xFFFF, 0, 0, 0x3, 1, 0, 1, 0xF, 0, 0, 1, 1, 0 }
|
||||
}, /* 0x18: data */
|
||||
{
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
|
||||
}, /* 0x20: reserve */
|
||||
};
|
||||
|
||||
//
|
||||
@ -46,8 +56,8 @@ GLOBAL_REMOVE_IF_UNREFERENCED IA32_GDT mGdtEntries[] = {
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = {
|
||||
sizeof (mGdtEntries) - 1,
|
||||
(UINTN) mGdtEntries
|
||||
};
|
||||
(UINTN)mGdtEntries
|
||||
};
|
||||
|
||||
/**
|
||||
Assembly function to transition from long mode to compatibility mode to execute 32-bit code and then transit back to
|
||||
@ -100,4 +110,3 @@ Execute32BitCode (
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -93,5 +93,5 @@ CallFspWrapperResetSystem (
|
||||
// Perform reset according to the type.
|
||||
//
|
||||
|
||||
CpuDeadLoop();
|
||||
CpuDeadLoop ();
|
||||
}
|
||||
|
@ -32,18 +32,21 @@ TestFspMemoryInitApiOutput (
|
||||
|
||||
Hob.Raw = (UINT8 *)(*(HobListPtr));
|
||||
while (TRUE) {
|
||||
if (END_OF_HOB_LIST(Hob) == TRUE) {
|
||||
DEBUG((DEBUG_INFO, "gFspBootLoaderTolumHobGuid not Found\n"));
|
||||
if (END_OF_HOB_LIST (Hob) == TRUE) {
|
||||
DEBUG ((DEBUG_INFO, "gFspBootLoaderTolumHobGuid not Found\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
if ((CompareGuid (&Hob.ResourceDescriptor->Owner, &gFspBootLoaderTolumHobGuid))) {
|
||||
DEBUG ((DEBUG_INFO, "gFspBootLoaderTolumHobGuid Found\n"));
|
||||
DEBUG ((DEBUG_INFO, "Fill Boot Loader reserved memory range with 0x5A for testing purpose\n"));
|
||||
SetMem ((VOID *)(UINTN)Hob.ResourceDescriptor->PhysicalStart, (UINTN)Hob.ResourceDescriptor->ResourceLength, 0x5A);
|
||||
break;
|
||||
}
|
||||
|
||||
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
|
@ -47,12 +47,13 @@ GetMemorySizeInMemoryTypeInformation (
|
||||
UINTN TempPageNum;
|
||||
|
||||
MemoryData = NULL;
|
||||
Status = (*PeiServices)->GetHobList ((CONST EFI_PEI_SERVICES**)PeiServices, (VOID **) &Hob.Raw);
|
||||
Status = (*PeiServices)->GetHobList ((CONST EFI_PEI_SERVICES **)PeiServices, (VOID **)&Hob.Raw);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
while (!END_OF_HOB_LIST (Hob)) {
|
||||
if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION &&
|
||||
CompareGuid (&Hob.Guid->Name, &gEfiMemoryTypeInformationGuid)) {
|
||||
MemoryData = (EFI_MEMORY_TYPE_INFORMATION *) (Hob.Raw + sizeof (EFI_HOB_GENERIC_HEADER) + sizeof (EFI_GUID));
|
||||
if ((Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) &&
|
||||
CompareGuid (&Hob.Guid->Name, &gEfiMemoryTypeInformationGuid))
|
||||
{
|
||||
MemoryData = (EFI_MEMORY_TYPE_INFORMATION *)(Hob.Raw + sizeof (EFI_HOB_GENERIC_HEADER) + sizeof (EFI_GUID));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -172,34 +173,37 @@ PostFspmHobProcess (
|
||||
// Report all the resource hob except the memory between 1M and 4G
|
||||
//
|
||||
Hob.Raw = (UINT8 *)(UINTN)FspHobList;
|
||||
DEBUG((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
|
||||
DEBUG ((DEBUG_INFO, "FspHobList - 0x%x\n", FspHobList));
|
||||
|
||||
while ((Hob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, Hob.Raw)) != NULL) {
|
||||
DEBUG((DEBUG_INFO, "\nResourceType: 0x%x\n", Hob.ResourceDescriptor->ResourceType));
|
||||
DEBUG ((DEBUG_INFO, "\nResourceType: 0x%x\n", Hob.ResourceDescriptor->ResourceType));
|
||||
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) ||
|
||||
(Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED)) {
|
||||
DEBUG((DEBUG_INFO, "ResourceAttribute: 0x%x\n", Hob.ResourceDescriptor->ResourceAttribute));
|
||||
DEBUG((DEBUG_INFO, "PhysicalStart: 0x%x\n", Hob.ResourceDescriptor->PhysicalStart));
|
||||
DEBUG((DEBUG_INFO, "ResourceLength: 0x%x\n", Hob.ResourceDescriptor->ResourceLength));
|
||||
DEBUG((DEBUG_INFO, "Owner: %g\n\n", &Hob.ResourceDescriptor->Owner));
|
||||
(Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED))
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "ResourceAttribute: 0x%x\n", Hob.ResourceDescriptor->ResourceAttribute));
|
||||
DEBUG ((DEBUG_INFO, "PhysicalStart: 0x%x\n", Hob.ResourceDescriptor->PhysicalStart));
|
||||
DEBUG ((DEBUG_INFO, "ResourceLength: 0x%x\n", Hob.ResourceDescriptor->ResourceLength));
|
||||
DEBUG ((DEBUG_INFO, "Owner: %g\n\n", &Hob.ResourceDescriptor->Owner));
|
||||
}
|
||||
|
||||
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) // Found the low memory length below 4G
|
||||
if ( (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) // Found the low memory length below 4G
|
||||
&& (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB)
|
||||
&& (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB)) {
|
||||
&& (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB))
|
||||
{
|
||||
LowMemorySize += Hob.ResourceDescriptor->ResourceLength;
|
||||
Hob.Raw = GET_NEXT_HOB (Hob);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) // Found the low memory length below 4G
|
||||
if ( (Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_MEMORY_RESERVED) // Found the low memory length below 4G
|
||||
&& (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB)
|
||||
&& (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB)
|
||||
&& (CompareGuid (&Hob.ResourceDescriptor->Owner, &gFspReservedMemoryResourceHobGuid))) {
|
||||
&& (CompareGuid (&Hob.ResourceDescriptor->Owner, &gFspReservedMemoryResourceHobGuid)))
|
||||
{
|
||||
FoundFspMemHob = TRUE;
|
||||
FspMemoryBase = Hob.ResourceDescriptor->PhysicalStart;
|
||||
FspMemorySize = Hob.ResourceDescriptor->ResourceLength;
|
||||
DEBUG((DEBUG_INFO, "Find fsp mem hob, base 0x%x, len 0x%x\n", FspMemoryBase, FspMemorySize));
|
||||
DEBUG ((DEBUG_INFO, "Find fsp mem hob, base 0x%x, len 0x%x\n", FspMemoryBase, FspMemorySize));
|
||||
}
|
||||
|
||||
//
|
||||
@ -216,13 +220,13 @@ PostFspmHobProcess (
|
||||
}
|
||||
|
||||
if (!FoundFspMemHob) {
|
||||
DEBUG((DEBUG_INFO, "Didn't find the fsp used memory information.\n"));
|
||||
//ASSERT(FALSE);
|
||||
DEBUG ((DEBUG_INFO, "Didn't find the fsp used memory information.\n"));
|
||||
// ASSERT(FALSE);
|
||||
}
|
||||
|
||||
DEBUG((DEBUG_INFO, "LowMemorySize: 0x%x.\n", LowMemorySize));
|
||||
DEBUG((DEBUG_INFO, "FspMemoryBase: 0x%x.\n", FspMemoryBase));
|
||||
DEBUG((DEBUG_INFO, "FspMemorySize: 0x%x.\n", FspMemorySize));
|
||||
DEBUG ((DEBUG_INFO, "LowMemorySize: 0x%x.\n", LowMemorySize));
|
||||
DEBUG ((DEBUG_INFO, "FspMemoryBase: 0x%x.\n", FspMemoryBase));
|
||||
DEBUG ((DEBUG_INFO, "FspMemorySize: 0x%x.\n", FspMemorySize));
|
||||
|
||||
if (BootMode == BOOT_ON_S3_RESUME) {
|
||||
BuildResourceDescriptorHob (
|
||||
@ -244,7 +248,7 @@ PostFspmHobProcess (
|
||||
S3PeiMemSize = 0;
|
||||
Status = GetS3MemoryInfo (&S3PeiMemSize, &S3PeiMemBase);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
DEBUG((DEBUG_INFO, "S3 memory %Xh - %Xh bytes\n", S3PeiMemBase, S3PeiMemSize));
|
||||
DEBUG ((DEBUG_INFO, "S3 memory %Xh - %Xh bytes\n", S3PeiMemBase, S3PeiMemSize));
|
||||
|
||||
//
|
||||
// Make sure Stack and PeiMemory are not overlap
|
||||
@ -257,7 +261,7 @@ PostFspmHobProcess (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
} else {
|
||||
PeiMemSize = GetPeiMemSize (PeiServices, BootMode);
|
||||
DEBUG((DEBUG_INFO, "PEI memory size = %Xh bytes\n", PeiMemSize));
|
||||
DEBUG ((DEBUG_INFO, "PEI memory size = %Xh bytes\n", PeiMemSize));
|
||||
|
||||
//
|
||||
// Capsule mode
|
||||
@ -270,7 +274,7 @@ PostFspmHobProcess (
|
||||
&gEfiPeiCapsulePpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &Capsule
|
||||
(VOID **)&Capsule
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -288,7 +292,7 @@ PostFspmHobProcess (
|
||||
}
|
||||
|
||||
RequiredMemSize = RetrieveRequiredMemorySize (PeiServices);
|
||||
DEBUG((DEBUG_INFO, "Required memory size = %Xh bytes\n", RequiredMemSize));
|
||||
DEBUG ((DEBUG_INFO, "Required memory size = %Xh bytes\n", RequiredMemSize));
|
||||
|
||||
//
|
||||
// Report the main memory
|
||||
@ -353,14 +357,15 @@ ProcessFspHobList (
|
||||
//
|
||||
// Skip FSP binary creates PcdDataBaseHobGuid
|
||||
//
|
||||
if (!CompareGuid(&FspHob.Guid->Name, &gPcdDataBaseHobGuid)) {
|
||||
if (!CompareGuid (&FspHob.Guid->Name, &gPcdDataBaseHobGuid)) {
|
||||
BuildGuidDataHob (
|
||||
&FspHob.Guid->Name,
|
||||
GET_GUID_HOB_DATA(FspHob),
|
||||
GET_GUID_HOB_DATA_SIZE(FspHob)
|
||||
GET_GUID_HOB_DATA (FspHob),
|
||||
GET_GUID_HOB_DATA_SIZE (FspHob)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
FspHob.Raw = GET_NEXT_HOB (FspHob);
|
||||
}
|
||||
}
|
||||
@ -392,5 +397,6 @@ PostFspsHobProcess (
|
||||
ASSERT (FspHobList != NULL);
|
||||
ProcessFspHobList (FspHobList);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@ -100,25 +100,25 @@ SecPlatformMain (
|
||||
{
|
||||
EFI_PEI_PPI_DESCRIPTOR *PpiList;
|
||||
|
||||
DEBUG((DEBUG_INFO, "SecPlatformMain\n"));
|
||||
DEBUG ((DEBUG_INFO, "SecPlatformMain\n"));
|
||||
|
||||
DEBUG((DEBUG_INFO, "BootFirmwareVolumeBase - 0x%x\n", SecCoreData->BootFirmwareVolumeBase));
|
||||
DEBUG((DEBUG_INFO, "BootFirmwareVolumeSize - 0x%x\n", SecCoreData->BootFirmwareVolumeSize));
|
||||
DEBUG((DEBUG_INFO, "TemporaryRamBase - 0x%x\n", SecCoreData->TemporaryRamBase));
|
||||
DEBUG((DEBUG_INFO, "TemporaryRamSize - 0x%x\n", SecCoreData->TemporaryRamSize));
|
||||
DEBUG((DEBUG_INFO, "PeiTemporaryRamBase - 0x%x\n", SecCoreData->PeiTemporaryRamBase));
|
||||
DEBUG((DEBUG_INFO, "PeiTemporaryRamSize - 0x%x\n", SecCoreData->PeiTemporaryRamSize));
|
||||
DEBUG((DEBUG_INFO, "StackBase - 0x%x\n", SecCoreData->StackBase));
|
||||
DEBUG((DEBUG_INFO, "StackSize - 0x%x\n", SecCoreData->StackSize));
|
||||
DEBUG ((DEBUG_INFO, "BootFirmwareVolumeBase - 0x%x\n", SecCoreData->BootFirmwareVolumeBase));
|
||||
DEBUG ((DEBUG_INFO, "BootFirmwareVolumeSize - 0x%x\n", SecCoreData->BootFirmwareVolumeSize));
|
||||
DEBUG ((DEBUG_INFO, "TemporaryRamBase - 0x%x\n", SecCoreData->TemporaryRamBase));
|
||||
DEBUG ((DEBUG_INFO, "TemporaryRamSize - 0x%x\n", SecCoreData->TemporaryRamSize));
|
||||
DEBUG ((DEBUG_INFO, "PeiTemporaryRamBase - 0x%x\n", SecCoreData->PeiTemporaryRamBase));
|
||||
DEBUG ((DEBUG_INFO, "PeiTemporaryRamSize - 0x%x\n", SecCoreData->PeiTemporaryRamSize));
|
||||
DEBUG ((DEBUG_INFO, "StackBase - 0x%x\n", SecCoreData->StackBase));
|
||||
DEBUG ((DEBUG_INFO, "StackSize - 0x%x\n", SecCoreData->StackSize));
|
||||
|
||||
InitializeApicTimer (0, (UINT32) -1, TRUE, 5);
|
||||
InitializeApicTimer (0, (UINT32)-1, TRUE, 5);
|
||||
|
||||
//
|
||||
// Use middle of Heap as temp buffer, it will be copied by caller.
|
||||
// Do not use Stack, because it will cause wrong calculation on stack by PeiCore
|
||||
//
|
||||
PpiList = (VOID *)((UINTN)SecCoreData->PeiTemporaryRamBase + (UINTN)SecCoreData->PeiTemporaryRamSize/2);
|
||||
CopyMem (PpiList, mPeiSecPlatformPpi, sizeof(mPeiSecPlatformPpi));
|
||||
CopyMem (PpiList, mPeiSecPlatformPpi, sizeof (mPeiSecPlatformPpi));
|
||||
|
||||
//
|
||||
// Patch TopOfTemporaryRamPpi
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
|
@ -53,7 +53,7 @@ SecGetPerformance (
|
||||
&gTopOfTemporaryRamPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &TopOfTemporaryRamPpi
|
||||
(VOID **)&TopOfTemporaryRamPpi
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
@ -72,12 +72,12 @@ SecGetPerformance (
|
||||
// | TSC[31:00] |
|
||||
// |--------------|
|
||||
//
|
||||
TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof(UINT32);
|
||||
TopOfTemporaryRam -= sizeof(UINT32) * 2;
|
||||
Count = *(UINT32 *) (UINTN) (TopOfTemporaryRam - sizeof (UINT32));
|
||||
TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof (UINT32);
|
||||
TopOfTemporaryRam -= sizeof (UINT32) * 2;
|
||||
Count = *(UINT32 *)(UINTN)(TopOfTemporaryRam - sizeof (UINT32));
|
||||
Size = Count * sizeof (UINT64);
|
||||
|
||||
Ticker = *(UINT64 *) (UINTN) (TopOfTemporaryRam - sizeof (UINT32) - Size - sizeof (UINT32) * 2);
|
||||
Ticker = *(UINT64 *)(UINTN)(TopOfTemporaryRam - sizeof (UINT32) - Size - sizeof (UINT32) * 2);
|
||||
Performance->ResetEnd = GetTimeInNanoSecond (Ticker);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
@ -47,7 +47,7 @@ SecPlatformInformation (
|
||||
&gTopOfTemporaryRamPpiGuid,
|
||||
0,
|
||||
NULL,
|
||||
(VOID **) &TopOfTemporaryRamPpi
|
||||
(VOID **)&TopOfTemporaryRamPpi
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
@ -60,17 +60,17 @@ SecPlatformInformation (
|
||||
// PlatformInformationRecord for output.
|
||||
//
|
||||
TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof (UINT32);
|
||||
TopOfTemporaryRam -= sizeof(UINT32) * 2;
|
||||
Count = *((UINT32 *)(UINTN) (TopOfTemporaryRam - sizeof (UINT32)));
|
||||
TopOfTemporaryRam -= sizeof (UINT32) * 2;
|
||||
Count = *((UINT32 *)(UINTN)(TopOfTemporaryRam - sizeof (UINT32)));
|
||||
Size = Count * sizeof (IA32_HANDOFF_STATUS);
|
||||
|
||||
if ((*StructureSize) < (UINT64) Size) {
|
||||
if ((*StructureSize) < (UINT64)Size) {
|
||||
*StructureSize = Size;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
|
||||
*StructureSize = Size;
|
||||
Bist = (UINT32 *) (TopOfTemporaryRam - sizeof (UINT32) - Size);
|
||||
Bist = (UINT32 *)(TopOfTemporaryRam - sizeof (UINT32) - Size);
|
||||
|
||||
CopyMem (PlatformInformationRecord, Bist, Size);
|
||||
|
||||
|
@ -33,8 +33,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = {
|
||||
//
|
||||
0x02,
|
||||
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||
},
|
||||
//
|
||||
// If platform does not support FSP spec 2.2 remove FSPT_ARCH_UPD structure.
|
||||
@ -58,4 +57,3 @@ GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = {
|
||||
FixedPcdGet32 (PcdFlashCodeCacheSize),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -27,17 +27,17 @@ SecPlatformDisableTemporaryMemory (
|
||||
VOID *TempRamExitParam;
|
||||
FSP_INFO_HEADER *FspHeader;
|
||||
|
||||
FspHeader = FspFindFspHeader (PcdGet32(PcdFspmBaseAddress));
|
||||
FspHeader = FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress));
|
||||
if (FspHeader == NULL) {
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
DEBUG((DEBUG_INFO, "SecPlatformDisableTemporaryMemory enter\n"));
|
||||
DEBUG ((DEBUG_INFO, "SecPlatformDisableTemporaryMemory enter\n"));
|
||||
|
||||
TempRamExitParam = UpdateTempRamExitParam ();
|
||||
Status = CallTempRamExit (TempRamExitParam);
|
||||
DEBUG((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));
|
||||
ASSERT_EFI_ERROR(Status);
|
||||
DEBUG ((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status));
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user