From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: ray.ni@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Thu, 25 Jul 2019 01:55:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 01:55:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,306,1559545200"; d="scan'208";a="177913774" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by FMSMGA003.fm.intel.com with ESMTP; 25 Jul 2019 01:55:08 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 25 Jul 2019 01:55:08 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 25 Jul 2019 01:55:08 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.110]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.55]) with mapi id 14.03.0439.000; Thu, 25 Jul 2019 16:55:06 +0800 From: "Ni, Ray" To: "Dong, Eric" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Kumar, Chandana C" , "Zeng, Star" Subject: Re: [Patch v3 5/6] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI. Thread-Topic: [Patch v3 5/6] UefiCpuPkg/CpuMpPei: Produce EDKII_PEI_MP_SERVICES2_PPI. Thread-Index: AQHVQe6C7TJexKImfkSnPn0WQ3eNhabbCSIQ Date: Thu, 25 Jul 2019 08:55:05 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C244EE7@SHSMSX104.ccr.corp.intel.com> References: <20190724070727.14976-1-eric.dong@intel.com> <20190724070727.14976-6-eric.dong@intel.com> In-Reply-To: <20190724070727.14976-6-eric.dong@intel.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable With file name changing from Mp2Pei.c to CpuMp2Pei.c, Reviewed-by: Ray Ni <= ray.ni@intel.com> > -----Original Message----- > From: Dong, Eric > Sent: Wednesday, July 24, 2019 3:07 PM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Laszlo Ersek ; Kumar, > Chandana C ; Zeng, Star > > Subject: [Patch v3 5/6] UefiCpuPkg/CpuMpPei: Produce > EDKII_PEI_MP_SERVICES2_PPI. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1973 >=20 > Produce new EDKII_PEI_MP_SERVICES2_PPI service. >=20 > It includes all APIs existed in EFI_PEI_MP_SERVICES_PPI and add new API > EDKII_PEI_MP_SERVICES_STARTUP_ALL_CPUS. >=20 > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Chandana Kumar > Cc: Star Zeng > Signed-off-by: Eric Dong > --- > UefiCpuPkg/CpuMpPei/CpuMpPei.c | 21 +- > UefiCpuPkg/CpuMpPei/CpuMpPei.h | 3 +- > UefiCpuPkg/CpuMpPei/CpuMpPei.inf | 2 + > UefiCpuPkg/CpuMpPei/Mp2Pei.c | 417 > +++++++++++++++++++++++++++++++ > 4 files changed, 436 insertions(+), 7 deletions(-) create mode 100644 > UefiCpuPkg/CpuMpPei/Mp2Pei.c >=20 > diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.c > b/UefiCpuPkg/CpuMpPei/CpuMpPei.c index 926541c937..07ccbe7c6a 100644 > --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.c > +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.c > @@ -1,13 +1,15 @@ > /** @file > CPU PEI Module installs CPU Multiple Processor PPI. >=20 > - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2015 - 2019, Intel Corporation. All rights > + reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ >=20 > #include "CpuMpPei.h" >=20 > +extern EDKII_PEI_MP_SERVICES2_PPI mMpServices2Ppi; > + > // > // CPU MP PPI to be installed > // > @@ -21,10 +23,17 @@ EFI_PEI_MP_SERVICES_PPI mMpServicesPpi= =3D > { > PeiWhoAmI, > }; >=20 > -EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc =3D { > - (EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > - &gEfiPeiMpServicesPpiGuid, > - &mMpServicesPpi > +EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiList[] =3D { > + { > + EFI_PEI_PPI_DESCRIPTOR_PPI, > + &gEdkiiPeiMpServices2PpiGuid, > + &mMpServices2Ppi > + }, > + { > + (EFI_PEI_PPI_DESCRIPTOR_PPI | > EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), > + &gEfiPeiMpServicesPpiGuid, > + &mMpServicesPpi > + } > }; >=20 > /** > @@ -667,7 +676,7 @@ InitializeCpuMpWorker ( > // > // Install CPU MP PPI > // > - Status =3D PeiServicesInstallPpi(&mPeiCpuMpPpiDesc); > + Status =3D PeiServicesInstallPpi(mPeiCpuMpPpiList); > ASSERT_EFI_ERROR (Status); >=20 > return Status; > diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.h > b/UefiCpuPkg/CpuMpPei/CpuMpPei.h index a5d8a755b2..7d5c527d60 > 100644 > --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.h > +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.h > @@ -1,7 +1,7 @@ > /** @file > Definitions to install Multiple Processor PPI. >=20 > - Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
> + Copyright (c) 2015 - 2019, Intel Corporation. All rights > + reserved.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > **/ > @@ -15,6 +15,7 @@ > #include #include > #include > +#include >=20 > #include > #include > diff --git a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf > b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf > index 4fc4ea77ba..fb2db650e5 100644 > --- a/UefiCpuPkg/CpuMpPei/CpuMpPei.inf > +++ b/UefiCpuPkg/CpuMpPei/CpuMpPei.inf > @@ -26,6 +26,7 @@ > CpuMpPei.c > CpuBist.c > CpuPaging.c > + Mp2Pei.c >=20 > [Packages] > MdePkg/MdePkg.dec > @@ -54,6 +55,7 @@ > gEfiSecPlatformInformation2PpiGuid > gEfiVectorHandoffInfoPpiGuid ## SOMETIMES_CONSUMES > gEfiPeiMemoryDiscoveredPpiGuid ## CONSUMES > + gEdkiiPeiMpServices2PpiGuid ## PRODUCES >=20 > [Pcd] >=20 > gEfiMdeModulePkgTokenSpaceGuid.PcdPteMemoryEncryptionAddressOrM > ask ## CONSUMES > diff --git a/UefiCpuPkg/CpuMpPei/Mp2Pei.c > b/UefiCpuPkg/CpuMpPei/Mp2Pei.c new file mode 100644 index > 0000000000..c1116a5b77 > --- /dev/null > +++ b/UefiCpuPkg/CpuMpPei/Mp2Pei.c > @@ -0,0 +1,417 @@ > +/** @file > + EDKII_PEI_MP_SERVICES2_PPI Implementation code. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved.
> + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include "CpuMpPei.h" > + > +/** > + This service retrieves the number of logical processor in the > +platform > + and the number of those logical processors that are enabled on this bo= ot. > + This service may only be called from the BSP. > + > + This function is used to retrieve the following information: > + - The number of logical processors that are present in the system. > + - The number of enabled logical processors in the system at the inst= ant > + this call is made. > + > + Because MP Service Ppi provides services to enable and disable > + processors dynamically, the number of enabled logical processors may > + vary during the course of a boot session. > + > + If this service is called from an AP, then EFI_DEVICE_ERROR is returne= d. > + If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then > + EFI_INVALID_PARAMETER is returned. Otherwise, the total number of > + processors is returned in NumberOfProcessors, the number of currently > + enabled processor is returned in NumberOfEnabledProcessors, and > EFI_SUCCESS is returned. > + > + @param[in] This Pointer to this instance of the PPI. > + @param[out] NumberOfProcessors Pointer to the total number of logical > processors in > + the system, including the BSP and disa= bled APs. > + @param[out] NumberOfEnabledProcessors > + Number of processors in the system tha= t are enabled. > + > + @retval EFI_SUCCESS The number of logical processors and e= nabled > + logical processors was retrieved. > + @retval EFI_DEVICE_ERROR The calling processor is an AP. > + @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL. > + NumberOfEnabledProcessors is NULL. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiGetNumberOfProcessors ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + OUT UINTN *NumberOfProcessors, > + OUT UINTN *NumberOfEnabledProcessors > + ) > +{ > + if ((NumberOfProcessors =3D=3D NULL) || (NumberOfEnabledProcessors =3D= =3D > NULL)) { > + return EFI_INVALID_PARAMETER; > + } > + > + return MpInitLibGetNumberOfProcessors ( > + NumberOfProcessors, > + NumberOfEnabledProcessors > + ); > +} > + > +/** > + Gets detailed MP-related information on the requested processor at > +the > + instant this call is made. This service may only be called from the BS= P. > + > + This service retrieves detailed MP-related information about any > + processor on the platform. Note the following: > + - The processor information may change during the course of a boot > session. > + - The information presented here is entirely MP related. > + > + Information regarding the number of caches and their sizes, frequency > + of operation, slot numbers is all considered platform-related > + information and is not provided by this service. > + > + @param[in] This Pointer to this instance of the PPI. > + @param[in] ProcessorNumber Pointer to the total number of logical > processors in > + the system, including the BSP and disa= bled APs. > + @param[out] ProcessorInfoBuffer Number of processors in the system > that are enabled. > + > + @retval EFI_SUCCESS Processor information was returned. > + @retval EFI_DEVICE_ERROR The calling processor is an AP. > + @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL. > + @retval EFI_NOT_FOUND The processor with the handle specifie= d by > + ProcessorNumber does not exist in the = platform. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiGetProcessorInfo ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN UINTN ProcessorNumber, > + OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer > + ) > +{ > + return MpInitLibGetProcessorInfo (ProcessorNumber, > +ProcessorInfoBuffer, NULL); } > + > +/** > + This service executes a caller provided function on all enabled APs. > +APs can > + run either simultaneously or one at a time in sequence. This service > +supports > + both blocking requests only. This service may only > + be called from the BSP. > + > + This function is used to dispatch all the enabled APs to the function > + specified by Procedure. If any enabled AP is busy, then > + EFI_NOT_READY is returned immediately and Procedure is not started on > any AP. > + > + If SingleThread is TRUE, all the enabled APs execute the function > + specified by Procedure one by one, in ascending order of processor > + handle number. Otherwise, all the enabled APs execute the function > specified by Procedure simultaneously. > + > + If the timeout specified by TimeoutInMicroSeconds expires before all > + APs return from Procedure, then Procedure on the failed APs is > + terminated. All enabled APs are always available for further calls to > + EDKII_PEI_MP_SERVICES2_PPI.StartupAllAPs() > + and EDKII_PEI_MP_SERVICES2_PPI.StartupThisAP(). If FailedCpuList is > + not NULL, its content points to the list of processor handle numbers > + in which Procedure was terminated. > + > + Note: It is the responsibility of the consumer of the > + EDKII_PEI_MP_SERVICES2_PPI.StartupAllAPs() > + to make sure that the nature of the code that is executed on the BSP > + and the dispatched APs is well controlled. The MP Services Ppi does > + not guarantee that the Procedure function is MP-safe. Hence, the > + tasks that can be run in parallel are limited to certain independent > + tasks and well-controlled exclusive code. PEI services and Ppis may > + not be called by APs unless otherwise specified. > + > + In blocking execution mode, BSP waits until all APs finish or > + TimeoutInMicroSeconds expires. > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[in] Procedure A pointer to the function to be run on > enabled APs of > + the system. > + @param[in] SingleThread If TRUE, then all the enabled APs exec= ute > the function > + specified by Procedure one by one, in = ascending order > + of processor handle number. If FALSE, = then all the > + enabled APs execute the function speci= fied by Procedure > + simultaneously. > + @param[in] TimeoutInMicroSeconds > + Indicates the time limit in microsecon= ds for APs to > + return from Procedure, for blocking mo= de only. Zero > + means infinity. If the timeout expires= before all APs > + return from Procedure, then Procedure = on the failed APs > + is terminated. All enabled APs are ava= ilable for next > + function assigned by > EDKII_PEI_MP_SERVICES2_PPI.StartupAllAPs() > + or EDKII_PEI_MP_SERVICES2_PPI.StartupT= hisAP(). If the > + timeout expires in blocking mode, BSP = returns > + EFI_TIMEOUT. > + @param[in] ProcedureArgument The parameter passed into Procedure > for all APs. > + > + @retval EFI_SUCCESS In blocking mode, all APs have finishe= d before > the > + timeout expired. > + @retval EFI_DEVICE_ERROR Caller processor is AP. > + @retval EFI_NOT_STARTED No enabled APs exist in the system. > + @retval EFI_NOT_READY Any enabled APs are busy. > + @retval EFI_TIMEOUT In blocking mode, the timeout expired = before > all > + enabled APs have finished. > + @retval EFI_INVALID_PARAMETER Procedure is NULL. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiStartupAllAPs ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN EFI_AP_PROCEDURE Procedure, > + IN BOOLEAN SingleThread, > + IN UINTN TimeoutInMicroSeconds, > + IN VOID *ProcedureArgument OPTIONAL > + ) > +{ > + return MpInitLibStartupAllAPs ( > + Procedure, > + SingleThread, > + NULL, > + TimeoutInMicroSeconds, > + ProcedureArgument, > + NULL > + ); > +} > + > +/** > + This service lets the caller get one enabled AP to execute a > +caller-provided > + function. The caller can request the BSP to wait for the completion > + of the AP. This service may only be called from the BSP. > + > + This function is used to dispatch one enabled AP to the function > + specified by Procedure passing in the argument specified by > ProcedureArgument. > + The execution is in blocking mode. The BSP waits until the AP > + finishes or TimeoutInMicroSecondss expires. > + > + If the timeout specified by TimeoutInMicroseconds expires before the > + AP returns from Procedure, then execution of Procedure by the AP is > + terminated. The AP is available for subsequent calls to > + EDKII_PEI_MP_SERVICES2_PPI.StartupAllAPs() and > EDKII_PEI_MP_SERVICES2_PPI.StartupThisAP(). > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[in] Procedure A pointer to the function to be run on > enabled APs of > + the system. > + @param[in] ProcessorNumber The handle number of the AP. The range > is from 0 to the > + total number of logical processors min= us 1. The total > + number of logical processors can be re= trieved by > + EDKII_PEI_MP_SERVICES2_PPI.GetNumberOf= Processors(). > + @param[in] TimeoutInMicroseconds > + Indicates the time limit in microsecon= ds for APs to > + return from Procedure, for blocking mo= de only. Zero > + means infinity. If the timeout expires= before all APs > + return from Procedure, then Procedure = on the failed APs > + is terminated. All enabled APs are ava= ilable for next > + function assigned by > EDKII_PEI_MP_SERVICES2_PPI.StartupAllAPs() > + or EDKII_PEI_MP_SERVICES2_PPI.StartupT= hisAP(). If the > + timeout expires in blocking mode, BSP = returns > + EFI_TIMEOUT. > + @param[in] ProcedureArgument The parameter passed into Procedure > for all APs. > + > + @retval EFI_SUCCESS In blocking mode, specified AP finishe= d before > the > + timeout expires. > + @retval EFI_DEVICE_ERROR The calling processor is an AP. > + @retval EFI_TIMEOUT In blocking mode, the timeout expired = before > the > + specified AP has finished. > + @retval EFI_NOT_FOUND The processor with the handle specifie= d by > + ProcessorNumber does not exist. > + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or > disabled AP. > + @retval EFI_INVALID_PARAMETER Procedure is NULL. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiStartupThisAP ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN EFI_AP_PROCEDURE Procedure, > + IN UINTN ProcessorNumber, > + IN UINTN TimeoutInMicroseconds, > + IN VOID *ProcedureArgument OPTIONAL > + ) > +{ > + return MpInitLibStartupThisAP ( > + Procedure, > + ProcessorNumber, > + NULL, > + TimeoutInMicroseconds, > + ProcedureArgument, > + NULL > + ); > +} > + > +/** > + This service switches the requested AP to be the BSP from that point > onward. > + This service changes the BSP for all purposes. This call can only be > performed > + by the current BSP. > + > + This service switches the requested AP to be the BSP from that point > onward. > + This service changes the BSP for all purposes. The new BSP can take > + over the execution of the old BSP and continue seamlessly from where > + the old one left off. > + > + If the BSP cannot be switched prior to the return from this service, > + then EFI_UNSUPPORTED must be returned. > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[in] ProcessorNumber The handle number of the AP. The range > is from 0 to the > + total number of logical processors min= us 1. The total > + number of logical processors can be re= trieved by > + EDKII_PEI_MP_SERVICES2_PPI.GetNumberOf= Processors(). > + @param[in] EnableOldBSP If TRUE, then the old BSP will be list= ed as an > enabled > + AP. Otherwise, it will be disabled. > + > + @retval EFI_SUCCESS BSP successfully switched. > + @retval EFI_UNSUPPORTED Switching the BSP cannot be completed > prior to this > + service returning. > + @retval EFI_UNSUPPORTED Switching the BSP is not supported. > + @retval EFI_DEVICE_ERROR The calling processor is an AP. > + @retval EFI_NOT_FOUND The processor with the handle specifie= d by > + ProcessorNumber does not exist. > + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the > current BSP or a disabled > + AP. > + @retval EFI_NOT_READY The specified AP is busy. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiSwitchBSP ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN UINTN ProcessorNumber, > + IN BOOLEAN EnableOldBSP > + ) > +{ > + return MpInitLibSwitchBSP (ProcessorNumber, EnableOldBSP); } > + > +/** > + This service lets the caller enable or disable an AP from this point o= nward. > + This service may only be called from the BSP. > + > + This service allows the caller enable or disable an AP from this point > onward. > + The caller can optionally specify the health status of the AP by > + Health. If an AP is being disabled, then the state of the disabled AP > + is implementation dependent. If an AP is enabled, then the > + implementation must guarantee that a complete initialization sequence > + is performed on the AP, so the AP is in a state that is compatible wit= h an > MP operating system. > + > + If the enable or disable AP operation cannot be completed prior to > + the return from this service, then EFI_UNSUPPORTED must be returned. > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[in] ProcessorNumber The handle number of the AP. The range > is from 0 to the > + total number of logical processors min= us 1. The total > + number of logical processors can be re= trieved by > + EDKII_PEI_MP_SERVICES2_PPI.GetNumberOf= Processors(). > + @param[in] EnableAP Specifies the new state for the proces= sor for > enabled, > + FALSE for disabled. > + @param[in] HealthFlag If not NULL, a pointer to a value that= specifies > the > + new health status of the AP. This flag= corresponds to > + StatusFlag defined in > EDKII_PEI_MP_SERVICES2_PPI.GetProcessorInfo(). > + Only the PROCESSOR_HEALTH_STATUS_BIT i= s used. All > other > + bits are ignored. If it is NULL, this = parameter is > + ignored. > + > + @retval EFI_SUCCESS The specified AP was enabled or disabl= ed > successfully. > + @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be > completed prior > + to this service returning. > + @retval EFI_UNSUPPORTED Enabling or disabling an AP is not > supported. > + @retval EFI_DEVICE_ERROR The calling processor is an AP. > + @retval EFI_NOT_FOUND Processor with the handle specified by > ProcessorNumber > + does not exist. > + @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiEnableDisableAP ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN UINTN ProcessorNumber, > + IN BOOLEAN EnableAP, > + IN UINT32 *HealthFlag OPTIONAL > + ) > +{ > + return MpInitLibEnableDisableAP (ProcessorNumber, EnableAP, > +HealthFlag); } > + > +/** > + This return the handle number for the calling processor. This > +service may be > + called from the BSP and APs. > + > + This service returns the processor handle number for the calling proce= ssor. > + The returned value is in the range from 0 to the total number of > + logical processors minus 1. The total number of logical processors > + can be retrieved with > + EDKII_PEI_MP_SERVICES2_PPI.GetNumberOfProcessors(). This service > may > + be called from the BSP and APs. If ProcessorNumber is NULL, then > + EFI_INVALID_PARAMETER is returned. Otherwise, the current processors > handle number is returned in ProcessorNumber, and EFI_SUCCESS is > returned. > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[out] ProcessorNumber The handle number of the AP. The > range is from 0 to the > + total number of logical processors min= us 1. The total > + number of logical processors can be re= trieved by > + EDKII_PEI_MP_SERVICES2_PPI.GetNumberOf= Processors(). > + > + @retval EFI_SUCCESS The current processor handle number wa= s > returned in > + ProcessorNumber. > + @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiWhoAmI ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + OUT UINTN *ProcessorNumber > + ) > +{ > + return MpInitLibWhoAmI (ProcessorNumber); } > + > +/** > + This service executes a caller provided function on all enabled CPUs. > +CPUs can > + run either simultaneously or one at a time in sequence. This service > +may only > + be called from the BSP. > + > + @param[in] This A pointer to the EDKII_PEI_MP_SERVICES= 2_PPI > instance. > + @param[in] Procedure A pointer to the function to be run on > enabled APs of > + the system. > + @param[in] TimeoutInMicroSeconds > + Indicates the time limit in microsecon= ds for APs to > + return from Procedure, for blocking mo= de only. Zero > + means infinity. If the timeout expire= s in blocking > + mode, BSP returns EFI_TIMEOUT. > + @param[in] ProcedureArgument The parameter passed into Procedure > for all CPUs. > + > + @retval EFI_SUCCESS In blocking mode, all APs have finishe= d before > the > + timeout expired. > + @retval EFI_DEVICE_ERROR Caller processor is AP. > + @retval EFI_NOT_READY Any enabled APs are busy. > + @retval EFI_TIMEOUT In blocking mode, the timeout expired = before > all > + enabled APs have finished. > + @retval EFI_INVALID_PARAMETER Procedure is NULL. > +**/ > +EFI_STATUS > +EFIAPI > +EdkiiPeiStartupAllCPUs ( > + IN EDKII_PEI_MP_SERVICES2_PPI *This, > + IN EFI_AP_PROCEDURE Procedure, > + IN UINTN TimeoutInMicroSeconds, > + IN VOID *ProcedureArgument OPTIONAL > + ) > +{ > + return MpInitLibStartupAllCPUs ( > + Procedure, > + TimeoutInMicroSeconds, > + ProcedureArgument > + ); > +} > + > +// > +// CPU MP2 PPI to be installed > +// > +EDKII_PEI_MP_SERVICES2_PPI mMpServices2Ppi =3D { > + EdkiiPeiGetNumberOfProcessors, > + EdkiiPeiGetProcessorInfo, > + EdkiiPeiStartupAllAPs, > + EdkiiPeiStartupThisAP, > + EdkiiPeiSwitchBSP, > + EdkiiPeiEnableDisableAP, > + EdkiiPeiWhoAmI, > + EdkiiPeiStartupAllCPUs > +}; > + > -- > 2.21.0.windows.1