Update FSP to follow: https://firmware.intel.com/sites/default/files/FSP_EAS_v2.0_Draft%20External.pdf
Add more API to get FSP2.0 information - FspInfoHeader, ApiIndex, StatusCode, CarBase, CarSize. Remove FSP1.1 support - ContinuationFunc. The FSP1.1 compatibility is NOT maintained. The new Intel platform will follow FSP2.0. The old platform can either use an old EDK branch, or move FSP1.1 support to platform directory. Cc: Giri P Mudusuru <giri.p.mudus...@intel.com> Cc: Maurice Ma <maurice...@intel.com> Cc: Ravi P Rangarajan <ravi.p.rangara...@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen....@intel.com> Reviewed-by: Giri P Mudusuru <giri.p.mudus...@intel.com> Reviewed-by: Maurice Ma <maurice...@intel.com> Reviewed-by: Ravi P Rangarajan <ravi.p.rangara...@intel.com> --- IntelFspPkg/Include/Library/FspCommonLib.h | 102 ++++++++---- IntelFspPkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf | 4 +- IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c | 165 ++++++++++++++------ 3 files changed, 188 insertions(+), 83 deletions(-) diff --git a/IntelFspPkg/Include/Library/FspCommonLib.h b/IntelFspPkg/Include/Library/FspCommonLib.h index fa2f81c..9331e95 100644 --- a/IntelFspPkg/Include/Library/FspCommonLib.h +++ b/IntelFspPkg/Include/Library/FspCommonLib.h @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -51,40 +51,26 @@ GetFspApiParameter ( ); /** - This function sets the FSP API paramter in the stack. - - @param[in] Value New parameter value. + This function gets back the FSP API second paramter passed by the bootlaoder. + @retval ApiParameter FSP API second paramter passed by the bootlaoder. **/ -VOID -EFIAPI -SetFspApiParameter ( - IN UINT32 Value - ); - -/** - This function sets the FSP continuation function parameters in the stack. - - @param[in] Value New parameter value to set. - @param[in] Index Parameter index. -**/ -VOID +UINT32 EFIAPI -SetFspContinuationFuncParameter ( - IN UINT32 Value, - IN UINT32 Index +GetFspApiParameter2 ( + VOID ); /** - This function changes the BootLoader return address in stack. + This function sets the FSP API paramter in the stack. - @param[in] ReturnAddress Address to return. + @param[in] Value New parameter value. **/ VOID EFIAPI -SetFspApiReturnAddress ( - IN UINT32 ReturnAddress +SetFspApiParameter ( + IN UINT32 Value ); /** @@ -138,18 +124,18 @@ GetFspPlatformDataPointer ( /** This function sets the UPD data pointer. - @param[in] UpdDataRgnPtr UPD data pointer. + @param[in] UpdDataPtr UPD data pointer. **/ VOID EFIAPI SetFspUpdDataPointer ( - IN VOID *UpdDataRgnPtr + IN VOID *UpdDataPtr ); /** This function gets the UPD data pointer. - @return UpdDataRgnPtr UPD data pointer. + @return UpdDataPtr UPD data pointer. **/ VOID * EFIAPI @@ -226,6 +212,17 @@ GetFspInfoHeader ( ); /** + This function sets the FSP info header pointer. + + @param[in] FspInfoHeader FSP info header pointer +**/ +VOID +EFIAPI +SetFspInfoHeader ( + FSP_INFO_HEADER *FspInfoHeader + ); + +/** This function gets the FSP info header pointer from the API context. @retval FspInfoHeader FSP info header pointer @@ -254,19 +251,62 @@ GetFspVpdDataPointer ( **/ UINT8 EFIAPI -GetFspApiCallingMode ( +GetFspApiCallingIndex ( VOID ); /** This function sets FSP API calling mode. - @param[in] Mode API calling mode + @param[in] Index API calling index **/ VOID EFIAPI -SetFspApiCallingMode ( - UINT8 Mode +SetFspApiCallingIndex ( + UINT8 Index + ); + +/** + This function gets FSP Phase StatusCode. + + @retval StatusCode +**/ +UINT32 +EFIAPI +GetPhaseStatusCode ( + VOID + ); + + +/** + This function sets FSP Phase StatusCode. + + @param[in] Mode Phase StatusCode +**/ +VOID +EFIAPI +SetPhaseStatusCode ( + UINT32 StatusCode + ); + +/** + This function gets FSP CAR base + +**/ +UINT32 +EFIAPI +GetFspCarBase ( + VOID + ); + +/** + This function gets FSP CAR size + +**/ +UINT32 +EFIAPI +GetFspCarSize ( + VOID ); #endif diff --git a/IntelFspPkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf b/IntelFspPkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf index 32b4482..abd1dd5 100644 --- a/IntelFspPkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf +++ b/IntelFspPkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf @@ -1,6 +1,6 @@ ## @file # Instance of FspCommonLib -# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> +# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR> # # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -35,3 +35,5 @@ [FixedPcd] gIntelFspPkgTokenSpaceGuid.PcdFspMaxPatchEntry ## CONSUMES gIntelFspPkgTokenSpaceGuid.PcdFspMaxPerfEntry ## CONSUMES + gIntelFspPkgTokenSpaceGuid.PcdTemporaryRamBase ## CONSUMES + gIntelFspPkgTokenSpaceGuid.PcdTemporaryRamSize ## CONSUMES diff --git a/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c b/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c index a31d16b..60fcf64 100644 --- a/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c +++ b/IntelFspPkg/Library/BaseFspCommonLib/FspCommonLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR> + Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -17,13 +17,11 @@ #include <Library/PcdLib.h> #include <FspGlobalData.h> #include <FspApi.h> +#include <FspDataTable.h> #pragma pack(1) // -// Cont Func Parameter 2 +0x3C -// Cont Func Parameter 1 +0x38 -// // API Parameter +0x34 // API return address +0x30 // @@ -49,7 +47,7 @@ typedef struct { UINT16 Flags[2]; UINT32 FspInfoHeader; UINT32 ApiRet; - UINT32 ApiParam; + UINT32 ApiParam[2]; } CONTEXT_STACK; #define CONTEXT_STACK_OFFSET(x) (UINT32)&((CONTEXT_STACK *)(UINTN)0)->x @@ -102,63 +100,42 @@ GetFspApiParameter ( FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); - return *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam)); -} - -/** - This function sets the FSP API paramter in the stack. - - @param[in] Value New parameter value. - -**/ -VOID -EFIAPI -SetFspApiParameter ( - IN UINT32 Value - ) -{ - FSP_GLOBAL_DATA *FspData; - - FspData = GetFspGlobalDataPointer (); - *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam)) = Value; + return *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam[0])); } /** - This function sets the FSP continuation function parameters in the stack. + This function gets back the FSP API paramter passed by the bootlaoder. - @param[in] Value New parameter value to set. - @param[in] Index Parameter index. + @retval ApiParameter FSP API paramter passed by the bootlaoder. **/ -VOID +UINT32 EFIAPI -SetFspContinuationFuncParameter ( - IN UINT32 Value, - IN UINT32 Index +GetFspApiParameter2 ( + VOID ) { FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); - *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam) + (Index + 1) * sizeof(UINT32)) = Value; + return *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam[1])); } - /** - This function changes the BootLoader return address in stack. + This function sets the FSP API paramter in the stack. - @param[in] ReturnAddress Address to return. + @param[in] Value New parameter value. **/ VOID EFIAPI -SetFspApiReturnAddress ( - IN UINT32 ReturnAddress +SetFspApiParameter ( + IN UINT32 Value ) { FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); - *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiRet)) = ReturnAddress; + *(UINT32 *)(UINTN)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam)) = Value; } /** @@ -251,12 +228,12 @@ GetFspPlatformDataPointer ( /** This function sets the UPD data pointer. - @param[in] UpdDataRgnPtr UPD data pointer. + @param[in] UpdDataPtr UPD data pointer. **/ VOID EFIAPI SetFspUpdDataPointer ( - IN VOID *UpdDataRgnPtr + IN VOID *UpdDataPtr ) { FSP_GLOBAL_DATA *FspData; @@ -269,13 +246,13 @@ SetFspUpdDataPointer ( // // Set the UPD pointer. // - FspData->UpdDataRgnPtr = UpdDataRgnPtr; + FspData->UpdDataPtr = UpdDataPtr; } /** This function gets the UPD data pointer. - @return UpdDataRgnPtr UPD data pointer. + @return UpdDataPtr UPD data pointer. **/ VOID * EFIAPI @@ -286,7 +263,7 @@ GetFspUpdDataPointer ( FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); - return FspData->UpdDataRgnPtr; + return FspData->UpdDataPtr; } @@ -417,6 +394,20 @@ GetFspInfoHeader ( } /** + This function sets the FSP info header pointer. + + @param[in] FspInfoHeader FSP info header pointer +**/ +VOID +EFIAPI +SetFspInfoHeader ( + FSP_INFO_HEADER *FspInfoHeader + ) +{ + GetFspGlobalDataPointer()->FspInfoHeader = FspInfoHeader; +} + +/** This function gets the FSP info header pointer using the API stack context. @retval FspInfoHeader FSP info header pointer using the API stack context @@ -451,33 +442,105 @@ GetFspVpdDataPointer ( } /** - This function gets FSP API calling mode. + This function gets FSP API calling index. - @retval API calling mode + @retval API calling index **/ UINT8 EFIAPI -GetFspApiCallingMode ( +GetFspApiCallingIndex ( VOID ) { - return GetFspGlobalDataPointer()->ApiMode; + return GetFspGlobalDataPointer()->ApiIdx; } /** This function sets FSP API calling mode. - @param[in] Mode API calling mode + @param[in] Index API calling index +**/ +VOID +EFIAPI +SetFspApiCallingIndex ( + UINT8 Index + ) +{ + FSP_GLOBAL_DATA *FspData; + + FspData = GetFspGlobalDataPointer (); + FspData->ApiIdx = Index; +} + +/** + This function gets FSP Phase StatusCode. + + @retval StatusCode +**/ +UINT32 +EFIAPI +GetPhaseStatusCode ( + VOID + ) +{ + return GetFspGlobalDataPointer()->StatusCode; +} + +/** + This function sets FSP Phase StatusCode. + + @param[in] Mode Phase StatusCode **/ VOID EFIAPI -SetFspApiCallingMode ( - UINT8 Mode +SetPhaseStatusCode ( + UINT32 StatusCode + ) +{ + FSP_GLOBAL_DATA *FspData; + + FspData = GetFspGlobalDataPointer (); + FspData->StatusCode = StatusCode; +} + +/** + This function gets FSP CAR base + +**/ +UINT32 +EFIAPI +GetFspCarBase ( + VOID ) { FSP_GLOBAL_DATA *FspData; + UINT32 CarBase; FspData = GetFspGlobalDataPointer (); - FspData->ApiMode = Mode; + CarBase = FspData->PlatformData.CarBase; + if (CarBase == 0) { + CarBase = PcdGet32(PcdTemporaryRamBase); + } + return CarBase; } +/** + This function gets FSP CAR size + +**/ +UINT32 +EFIAPI +GetFspCarSize ( + VOID + ) +{ + FSP_GLOBAL_DATA *FspData; + UINT32 CarSize; + + FspData = GetFspGlobalDataPointer (); + CarSize = FspData->PlatformData.CarSize; + if (FspData->PlatformData.CarBase == 0) { + CarSize = PcdGet32(PcdTemporaryRamSize); + } + return CarSize; +} -- 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel