public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nate DeSimone" <nathaniel.l.desimone@intel.com>
To: "Chiu, Chasel" <chasel.chiu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v2 1/4] IntelFsp2Pkg: Add FSP 2.4 MultiPhase interface.
Date: Wed, 31 Aug 2022 00:11:21 +0000	[thread overview]
Message-ID: <PH0PR11MB5832FC17DC1CB31F9613BA58CD789@PH0PR11MB5832.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220810004822.1499-2-chasel.chiu@intel.com>

Hi Chasel,

Please see feedback inline. Specifically, some improvements are needed in the comments. The code itself looks good! For that reason, there is no need to send a V3 patch series. Please fix the comments then you are free to push the change.

With those changes...

Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

Thanks,
Nate

> -----Original Message-----
> From: Chiu, Chasel <chasel.chiu@intel.com>
> Sent: Tuesday, August 9, 2022 5:48 PM
> To: devel@edk2.groups.io
> Cc: Chiu, Chasel <chasel.chiu@intel.com>; Desimone, Nathaniel L
> <nathaniel.l.desimone@intel.com>; Zeng, Star <star.zeng@intel.com>
> Subject: [PATCH v2 1/4] IntelFsp2Pkg: Add FSP 2.4 MultiPhase interface.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3916
> 
> Provide FSP 2.4 MultiPhase interface and scripts support.
> 
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
> ---
>  IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/FspMultiPhaseLib.c       | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c |  30 ++++++++++++++++++++++++++++++
>  IntelFsp2Pkg/Include/FspEas/FspApi.h                               |  62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  IntelFsp2Pkg/Include/FspGlobalData.h                               |   5 ++++-
>  IntelFsp2Pkg/Include/Library/FspMultiPhaseLib.h                    |  54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h                   |  19 +++++++++++++++++++
>  IntelFsp2Pkg/IntelFsp2Pkg.dec                                      |  12 ++++++++++--
>  IntelFsp2Pkg/IntelFsp2Pkg.dsc                                      |   4 ++++
>  IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf |  50 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  IntelFsp2Pkg/Tools/SplitFspBin.py                                  |  48 +++++++++++++++++++++++++-----------------------
>  10 files changed, 440 insertions(+), 28 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/FspMultiPhaseLib.c b/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/FspMultiPhaseLib.c
> new file mode 100644
> index 0000000000..1ab355085b
> --- /dev/null
> +++ b/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/FspMultiPhaseLib.c
> @@ -0,0 +1,184 @@
> +/** @file
> +  Null instance of Platform Sec Lib.
> +
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#include <PiPei.h>
> +#include <Library/FspCommonLib.h>
> +#include <Library/FspSwitchStackLib.h>
> +#include <Library/FspSecPlatformLib.h>
> +#include <Library/DebugLib.h>
> +#include <Library/PcdLib.h>
> +#include <FspEas/FspApi.h>
> +#include <FspGlobalData.h>
> +
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseSwitchStack (
> +  )
> +{
> +  SetFspApiReturnStatus (EFI_SUCCESS);
> +  Pei2LoaderSwitchStack ();
> +
> +  return EFI_SUCCESS;
> +}
> +
> +EFI_STATUS
> +EFIAPI
> +FspVariableRequestSwitchStack (
> +  IN FSP_MULTI_PHASE_VARIABLE_REQUEST_INFO_PARAMS  *FspVariableRequestParams
> +  )
> +{
> +  FSP_GLOBAL_DATA  *FspData;
> +
> +  FspData = GetFspGlobalDataPointer ();
> +  if (((UINTN)FspData == 0) || ((UINTN)FspData == 0xFFFFFFFF)) {
> +    return EFI_UNSUPPORTED;
> +  }
> +
> +  FspData->VariableRequestParameterPtr = (VOID *)FspVariableRequestParams;
> +  SetFspApiReturnStatus (FSP_STATUS_VARIABLE_REQUEST);
> +  Pei2LoaderSwitchStack ();
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function supports FspMultiPhase implementation.
> +
> +  @param[in]  ApiIdx           Internal index of the FSP API.
> +  @param[in]  ApiParam         Parameter of the FSP API.
> +
> +  @retval EFI_SUCCESS                 FSP execution was successful.
> +  @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
> +  @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
> +  @retval EFI_DEVICE_ERROR            FSP initialization failed.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseWorker (
> +  IN UINT32  ApiIdx,
> +  IN VOID    *ApiParam
> +  )
> +{
> +  FSP_MULTI_PHASE_PARAMS                       *FspMultiPhaseParams;
> +  FSP_GLOBAL_DATA                              *FspData;
> +  FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS  *FspMultiPhaseGetNumber;
> +  BOOLEAN                                      FspDataValid;
> +  UINT32                                       NumberOfPhasesSupported;
> +
> +  FspDataValid = TRUE;
> +  FspData      = GetFspGlobalDataPointer ();
> +  if (((UINTN)FspData == 0) || ((UINTN)FspData == 0xFFFFFFFF)) {
> +    FspDataValid = FALSE;
> +  }
> +
> +  //
> +  // It is required that FspData->NumberOfPhases to be reset to 0 after
> +  // current FSP component finished.
> +  // The next component FspData->NumberOfPhases will only be re-initialized when FspData->NumberOfPhases = 0
> +  //
> +  if ((FspDataValid == TRUE) && (FspData->NumberOfPhases == 0)) {
> +    FspData->NumberOfPhases = PcdGet32 (PcdMultiPhaseNumberOfPhases);
> +    FspData->PhasesExecuted = 0;
> +    if (FspMultiPhasePlatformGetNumberOfPhases (ApiIdx, &NumberOfPhasesSupported) == TRUE) {
> +      //
> +      // Platform has implemented runtime controling for NumberOfPhasesSupported
> +      //
> +      FspData->NumberOfPhases = NumberOfPhasesSupported;
> +    }
> +  }
> +
> +  FspMultiPhaseParams = (FSP_MULTI_PHASE_PARAMS *)ApiParam;
> +
> +  if (FspDataValid == FALSE) {
> +    return EFI_DEVICE_ERROR;
> +  } else {
> +    switch (FspMultiPhaseParams->MultiPhaseAction) {
> +      case EnumMultiPhaseGetNumberOfPhases:
> +        if ((FspMultiPhaseParams->MultiPhaseParamPtr == NULL) || (FspMultiPhaseParams->PhaseIndex != 0)) {
> +          return EFI_INVALID_PARAMETER;
> +        }
> +
> +        FspMultiPhaseGetNumber                 = (FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS *)FspMultiPhaseParams->MultiPhaseParamPtr;
> +        FspMultiPhaseGetNumber->NumberOfPhases = FspData->NumberOfPhases;
> +        FspMultiPhaseGetNumber->PhasesExecuted = FspData->PhasesExecuted;
> +        break;
> +
> +      case EnumMultiPhaseExecutePhase:
> +        if ((FspMultiPhaseParams->PhaseIndex > FspData->PhasesExecuted) && (FspMultiPhaseParams->PhaseIndex <= FspData->NumberOfPhases)) {
> +          FspData->PhasesExecuted = FspMultiPhaseParams->PhaseIndex;
> +          return Loader2PeiSwitchStack ();
> +        } else {
> +          return EFI_INVALID_PARAMETER;
> +        }
> +
> +        break;
> +
> +      case EnumMultiPhaseGetVariableRequestInfo:
> +        //
> +        // return variable request info
> +        //
> +        FspMultiPhaseParams->MultiPhaseParamPtr = FspData->VariableRequestParameterPtr;
> +        break;
> +
> +      case EnumMultiPhaseCompleteVariableRequest:
> +        //
> +        // retrieve complete variable request params
> +        //
> +        FspData->VariableRequestParameterPtr = FspMultiPhaseParams->MultiPhaseParamPtr;
> +        return Loader2PeiSwitchStack ();
> +        break;
> +
> +      default:
> +        return EFI_UNSUPPORTED;
> +    }
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
> +/**
> +  This function handles FspMultiPhaseMemInitApi.
> +
> +  @param[in]  ApiIdx           Internal index of the FSP API.
> +  @param[in]  ApiParam         Parameter of the FSP API.
> +
> +  @retval EFI_SUCCESS                 FSP execution was successful.
> +  @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
> +  @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
> +  @retval EFI_DEVICE_ERROR            FSP initialization failed.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseMemInitApiHandler (
> +  IN UINT32  ApiIdx,
> +  IN VOID    *ApiParam
> +  )
> +{
> +  return FspMultiPhaseWorker (ApiIdx, ApiParam);
> +}
> +
> +/**
> +  This function handles FspMultiPhaseSiInitApi.
> +
> +  @param[in]  ApiIdx           Internal index of the FSP API.
> +  @param[in]  ApiParam         Parameter of the FSP API.
> +
> +  @retval EFI_SUCCESS                 FSP execution was successful.
> +  @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
> +  @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
> +  @retval EFI_DEVICE_ERROR            FSP initialization failed.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseSiInitApiHandlerV2 (
> +  IN UINT32  ApiIdx,
> +  IN VOID    *ApiParam
> +  )
> +{
> +  return FspMultiPhaseWorker (ApiIdx, ApiParam);
> +}
> diff --git a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c
> index a6f3892ed8..27b2e75d1d 100644
> --- a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c
> +++ b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c
> @@ -28,6 +28,7 @@ FspUpdSignatureCheck (
>  
>  /**
>    This function handles FspMultiPhaseSiInitApi.
> +  Starting from FSP 2.4 this funciton is obsolete and FspMultiPhaseSiInitApiHandlerV2 is the replacement.

Spelling error here. " funciton" should be " function".

>  
>    @param[in]  ApiIdx           Internal index of the FSP API.
>    @param[in]  ApiParam         Parameter of the FSP API.
> @@ -42,3 +43,32 @@ FspMultiPhaseSiInitApiHandler (
>  {
>    return EFI_SUCCESS;
>  }
> +
> +/**
> +  FSP MultiPhase Platform cnotrol function.

Spelling error here. "cnotrol" should be "control".

> +  Certain phases may depend on feature enabling or disabling which will be controlled by Platform.

I would recommend a more descriptive comment here. Perhaps something like this:

FSP MultiPhase Platform Get Number Of Phases Function.

Allows an FSP binary to dynamically update the number of phases at runtime.
For example, UPD settings could negate the need to enter the multi-phase
flow in certain scenarios. If this function returns FALSE, the default number
of phases provided by PcdMultiPhaseNumberOfPhases will be returned to
the bootloader instead.

> +
> +  @param[in] ApiIdx                  - Internal index of the FSP API.
> +  @param[in] NumberOfPhasesSupported - How many phases are supported by current FSP Component.
> +
> +  @retval  TRUE  - NumberOfPhases are modified by Platform during runtime.
> +  @retval  FALSE - The Default build time NumberOfPhases should be used.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FspMultiPhasePlatformGetNumberOfPhases (
> +  IN     UINT8   ApiIdx,
> +  IN OUT UINT32  *NumberOfPhasesSupported
> +  )
> +{
> +  /* Example for platform runtime controling
> +  if ((ApiIdx == FspMultiPhaseSiInitApiIndex) && (Feature1Enable == FALSE)) {
> +    *NumberOfPhasesSupported = 0;
> +    return TRUE;
> +  }
> +  return FALSE
> +  */
> +
> +  return FALSE;
> +}
> diff --git a/IntelFsp2Pkg/Include/FspEas/FspApi.h b/IntelFsp2Pkg/Include/FspEas/FspApi.h
> index 361e916b5f..af42d7f707 100644
> --- a/IntelFsp2Pkg/Include/FspEas/FspApi.h
> +++ b/IntelFsp2Pkg/Include/FspEas/FspApi.h
> @@ -487,10 +487,38 @@ typedef struct {
>  /// Action definition for FspMultiPhaseSiInit API
>  ///
>  typedef enum {
> -  EnumMultiPhaseGetNumberOfPhases = 0x0,
> -  EnumMultiPhaseExecutePhase      = 0x1
> +  EnumMultiPhaseGetNumberOfPhases       = 0x0,
> +  EnumMultiPhaseExecutePhase            = 0x1,
> +  EnumMultiPhaseGetVariableRequestInfo  = 0x2,
> +  EnumMultiPhaseCompleteVariableRequest = 0x3
>  } FSP_MULTI_PHASE_ACTION;
>  
> +typedef enum {
> +  EnumFspVariableRequestGetVariable         = 0x0,
> +  EnumFspVariableRequestGetNextVariableName = 0x1,
> +  EnumFspVariableRequestSetVariable         = 0x2,
> +  EnumFspVariableRequestQueryVariableInfo   = 0x3
> +} FSP_VARIABLE_REQUEST_TYPE;
> +
> +#pragma pack(16)
> +typedef struct {
> +  IN     FSP_VARIABLE_REQUEST_TYPE    VariableRequest;
> +  IN OUT CHAR16                       *VariableName;
> +  IN OUT UINT64                       *VariableNameSize;
> +  IN OUT EFI_GUID                     *VariableGuid;
> +  IN OUT UINT32                       *Attributes;
> +  IN OUT UINT64                       *DataSize;
> +  IN OUT VOID                         *Data;
> +  OUT    UINT64                       *MaximumVariableStorageSize;
> +  OUT    UINT64                       *RemainingVariableStorageSize;
> +  OUT    UINT64                       *MaximumVariableSize;
> +} FSP_MULTI_PHASE_VARIABLE_REQUEST_INFO_PARAMS;
> +
> +typedef struct {
> +  EFI_STATUS    VariableRequestStatus;
> +} FSP_MULTI_PHASE_COMPLETE_VARIABLE_REQUEST_PARAMS;
> +#pragma pack()
> +
>  ///
>  /// Data structure returned by FSP when bootloader calling
>  /// FspMultiPhaseSiInit API with action 0 (EnumMultiPhaseGetNumberOfPhases)
> @@ -690,4 +718,34 @@ EFI_STATUS
>    IN VOID          *FspiUpdDataPtr
>    );
>  
> +/**
> +  This FSP API provides multi-phase memory and silicon initialization, which brings greater modularity to the existing
> +  FspMemoryInit() and FspSiliconInit() API. Increased modularity is achieved by adding an extra API to FSP-M and FSP-S.
> +  This allows the bootloader to add board specific initialization steps throughout the MemoryInit and SiliconInit flows as needed.
> +  The FspMemoryInit() API is always called before FspMultiPhaseMemInit(); it is the first phase of memory initialization. Similarly,
> +  the FspSiliconInit() API is always called before FspMultiPhaseSiInit(); it is the first phase of silicon initialization.
> +  After the first phase, subsequent phases are invoked by calling the FspMultiPhaseMem/SiInit() API.
> +  The FspMultiPhaseMemInit() API may only be called after the FspMemoryInit() API and before the FspSiliconInit() API;
> +  or in the case that FSP-T is being used, before the TempRamExit() API. The FspMultiPhaseSiInit() API may only be called after
> +  the FspSiliconInit() API and before NotifyPhase() API; or in the case that FSP-I is being used, before the FspSmmInit() API.
> +  The multi-phase APIs may not be called at any other time.
> +
> +  @param[in,out] FSP_MULTI_PHASE_PARAMS   For action - EnumMultiPhaseGetNumberOfPhases:
> +                                            FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr will contain
> +                                            how many phases supported by FSP.
> +                                          For action - EnumMultiPhaseExecutePhase:
> +                                            FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr shall be NULL.
> +  @retval EFI_SUCCESS                     FSP execution environment was initialized successfully.
> +  @retval EFI_INVALID_PARAMETER           Input parameters are invalid.
> +  @retval EFI_UNSUPPORTED                 The FSP calling conditions were not met.
> +  @retval EFI_DEVICE_ERROR                FSP initialization failed.
> +  @retval FSP_STATUS_RESET_REQUIRED_*     A reset is required. These status codes will not be returned during S3.
> +  @retval FSP_STATUS_VARIABLE_REQUEST     A variable request has been made by FSP that needs boot loader handling.
> +**/
> +typedef
> +EFI_STATUS
> +(EFIAPI *FSP_MULTI_PHASE_INIT)(
> +  IN FSP_MULTI_PHASE_PARAMS     *MultiPhaseInitParamPtr
> +  );
> +
>  #endif
> diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h b/IntelFsp2Pkg/Include/FspGlobalData.h
> index 32c6d460e4..81813df3ce 100644
> --- a/IntelFsp2Pkg/Include/FspGlobalData.h
> +++ b/IntelFsp2Pkg/Include/FspGlobalData.h
> @@ -12,7 +12,7 @@
>  
>  #define FSP_IN_API_MODE          0
>  #define FSP_IN_DISPATCH_MODE     1
> -#define FSP_GLOBAL_DATA_VERSION  0x2
> +#define FSP_GLOBAL_DATA_VERSION  0x3
>  
>  #pragma pack(1)
>  
> @@ -25,6 +25,7 @@ typedef enum {
>    FspSiliconInitApiIndex,
>    FspMultiPhaseSiInitApiIndex,
>    FspSmmInitApiIndex,
> +  FspMultiPhaseMemInitApiIndex,
>    FspApiIndexMax
>  } FSP_API_INDEX;
>  
> @@ -82,6 +83,8 @@ typedef struct  {
>    VOID               *FunctionParameterPtr;
>    FSP_INFO_HEADER    *FspInfoHeader;
>    VOID               *UpdDataPtr;
> +  VOID               *FspHobListPtr;
> +  VOID               *VariableRequestParameterPtr;
>    ///
>    /// End of UINTN and pointer section
>    /// At this point, next field offset must be either *0h or *8h to
> diff --git a/IntelFsp2Pkg/Include/Library/FspMultiPhaseLib.h b/IntelFsp2Pkg/Include/Library/FspMultiPhaseLib.h
> new file mode 100644
> index 0000000000..7ac4e197d9
> --- /dev/null
> +++ b/IntelFsp2Pkg/Include/Library/FspMultiPhaseLib.h
> @@ -0,0 +1,54 @@
> +/** @file
> +
> +  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
> +  SPDX-License-Identifier: BSD-2-Clause-Patent
> +
> +**/
> +
> +#ifndef _FSP_SEC_PLATFORM_LIB_H_
> +#define _FSP_SEC_PLATFORM_LIB_H_
> +
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseSwitchStack (
> +  );
> +
> +EFI_STATUS
> +EFIAPI
> +FspVariableRequestSwitchStack (
> +  IN FSP_MULTI_PHASE_VARIABLE_REQUEST_INFO_PARAMS  *FspVariableRequestParams
> +  );
> +
> +/**
> +  This function handles FspMultiPhaseMemInitApi.
> +
> +  @param[in]  ApiIdx           Internal index of the FSP API.
> +  @param[in]  ApiParam         Parameter of the FSP API.
> +
> +  @retval EFI_SUCCESS                 FSP execution was successful.
> +  @retval EFI_INVALID_PARAMETER       Input parameters are invalid.
> +  @retval EFI_UNSUPPORTED             The FSP calling conditions were not met.
> +  @retval EFI_DEVICE_ERROR            FSP initialization failed.
> +**/
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseMemInitApiHandler (
> +  IN UINT32  ApiIdx,
> +  IN VOID    *ApiParam
> +  );
> +
> +/**
> +  This function handles FspMultiPhaseSiInitApi.
> +
> +  @param[in]  ApiIdx           Internal index of the FSP API.
> +  @param[in]  ApiParam         Parameter of the FSP API.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +FspMultiPhaseSiInitApiHandlerV2 (
> +  IN UINT32  ApiIdx,
> +  IN VOID    *ApiParam
> +  );
> +
> +#endif
> diff --git a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> index 920115e90e..236ce804c5 100644
> --- a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> +++ b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h
> @@ -81,6 +81,7 @@ FspUpdSignatureCheck (
>  
>  /**
>    This function handles FspMultiPhaseSiInitApi.
> +  Starting from FSP 2.4 this funciton is obsolete and FspMultiPhaseSiInitApiHandlerV2 is the replacement.

Spelling error here. "funciton" should be " function".

>  
>    @param[in]  ApiIdx           Internal index of the FSP API.
>    @param[in]  ApiParam         Parameter of the FSP API.
> @@ -93,4 +94,22 @@ FspMultiPhaseSiInitApiHandler (
>    IN VOID    *ApiParam
>    );
>  
> +/**
> +  FSP MultiPhase Platform cnotrol function.

Spelling error here. "cnotrol" should be "control".

> +  Certain phases may depend on feature enabling or disabling which will be controlled by Platform.

I would recommend a more descriptive comment here. Perhaps something like this:

FSP MultiPhase Platform Get Number Of Phases Function.

Allows an FSP binary to dynamically update the number of phases at runtime.
For example, UPD settings could negate the need to enter the multi-phase
flow in certain scenarios. If this function returns FALSE, the default number
of phases provided by PcdMultiPhaseNumberOfPhases will be returned to
the bootloader instead.

> +
> +  @param[in] ApiIdx                  - Internal index of the FSP API.
> +  @param[in] NumberOfPhasesSupported - How many phases are supported by current FSP Component.
> +
> +  @retval  TRUE  - NumberOfPhases are modified by Platform during runtime.
> +  @retval  FALSE - The Default build time NumberOfPhases should be used.
> +
> +**/
> +BOOLEAN
> +EFIAPI
> +FspMultiPhasePlatformGetNumberOfPhases (
> +  IN     UINTN   ApiIdx,
> +  IN OUT UINT32  *NumberOfPhasesSupported
> +  );
> +
>  #endif
> diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dec b/IntelFsp2Pkg/IntelFsp2Pkg.dec
> index 2d3eb708b9..d1c3d3ee7b 100644
> --- a/IntelFsp2Pkg/IntelFsp2Pkg.dec
> +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dec
> @@ -37,6 +37,9 @@
>    ##  @libraryclass  Provides FSP platform sec related actions.
>    FspSecPlatformLib|Include/Library/FspSecPlatformLib.h
>  
> +  ## @libraryclass  Provides FSP MultiPhase service functions.
> +  FspMultiPhaseLib|Include/Library/FspMultiPhaseLib.h
> +
>  [Ppis]
>    #
>    # PPI to indicate FSP is ready to enter notify phase
> @@ -112,5 +115,10 @@
>    gIntelFsp2PkgTokenSpaceGuid.PcdFspPrivateTemporaryRamSize |0x00000000|UINT32|0x10000006
>  
>  [PcdsFixedAtBuild,PcdsDynamic,PcdsDynamicEx]
> -  gIntelFsp2PkgTokenSpaceGuid.PcdFspReservedMemoryLength |0x00100000|UINT32|0x46530000
> -  gIntelFsp2PkgTokenSpaceGuid.PcdBootLoaderEntry         |0xFFFFFFE4|UINT32|0x46530100
> +  gIntelFsp2PkgTokenSpaceGuid.PcdFspReservedMemoryLength  |0x00100000|UINT32|0x46530000
> +  gIntelFsp2PkgTokenSpaceGuid.PcdBootLoaderEntry          |0xFFFFFFE4|UINT32|0x46530100
> +  #
> +  # Different FSP Components may have different NumberOfPhases which can be defined
> +  # by each FspSecCore module from DSC.
> +  #
> +  gIntelFsp2PkgTokenSpaceGuid.PcdMultiPhaseNumberOfPhases |0x00000000|UINT32|0x46530101
> diff --git a/IntelFsp2Pkg/IntelFsp2Pkg.dsc b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> index b2d7867880..0713f0028d 100644
> --- a/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> +++ b/IntelFsp2Pkg/IntelFsp2Pkg.dsc
> @@ -45,6 +45,7 @@
>    FspPlatformLib|IntelFsp2Pkg/Library/BaseFspPlatformLib/BaseFspPlatformLib.inf
>    FspSwitchStackLib|IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
>    FspSecPlatformLib|IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf
> +  FspMultiPhaseLib|IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf
>  
>  [LibraryClasses.common.PEIM]
>    PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
> @@ -64,12 +65,15 @@
>    IntelFsp2Pkg/Library/BaseFspSwitchStackLib/BaseFspSwitchStackLib.inf
>    IntelFsp2Pkg/Library/BaseDebugDeviceLibNull/BaseDebugDeviceLibNull.inf
>    IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/SecFspSecPlatformLibNull.inf
> +  IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf
>  
>    IntelFsp2Pkg/FspSecCore/FspSecCoreT.inf
>    IntelFsp2Pkg/FspSecCore/FspSecCoreM.inf
> +  IntelFsp2Pkg/FspSecCore/Fsp24SecCoreM.inf
>    IntelFsp2Pkg/FspSecCore/FspSecCoreS.inf
>    IntelFsp2Pkg/FspSecCore/FspSecCoreI.inf
>    IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf
> +  IntelFsp2Pkg/FspSecCore/Fsp24SecCoreS.inf
>    IntelFsp2Pkg/FspNotifyPhase/FspNotifyPhasePeim.inf
>  
>  [PcdsFixedAtBuild.common]
> diff --git a/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf b/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf
> new file mode 100644
> index 0000000000..a79f6aecda
> --- /dev/null
> +++ b/IntelFsp2Pkg/Library/BaseFspMultiPhaseLib/BaseFspMultiPhaseLib.inf
> @@ -0,0 +1,50 @@
> +## @file
> +#  FSP MultiPhase Lib.
> +#
> +#  Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
> +#
> +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +##
> +
> +################################################################################
> +#
> +# Defines Section - statements that will be processed to create a Makefile.
> +#
> +################################################################################
> +[Defines]
> +  INF_VERSION                    = 0x00010005
> +  BASE_NAME                      = BaseFspMultiPhaseLib
> +  FILE_GUID                      = C128CADC-623E-4E41-97CB-A7138E627460
> +  MODULE_TYPE                    = SEC
> +  VERSION_STRING                 = 1.0
> +  LIBRARY_CLASS                  = FspMultiPhaseLib
> +
> +#
> +# The following information is for reference only and not required by the build tools.
> +#
> +#  VALID_ARCHITECTURES           = IA32 X64
> +#
> +
> +################################################################################
> +#
> +# Sources Section - list of files that are required for the build to succeed.
> +#
> +################################################################################
> +
> +[Sources]
> +  FspMultiPhaseLib.c
> +
> +################################################################################
> +#
> +# Package Dependency Section - list of Package files that are required for
> +#                              this module.
> +#
> +################################################################################
> +
> +[Packages]
> +  MdePkg/MdePkg.dec
> +  IntelFsp2Pkg/IntelFsp2Pkg.dec
> +
> +[Pcd]
> + gIntelFsp2PkgTokenSpaceGuid.PcdMultiPhaseNumberOfPhases # CONSUMES
> diff --git a/IntelFsp2Pkg/Tools/SplitFspBin.py b/IntelFsp2Pkg/Tools/SplitFspBin.py
> index ddabab7d8c..419e5ba985 100644
> --- a/IntelFsp2Pkg/Tools/SplitFspBin.py
> +++ b/IntelFsp2Pkg/Tools/SplitFspBin.py
> @@ -103,29 +103,31 @@ class FSP_COMMON_HEADER(Structure):
>  
>  class FSP_INFORMATION_HEADER(Structure):
>       _fields_ = [
> -        ('Signature',                      ARRAY(c_char, 4)),
> -        ('HeaderLength',                   c_uint32),
> -        ('Reserved1',                      c_uint16),
> -        ('SpecVersion',                    c_uint8),
> -        ('HeaderRevision',                 c_uint8),
> -        ('ImageRevision',                  c_uint32),
> -        ('ImageId',                        ARRAY(c_char, 8)),
> -        ('ImageSize',                      c_uint32),
> -        ('ImageBase',                      c_uint32),
> -        ('ImageAttribute',                 c_uint16),
> -        ('ComponentAttribute',             c_uint16),
> -        ('CfgRegionOffset',                c_uint32),
> -        ('CfgRegionSize',                  c_uint32),
> -        ('Reserved2',                      c_uint32),
> -        ('TempRamInitEntryOffset',         c_uint32),
> -        ('Reserved3',                      c_uint32),
> -        ('NotifyPhaseEntryOffset',         c_uint32),
> -        ('FspMemoryInitEntryOffset',       c_uint32),
> -        ('TempRamExitEntryOffset',         c_uint32),
> -        ('FspSiliconInitEntryOffset',      c_uint32),
> -        ('FspMultiPhaseSiInitEntryOffset', c_uint32),
> -        ('ExtendedImageRevision',          c_uint16),
> -        ('Reserved4',                      c_uint16)
> +        ('Signature',                       ARRAY(c_char, 4)),
> +        ('HeaderLength',                    c_uint32),
> +        ('Reserved1',                       c_uint16),
> +        ('SpecVersion',                     c_uint8),
> +        ('HeaderRevision',                  c_uint8),
> +        ('ImageRevision',                   c_uint32),
> +        ('ImageId',                         ARRAY(c_char, 8)),
> +        ('ImageSize',                       c_uint32),
> +        ('ImageBase',                       c_uint32),
> +        ('ImageAttribute',                  c_uint16),
> +        ('ComponentAttribute',              c_uint16),
> +        ('CfgRegionOffset',                 c_uint32),
> +        ('CfgRegionSize',                   c_uint32),
> +        ('Reserved2',                       c_uint32),
> +        ('TempRamInitEntryOffset',          c_uint32),
> +        ('Reserved3',                       c_uint32),
> +        ('NotifyPhaseEntryOffset',          c_uint32),
> +        ('FspMemoryInitEntryOffset',        c_uint32),
> +        ('TempRamExitEntryOffset',          c_uint32),
> +        ('FspSiliconInitEntryOffset',       c_uint32),
> +        ('FspMultiPhaseSiInitEntryOffset',  c_uint32),
> +        ('ExtendedImageRevision',           c_uint16),
> +        ('Reserved4',                       c_uint16),
> +        ('FspMultiPhaseMemInitEntryOffset', c_uint32),
> +        ('FspSmmInitEntryOffset',           c_uint32)
>      ]
>  
>  class FSP_PATCH_TABLE(Structure):
> -- 
> 2.35.0.windows.1

  reply	other threads:[~2022-08-31  0:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  0:48 [PATCH v2 0/4] IntelFsp2(Wrapper)Pkg: Support FSP 2.4 MultiPhase Chiu, Chasel
2022-08-10  0:48 ` [PATCH v2 1/4] IntelFsp2Pkg: Add FSP 2.4 MultiPhase interface Chiu, Chasel
2022-08-31  0:11   ` Nate DeSimone [this message]
2022-08-10  0:48 ` [PATCH v2 2/4] IntelFsp2WrapperPkg: " Chiu, Chasel
2022-08-31  0:11   ` Nate DeSimone
2022-08-10  0:48 ` [PATCH v2 3/4] IntelFsp2Pkg: Adopt FSP 2.4 MultiPhase functions Chiu, Chasel
2022-08-31  0:11   ` Nate DeSimone
2022-08-10  0:48 ` [PATCH v2 4/4] IntelFsp2WrapperPkg: Implement FSP 2.4 MultiPhase wrapper handlers Chiu, Chasel
2022-08-31  0:11   ` Nate DeSimone
2022-08-31  0:11 ` [PATCH v2 0/4] IntelFsp2(Wrapper)Pkg: Support FSP 2.4 MultiPhase Nate DeSimone
2022-08-31 18:13 ` Chiu, Chasel
     [not found] ` <1710808E80FE5771.19509@groups.io>
2022-09-07  4:27   ` [edk2-devel] " Chiu, Chasel
     [not found]   ` <171279939D8A2496.24814@groups.io>
2022-09-26 20:24     ` Chiu, Chasel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR11MB5832FC17DC1CB31F9613BA58CD789@PH0PR11MB5832.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox