From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.11431.1589461050972685431 for ; Thu, 14 May 2020 05:57:31 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Jt0J4EJB; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: chasel.chiu@intel.com) IronPort-SDR: A/lHJp/qASf3SH3AgPwNRZsj4jD1hESxAfvMtN7DiWHuCIp+ScZCz9lmvtHo0RBwmsYbNLCzMK 3eKWFxjQ3D/w== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 May 2020 05:57:30 -0700 IronPort-SDR: 7HtYkR61Hn9eS7EhZzb70wK+oTzyujmYcPbrnnaSpMF8qnci+ia07MuHSNKvMOLYV3lT6Gn3pE f9un7HvOzZrA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,391,1583222400"; d="scan'208";a="298699893" Received: from orsmsx103.amr.corp.intel.com ([10.22.225.130]) by orsmga008.jf.intel.com with ESMTP; 14 May 2020 05:57:29 -0700 Received: from ORSEDG001.ED.cps.intel.com (10.7.248.4) by ORSMSX103.amr.corp.intel.com (10.22.225.130) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 May 2020 05:57:29 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.177) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 14 May 2020 05:57:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KRjLF5l8YTK+j9Tf5qfPSfqFSkdn+441JhDo0xKbOEzlel4xoy4BAW/aqVhRbjaBk/v3a8Nml5lAym1Zfoox5XaciOKacILIUharNrcoWoz7jPlZVD9EoaffHFsWUfuwCJFm5UdZog9Tj7sfGf72hPttciuUJNrEHnqC+4yw1MhG6JoBpmR0jtAlgFmxDIsU+XhYNh76xCa2DTKfgydeoc/3h/+AoEkIxcxz5fk3oKSywDFcqTBirQLTv1Av4Uzf7C8Z/W9JhvAa0oqG1DGbFSg9Sxiy5EYpd+/MRrcCmVyoXLSL/NC6UdLAjh0N3XZSEmUPOMuUwkUPLElKXFVjWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rKhi/JRxY82HWQxMfpEHbUn91J3v3RdE2Q4Zm9tBcek=; b=IYSBFJ3MuxP801a2pElngmM7OUMKPf66hG/fuD7eRL1wUM7hYtwueFa53maBVpkiyAyWHYcm4yD/VGPb73QtPYQ+jaAhMMwxkSuB0FR/c9s5WOnfMh6i9DLI0PFe5xIm/lXgbIn0gDQyxPdKKQGTW1yb7H0KzupwKTeHDoM08kJdF0KqjeNhuoasCsQ8Z+C1ygnusyN3f0EVWlj2byUePddGiC58K3AK7yC0X4y2jjSL7bhxPNm+/KPn1wkkMqs8Uuds9wf/44bxW3ut7jKYP/MMs3B5Vi5iq+7F9zFR4PRgmV5aOuYdBIDL7m88YyK2ZjVhMrTE5ivCUFBRulFzAw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rKhi/JRxY82HWQxMfpEHbUn91J3v3RdE2Q4Zm9tBcek=; b=Jt0J4EJB9jsifGGTp03qD3PULOqohFyfmL7BuO0xLZi0wt8rwkkHKgqBQCZSDRrtPiJRWG6+xUFzOKibijDOHJ/ggXi6w621JnM+3RPD8jHsZ80SqlAM5wbwSZEFLNCQtBzVZNC0ozT5+gL6sLO2Q9u6OsVqeNTv9tZweEFKsi0= Received: from SN6PR11MB2814.namprd11.prod.outlook.com (2603:10b6:805:55::15) by SN6PR11MB3423.namprd11.prod.outlook.com (2603:10b6:805:db::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Thu, 14 May 2020 12:57:26 +0000 Received: from SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::152f:df2:6370:1584]) by SN6PR11MB2814.namprd11.prod.outlook.com ([fe80::152f:df2:6370:1584%4]) with mapi id 15.20.3000.016; Thu, 14 May 2020 12:57:26 +0000 From: "Chiu, Chasel" To: "Desimone, Nathaniel L" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "Zeng, Star" Subject: Re: [edk2-devel] [PATCH v8] IntelFsp2Pkg: Support Multi-Phase SiInit and debug handlers. Thread-Topic: [edk2-devel] [PATCH v8] IntelFsp2Pkg: Support Multi-Phase SiInit and debug handlers. Thread-Index: AQHWKTXwsxSVZIg3SEO3bbHPIVXSZ6inB25AgACEW0A= Date: Thu, 14 May 2020 12:57:26 +0000 Message-ID: References: <20200513145019.13504-1-chasel.chiu@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.2.0.6 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [134.134.136.196] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 3d1315ac-7dad-48f8-ec71-08d7f8065a5e x-ms-traffictypediagnostic: SN6PR11MB3423: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 040359335D x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RQ5XnLsHL9/NEm8qaS4yPXMRUz3eStrSNuTb3oxdQu+SUj1N2ck+DR9p56If+mea23bhkSfYbI/7tvRwpFEbf3bKAeymDfzE+phH34fRe2fAajVkfoOApqPrb+n9kfqcTq75WaEaycbp+Qb+ur/C8Zi7h7P3Pf4VMfRmFu7o8joTQXPIkdq2o/b/BVwhWXy+lQzVATfNDvJIgPqTmg1V56owf6yWGf6ANyBoXoAZ0wlS3zapbOmoHWy4iApTrIBLyCeNWGK4WJnYv5YGk7WlYGDY1+zZ9pACDxkCe72oTRJflWWPcq1fc6OuE3VqSa3bFapmbFj+4PV3llsik4FPPIV0clkV++55zv0GKFhFHOQdw+mj8A1Sssc6sm541uqwHiUNw7WIXiJnPcVsZIElNpdF1ICdxZTmem/5OfZK73ZVT2gZVwNiTy9vI8AjBOFh4KYicn8YwNH437ZB52SoRTOg7tGpycdgSHVi1PmCgyYY0ShZB+l5eyu/6/y++dDrs06OVai+7we83A1hOKo0eg== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR11MB2814.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(6029001)(376002)(396003)(39860400002)(136003)(346002)(366004)(55016002)(33656002)(66946007)(76116006)(26005)(6506007)(8936002)(86362001)(186003)(8676002)(52536014)(54906003)(107886003)(53546011)(7696005)(316002)(4326008)(110136005)(19627235002)(64756008)(66476007)(966005)(9686003)(478600001)(66446008)(2906002)(66556008)(5660300002)(30864003)(71200400001)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: R54LtXI484nI1u4ai/ZX4dJwDe92AKkqKlzuEYEXzkyZ48QLXXPT27jpqh/Afpiaxs5NcfoRm8wE5Nj4Tcn+GKSMgzQfYo+gI409lmX+7talPUm3OTRRuA77R8djOBtHlhaCd2wyHL3iFIgBwiv8/4YsNkKmrDl1igb6xTpiq2BEWunhoaFI0gPpkO3/+kapeA20X1Rk2ngoAVSYyHGwE4aEJ4M5BgMTeG8N9AudA/592///c3sMw6f+xjJgT+9khdKL6ebneL1T2X8qpZ4ei7tqdwrDhMcTX36tYvwomCsUOhukI81dHFThD9JElD0oqHGZKrDpaWONAbp6XZ4GpVH6IjXB0okTDd6oZG9ZRO33xf4nnZY3u/wQK1X6OqU+okmVyr9HmjYfQt3BQAI7EIjpshfkNhbaSFdIf0fGRXa7s8U8GRE+y4ESJL9WzDPz5Mc6/ptCLk6AIzlt/CM6i+ZbwHDblv7PWVZHM7bcMthv7rYux8MFvkK51XKkRfdn MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 3d1315ac-7dad-48f8-ec71-08d7f8065a5e X-MS-Exchange-CrossTenant-originalarrivaltime: 14 May 2020 12:57:26.3538 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: G5B2HPmFpMg54QIQNLApVW8AnOPdJA1dvYKo0vQB0kdR57ibTKJ3R8rzdeXsr8sNfUu0A8kTTK2/O4qIv5OMPg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB3423 Return-Path: chasel.chiu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Thanks Nate! I have resolved below issues and pushed: f2cdb268ef04eeec5194= 8b5d81eeca5cab5ed9af > -----Original Message----- > From: Desimone, Nathaniel L > Sent: Thursday, May 14, 2020 1:06 PM > To: devel@edk2.groups.io; Chiu, Chasel > Cc: Ma, Maurice ; Zeng, Star > Subject: RE: [edk2-devel] [PATCH v8] IntelFsp2Pkg: Support Multi-Phase S= iInit > and debug handlers. >=20 > Hi Chasel, >=20 > Two minor comments. >=20 > #1) The following comment: >=20 > // Usually OnSeparateStack can be reset when FSP-M returning control > back to bootloader and after > // that FSP again has a chance to run on the same bootloader stack. >=20 > This is not quite accurate. Once we switch to the separate stack, we can > never come back to bootloader stack. The reason why is because all the P= EI > core global data (List of PEIMs, PPI list, etc.) is stored in the stack.= Because > those data structure use several pointers, all the PEI core state needs = to be > relocated/fixed up if the stack base changes. >=20 > The only reason this works OK is because the PeiCore() function never > returns. >=20 > #2) I think Reserved4[26] should be Reserved4[20]. Please see inline. >=20 > With those changes... >=20 > Reviewed-by: Nate DeSimone >=20 > The only opportunity we have to fixup the PEI global state is during the= flow > that shadows PEI to DRAM, since that requires us to relocate PEI core an= yway. > So once OneSeperateStack becomes 1... it can never go back to 0 without = a > platform reset. > > -----Original Message----- > > From: devel@edk2.groups.io On Behalf Of Chiu, > > Chasel > > Sent: Wednesday, May 13, 2020 7:50 AM > > To: devel@edk2.groups.io > > Cc: Ma, Maurice ; Desimone, Nathaniel L > > ; Zeng, Star > > Subject: [edk2-devel] [PATCH v8] IntelFsp2Pkg: Support Multi-Phase > > SiInit and debug handlers. > > > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2698 > > > > To enhance FSP silicon initialization flexibility an optional > > Multi-Phase API is introduced and FSP header needs update for new API > > offset. Also new SecCore module created for FspMultiPhaseSiInit API > > > > New ARCH_UPD introduced for enhancing FSP debug message flexibility > > now bootloader can pass its own debug handler function pointer and FSP > > will call the function to handle debug message. > > To support calling bootloader functions, a FspGlobalData field added > > to indicate if FSP needs to switch stack when FSP running on separate > > stack from bootloader. > > > > Cc: Maurice Ma > > Cc: Nate DeSimone > > Cc: Star Zeng > > Signed-off-by: Chasel Chiu > > --- > > > > V8: > > Add OnSeparateStack FspGlobalData field to indicate if FSP running on > > bootloader stack or not. When FSP calling bootloader functions > > switching stack is necessary when FSP running on separate stack. > > > > IntelFsp2Pkg/FspSecCore/SecFsp.c > | 12 +++++++++++- > > IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > | 6 +++--- > > IntelFsp2Pkg/FspSecCore/SecMain.c > | 10 +++++++++- > > IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c | > > 19 > > ++++++++++++++++++- > > IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf > | 52 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++ > > IntelFsp2Pkg/FspSecCore/Ia32/Fsp22ApiEntryS.nasm > | 99 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > +++++++++++++++++++++++++++++++++++++++++ > > IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm > | 5 > > ++++- > > IntelFsp2Pkg/Include/FspEas/FspApi.h > | 130 > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > > +++++++++++--- > > IntelFsp2Pkg/Include/FspGlobalData.h > | 11 ++++++++--- > > IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > | 10 ++++++++-- > > IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h | > 16 > > +++++++++++++++- > > 11 files changed, 354 insertions(+), 16 deletions(-) > > > > diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.c > > b/IntelFsp2Pkg/FspSecCore/SecFsp.c > > index 446d1730e9..216f7bb6c5 100644 > > --- a/IntelFsp2Pkg/FspSecCore/SecFsp.c > > +++ b/IntelFsp2Pkg/FspSecCore/SecFsp.c > > @@ -1,6 +1,6 @@ > > /** @file > > > > - Copyright (c) 2014 - 2019, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -161,6 +161,16 @@ FspGlobalDataInit ( > > SetFspSiliconInitUpdDataPointer (NULL); > > > > // > > + // Initialize OnSeparateStack value. > > + // > > + if (PcdGet8 (PcdFspHeapSizePercentage) !=3D 0) { > > + // > > + // FSP is running on its own stack and may need switching stack > > + when > > calling bootloader functions. > > + // > > + GetFspGlobalDataPointer ()->OnSeparateStack =3D 1; } > > + > > + // > > // Initialize serial port > > // It might have been done in ProcessLibraryConstructorList(), > however, > > // the FSP global data is not initialized at that time. So do it > > again diff --git a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > > b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > > index 8e0595fe9a..1334959005 100644 > > --- a/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > > +++ b/IntelFsp2Pkg/FspSecCore/SecFspApiChk.c > > @@ -1,6 +1,6 @@ > > /** @file > > > > - Copyright (c) 2016 - 2018, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2016 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -59,7 +59,7 @@ FspApiCallingCheck ( > > Status =3D EFI_UNSUPPORTED; > > } > > } > > - } else if (ApiIdx =3D=3D FspSiliconInitApiIndex) { > > + } else if ((ApiIdx =3D=3D FspSiliconInitApiIndex) || (ApiIdx =3D=3D > > + FspMultiPhaseSiInitApiIndex)) { > > // > > // FspSiliconInit check > > // > > @@ -68,7 +68,7 @@ FspApiCallingCheck ( > > } else { > > if (FspData->Signature !=3D FSP_GLOBAL_DATA_SIGNATURE) { > > Status =3D EFI_UNSUPPORTED; > > - } else if (EFI_ERROR (FspUpdSignatureCheck (ApiIdx, ApiParam)))= { > > + } else if (EFI_ERROR (FspUpdSignatureCheck > > + (FspSiliconInitApiIndex, ApiParam))) { > > Status =3D EFI_INVALID_PARAMETER; > > } > > } > > diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c > > b/IntelFsp2Pkg/FspSecCore/SecMain.c > > index 7169afc6c7..300f93ebab 100644 > > --- a/IntelFsp2Pkg/FspSecCore/SecMain.c > > +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c > > @@ -1,6 +1,6 @@ > > /** @file > > > > - Copyright (c) 2014 - 2019, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -221,6 +221,14 @@ SecTemporaryRamSupport ( > > UINTN CurrentStack; > > UINTN FspStackBase; > > > > + // > > + // Override OnSeparateStack to 1 because this function will switch > > + stack to permanent memory which // makes FSP running on different > > stack from bootloader temp ram stack. > > + // Usually OnSeparateStack can be reset when FSP-M returning > > + control back to bootloader and after // that FSP again has a chance > > + to run on the > > same bootloader stack. > > + // > > + GetFspGlobalDataPointer ()->OnSeparateStack =3D 1; > > + > > if (PcdGet8 (PcdFspHeapSizePercentage) =3D=3D 0) { > > > > CurrentStack =3D AsmReadEsp(); > > diff --git > > a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c > > b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c > > index f7945b5240..df8c5d121f 100644 > > --- > > a/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull.c > > +++ b/IntelFsp2Pkg/Library/SecFspSecPlatformLibNull/PlatformSecLibNull > > +++ .c > > @@ -1,7 +1,7 @@ > > /** @file > > Null instance of Platform Sec Lib. > > > > - Copyright (c) 2014 - 2019, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -25,3 +25,20 @@ FspUpdSignatureCheck ( { > > return EFI_SUCCESS; > > } > > + > > +/** > > + This function handles FspMultiPhaseSiInitApi. > > + > > + @param[in] ApiIdx Internal index of the FSP API. > > + @param[in] ApiParam Parameter of the FSP API. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +FspMultiPhaseSiInitApiHandler ( > > + IN UINT32 ApiIdx, > > + IN VOID *ApiParam > > + ) > > +{ > > + return EFI_SUCCESS; > > +} > > diff --git a/IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf > > b/IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf > > new file mode 100644 > > index 0000000000..0a24eb2a8b > > --- /dev/null > > +++ b/IntelFsp2Pkg/FspSecCore/Fsp22SecCoreS.inf > > @@ -0,0 +1,52 @@ > > +## @file > > +# Sec Core for FSP to support MultiPhase (SeparatePhase) > SiInitialization. > > +# > > +# Copyright (c) 2020, Intel Corporation. All rights reserved.
# > > +# > > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > > + > > +[Defines] > > + INF_VERSION =3D 0x00010005 > > + BASE_NAME =3D Fsp22SecCoreS > > + FILE_GUID =3D > DF0FCD70-264A-40BF-BBD4-06C76DB19CB1 > > + MODULE_TYPE =3D SEC > > + VERSION_STRING =3D 1.0 > > + > > +# > > +# The following information is for reference only and not required by > > +the > > build tools. > > +# > > +# VALID_ARCHITECTURES =3D IA32 > > +# > > + > > +[Sources] > > + SecFspApiChk.c > > + SecFsp.h > > + > > +[Sources.IA32] > > + Ia32/Stack.nasm > > + Ia32/Fsp22ApiEntryS.nasm > > + Ia32/FspApiEntryCommon.nasm > > + Ia32/FspHelper.nasm > > + > > +[Binaries.Ia32] > > + RAW|Vtf0/Bin/ResetVec.ia32.raw |GCC > > + > > +[Packages] > > + MdePkg/MdePkg.dec > > + IntelFsp2Pkg/IntelFsp2Pkg.dec > > + > > +[LibraryClasses] > > + BaseMemoryLib > > + DebugLib > > + BaseLib > > + PciCf8Lib > > + SerialPortLib > > + FspSwitchStackLib > > + FspCommonLib > > + FspSecPlatformLib > > + > > +[Ppis] > > + gEfiTemporaryRamSupportPpiGuid > ## PRODUCES > > + > > diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/Fsp22ApiEntryS.nasm > > b/IntelFsp2Pkg/FspSecCore/Ia32/Fsp22ApiEntryS.nasm > > new file mode 100644 > > index 0000000000..c5e73a635b > > --- /dev/null > > +++ b/IntelFsp2Pkg/FspSecCore/Ia32/Fsp22ApiEntryS.nasm > > @@ -0,0 +1,99 @@ > > +;; @file > > +; Provide FSP API entry points. > > +; > > +; Copyright (c) 2020, Intel Corporation. All rights reserved.
; > > +SPDX-License-Identifier: BSD-2-Clause-Patent ;; > > + > > + SECTION .text > > + > > +; > > +; Following functions will be provided in C ; extern > > +ASM_PFX(FspApiCommon) extern > > ASM_PFX(FspMultiPhaseSiInitApiHandler) > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; NotifyPhase API > > +; > > +; This FSP API will notify the FSP about the different phases in the > > +boot ; process ; > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(NotifyPhaseApi) > > +ASM_PFX(NotifyPhaseApi): > > + mov eax, 2 ; FSP_API_INDEX.NotifyPhaseApiIndex > > + jmp ASM_PFX(FspApiCommon) > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; FspSiliconInit API > > +; > > +; This FSP API initializes the CPU and the chipset including the IO ; > > +controllers in the chipset to enable normal operation of these device= s. > > +; > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(FspSiliconInitApi) > > +ASM_PFX(FspSiliconInitApi): > > + mov eax, 5 ; FSP_API_INDEX.FspSiliconInitApiIndex > > + jmp ASM_PFX(FspApiCommon) > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; FspMultiPhaseSiInitApi API > > +; > > +; This FSP API provides multi-phase silicon initialization, which > > +brings greater ; modularity beyond the existing FspSiliconInit() API. > > +; Increased modularity is achieved by adding an extra API to FSP-S. > > +; This allows the bootloader to add board specific initialization > > +steps throughout ; the SiliconInit flow as needed. > > +; > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(FspMultiPhaseSiInitApi) > > +ASM_PFX(FspMultiPhaseSiInitApi): > > + mov eax, 6 ; FSP_API_INDEX.FspMultiPhaseSiInitApiIndex > > + jmp ASM_PFX(FspApiCommon) > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; FspApiCommonContinue API > > +; > > +; This is the FSP API common entry point to resume the FSP execution > > +; > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(FspApiCommonContinue) > > +ASM_PFX(FspApiCommonContinue): > > + ; > > + ; Handle FspMultiPhaseSiInitApiIndex API > > + ; > > + cmp eax, 6 > > + jnz NotMultiPhaseSiInitApi > > + > > + pushad > > + push DWORD [esp + (4 * 8 + 4)] ; push ApiParam > > + push eax ; push ApiIdx > > + call ASM_PFX(FspMultiPhaseSiInitApiHandler) > > + add esp, 8 > > + mov dword [esp + (4 * 7)], eax > > + popad > > + ret > > + > > +NotMultiPhaseSiInitApi: > > + jmp $ > > + ret > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; TempRamInit API > > +; > > +; Empty function for WHOLEARCHIVE build option ; > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(TempRamInitApi) > > +ASM_PFX(TempRamInitApi): > > + jmp $ > > + ret > > + > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +; Module Entrypoint API > > +;-------------------------------------------------------------------- > > +-- > > +------ > > +global ASM_PFX(_ModuleEntryPoint) > > +ASM_PFX(_ModuleEntryPoint): > > + jmp $ > > + > > diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm > > b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm > > index bb4451b145..26ae7d9fd3 100644 > > --- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm > > +++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryCommon.nasm > > @@ -1,7 +1,7 @@ > > ;; @file > > ; Provide FSP API entry points. > > ; > > -; Copyright (c) 2016, Intel Corporation. All rights reserved.
> > +; Copyright (c) 2016 - 2020, Intel Corporation. All rights > > +reserved.
> > ; SPDX-License-Identifier: BSD-2-Clause-Patent ;; > > > > @@ -62,6 +62,9 @@ FspApiCommon2: > > cmp eax, 3 ; FspMemoryInit API > > jz FspApiCommon3 > > > > + cmp eax, 6 ; FspMultiPhaseSiInitApiIndex API > > + jz FspApiCommon3 > > + > > call ASM_PFX(AsmGetFspInfoHeader) > > jmp ASM_PFX(Loader2PeiSwitchStack) > > > > diff --git a/IntelFsp2Pkg/Include/FspEas/FspApi.h > > b/IntelFsp2Pkg/Include/FspEas/FspApi.h > > index dcf489dbe6..ed40f9538c 100644 > > --- a/IntelFsp2Pkg/Include/FspEas/FspApi.h > > +++ b/IntelFsp2Pkg/Include/FspEas/FspApi.h > > @@ -1,8 +1,8 @@ > > /** @file > > Intel FSP API definition from Intel Firmware Support Package > > External > > - Architecture Specification v2.0. > > + Architecture Specification v2.0 - v2.2 > > > > - Copyright (c) 2014 - 2019, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -10,6 +10,8 @@ > > #ifndef _FSP_API_H_ > > #define _FSP_API_H_ > > > > +#include > > + > > /// > > /// FSP Reset Status code > > /// These are defined in FSP EAS v2.0 section 11.2.2 - OEM Status > > Code @@ - > > 24,6 +26,65 @@ > > #define FSP_STATUS_RESET_REQUIRED_8 0x40000008 > > /// @} > > > > +/// > > +/// FSP Event related definition. > > +/// > > +#define FSP_EVENT_CODE 0xF5000000 > > +#define FSP_POST_CODE (FSP_EVENT_CODE | 0x00F80000) > > + > > +/* > > + FSP may optionally include the capability of generating events > > +messages to > > aid in the debugging of firmware issues. > > + These events fall under three catagories: Error, Progress, and Debu= g. > > +The event reporting mechanism follows the > > + status code services described in section 6 and 7 of the PI > > +Specification v1.7 > > Volume 3. > > + > > + @param[in] Type Indicates the type of event > being reported. > > + See > > + MdePkg/Include/Pi/PiStatusCode.h for the definition > > of EFI_STATUS_CODE_TYPE. > > + @param[in] Value Describes the current status of > a hardware or > > software entity. > > + This includes information > about > > + the class and subclass that > > is used to classify the entity as well as an operation. > > + For progress events, the > operation is the current activity. > > For error events, it is the exception. > > + For debug events, it is not > defined at this time. > > + See > > + MdePkg/Include/Pi/PiStatusCode.h for the definition > > of EFI_STATUS_CODE_VALUE. > > + @param[in] Instance The enumeration of a hardware > or software > > entity within the system. > > + A system may contain multiple > > + entities that match a > > class/subclass pairing. The instance differentiates between them. > > + An instance of 0 indicates that > > + instance information is > > unavailable, not meaningful, or not relevant. > > + Valid instance numbers start > with 1. > > + @param[in] *CallerId This parameter can be used to > identify the > > sub-module within the FSP generating the event. > > + This parameter may be NULL. > > + @param[in] *Data This optional parameter may > be used to pass > > additional data. The contents can have event-specific data. > > + For example, the FSP provides > a > > EFI_STATUS_CODE_STRING_DATA instance to this parameter when sending > > debug messages. > > + This parameter is NULL when > no > > + additional data is > > provided. > > + > > + @retval EFI_SUCCESS The event was handled > successfully. > > + @retval EFI_INVALID_PARAMETER Input parameters are invalid. > > + @retval EFI_DEVICE_ERROR The event handler failed. > > +*/ > > +typedef > > +EFI_STATUS > > +(EFIAPI *FSP_EVENT_HANDLER) ( > > + IN EFI_STATUS_CODE_TYPE Type, > > + IN EFI_STATUS_CODE_VALUE Value, > > + IN UINT32 Instance, > > + IN OPTIONAL EFI_GUID *CallerId, > > + IN OPTIONAL EFI_STATUS_CODE_DATA *Data > > + ); > > + > > +/* > > + Handler for FSP-T debug log messages, provided by the bootloader. > > + > > + @param[in] DebugMessage A pointer to the debug > message to be > > written to the log. > > + @param[in] MessageLength Number of bytes to written to > the debug > > log. > > + > > + @retval UINT32 The return value indicates the > number of bytes > > actually written to > > + the debug log. If the return > > + value is less than > > MessageLength, > > + an error occurred. > > +*/ > > +typedef > > +UINT32 > > +(EFIAPI *FSP_DEBUG_HANDLER) ( > > + IN CHAR8* DebugMessage, > > + IN UINT32 MessageLength > > + ); > > + > > #pragma pack(1) > > /// > > /// FSP_UPD_HEADER Configuration. > > @@ -77,7 +138,12 @@ typedef struct { > > /// Current boot mode. > > /// > > UINT32 BootMode; > > - UINT8 Reserved1[8]; > > + /// > > + /// Optional event handler for the bootloader to be informed of > > + events > > occurring during FSP execution. > > + /// This value is only valid if Revision is >=3D 2. > > + /// > > + FSP_EVENT_HANDLER *FspEventHandler; > > + UINT8 Reserved1[4]; > > } FSPM_ARCH_UPD; > > > > /// > > @@ -147,6 +213,40 @@ typedef struct { > > FSP_INIT_PHASE Phase; > > } NOTIFY_PHASE_PARAMS; > > > > +/// > > +/// Action definition for FspMultiPhaseSiInit API /// typedef enum { > > + EnumMultiPhaseGetNumberOfPhases =3D 0x0, > > + EnumMultiPhaseExecutePhase =3D 0x1 > > +} FSP_MULTI_PHASE_ACTION; > > + > > +/// > > +/// Data structure returned by FSP when bootloader calling /// > > +FspMultiPhaseSiInit API with action 0 > > (EnumMultiPhaseGetNumberOfPhases) > > +/// typedef struct { > > + UINT32 NumberOfPhases; > > + UINT32 PhasesExecuted; > > +} FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS; > > + > > +/// > > +/// FspMultiPhaseSiInit function parameter. > > +/// > > +/// For action 0 (EnumMultiPhaseGetNumberOfPhases): > > +/// - PhaseIndex must be 0. > > +/// - MultiPhaseParamPtr should point to an instance of > > FSP_MULTI_PHASE_GET_NUMBER_OF_PHASES_PARAMS. > > +/// > > +/// For action 1 (EnumMultiPhaseExecutePhase): > > +/// - PhaseIndex will be the phase that will be executed by FSP. > > +/// - MultiPhaseParamPtr shall be NULL. > > +/// > > +typedef struct { > > + IN FSP_MULTI_PHASE_ACTION MultiPhaseAction; > > + IN UINT32 PhaseIndex; > > + IN OUT VOID *MultiPhaseParamPtr; > > +} FSP_MULTI_PHASE_PARAMS; > > + > > #pragma pack() > > > > /** > > @@ -279,4 +379,28 @@ EFI_STATUS > > IN VOID *FspsUpdDataPtr > > ); > > > > +/** > > + This FSP API is expected to be called after FspSiliconInit but > > +before > > FspNotifyPhase. > > + This FSP API provides multi-phase silicon initialization; which > > +brings greater modularity > > + beyond the existing FspSiliconInit() API. Increased modularity is > > +achieved by adding an > > + extra API to FSP-S. This allows the bootloader to add board > > +specific initialization steps > > + throughout the SiliconInit flow as needed. > > + > > + @param[in,out] FSP_MULTI_PHASE_PARAMS For action - > > EnumMultiPhaseGetNumberOfPhases: > > + > > + FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr > > will contain > > + how many phases > supported by FSP. > > + For action - > EnumMultiPhaseExecutePhase: > > + > > + FSP_MULTI_PHASE_PARAMS->MultiPhaseParamPtr > > shall be NULL. > > + @retval EFI_SUCCESS FSP execution > environment was initialized > > successfully. > > + @retval EFI_INVALID_PARAMETER Input parameters are > invalid. > > + @retval EFI_UNSUPPORTED The FSP calling > conditions were not > > met. > > + @retval EFI_DEVICE_ERROR FSP initialization failed. > > + @retval FSP_STATUS_RESET_REQUIREDx A reset is required. > These > > status codes will not be returned during S3. > > +**/ > > +typedef > > +EFI_STATUS > > +(EFIAPI *FSP_MULTI_PHASE_SI_INIT) ( > > + IN FSP_MULTI_PHASE_PARAMS *MultiPhaseSiInitParamPtr > > +); > > + > > #endif > > diff --git a/IntelFsp2Pkg/Include/FspGlobalData.h > > b/IntelFsp2Pkg/Include/FspGlobalData.h > > index 1896b0240a..34a3793ace 100644 > > --- a/IntelFsp2Pkg/Include/FspGlobalData.h > > +++ b/IntelFsp2Pkg/Include/FspGlobalData.h > > @@ -1,6 +1,6 @@ > > /** @file > > > > - Copyright (c) 2014 - 2018, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -22,6 +22,7 @@ typedef enum { > > FspMemoryInitApiIndex, > > TempRamExitApiIndex, > > FspSiliconInitApiIndex, > > + FspMultiPhaseSiInitApiIndex, > > FspApiIndexMax > > } FSP_API_INDEX; > > > > @@ -52,10 +53,14 @@ typedef struct { > > VOID *SiliconInitUpdPtr; > > UINT8 ApiIdx; > > UINT8 FspMode; // 0: FSP in API mode; 1: FSP in > DISPATCH mode > > - UINT8 Reserved3[30]; > > + UINT8 OnSeparateStack; > > + UINT8 Reserved3; > > + UINT32 NumberOfPhases; > > + UINT32 PhasesExecuted; > > + UINT8 Reserved4[26]; >=20 > I think this should be Reserved4[20]; >=20 > > UINT32 PerfSig; > > UINT16 PerfLen; > > - UINT16 Reserved4; > > + UINT16 Reserved5; > > UINT32 PerfIdx; > > UINT64 PerfData[32]; > > } FSP_GLOBAL_DATA; > > diff --git a/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > > b/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > > index 16f43a1273..3474bac1de 100644 > > --- a/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > > +++ b/IntelFsp2Pkg/Include/Guid/FspHeaderFile.h > > @@ -1,8 +1,8 @@ > > /** @file > > Intel FSP Header File definition from Intel Firmware Support > > Package External > > - Architecture Specification v2.0. > > + Architecture Specification v2.0 and above. > > > > - Copyright (c) 2014 - 2018, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2014 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -110,6 +110,12 @@ typedef struct { > > /// Byte 0x44: The offset for the API to initialize the CPU and chi= pset. > > /// > > UINT32 FspSiliconInitEntryOffset; > > + /// > > + /// Byte 0x48: Offset for the API for the optional Multi-Phase > > + processor > > and chipset initialization. > > + /// This value is only valid if FSP HeaderRevision is >= =3D 5. > > + /// If the value is set to 0x00000000, then this API is = not > available in > > this component. > > + /// > > + UINT32 FspMultiPhaseSiInitEntryOffset; > > } FSP_INFO_HEADER; > > > > /// > > diff --git a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h > > b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h > > index 4d01b5f6d9..51a0309aed 100644 > > --- a/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h > > +++ b/IntelFsp2Pkg/Include/Library/FspSecPlatformLib.h > > @@ -1,6 +1,6 @@ > > /** @file > > > > - Copyright (c) 2015 - 2019, Intel Corporation. All rights > > reserved.
> > + Copyright (c) 2015 - 2020, Intel Corporation. All rights > > + reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > > > **/ > > @@ -79,4 +79,18 @@ FspUpdSignatureCheck ( > > IN VOID *ApiParam > > ); > > > > +/** > > + This function handles FspMultiPhaseSiInitApi. > > + > > + @param[in] ApiIdx Internal index of the FSP API. > > + @param[in] ApiParam Parameter of the FSP API. > > + > > +**/ > > +EFI_STATUS > > +EFIAPI > > +FspMultiPhaseSiInitApiHandler ( > > + IN UINT32 ApiIdx, > > + IN VOID *ApiParam > > + ); > > + > > #endif > > -- > > 2.13.3.windows.1 > > > > > >=20