Reviewed-by: [email protected]

> -----Original Message-----
> From: Yarlagadda, Satya P
> Sent: Friday, June 24, 2016 10:38 AM
> To: [email protected]
> Cc: Mudusuru, Giri P <[email protected]>; Yao, Jiewen
> <[email protected]>
> Subject: [PATCH] IntelFsp2Pkg-BaseFspCommonLib: Add funtion to return the
> reset required status
> 
> Added new funtion in FSPCommonLib to update the FSP API return status
> with
> the requested return status and return the control to the boot loader.
> 
> Cc: Giri P Mudusuru <[email protected]>
> Cc: Jiewen Yao <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Satya Yarlagadda <[email protected]>
> ---
>  IntelFsp2Pkg/Include/Library/FspCommonLib.h        | 11 ++++++++
>  .../Library/BaseFspCommonLib/BaseFspCommonLib.inf  |  1 +
>  .../Library/BaseFspCommonLib/FspCommonLib.c        | 29
> ++++++++++++++++++++++
>  3 files changed, 41 insertions(+)
> 
> diff --git a/IntelFsp2Pkg/Include/Library/FspCommonLib.h
> b/IntelFsp2Pkg/Include/Library/FspCommonLib.h
> index e13d0c3..231f1e4 100644
> --- a/IntelFsp2Pkg/Include/Library/FspCommonLib.h
> +++ b/IntelFsp2Pkg/Include/Library/FspCommonLib.h
> @@ -309,4 +309,15 @@ GetFspCarSize (
>    VOID
>    );
> 
> +/**
> +  This function updates the return status of the FSP API with requested
> reset type and returns to Boot Loader.
> +
> +  @param[in] FspResetType     Reset type that needs to returned as API
> return status
> +
> +**/
> +VOID
> +EFIAPI
> +FspApiReturnStatusReset (
> +  IN UINT32   FspResetType
> +  );
>  #endif
> diff --git
> a/IntelFsp2Pkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf
> b/IntelFsp2Pkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf
> index 0b0741b..df8803a 100644
> --- a/IntelFsp2Pkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf
> +++ b/IntelFsp2Pkg/Library/BaseFspCommonLib/BaseFspCommonLib.inf
> @@ -28,6 +28,7 @@
> 
>  [LibraryClasses]
>    BaseMemoryLib
> +  FspSwitchStackLib
> 
>  [Pcd]
>    gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAddress      ##
> CONSUMES
> diff --git a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c
> b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c
> index 151b189..0c5f0b3 100644
> --- a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c
> +++ b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c
> @@ -18,6 +18,7 @@
>  #include <FspGlobalData.h>
>  #include <FspEas.h>
>  #include <FspDataTable.h>
> +#include <Library/FspSwitchStackLib.h>
> 
>  #pragma pack(1)
> 
> @@ -544,3 +545,31 @@ GetFspCarSize (
>    }
>    return CarSize;
>  }
> +
> +/**
> +  This function updates the return status of the FSP API with requested
> reset type and returns to Boot Loader.
> +
> +  @param[in] FspResetType     Reset type that needs to returned as API
> return status
> +
> +**/
> +VOID
> +EFIAPI
> +FspApiReturnStatusReset (
> +  IN UINT32   FspResetType
> +  )
> +{
> +  volatile BOOLEAN  LoopUntilReset;
> +
> +  LoopUntilReset = TRUE;
> +  DEBUG ((DEBUG_INFO, "FSP returning control to Bootloader with reset
> required return status %x\n",FspResetType));
> +  ///
> +  /// Below code is not an infinite loop.The control will go back to API
> calling function in BootLoader each time BootLoader
> +  /// calls the FSP API without honoring the reset request by FSP
> +  ///
> +  do {
> +    SetFspApiReturnStatus ((EFI_STATUS)FspResetType);
> +    Pei2LoaderSwitchStack ();
> +    DEBUG ((DEBUG_ERROR, "!!!ERROR: FSP has requested BootLoader
> for reset. But BootLoader has not honored the reset\n"));
> +    DEBUG ((DEBUG_ERROR, "!!!ERROR: Please add support in
> BootLoader to honour the reset request from FSP\n"));
> +  } while (LoopUntilReset);
> +}
> --
> 2.9.0.windows.1

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to