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.20; helo=mga02.intel.com; envelope-from=ray.ni@intel.com; receiver=edk2-devel@lists.01.org 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 7F42E21959CB2 for ; Thu, 14 Feb 2019 06:10:56 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2019 06:10:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,369,1544515200"; d="scan'208";a="319003956" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga006.fm.intel.com with ESMTP; 14 Feb 2019 06:10:55 -0800 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 06:10:55 -0800 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 14 Feb 2019 06:10:54 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.102]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.162]) with mapi id 14.03.0415.000; Thu, 14 Feb 2019 22:10:53 +0800 From: "Ni, Ray" To: "Chiu, Chasel" , "edk2-devel@lists.01.org" CC: "Wang, Jian J" , "Wu, Hao A" , "Zeng, Star" , "Gao, Liming" Thread-Topic: [PATCH v3 2/3] MdeModulePkg/PeiMain: Support EFI_PEI_CORE_FV_LOCATION_PPI Thread-Index: AQHUxFRhq3D7LFgXoUurU2CFCbzWO6XfVYGQ Date: Thu, 14 Feb 2019 14:10:53 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C01A786@SHSMSX104.ccr.corp.intel.com> References: <20190214105858.5580-1-chasel.chiu@intel.com> <20190214105858.5580-3-chasel.chiu@intel.com> In-Reply-To: <20190214105858.5580-3-chasel.chiu@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTEyYWU1ZTgtZTY2NC00YzcxLWIxYWUtMWFjYWMxN2Q5NjUyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicDl5ZHZcL0UrMmJiYVNWZTFmZjV6VGF0VjRseERzak5aZldvQmZsUXJrZmsxUDRjK2NMZ2JnaVpBajBWcXFLVlUifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH v3 2/3] MdeModulePkg/PeiMain: Support EFI_PEI_CORE_FV_LOCATION_PPI 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: Thu, 14 Feb 2019 14:10:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Chiu, Chasel > Sent: Thursday, February 14, 2019 6:59 PM > To: edk2-devel@lists.01.org > Cc: Wang, Jian J ; Wu, Hao A ; > Ni, Ray ; Zeng, Star ; Gao, Liming > ; Chiu, Chasel > Subject: [PATCH v3 2/3] MdeModulePkg/PeiMain: Support > EFI_PEI_CORE_FV_LOCATION_PPI >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1524 >=20 > When shadowing PeiCore the EFI_PEI_CORE_FV_LOCATION_PPI should be > checked to see if PeiCore not in BFV, otherwise just shadowing PeiCore fr= om > BFV. >=20 > Test: Verified on internal platform and booting successfully. >=20 > Cc: Jian J Wang > Cc: Hao Wu > Cc: Ray Ni > Cc: Star Zeng > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Chasel Chiu > --- > MdeModulePkg/Core/Pei/PeiMain/PeiMain.c | 53 > ++++++++++++++++++++++++++++++++++++++++------------- > MdeModulePkg/Core/Pei/PeiMain.h | 3 ++- > MdeModulePkg/Core/Pei/PeiMain.inf | 3 ++- > 3 files changed, 44 insertions(+), 15 deletions(-) >=20 > diff --git a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c > b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c > index 4da80a8222..a7da90e149 100644 > --- a/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c > +++ b/MdeModulePkg/Core/Pei/PeiMain/PeiMain.c > @@ -1,7 +1,7 @@ > /** @file > Pei Core Main Entry Point >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> This program and the accompanying materials are licensed and made avail= able > under the terms and conditions of the BSD License which accompanies this > distribution. The full text of the license may be found at @@ -80,22 +80= ,49 @@ > ShadowPeiCore ( > IN PEI_CORE_INSTANCE *PrivateData > ) > { > - EFI_PEI_FILE_HANDLE PeiCoreFileHandle; > - EFI_PHYSICAL_ADDRESS EntryPoint; > - EFI_STATUS Status; > - UINT32 AuthenticationState; > + EFI_PEI_FILE_HANDLE PeiCoreFileHandle; > + EFI_PHYSICAL_ADDRESS EntryPoint; > + EFI_STATUS Status; > + UINT32 AuthenticationState; > + UINTN Index; > + EFI_PEI_CORE_FV_LOCATION_PPI *PeiCoreFvLocationPpi; > + UINTN PeiCoreFvIndex; >=20 > PeiCoreFileHandle =3D NULL; > - > // > - // Find the PEI Core in the BFV > + // Default PeiCore is in BFV > + // > + PeiCoreFvIndex =3D 0; > + // > + // Find the PEI Core either from EFI_PEI_CORE_FV_LOCATION_PPI > + indicated FV or BFV // Status =3D PeiServicesLocatePpi ( > + &gEfiPeiCoreFvLocationPpiGuid, > + 0, > + NULL, > + (VOID **) &PeiCoreFvLocationPpi > + ); > + if (!EFI_ERROR (Status) && (PeiCoreFvLocationPpi->PeiCoreFvLocation != =3D > NULL)) { > + // > + // If PeiCoreFvLocation present, the PEI Core should be found from i= ndicated > FV > + // > + for (Index =3D 0; Index < PrivateData->FvCount; Index ++) { > + if (PrivateData->Fv[Index].FvHandle =3D=3D PeiCoreFvLocationPpi- > >PeiCoreFvLocation) { > + PeiCoreFvIndex =3D Index; > + break; > + } > + } > + ASSERT (Index < PrivateData->FvCount); } // // Find PEI Core > + from the given FV index > // > - Status =3D PrivateData->Fv[0].FvPpi->FindFileByType ( > - PrivateData->Fv[0].FvPpi, > - EFI_FV_FILETYPE_PEI_CORE, > - PrivateData->Fv[0].FvHandle, > - &PeiCoreFileHandle > - ); > + Status =3D PrivateData->Fv[PeiCoreFvIndex].FvPpi->FindFileByType ( > + PrivateData->Fv[PeiC= oreFvIndex].FvPpi, > + EFI_FV_FILETYPE_PEI_= CORE, > + PrivateData->Fv[PeiC= oreFvIndex].FvHandle, > + &PeiCoreFileHandle > + ); > ASSERT_EFI_ERROR (Status); >=20 > // > diff --git a/MdeModulePkg/Core/Pei/PeiMain.h > b/MdeModulePkg/Core/Pei/PeiMain.h index 322e7cd845..a61da73fd8 100644 > --- a/MdeModulePkg/Core/Pei/PeiMain.h > +++ b/MdeModulePkg/Core/Pei/PeiMain.h > @@ -1,7 +1,7 @@ > /** @file > Definition of Pei Core Structures and Services >=20 > -Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.
> This program and the accompanying materials are licensed and made avail= able > under the terms and conditions of the BSD License which accompanies this > distribution. The full text of the license may be found at @@ -31,6 +31,= 7 @@ > WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS > OR IMPLIED. > #include > #include > #include > +#include > #include > #include > #include > diff --git a/MdeModulePkg/Core/Pei/PeiMain.inf > b/MdeModulePkg/Core/Pei/PeiMain.inf > index 140c4444b1..5bab2aab8c 100644 > --- a/MdeModulePkg/Core/Pei/PeiMain.inf > +++ b/MdeModulePkg/Core/Pei/PeiMain.inf > @@ -6,7 +6,7 @@ > # 2) Dispatch PEIM from discovered FV. > # 3) Handoff control to DxeIpl to load DXE core and enter DXE phase. > # > -# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
> +# Copyright (c) 2006 - 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 @@ -102,6 +10= 2,7 > @@ > gEfiTemporaryRamDonePpiGuid ## SOMETIMES_CONSUMES > gEfiPeiReset2PpiGuid ## SOMETIMES_CONSUMES > gEfiSecHobDataPpiGuid ## SOMETIMES_CONSUMES > + gEfiPeiCoreFvLocationPpiGuid ## SOMETIMES_CONSUMES >=20 > [Pcd] > gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize = ## > CONSUMES > -- > 2.13.3.windows.1