From 35897da27ed289f086d2b528800fa60d6ef2407d Mon Sep 17 00:00:00 2001 From: "Chasel, Chiu" Date: Wed, 23 Jan 2019 12:07:45 +0800 Subject: IntelFsp2Pkg: Add function to get bootloader stack pointer REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1391 FSP on-going enhancement for stack utilization required to know bootloader stack pointer and this pointer can be retrieved by first input parameter address when FSP-M entry API invoked by bootloader. Test: Verified on internal platform and booting successfully Cc: Nate DeSimone Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chasel Chiu Reviewed-by: Star Zeng Reviewed-by: Nate DeSimone --- .../Library/BaseFspCommonLib/FspCommonLib.c | 27 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'IntelFsp2Pkg/Library/BaseFspCommonLib') diff --git a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c index 64ffba1d16..5bec4f9f97 100644 --- a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c +++ b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
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 @@ -87,9 +87,9 @@ GetFspGlobalDataPointer ( } /** - This function gets back the FSP API first parameter passed by the bootlaoder. + This function gets back the FSP API first parameter passed by the bootloader. - @retval ApiParameter FSP API first parameter passed by the bootlaoder. + @retval ApiParameter FSP API first parameter passed by the bootloader. **/ UINT32 EFIAPI @@ -104,9 +104,26 @@ GetFspApiParameter ( } /** - This function gets back the FSP API second parameter passed by the bootlaoder. + This function returns the FSP entry stack pointer from address of the first API parameter. - @retval ApiParameter FSP API second parameter passed by the bootlaoder. + @retval FSP entry stack pointer. +**/ +VOID* +EFIAPI +GetFspEntryStack ( + VOID + ) +{ + FSP_GLOBAL_DATA *FspData; + + FspData = GetFspGlobalDataPointer (); + return (VOID*)(FspData->CoreStack + CONTEXT_STACK_OFFSET(ApiParam[0])); +} + +/** + This function gets back the FSP API second parameter passed by the bootloader. + + @retval ApiParameter FSP API second parameter passed by the bootloader. **/ UINT32 EFIAPI -- cgit v1.2.3