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.126; helo=mga18.intel.com; envelope-from=nathaniel.l.desimone@intel.com; receiver=edk2-devel@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 DC1F22194D387 for ; Thu, 24 Jan 2019 16:26:53 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2019 16:26:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,518,1539673200"; d="scan'208";a="109588423" Received: from orsmsx104.amr.corp.intel.com ([10.22.225.131]) by orsmga007.jf.intel.com with ESMTP; 24 Jan 2019 16:26:53 -0800 Received: from orsmsx159.amr.corp.intel.com (10.22.240.24) by ORSMSX104.amr.corp.intel.com (10.22.225.131) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 24 Jan 2019 16:26:52 -0800 Received: from orsmsx114.amr.corp.intel.com ([169.254.8.248]) by ORSMSX159.amr.corp.intel.com ([169.254.11.106]) with mapi id 14.03.0415.000; Thu, 24 Jan 2019 16:26:51 -0800 From: "Desimone, Nathaniel L" To: "Chiu, Chasel" , "edk2-devel@lists.01.org" CC: "Zeng, Star" Thread-Topic: [PATCH] IntelFsp2Pkg: Add function to get bootloader stack pointer Thread-Index: AQHUst21Haj4Eii0xk6/VSSjiiIrLqW/I3gA Date: Fri, 25 Jan 2019 00:26:51 +0000 Message-ID: <02A34F284D1DA44BB705E61F7180EF0AAE815971@ORSMSX114.amr.corp.intel.com> References: <20190123053628.1664-1-chasel.chiu@intel.com> In-Reply-To: <20190123053628.1664-1-chasel.chiu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzYzZDMxZmItNGEyZS00N2YyLTgxYWEtOTRjOGM5NGU3MGJhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMnhyYnZQWGYwT0FubUJsOEhkMXNIaXBcL2l4Rngya2w4U0ZJV1FaME95Tis1THFlalFuQmVnZ3F2XC9NVW16c3dKIn0= x-ctpclassification: CTP_NT x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: [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: Fri, 25 Jan 2019 00:26:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Nate DeSimone -----Original Message----- From: Chiu, Chasel=20 Sent: Tuesday, January 22, 2019 9:36 PM To: edk2-devel@lists.01.org Cc: Desimone, Nathaniel L ; Zeng, Star ; Chiu, Chasel Subject: [PATCH] IntelFsp2Pkg: Add function to get bootloader stack pointer REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1391 FSP on-going enhancement for stack utilization required to know bootloader = stack pointer and this pointer can be retrieved by first input parameter ad= dress 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/IntelFs= p2Pkg/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 =20 - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -87,9 +87,9 @@ GetFspGlobalDataPointer ( } =20 /** - This function gets back the FSP API first parameter passed by the bootla= oder. + This function gets back the FSP API first parameter passed by the bootlo= ader. =20 - @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 ( } =20 /** - This function gets back the FSP API second parameter passed by the bootl= aoder. + This function returns the FSP entry stack pointer from address of the=20 + first API parameter =20 - @retval ApiParameter FSP API second parameter passed by the bootlaoder. + @retval FSP entry stack pointer. +**/ +VOID* +EFIAPI +GetFspEntryStack ( + VOID + ) +{ + FSP_GLOBAL_DATA *FspData; + + FspData =3D GetFspGlobalDataPointer (); + return (VOID*)(FspData->CoreStack +=20 +CONTEXT_STACK_OFFSET(ApiParam[0])); +} + +/** + This function gets back the FSP API second parameter passed by the bootl= oader. + + @retval ApiParameter FSP API second parameter passed by the bootloader. **/ UINT32 EFIAPI diff --git a/IntelFsp2Pkg/Include/Library/FspCommonLib.h b/IntelFsp2Pkg/Inc= lude/Library/FspCommonLib.h index 1c99be3b1f..e98b180fca 100644 --- a/IntelFsp2Pkg/Include/Library/FspCommonLib.h +++ b/IntelFsp2Pkg/Include/Library/FspCommonLib.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights=20 + reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License which accompanies this distribution. The full text of the license may b= e found at @@ -40,9 +40,9 @@ GetFspGlobalDataPointer ( ); =20 /** - This function gets back the FSP API first parameter passed by the bootla= oder. + This function gets back the FSP API first parameter passed by the bootlo= ader. =20 - @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 ( ); =20 /** - This function gets back the FSP API second parameter passed by the bootl= aoder. + This function gets back the FSP API second parameter passed by the bootl= oader. =20 - @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 ); =20 + +/** + This function returns the FSP entry stack pointer from address of the=20 +first API parameter + + @retval FSP entry stack pointer. +**/ +VOID* +EFIAPI +GetFspEntryStack ( + VOID + ); /** This function sets the FSP API parameter in the stack. =20 -- 2.13.3.windows.1