From nobody Tue Dec 24 13:26:43 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 15114042214441007.4223038491857; Wed, 22 Nov 2017 18:30:21 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 05FAF2035BB25; Wed, 22 Nov 2017 18:26:03 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 9F33B21C913D3 for ; Wed, 22 Nov 2017 18:26:01 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Nov 2017 18:30:18 -0800 Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.240.24]) by orsmga003.jf.intel.com with ESMTP; 22 Nov 2017 18:30:16 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=chasel.chiu@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,438,1505804400"; d="scan'208";a="5407615" From: "Chasel, Chiu" To: edk2-devel@lists.01.org Date: Thu, 23 Nov 2017 10:30:03 +0800 Message-Id: <20171123023003.10552-1-chasel.chiu@intel.com> X-Mailer: git-send-email 2.13.3.windows.1 Subject: [edk2] [PATCH] IntelFsp2WrapperPkg: Support UPD allocation outside FspWrapper X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiewen Yao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" UPD allocation and patching can be done outside FspWrapper as implementation choice so adding a PCD to select between original FspWrapper allocation model or outside model Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chasel Chiu Reviewed-by: Jiewen.yao@intel.com --- .../FspmWrapperPeim/FspmWrapperPeim.c | 25 ++++--- .../FspmWrapperPeim/FspmWrapperPeim.inf | 3 +- .../FspsWrapperPeim/FspsWrapperPeim.c | 84 +++++++++++-------= ---- .../FspsWrapperPeim/FspsWrapperPeim.inf | 3 +- IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec | 13 +++- 5 files changed, 76 insertions(+), 52 deletions(-) diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c b/IntelF= sp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c index f1d1cd6421..7b7c5f5d86 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.c @@ -3,7 +3,7 @@ register TemporaryRamDonePpi to call TempRamExit API, and register Memor= yDiscoveredPpi notify to call FspSiliconInit API. =20 - Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2017, Intel Corporation. All rights 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 @@ -63,20 +63,29 @@ PeiFspMemoryInit ( DEBUG ((DEBUG_INFO, "PeiFspMemoryInit enter\n")); =20 FspHobListPtr =3D NULL; + FspmUpdDataPtr =3D NULL; =20 - // - // Copy default FSP-M UPD data from Flash - // FspmHeaderPtr =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFspm= BaseAddress)); DEBUG ((DEBUG_INFO, "FspmHeaderPtr - 0x%x\n", FspmHeaderPtr)); if (FspmHeaderPtr =3D=3D NULL) { return EFI_DEVICE_ERROR; } =20 - FspmUpdDataPtr =3D (FSPM_UPD_COMMON *)AllocateZeroPool ((UINTN)FspmHeade= rPtr->CfgRegionSize); - ASSERT (FspmUpdDataPtr !=3D NULL); - SourceData =3D (UINTN *)((UINTN)FspmHeaderPtr->ImageBase + (UINTN)FspmHe= aderPtr->CfgRegionOffset); - CopyMem (FspmUpdDataPtr, SourceData, (UINTN)FspmHeaderPtr->CfgRegionSize= ); + if (PcdGet32 (PcdFspmUpdDataAddress) =3D=3D 0 && (FspmHeaderPtr->CfgRegi= onSize !=3D 0) && (FspmHeaderPtr->CfgRegionOffset !=3D 0)) { + // + // Copy default FSP-M UPD data from Flash + // + FspmUpdDataPtr =3D (FSPM_UPD_COMMON *)AllocateZeroPool ((UINTN)FspmHea= derPtr->CfgRegionSize); + ASSERT (FspmUpdDataPtr !=3D NULL); + SourceData =3D (UINTN *)((UINTN)FspmHeaderPtr->ImageBase + (UINTN)Fspm= HeaderPtr->CfgRegionOffset); + CopyMem (FspmUpdDataPtr, SourceData, (UINTN)FspmHeaderPtr->CfgRegionSi= ze); + } else { + // + // External UPD is ready, get the buffer from PCD pointer. + // + FspmUpdDataPtr =3D (FSPM_UPD_COMMON *)PcdGet32 (PcdFspmUpdDataAddress); + ASSERT (FspmUpdDataPtr !=3D NULL); + } =20 DEBUG ((DEBUG_INFO, "UpdateFspmUpdData enter\n")); UpdateFspmUpdData ((VOID *)FspmUpdDataPtr); diff --git a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf b/Inte= lFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf index 2b3d240d08..542356b582 100644 --- a/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf +++ b/IntelFsp2WrapperPkg/FspmWrapperPeim/FspmWrapperPeim.inf @@ -59,7 +59,8 @@ IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec =20 [Pcd] - gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmBaseAddress ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress ## CONSUMES =20 [Sources] FspmWrapperPeim.c diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c b/IntelF= sp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c index ddc19c7e8f..70dac7a414 100644 --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.c @@ -3,7 +3,7 @@ register TemporaryRamDonePpi to call TempRamExit API, and register Memor= yDiscoveredPpi notify to call FspSiliconInit API. =20 - Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2017, Intel Corporation. All rights 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 @@ -44,14 +44,14 @@ extern EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc; extern EFI_GUID gFspHobGuid; =20 /** -This function handles S3 resume task at the end of PEI + This function handles S3 resume task at the end of PEI =20 -@param[in] PeiServices Pointer to PEI Services Table. -@param[in] NotifyDesc Pointer to the descriptor for the Notification e= vent that -caused this function to execute. -@param[in] Ppi Pointer to the PPI data associated with this fun= ction. + @param[in] PeiServices Pointer to PEI Services Table. + @param[in] NotifyDesc Pointer to the descriptor for the Notification= event that + caused this function to execute. + @param[in] Ppi Pointer to the PPI data associated with this f= unction. =20 -@retval EFI_STATUS Always return EFI_SUCCESS + @retval EFI_STATUS Always return EFI_SUCCESS **/ EFI_STATUS EFIAPI @@ -68,14 +68,14 @@ EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc =3D { }; =20 /** -This function handles S3 resume task at the end of PEI + This function handles S3 resume task at the end of PEI =20 -@param[in] PeiServices Pointer to PEI Services Table. -@param[in] NotifyDesc Pointer to the descriptor for the Notification e= vent that -caused this function to execute. -@param[in] Ppi Pointer to the PPI data associated with this fun= ction. + @param[in] PeiServices Pointer to PEI Services Table. + @param[in] NotifyDesc Pointer to the descriptor for the Notification= event that + caused this function to execute. + @param[in] Ppi Pointer to the PPI data associated with this f= unction. =20 -@retval EFI_STATUS Always return EFI_SUCCESS + @retval EFI_STATUS Always return EFI_SUCCESS **/ EFI_STATUS EFIAPI @@ -130,13 +130,13 @@ S3EndOfPeiNotify( } =20 /** -Return Hob list produced by FSP. + Return Hob list produced by FSP. =20 -@param[in] PeiServices The pointer to the PEI Services Table. -@param[in] This The pointer to this instance of this PPI. -@param[out] FspHobList The pointer to Hob list produced by FSP. + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of this PPI. + @param[out] FspHobList The pointer to Hob list produced by FSP. =20 -@return EFI_SUCCESS FReturn Hob list produced by FSP successfully. + @return EFI_SUCCESS FReturn Hob list produced by FSP successfully. **/ EFI_STATUS EFIAPI @@ -157,13 +157,13 @@ EFI_PEI_PPI_DESCRIPTOR mPeiFspSiliconInitD= onePpi =3D { }; =20 /** -Return Hob list produced by FSP. + Return Hob list produced by FSP. =20 -@param[in] PeiServices The pointer to the PEI Services Table. -@param[in] This The pointer to this instance of this PPI. -@param[out] FspHobList The pointer to Hob list produced by FSP. + @param[in] PeiServices The pointer to the PEI Services Table. + @param[in] This The pointer to this instance of this PPI. + @param[out] FspHobList The pointer to Hob list produced by FSP. =20 -@return EFI_SUCCESS FReturn Hob list produced by FSP successfully. + @return EFI_SUCCESS FReturn Hob list produced by FSP successfully. **/ EFI_STATUS EFIAPI @@ -209,14 +209,14 @@ EFI_PEI_NOTIFY_DESCRIPTOR mPeiMemoryDiscoveredNotifyD= esc =3D { }; =20 /** -This function is called after PEI core discover memory and finish migratio= n. + This function is called after PEI core discover memory and finish migrat= ion. =20 -@param[in] PeiServices Pointer to PEI Services Table. -@param[in] NotifyDesc Pointer to the descriptor for the Notification e= vent that -caused this function to execute. -@param[in] Ppi Pointer to the PPI data associated with this fun= ction. + @param[in] PeiServices Pointer to PEI Services Table. + @param[in] NotifyDesc Pointer to the descriptor for the Notification= event that + caused this function to execute. + @param[in] Ppi Pointer to the PPI data associated with this f= unction. =20 -@retval EFI_STATUS Always return EFI_SUCCESS + @retval EFI_STATUS Always return EFI_SUCCESS **/ EFI_STATUS EFIAPI @@ -234,22 +234,27 @@ PeiMemoryDiscoveredNotify ( FSPS_UPD_COMMON *FspsUpdDataPtr; UINTN *SourceData; =20 - =20 DEBUG ((DEBUG_INFO, "PeiMemoryDiscoveredNotify enter\n")); - =20 - // - // Copy default FSP-S UPD data from Flash - // + FspsUpdDataPtr =3D NULL; + FspsHeaderPtr =3D (FSP_INFO_HEADER *)FspFindFspHeader (PcdGet32 (PcdFsps= BaseAddress)); DEBUG ((DEBUG_INFO, "FspsHeaderPtr - 0x%x\n", FspsHeaderPtr)); if (FspsHeaderPtr =3D=3D NULL) { return EFI_DEVICE_ERROR; } =20 - FspsUpdDataPtr =3D (FSPS_UPD_COMMON *)AllocateZeroPool ((UINTN)FspsHeade= rPtr->CfgRegionSize); - ASSERT (FspsUpdDataPtr !=3D NULL); - SourceData =3D (UINTN *)((UINTN)FspsHeaderPtr->ImageBase + (UINTN)FspsHe= aderPtr->CfgRegionOffset); - CopyMem (FspsUpdDataPtr, SourceData, (UINTN)FspsHeaderPtr->CfgRegionSize= ); + if (PcdGet32 (PcdFspsUpdDataAddress) =3D=3D 0 && (FspsHeaderPtr->CfgRegi= onSize !=3D 0) && (FspsHeaderPtr->CfgRegionOffset !=3D 0)) { + // + // Copy default FSP-S UPD data from Flash + // + FspsUpdDataPtr =3D (FSPS_UPD_COMMON *)AllocateZeroPool ((UINTN)FspsHea= derPtr->CfgRegionSize); + ASSERT (FspsUpdDataPtr !=3D NULL); + SourceData =3D (UINTN *)((UINTN)FspsHeaderPtr->ImageBase + (UINTN)Fsps= HeaderPtr->CfgRegionOffset); + CopyMem (FspsUpdDataPtr, SourceData, (UINTN)FspsHeaderPtr->CfgRegionSi= ze); + } else { + FspsUpdDataPtr =3D (FSPS_UPD_COMMON *)PcdGet32 (PcdFspsUpdDataAddress); + ASSERT (FspsUpdDataPtr !=3D NULL); + } =20 UpdateFspsUpdData ((VOID *)FspsUpdDataPtr); =20 @@ -314,7 +319,7 @@ FspsWrapperInit ( // Status =3D PeiServicesNotifyPpi (&mPeiMemoryDiscoveredNotifyDesc); ASSERT_EFI_ERROR (Status); - =20 + // // Register EndOfPei Notify for S3 to run FSP NotifyPhase // @@ -342,7 +347,6 @@ FspsWrapperPeimEntryPoint ( IN CONST EFI_PEI_SERVICES **PeiServices ) { - DEBUG ((DEBUG_INFO, "FspsWrapperPeimEntryPoint\n")); =20 FspsWrapperInit (); diff --git a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf b/Inte= lFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf index c858e7097d..cd87a99c40 100644 --- a/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf +++ b/IntelFsp2WrapperPkg/FspsWrapperPeim/FspsWrapperPeim.inf @@ -66,7 +66,8 @@ gEfiPeiMemoryDiscoveredPpiGuid ## NOTIFY =20 [Pcd] - gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress ## CONSUMES + gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress ## CONSUMES =20 [Guids] gFspHobGuid ## CONSUMES ## HOB diff --git a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec b/IntelFsp2Wrapper= Pkg/IntelFsp2WrapperPkg.dec index c0881852c5..7634619f80 100644 --- a/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec +++ b/IntelFsp2WrapperPkg/IntelFsp2WrapperPkg.dec @@ -1,7 +1,7 @@ ## @file # Provides drivers and definitions to support fsp in EDKII bios. # -# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials are licensed and made availa= ble under # the terms and conditions of the BSD License that accompanies this distri= bution. # The full text of the license may be found at @@ -95,4 +95,13 @@ =20 [PcdsFixedAtBuild, PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx] gIntelFsp2WrapperTokenSpaceGuid.PcdFspsBaseAddress|0x00000000|UINT32|0x0= 0001001 - =20 \ No newline at end of file + # + # To provide flexibility for platform to pre-allocate FSP UPD buffer + # + # The PCDs define the pre-allocated FSPM and FSPS UPD Data Buffer Addres= s. + # 0x00000000 - Platform will not pre-allocate UPD buffer before FspWrapp= er module + # non-zero - Platform will pre-allocate UPD buffer and patch this valu= e to + # buffer address before FspWrapper module executing. + # + gIntelFsp2WrapperTokenSpaceGuid.PcdFspmUpdDataAddress|0x00000000|UINT32|= 0x50000000 + gIntelFsp2WrapperTokenSpaceGuid.PcdFspsUpdDataAddress|0x00000000|UINT32|= 0x50000001 \ No newline at end of file --=20 2.13.3.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel