From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2663E211963EC for ; Tue, 22 Jan 2019 21:37:05 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jan 2019 21:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,509,1539673200"; d="scan'208";a="110315172" Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.45]) by orsmga006.jf.intel.com with ESMTP; 22 Jan 2019 21:37:04 -0800 From: "Chasel, Chiu" To: edk2-devel@lists.01.org Cc: Nate DeSimone , Star Zeng , Chasel Chiu Date: Wed, 23 Jan 2019 13:36:28 +0800 Message-Id: <20190123053628.1664-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 Subject: [PATCH] IntelFsp2Pkg: Add function to get bootloader stack pointer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jan 2019 05:37:06 -0000 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 --- IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c | 27 ++++++++++++++++++++++----- IntelFsp2Pkg/Include/Library/FspCommonLib.h | 21 ++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c b/IntelFsp2Pkg/Library/BaseFspCommonLib/FspCommonLib.c index 64ffba1d16..2f2861281c 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 diff --git a/IntelFsp2Pkg/Include/Library/FspCommonLib.h b/IntelFsp2Pkg/Include/Library/FspCommonLib.h index 1c99be3b1f..e98b180fca 100644 --- a/IntelFsp2Pkg/Include/Library/FspCommonLib.h +++ b/IntelFsp2Pkg/Include/Library/FspCommonLib.h @@ -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 @@ -40,9 +40,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 @@ -51,9 +51,9 @@ GetFspApiParameter ( ); /** - This function gets back the FSP API second parameter passed by the bootlaoder. + This function gets back the FSP API second parameter passed by the bootloader. - @retval ApiParameter FSP API second parameter passed by the bootlaoder. + @retval ApiParameter FSP API second parameter passed by the bootloader. **/ UINT32 EFIAPI @@ -61,6 +61,17 @@ GetFspApiParameter2 ( VOID ); + +/** + This function returns the FSP entry stack pointer from address of the first API parameter + + @retval FSP entry stack pointer. +**/ +VOID* +EFIAPI +GetFspEntryStack ( + VOID + ); /** This function sets the FSP API parameter in the stack. -- 2.13.3.windows.1