From 7c7184e201a90a1d2376e615e55e3f4074731468 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Sun, 5 Dec 2021 14:54:00 -0800 Subject: 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 Cc: Leif Lindholm Cc: Michael D Kinney Signed-off-by: Michael Kubacki Reviewed-by: Chasel Chiu --- .../BaseFspMeasurementLib/FspMeasurementLib.c | 145 +++++++-------- .../BaseFspWrapperApiLib/FspWrapperApiLib.c | 67 ++++--- .../BaseFspWrapperApiLib/IA32/DispatchExecute.c | 15 +- .../BaseFspWrapperApiLib/X64/DispatchExecute.c | 63 ++++--- .../FspWrapperApiTestNull.c | 8 +- .../FspWrapperPlatformLibSample.c | 12 +- .../PeiFspWrapperApiTestLib/FspWrapperApiTest.c | 17 +- .../FspWrapperHobProcessLibSample.c | 194 +++++++++++---------- .../FspWrapperPlatformSecLibSample.c | 32 ++-- .../SecFspWrapperPlatformSecLibSample/Ia32/Fsp.h | 34 ++-- .../PlatformInit.c | 7 +- .../SecGetPerformance.c | 12 +- .../SecPlatformInformation.c | 22 +-- .../SecRamInitData.c | 14 +- .../SecTempRamDone.c | 20 +-- 15 files changed, 340 insertions(+), 322 deletions(-) (limited to 'IntelFsp2WrapperPkg/Library') diff --git a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c index 0fe0606a6d..2c017a4250 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspMeasurementLib/FspMeasurementLib.c @@ -43,26 +43,26 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_STATUS EFIAPI TpmMeasureAndLogDataWithFlags ( - IN UINT32 PcrIndex, - IN UINT32 EventType, - IN VOID *EventLog, - IN UINT32 LogLen, - IN VOID *HashData, - IN UINT64 HashDataLen, - IN UINT64 Flags + IN UINT32 PcrIndex, + IN UINT32 EventType, + IN VOID *EventLog, + IN UINT32 LogLen, + IN VOID *HashData, + IN UINT64 HashDataLen, + IN UINT64 Flags ) { - EFI_STATUS Status; - EDKII_TCG_PPI *TcgPpi; - TCG_PCR_EVENT_HDR TcgEventHdr; + EFI_STATUS Status; + 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; } @@ -99,60 +99,61 @@ STATIC EFI_STATUS EFIAPI MeasureFspFirmwareBlobWithCfg ( - IN CHAR8 *Description OPTIONAL, - IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, - IN UINT64 FirmwareBlobLength, - IN UINT32 CfgRegionOffset, - IN UINT32 CfgRegionSize + IN CHAR8 *Description OPTIONAL, + IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, + IN UINT64 FirmwareBlobLength, + IN UINT32 CfgRegionOffset, + IN UINT32 CfgRegionSize ) { - EFI_PLATFORM_FIRMWARE_BLOB FvBlob, UpdBlob; - PLATFORM_FIRMWARE_BLOB2_STRUCT FvBlob2, UpdBlob2; - VOID *FvName; - UINT32 FvEventType; - VOID *FvEventLog, *UpdEventLog; - UINT32 FvEventLogSize, UpdEventLogSize; - EFI_STATUS Status; - HASH_HANDLE HashHandle; - UINT8 *HashBase; - UINTN HashSize; - TPML_DIGEST_VALUES DigestList; + EFI_PLATFORM_FIRMWARE_BLOB FvBlob, UpdBlob; + PLATFORM_FIRMWARE_BLOB2_STRUCT FvBlob2, UpdBlob2; + VOID *FvName; + UINT32 FvEventType; + VOID *FvEventLog, *UpdEventLog; + UINT32 FvEventLogSize, UpdEventLogSize; + EFI_STATUS Status; + HASH_HANDLE HashHandle; + UINT8 *HashBase; + UINTN HashSize; + TPML_DIGEST_VALUES DigestList; 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); - } 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), "%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); } - FvBlob2.BlobDescriptionSize = sizeof(FvBlob2.BlobDescription); - FvBlob2.BlobBase = FirmwareBlobBase; - FvBlob2.BlobLength = FirmwareBlobLength; - FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB2; - FvEventLog = &FvBlob2; - FvEventLogSize = sizeof(FvBlob2); - - UpdBlob2.BlobDescriptionSize = sizeof(UpdBlob2.BlobDescription); - UpdBlob2.BlobBase = CfgRegionOffset; - UpdBlob2.BlobLength = CfgRegionSize; - UpdEventLog = &UpdBlob2; - UpdEventLogSize = sizeof(UpdBlob2); + FvBlob2.BlobDescriptionSize = sizeof (FvBlob2.BlobDescription); + FvBlob2.BlobBase = FirmwareBlobBase; + FvBlob2.BlobLength = FirmwareBlobLength; + FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB2; + FvEventLog = &FvBlob2; + FvEventLogSize = sizeof (FvBlob2); + + UpdBlob2.BlobDescriptionSize = sizeof (UpdBlob2.BlobDescription); + UpdBlob2.BlobBase = CfgRegionOffset; + UpdBlob2.BlobLength = CfgRegionSize; + UpdEventLog = &UpdBlob2; + UpdEventLogSize = sizeof (UpdBlob2); } else { - FvBlob.BlobBase = FirmwareBlobBase; + FvBlob.BlobBase = FirmwareBlobBase; FvBlob.BlobLength = FirmwareBlobLength; - FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB; - FvEventLog = &FvBlob; - FvEventLogSize = sizeof(FvBlob); + FvEventType = EV_EFI_PLATFORM_FIRMWARE_BLOB; + FvEventLog = &FvBlob; + FvEventLogSize = sizeof (FvBlob); - UpdBlob.BlobBase = CfgRegionOffset; + UpdBlob.BlobBase = CfgRegionOffset; UpdBlob.BlobLength = CfgRegionSize; - UpdEventLog = &UpdBlob; - UpdEventLogSize = sizeof(UpdBlob); + UpdEventLog = &UpdBlob; + UpdEventLogSize = sizeof (UpdBlob); } /** Initialize a SHA hash context. **/ @@ -163,18 +164,18 @@ MeasureFspFirmwareBlobWithCfg ( } /** Hash FSP binary before UDP **/ - HashBase = (UINT8 *) (UINTN) FirmwareBlobBase; - HashSize = (UINTN) CfgRegionOffset; - Status = HashUpdate (HashHandle, HashBase, HashSize); + HashBase = (UINT8 *)(UINTN)FirmwareBlobBase; + HashSize = (UINTN)CfgRegionOffset; + Status = HashUpdate (HashHandle, HashBase, HashSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HashUpdate failed - %r\n", Status)); return Status; } /** 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); + Status = HashUpdate (HashHandle, HashBase, HashSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "HashUpdate failed - %r\n", Status)); return 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 ); @@ -225,10 +226,10 @@ MeasureFspFirmwareBlobWithCfg ( EFI_STATUS EFIAPI MeasureFspFirmwareBlob ( - IN UINT32 PcrIndex, - IN CHAR8 *Description OPTIONAL, - IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, - IN UINT64 FirmwareBlobLength + IN UINT32 PcrIndex, + IN CHAR8 *Description OPTIONAL, + IN EFI_PHYSICAL_ADDRESS FirmwareBlobBase, + IN UINT64 FirmwareBlobLength ) { UINT32 FspMeasureMask; @@ -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); } - diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c index 2732920914..67faad927c 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/FspWrapperApiLib.c @@ -24,9 +24,9 @@ **/ EFI_STATUS Execute32BitCode ( - IN UINT64 Function, - IN UINT64 Param1, - IN UINT64 Param2 + IN UINT64 Function, + IN UINT64 Param1, + IN UINT64 Param2 ); /** @@ -42,9 +42,9 @@ FspFindFspHeader ( IN EFI_PHYSICAL_ADDRESS FlashFvFspBase ) { - UINT8 *CheckPointer; + 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) { @@ -80,13 +79,13 @@ FspFindFspHeader ( EFI_STATUS EFIAPI CallFspNotifyPhase ( - IN NOTIFY_PHASE_PARAMS *NotifyPhaseParams + IN NOTIFY_PHASE_PARAMS *NotifyPhaseParams ) { - FSP_INFO_HEADER *FspHeader; - FSP_NOTIFY_PHASE NotifyPhaseApi; - EFI_STATUS Status; - BOOLEAN InterruptState; + FSP_INFO_HEADER *FspHeader; + FSP_NOTIFY_PHASE NotifyPhaseApi; + EFI_STATUS Status; + BOOLEAN InterruptState; FspHeader = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress)); if (FspHeader == NULL) { @@ -95,7 +94,7 @@ CallFspNotifyPhase ( NotifyPhaseApi = (FSP_NOTIFY_PHASE)((UINTN)FspHeader->ImageBase + FspHeader->NotifyPhaseEntryOffset); InterruptState = SaveAndDisableInterrupts (); - Status = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams, (UINTN)NULL); + Status = Execute32BitCode ((UINTN)NotifyPhaseApi, (UINTN)NotifyPhaseParams, (UINTN)NULL); SetInterruptState (InterruptState); return Status; @@ -112,14 +111,14 @@ CallFspNotifyPhase ( EFI_STATUS EFIAPI CallFspMemoryInit ( - IN VOID *FspmUpdDataPtr, - OUT VOID **HobListPtr + IN VOID *FspmUpdDataPtr, + OUT VOID **HobListPtr ) { - FSP_INFO_HEADER *FspHeader; - FSP_MEMORY_INIT FspMemoryInitApi; - EFI_STATUS Status; - BOOLEAN InterruptState; + FSP_INFO_HEADER *FspHeader; + FSP_MEMORY_INIT FspMemoryInitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; FspHeader = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress)); if (FspHeader == NULL) { @@ -127,8 +126,8 @@ CallFspMemoryInit ( } FspMemoryInitApi = (FSP_MEMORY_INIT)((UINTN)FspHeader->ImageBase + FspHeader->FspMemoryInitEntryOffset); - InterruptState = SaveAndDisableInterrupts (); - Status = Execute32BitCode ((UINTN)FspMemoryInitApi, (UINTN)FspmUpdDataPtr, (UINTN)HobListPtr); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)FspMemoryInitApi, (UINTN)FspmUpdDataPtr, (UINTN)HobListPtr); SetInterruptState (InterruptState); return Status; @@ -144,13 +143,13 @@ CallFspMemoryInit ( EFI_STATUS EFIAPI CallTempRamExit ( - IN VOID *TempRamExitParam + IN VOID *TempRamExitParam ) { - FSP_INFO_HEADER *FspHeader; - FSP_TEMP_RAM_EXIT TempRamExitApi; - EFI_STATUS Status; - BOOLEAN InterruptState; + FSP_INFO_HEADER *FspHeader; + FSP_TEMP_RAM_EXIT TempRamExitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; FspHeader = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspmBaseAddress)); if (FspHeader == NULL) { @@ -159,7 +158,7 @@ CallTempRamExit ( TempRamExitApi = (FSP_TEMP_RAM_EXIT)((UINTN)FspHeader->ImageBase + FspHeader->TempRamExitEntryOffset); InterruptState = SaveAndDisableInterrupts (); - Status = Execute32BitCode ((UINTN)TempRamExitApi, (UINTN)TempRamExitParam, (UINTN)NULL); + Status = Execute32BitCode ((UINTN)TempRamExitApi, (UINTN)TempRamExitParam, (UINTN)NULL); SetInterruptState (InterruptState); return Status; @@ -175,13 +174,13 @@ CallTempRamExit ( EFI_STATUS EFIAPI CallFspSiliconInit ( - IN VOID *FspsUpdDataPtr + IN VOID *FspsUpdDataPtr ) { - FSP_INFO_HEADER *FspHeader; - FSP_SILICON_INIT FspSiliconInitApi; - EFI_STATUS Status; - BOOLEAN InterruptState; + FSP_INFO_HEADER *FspHeader; + FSP_SILICON_INIT FspSiliconInitApi; + EFI_STATUS Status; + BOOLEAN InterruptState; FspHeader = (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspsBaseAddress)); if (FspHeader == NULL) { @@ -189,8 +188,8 @@ CallFspSiliconInit ( } FspSiliconInitApi = (FSP_SILICON_INIT)((UINTN)FspHeader->ImageBase + FspHeader->FspSiliconInitEntryOffset); - InterruptState = SaveAndDisableInterrupts (); - Status = Execute32BitCode ((UINTN)FspSiliconInitApi, (UINTN)FspsUpdDataPtr, (UINTN)NULL); + InterruptState = SaveAndDisableInterrupts (); + Status = Execute32BitCode ((UINTN)FspSiliconInitApi, (UINTN)FspsUpdDataPtr, (UINTN)NULL); SetInterruptState (InterruptState); return Status; diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/IA32/DispatchExecute.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/IA32/DispatchExecute.c index 3b3472e5db..4f6a8dd1a7 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/IA32/DispatchExecute.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/IA32/DispatchExecute.c @@ -19,7 +19,7 @@ **/ typedef EFI_STATUS -(EFIAPI *FSP_FUNCTION) ( +(EFIAPI *FSP_FUNCTION)( IN VOID *Param1, IN VOID *Param2 ); @@ -36,17 +36,16 @@ EFI_STATUS **/ EFI_STATUS Execute32BitCode ( - IN UINT64 Function, - IN UINT64 Param1, - IN UINT64 Param2 + IN UINT64 Function, + IN UINT64 Param1, + IN UINT64 Param2 ) { - FSP_FUNCTION EntryFunc; - EFI_STATUS Status; + 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; } - diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/DispatchExecute.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/DispatchExecute.c index 001fc6f8f1..2ee5bc3dd4 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/DispatchExecute.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiLib/X64/DispatchExecute.c @@ -15,39 +15,49 @@ #pragma pack(1) typedef union { struct { - UINT32 LimitLow : 16; - UINT32 BaseLow : 16; - UINT32 BaseMid : 8; - UINT32 Type : 4; - UINT32 System : 1; - UINT32 Dpl : 2; - UINT32 Present : 1; - UINT32 LimitHigh : 4; - UINT32 Software : 1; - UINT32 Reserved : 1; - UINT32 DefaultSize : 1; - UINT32 Granularity : 1; - UINT32 BaseHigh : 8; + UINT32 LimitLow : 16; + UINT32 BaseLow : 16; + UINT32 BaseMid : 8; + UINT32 Type : 4; + UINT32 System : 1; + UINT32 Dpl : 2; + UINT32 Present : 1; + UINT32 LimitHigh : 4; + UINT32 Software : 1; + UINT32 Reserved : 1; + UINT32 DefaultSize : 1; + UINT32 Granularity : 1; + UINT32 BaseHigh : 8; } Bits; - UINT64 Uint64; + UINT64 Uint64; } IA32_GDT; #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 */ +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 */ }; // // IA32 Gdt register // -GLOBAL_REMOVE_IF_UNREFERENCED IA32_DESCRIPTOR mGdt = { +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 @@ -81,9 +91,9 @@ AsmExecute32BitCode ( **/ EFI_STATUS Execute32BitCode ( - IN UINT64 Function, - IN UINT64 Param1, - IN UINT64 Param2 + IN UINT64 Function, + IN UINT64 Param1, + IN UINT64 Param2 ) { EFI_STATUS Status; @@ -100,4 +110,3 @@ Execute32BitCode ( return Status; } - diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c index 1de782c260..4ac5d3d738 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperApiTestLibNull/FspWrapperApiTestNull.c @@ -19,8 +19,8 @@ EFI_STATUS EFIAPI TestFspMemoryInitApiOutput ( - IN VOID *FspmUpdDataPtr, - IN VOID **HobListPtr + IN VOID *FspmUpdDataPtr, + IN VOID **HobListPtr ) { return RETURN_UNSUPPORTED; @@ -36,7 +36,7 @@ TestFspMemoryInitApiOutput ( EFI_STATUS EFIAPI TestFspTempRamExitApiOutput ( - IN VOID *TempRamExitParam + IN VOID *TempRamExitParam ) { return RETURN_UNSUPPORTED; @@ -52,7 +52,7 @@ TestFspTempRamExitApiOutput ( EFI_STATUS EFIAPI TestFspSiliconInitApiOutput ( - IN VOID *FspsUpdDataPtr + IN VOID *FspsUpdDataPtr ) { return RETURN_UNSUPPORTED; diff --git a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c index dddf80b76c..fa7d60c292 100644 --- a/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c +++ b/IntelFsp2WrapperPkg/Library/BaseFspWrapperPlatformLibSample/FspWrapperPlatformLibSample.c @@ -20,7 +20,7 @@ VOID EFIAPI UpdateFspmUpdData ( - IN OUT VOID *FspUpdRgnPtr + IN OUT VOID *FspUpdRgnPtr ) { } @@ -34,7 +34,7 @@ UpdateFspmUpdData ( VOID EFIAPI UpdateFspsUpdData ( - IN OUT VOID *FspUpdRgnPtr + IN OUT VOID *FspUpdRgnPtr ) { } @@ -69,8 +69,8 @@ UpdateTempRamExitParam ( EFI_STATUS EFIAPI GetS3MemoryInfo ( - OUT UINT64 *S3PeiMemSize, - OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase + OUT UINT64 *S3PeiMemSize, + OUT EFI_PHYSICAL_ADDRESS *S3PeiMemBase ) { return EFI_UNSUPPORTED; @@ -86,12 +86,12 @@ GetS3MemoryInfo ( VOID EFIAPI CallFspWrapperResetSystem ( - IN UINT32 FspStatusResetType + IN UINT32 FspStatusResetType ) { // // Perform reset according to the type. // - CpuDeadLoop(); + CpuDeadLoop (); } diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c b/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c index 2e8246b0e4..0b48677b77 100644 --- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c +++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperApiTestLib/FspWrapperApiTest.c @@ -23,27 +23,30 @@ EFI_STATUS EFIAPI TestFspMemoryInitApiOutput ( - IN VOID *FspmUpdDataPtr, - IN VOID **HobListPtr + IN VOID *FspmUpdDataPtr, + IN VOID **HobListPtr ) { DEBUG_CODE_BEGIN (); - EFI_PEI_HOB_POINTERS Hob; + EFI_PEI_HOB_POINTERS Hob; 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; @@ -59,7 +62,7 @@ TestFspMemoryInitApiOutput ( EFI_STATUS EFIAPI TestFspTempRamExitApiOutput ( - IN VOID *TempRamExitParam + IN VOID *TempRamExitParam ) { return RETURN_SUCCESS; @@ -75,7 +78,7 @@ TestFspTempRamExitApiOutput ( EFI_STATUS EFIAPI TestFspSiliconInitApiOutput ( - IN VOID *FspsUpdDataPtr + IN VOID *FspsUpdDataPtr ) { return RETURN_SUCCESS; diff --git a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c index 48f4b0295a..84360ac6e3 100644 --- a/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c +++ b/IntelFsp2WrapperPkg/Library/PeiFspWrapperHobProcessLibSample/FspWrapperHobProcessLibSample.c @@ -26,7 +26,7 @@ // Additional pages are used by DXE memory manager. // It should be consistent between RetrieveRequiredMemorySize() and GetPeiMemSize() // -#define PEI_ADDITIONAL_MEMORY_SIZE (16 * EFI_PAGE_SIZE) +#define PEI_ADDITIONAL_MEMORY_SIZE (16 * EFI_PAGE_SIZE) /** Get the mem size in memory type information table. @@ -37,22 +37,23 @@ **/ UINT64 GetMemorySizeInMemoryTypeInformation ( - IN EFI_PEI_SERVICES **PeiServices + IN EFI_PEI_SERVICES **PeiServices ) { - EFI_STATUS Status; - EFI_PEI_HOB_POINTERS Hob; - EFI_MEMORY_TYPE_INFORMATION *MemoryData; - UINT8 Index; - UINTN TempPageNum; + EFI_STATUS Status; + EFI_PEI_HOB_POINTERS Hob; + EFI_MEMORY_TYPE_INFORMATION *MemoryData; + UINT8 Index; + 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; } @@ -83,10 +84,10 @@ GetMemorySizeInMemoryTypeInformation ( **/ UINT64 RetrieveRequiredMemorySize ( - IN EFI_PEI_SERVICES **PeiServices + IN EFI_PEI_SERVICES **PeiServices ) { - UINT64 Size; + UINT64 Size; Size = GetMemorySizeInMemoryTypeInformation (PeiServices); return Size + PEI_ADDITIONAL_MEMORY_SIZE; @@ -102,12 +103,12 @@ RetrieveRequiredMemorySize ( **/ UINT64 GetPeiMemSize ( - IN EFI_PEI_SERVICES **PeiServices, - IN UINT32 BootMode + IN EFI_PEI_SERVICES **PeiServices, + IN UINT32 BootMode ) { - UINT64 Size; - UINT64 MinSize; + UINT64 Size; + UINT64 MinSize; if (BootMode == BOOT_IN_RECOVERY_MODE) { return PcdGet32 (PcdPeiRecoveryMinMemSize); @@ -137,34 +138,34 @@ GetPeiMemSize ( EFI_STATUS EFIAPI PostFspmHobProcess ( - IN VOID *FspHobList + IN VOID *FspHobList ) { - EFI_PEI_HOB_POINTERS Hob; - UINT64 LowMemorySize; - UINT64 FspMemorySize; - EFI_PHYSICAL_ADDRESS FspMemoryBase; - UINT64 PeiMemSize; - EFI_PHYSICAL_ADDRESS PeiMemBase; - UINT64 S3PeiMemSize; - EFI_PHYSICAL_ADDRESS S3PeiMemBase; - BOOLEAN FoundFspMemHob; - EFI_STATUS Status; - EFI_BOOT_MODE BootMode; - EFI_PEI_CAPSULE_PPI *Capsule; - VOID *CapsuleBuffer; - UINTN CapsuleBufferLength; - UINT64 RequiredMemSize; - EFI_PEI_SERVICES **PeiServices; + EFI_PEI_HOB_POINTERS Hob; + UINT64 LowMemorySize; + UINT64 FspMemorySize; + EFI_PHYSICAL_ADDRESS FspMemoryBase; + UINT64 PeiMemSize; + EFI_PHYSICAL_ADDRESS PeiMemBase; + UINT64 S3PeiMemSize; + EFI_PHYSICAL_ADDRESS S3PeiMemBase; + BOOLEAN FoundFspMemHob; + EFI_STATUS Status; + EFI_BOOT_MODE BootMode; + EFI_PEI_CAPSULE_PPI *Capsule; + VOID *CapsuleBuffer; + UINTN CapsuleBufferLength; + UINT64 RequiredMemSize; + EFI_PEI_SERVICES **PeiServices; PeiServices = (EFI_PEI_SERVICES **)GetPeiServicesTablePointer (); PeiServicesGetBootMode (&BootMode); - PeiMemBase = 0; - LowMemorySize = 0; - FspMemorySize = 0; - FspMemoryBase = 0; + PeiMemBase = 0; + LowMemorySize = 0; + FspMemorySize = 0; + FspMemoryBase = 0; FoundFspMemHob = FALSE; // @@ -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 - && (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB)) { - LowMemorySize += Hob.ResourceDescriptor->ResourceLength; - Hob.Raw = GET_NEXT_HOB (Hob); + 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)) + { + 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 - && (Hob.ResourceDescriptor->PhysicalStart >= BASE_1MB) - && (Hob.ResourceDescriptor->PhysicalStart + Hob.ResourceDescriptor->ResourceLength <= BASE_4GB) - && (CompareGuid (&Hob.ResourceDescriptor->Owner, &gFspReservedMemoryResourceHobGuid))) { + 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))) + { 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)); + FspMemoryBase = Hob.ResourceDescriptor->PhysicalStart; + FspMemorySize = Hob.ResourceDescriptor->ResourceLength; + DEBUG ((DEBUG_INFO, "Find fsp mem hob, base 0x%x, len 0x%x\n", FspMemoryBase, FspMemorySize)); } // @@ -216,25 +220,25 @@ 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 ( EFI_RESOURCE_SYSTEM_MEMORY, ( - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - // EFI_RESOURCE_ATTRIBUTE_TESTED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + // EFI_RESOURCE_ATTRIBUTE_TESTED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE ), BASE_1MB, LowMemorySize @@ -242,9 +246,9 @@ PostFspmHobProcess ( S3PeiMemBase = 0; S3PeiMemSize = 0; - Status = GetS3MemoryInfo (&S3PeiMemSize, &S3PeiMemBase); + 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,20 +261,20 @@ 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 // - Capsule = NULL; - CapsuleBuffer = NULL; + Capsule = NULL; + CapsuleBuffer = NULL; CapsuleBufferLength = 0; if (BootMode == BOOT_ON_FLASH_UPDATE) { Status = PeiServicesLocatePpi ( &gEfiPeiCapsulePpiGuid, 0, NULL, - (VOID **) &Capsule + (VOID **)&Capsule ); ASSERT_EFI_ERROR (Status); @@ -278,7 +282,7 @@ PostFspmHobProcess ( // // Make sure Stack and CapsuleBuffer are not overlap // - CapsuleBuffer = (VOID *)(UINTN)BASE_1MB; + CapsuleBuffer = (VOID *)(UINTN)BASE_1MB; CapsuleBufferLength = (UINTN)(LowMemorySize - PeiMemSize); // // Call the Capsule PPI Coalesce function to coalesce the capsule data. @@ -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 @@ -296,13 +300,13 @@ PostFspmHobProcess ( BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY, ( - EFI_RESOURCE_ATTRIBUTE_PRESENT | - EFI_RESOURCE_ATTRIBUTE_INITIALIZED | - EFI_RESOURCE_ATTRIBUTE_TESTED | - EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | - EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE + EFI_RESOURCE_ATTRIBUTE_PRESENT | + EFI_RESOURCE_ATTRIBUTE_INITIALIZED | + EFI_RESOURCE_ATTRIBUTE_TESTED | + EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE | + EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE ), BASE_1MB, LowMemorySize @@ -316,10 +320,10 @@ PostFspmHobProcess ( // Install efi memory // PeiMemBase = BASE_1MB + LowMemorySize - PeiMemSize; - Status = PeiServicesInstallPeiMemory ( - PeiMemBase, - PeiMemSize - RequiredMemSize - ); + Status = PeiServicesInstallPeiMemory ( + PeiMemBase, + PeiMemSize - RequiredMemSize + ); ASSERT_EFI_ERROR (Status); if (Capsule != NULL) { @@ -338,7 +342,7 @@ PostFspmHobProcess ( **/ VOID ProcessFspHobList ( - IN VOID *FspHobList + IN VOID *FspHobList ) { EFI_PEI_HOB_POINTERS FspHob; @@ -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); } } @@ -375,7 +380,7 @@ ProcessFspHobList ( EFI_STATUS EFIAPI PostFspsHobProcess ( - IN VOID *FspHobList + IN VOID *FspHobList ) { // @@ -392,5 +397,6 @@ PostFspsHobProcess ( ASSERT (FspHobList != NULL); ProcessFspHobList (FspHobList); } + return EFI_SUCCESS; } diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c index 0902cadb24..29d4bb7c46 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/FspWrapperPlatformSecLibSample.c @@ -29,9 +29,9 @@ EFI_STATUS EFIAPI SecPlatformInformation ( - 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 ); /** @@ -95,30 +95,30 @@ EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] = { EFI_PEI_PPI_DESCRIPTOR * EFIAPI SecPlatformMain ( - IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData + IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData ) { - EFI_PEI_PPI_DESCRIPTOR *PpiList; + 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 diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Fsp.h b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Fsp.h index b654a47af7..d2af7a5484 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Fsp.h +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/Ia32/Fsp.h @@ -12,34 +12,34 @@ // // Fv Header // -#define FVH_FV_LENGTH_OFFSET 0x20 -#define FVH_SIGINATURE_OFFSET 0x28 -#define FVH_SIGINATURE_VALID_VALUE 0x4856465F // valid signature:_FVH -#define FVH_HEADER_LENGTH_OFFSET 0x30 -#define FVH_EXTHEADER_OFFSET_OFFSET 0x34 -#define FVH_EXTHEADER_SIZE_OFFSET 0x10 +#define FVH_FV_LENGTH_OFFSET 0x20 +#define FVH_SIGINATURE_OFFSET 0x28 +#define FVH_SIGINATURE_VALID_VALUE 0x4856465F // valid signature:_FVH +#define FVH_HEADER_LENGTH_OFFSET 0x30 +#define FVH_EXTHEADER_OFFSET_OFFSET 0x34 +#define FVH_EXTHEADER_SIZE_OFFSET 0x10 // // Ffs Header // -#define FSP_HEADER_SIGNATURE_OFFSET 0x1C -#define FSP_HEADER_SIGNATURE 0x48505346 ; valid signature:FSPH -#define FSP_HEADER_GUID_DWORD1 0x912740BE -#define FSP_HEADER_GUID_DWORD2 0x47342284 -#define FSP_HEADER_GUID_DWORD3 0xB08471B9 -#define FSP_HEADER_GUID_DWORD4 0x0C3F3527 -#define FFS_HEADER_SIZE_VALUE 0x18 +#define FSP_HEADER_SIGNATURE_OFFSET 0x1C +#define FSP_HEADER_SIGNATURE 0x48505346 ; valid signature:FSPH +#define FSP_HEADER_GUID_DWORD1 0x912740BE +#define FSP_HEADER_GUID_DWORD2 0x47342284 +#define FSP_HEADER_GUID_DWORD3 0xB08471B9 +#define FSP_HEADER_GUID_DWORD4 0x0C3F3527 +#define FFS_HEADER_SIZE_VALUE 0x18 // // Section Header // -#define SECTION_HEADER_TYPE_OFFSET 0x03 -#define RAW_SECTION_HEADER_SIZE_VALUE 0x04 +#define SECTION_HEADER_TYPE_OFFSET 0x03 +#define RAW_SECTION_HEADER_SIZE_VALUE 0x04 // // Fsp Header // -#define FSP_HEADER_IMAGEBASE_OFFSET 0x1C -#define FSP_HEADER_TEMPRAMINIT_OFFSET 0x30 +#define FSP_HEADER_IMAGEBASE_OFFSET 0x1C +#define FSP_HEADER_TEMPRAMINIT_OFFSET 0x30 #endif diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/PlatformInit.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/PlatformInit.c index 0523d0cf55..eae474675e 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/PlatformInit.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/PlatformInit.c @@ -6,7 +6,6 @@ **/ - #include #include #include @@ -21,9 +20,9 @@ VOID EFIAPI PlatformInit ( - IN VOID *FspHobList, - IN VOID *StartOfRange, - IN VOID *EndOfRange + IN VOID *FspHobList, + IN VOID *StartOfRange, + IN VOID *EndOfRange ) { // diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecGetPerformance.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecGetPerformance.c index 9ae15d1716..6946f4a01e 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecGetPerformance.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecGetPerformance.c @@ -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)); - Size = Count * sizeof (UINT64); + 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; diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecPlatformInformation.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecPlatformInformation.c index 28e25fde22..1406d0f2ac 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecPlatformInformation.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecPlatformInformation.c @@ -28,9 +28,9 @@ EFI_STATUS EFIAPI SecPlatformInformation ( - 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 ) { UINT32 *Bist; @@ -47,7 +47,7 @@ SecPlatformInformation ( &gTopOfTemporaryRamPpiGuid, 0, NULL, - (VOID **) &TopOfTemporaryRamPpi + (VOID **)&TopOfTemporaryRamPpi ); if (EFI_ERROR (Status)) { return EFI_NOT_FOUND; @@ -59,18 +59,18 @@ SecPlatformInformation ( // This routine copies the BIST information to the buffer pointed by // PlatformInformationRecord for output. // - TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - sizeof (UINT32); - TopOfTemporaryRam -= sizeof(UINT32) * 2; - Count = *((UINT32 *)(UINTN) (TopOfTemporaryRam - sizeof (UINT32))); - Size = Count * sizeof (IA32_HANDOFF_STATUS); + TopOfTemporaryRam = (UINT32)(UINTN)TopOfTemporaryRamPpi - 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); + *StructureSize = Size; + Bist = (UINT32 *)(TopOfTemporaryRam - sizeof (UINT32) - Size); CopyMem (PlatformInformationRecord, Bist, Size); diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c index e57b5b57be..03616cb418 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecRamInitData.c @@ -10,10 +10,10 @@ #include typedef struct { - UINT32 MicrocodeRegionBase; - UINT32 MicrocodeRegionSize; - UINT32 CodeRegionBase; - UINT32 CodeRegionSize; + UINT32 MicrocodeRegionBase; + UINT32 MicrocodeRegionSize; + UINT32 CodeRegionBase; + UINT32 CodeRegionSize; } FSPT_CORE_UPD; typedef struct { @@ -25,7 +25,7 @@ typedef struct { FSPT_CORE_UPD FsptCoreUpd; } FSPT_UPD_CORE_DATA; -GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = { +GLOBAL_REMOVE_IF_UNREFERENCED CONST FSPT_UPD_CORE_DATA FsptUpdDataPtr = { { 0x4450555F54505346, // @@ -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), } }; - diff --git a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c index eafbadb152..ef426b3677 100644 --- a/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c +++ b/IntelFsp2WrapperPkg/Library/SecFspWrapperPlatformSecLibSample/SecTempRamDone.c @@ -23,21 +23,21 @@ SecPlatformDisableTemporaryMemory ( VOID ) { - EFI_STATUS Status; - VOID *TempRamExitParam; - FSP_INFO_HEADER *FspHeader; + EFI_STATUS Status; + 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); + Status = CallTempRamExit (TempRamExitParam); + DEBUG ((DEBUG_INFO, "TempRamExit status: 0x%x\n", Status)); + ASSERT_EFI_ERROR (Status); - return ; + return; } -- cgit v1.2.3