From 1fd2f9ec8f16cc8efb949888db94eb42006f77c6 Mon Sep 17 00:00:00 2001 From: Hongbin1 Zhang Date: Fri, 26 Jul 2024 10:16:42 +0800 Subject: [PATCH] IntelFsp2Pkg: Align FSP global data pointer for X64 build When it used 32 bits for set FSP global data pointer under X64 build, it should get FSP global data pointer with 32 bits data under X64 build. Signed-off-by: Hongbin1 Zhang Cc: Chasel Chiu Cc: Nate DeSimone Cc: Duggapu Chinni B Cc: Star Zeng Cc: Ted Kuo Cc: Ashraf Ali S --- IntelFsp2Pkg/FspSecCore/SecFspApiChk.c | 12 ++++++------ IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c index 5f59938518..644c374bd6 100644 --- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c +++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c @@ -31,7 +31,7 @@ FspApiCallingCheck ( // // NotifyPhase check // - if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) { + if ((FspData == NULL) || ((UINT32)(UINTN)FspData == MAX_UINT32)) { Status = EFI_UNSUPPORTED; } else { if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) { @@ -42,7 +42,7 @@ FspApiCallingCheck ( // // FspMemoryInit check // - if (((UINTN)FspData != MAX_ADDRESS) && ((UINTN)FspData != MAX_UINT32)) { + if ((UINT32)(UINTN)FspData != MAX_UINT32) { Status = EFI_UNSUPPORTED; } else if (ApiParam == NULL) { Status = EFI_SUCCESS; @@ -53,7 +53,7 @@ FspApiCallingCheck ( // // TempRamExit check // - if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) { + if ((FspData == NULL) || ((UINT32)(UINTN)FspData == MAX_UINT32)) { Status = EFI_UNSUPPORTED; } else { if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) { @@ -64,7 +64,7 @@ FspApiCallingCheck ( // // FspSiliconInit check // - if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) { + if ((FspData == NULL) || ((UINT32)(UINTN)FspData == MAX_UINT32)) { Status = EFI_UNSUPPORTED; } else { if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) { @@ -83,14 +83,14 @@ FspApiCallingCheck ( } } } else if (ApiIdx == FspMultiPhaseMemInitApiIndex) { - if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) { + if ((FspData == NULL) || ((UINT32)(UINTN)FspData == MAX_UINT32)) { Status = EFI_UNSUPPORTED; } } else if (ApiIdx == FspSmmInitApiIndex) { // // FspSmmInitApiIndex check // - if ((FspData == NULL) || ((UINTN)FspData == MAX_ADDRESS) || ((UINTN)FspData == MAX_UINT32)) { + if ((FspData == NULL) || ((UINT32)(UINTN)FspData == MAX_UINT32)) { Status = EFI_UNSUPPORTED; } else { if (FspData->Signature != FSP_GLOBAL_DATA_SIGNATURE) { diff --git a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c index d33d01fe22..54dbf546c3 100644 --- a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c +++ b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c @@ -89,10 +89,10 @@ GetFspGlobalDataPointer ( VOID ) { - FSP_GLOBAL_DATA *FspData; + UINT32 FspDataAddress; - FspData = *(FSP_GLOBAL_DATA **)(UINTN)PcdGet32 (PcdGlobalDataPointerAddress); - return FspData; + FspDataAddress = *(UINT32 *)(UINTN)PcdGet32 (PcdGlobalDataPointerAddress); + return (FSP_GLOBAL_DATA *)(UINTN)FspDataAddress; } /**