Path: blob/main/sys/contrib/edk2/Include/Protocol/MpService.h
96339 views
/** @file1When installed, the MP Services Protocol produces a collection of services2that are needed for MP management.34The MP Services Protocol provides a generalized way of performing following tasks:5- Retrieving information of multi-processor environment and MP-related status of6specific processors.7- Dispatching user-provided function to APs.8- Maintain MP-related processor status.910The MP Services Protocol must be produced on any system with more than one logical11processor.1213The Protocol is available only during boot time.1415MP Services Protocol is hardware-independent. Most of the logic of this protocol16is architecturally neutral. It abstracts the multi-processor environment and17status of processors, and provides interfaces to retrieve information, maintain,18and dispatch.1920MP Services Protocol may be consumed by ACPI module. The ACPI module may use this21protocol to retrieve data that are needed for an MP platform and report them to OS.22MP Services Protocol may also be used to program and configure processors, such23as MTRR synchronization for memory space attributes setting in DXE Services.24MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot25by taking advantage of the processing capabilities of the APs, for example, using26APs to help test system memory in parallel with other device initialization.27Diagnostics applications may also use this protocol for multi-processor.2829Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>30SPDX-License-Identifier: BSD-2-Clause-Patent3132@par Revision Reference:33This Protocol is defined in the UEFI Platform Initialization Specification 1.2,34Volume 2:Driver Execution Environment Core Interface.3536**/3738#ifndef _MP_SERVICE_PROTOCOL_H_39#define _MP_SERVICE_PROTOCOL_H_4041///42/// Global ID for the EFI_MP_SERVICES_PROTOCOL.43///44#define EFI_MP_SERVICES_PROTOCOL_GUID \45{ \460x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} \47}4849///50/// Value used in the NumberProcessors parameter of the GetProcessorInfo function51///52#define CPU_V2_EXTENDED_TOPOLOGY BIT245354///55/// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.56///57typedef struct _EFI_MP_SERVICES_PROTOCOL EFI_MP_SERVICES_PROTOCOL;5859///60/// Terminator for a list of failed CPUs returned by StartAllAPs().61///62#define END_OF_CPU_LIST 0xffffffff6364///65/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and66/// indicates whether the processor is playing the role of BSP. If the bit is 1,67/// then the processor is BSP. Otherwise, it is AP.68///69#define PROCESSOR_AS_BSP_BIT 0x000000017071///72/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and73/// indicates whether the processor is enabled. If the bit is 1, then the74/// processor is enabled. Otherwise, it is disabled.75///76#define PROCESSOR_ENABLED_BIT 0x000000027778///79/// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and80/// indicates whether the processor is healthy. If the bit is 1, then the81/// processor is healthy. Otherwise, some fault has been detected for the processor.82///83#define PROCESSOR_HEALTH_STATUS_BIT 0x000000048485///86/// Structure that describes the pyhiscal location of a logical CPU.87///88typedef struct {89///90/// Zero-based physical package number that identifies the cartridge of the processor.91///92UINT32 Package;93///94/// Zero-based physical core number within package of the processor.95///96UINT32 Core;97///98/// Zero-based logical thread number within core of the processor.99///100UINT32 Thread;101} EFI_CPU_PHYSICAL_LOCATION;102103///104/// Structure that defines the 6-level physical location of the processor105///106typedef struct {107///108/// Package Zero-based physical package number that identifies the cartridge of the processor.109///110UINT32 Package;111///112/// Module Zero-based physical module number within package of the processor.113///114UINT32 Module;115///116/// Tile Zero-based physical tile number within module of the processor.117///118UINT32 Tile;119///120/// Die Zero-based physical die number within tile of the processor.121///122UINT32 Die;123///124/// Core Zero-based physical core number within die of the processor.125///126UINT32 Core;127///128/// Thread Zero-based logical thread number within core of the processor.129///130UINT32 Thread;131} EFI_CPU_PHYSICAL_LOCATION2;132133typedef union {134/// The 6-level physical location of the processor, including the135/// physical package number that identifies the cartridge, the physical136/// module number within package, the physical tile number within the module,137/// the physical die number within the tile, the physical core number within138/// package, and logical thread number within core.139EFI_CPU_PHYSICAL_LOCATION2 Location2;140} EXTENDED_PROCESSOR_INFORMATION;141142///143/// Structure that describes information about a logical CPU.144///145typedef struct {146///147/// The unique processor ID determined by system hardware. For IA32 and X64,148/// the processor ID is the same as the Local APIC ID. Only the lower 8 bits149/// are used, and higher bits are reserved. For IPF, the lower 16 bits contains150/// id/eid, and higher bits are reserved.151///152UINT64 ProcessorId;153///154/// Flags indicating if the processor is BSP or AP, if the processor is enabled155/// or disabled, and if the processor is healthy. Bits 3..31 are reserved and156/// must be 0.157///158/// <pre>159/// BSP ENABLED HEALTH Description160/// === ======= ====== ===================================================161/// 0 0 0 Unhealthy Disabled AP.162/// 0 0 1 Healthy Disabled AP.163/// 0 1 0 Unhealthy Enabled AP.164/// 0 1 1 Healthy Enabled AP.165/// 1 0 0 Invalid. The BSP can never be in the disabled state.166/// 1 0 1 Invalid. The BSP can never be in the disabled state.167/// 1 1 0 Unhealthy Enabled BSP.168/// 1 1 1 Healthy Enabled BSP.169/// </pre>170///171UINT32 StatusFlag;172///173/// The physical location of the processor, including the physical package number174/// that identifies the cartridge, the physical core number within package, and175/// logical thread number within core.176///177EFI_CPU_PHYSICAL_LOCATION Location;178///179/// The extended information of the processor. This field is filled only when180/// CPU_V2_EXTENDED_TOPOLOGY is set in parameter ProcessorNumber.181EXTENDED_PROCESSOR_INFORMATION ExtendedInformation;182} EFI_PROCESSOR_INFORMATION;183184/**185This service retrieves the number of logical processor in the platform186and the number of those logical processors that are enabled on this boot.187This service may only be called from the BSP.188189This function is used to retrieve the following information:190- The number of logical processors that are present in the system.191- The number of enabled logical processors in the system at the instant192this call is made.193194Because MP Service Protocol provides services to enable and disable processors195dynamically, the number of enabled logical processors may vary during the196course of a boot session.197198If this service is called from an AP, then EFI_DEVICE_ERROR is returned.199If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then200EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors201is returned in NumberOfProcessors, the number of currently enabled processor202is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.203204@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL205instance.206@param[out] NumberOfProcessors Pointer to the total number of logical207processors in the system, including the BSP208and disabled APs.209@param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical210processors that exist in system, including211the BSP.212213@retval EFI_SUCCESS The number of logical processors and enabled214logical processors was retrieved.215@retval EFI_DEVICE_ERROR The calling processor is an AP.216@retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.217@retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.218219**/220typedef221EFI_STATUS222(EFIAPI *EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(223IN EFI_MP_SERVICES_PROTOCOL *This,224OUT UINTN *NumberOfProcessors,225OUT UINTN *NumberOfEnabledProcessors226);227228/**229Gets detailed MP-related information on the requested processor at the230instant this call is made. This service may only be called from the BSP.231232This service retrieves detailed MP-related information about any processor233on the platform. Note the following:234- The processor information may change during the course of a boot session.235- The information presented here is entirely MP related.236237Information regarding the number of caches and their sizes, frequency of operation,238slot numbers is all considered platform-related information and is not provided239by this service.240241@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL242instance.243@param[in] ProcessorNumber The handle number of processor.244@param[out] ProcessorInfoBuffer A pointer to the buffer where information for245the requested processor is deposited.246247@retval EFI_SUCCESS Processor information was returned.248@retval EFI_DEVICE_ERROR The calling processor is an AP.249@retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.250@retval EFI_NOT_FOUND The processor with the handle specified by251ProcessorNumber does not exist in the platform.252253**/254typedef255EFI_STATUS256(EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_INFO)(257IN EFI_MP_SERVICES_PROTOCOL *This,258IN UINTN ProcessorNumber,259OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer260);261262/**263This service executes a caller provided function on all enabled APs. APs can264run either simultaneously or one at a time in sequence. This service supports265both blocking and non-blocking requests. The non-blocking requests use EFI266events so the BSP can detect when the APs have finished. This service may only267be called from the BSP.268269This function is used to dispatch all the enabled APs to the function specified270by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned271immediately and Procedure is not started on any AP.272273If SingleThread is TRUE, all the enabled APs execute the function specified by274Procedure one by one, in ascending order of processor handle number. Otherwise,275all the enabled APs execute the function specified by Procedure simultaneously.276277If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all278APs finish or TimeoutInMicroSecs expires. Otherwise, execution is in non-blocking279mode, and the BSP returns from this service without waiting for APs. If a280non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT281is signaled, then EFI_UNSUPPORTED must be returned.282283If the timeout specified by TimeoutInMicroseconds expires before all APs return284from Procedure, then Procedure on the failed APs is terminated. All enabled APs285are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()286and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its287content points to the list of processor handle numbers in which Procedure was288terminated.289290Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()291to make sure that the nature of the code that is executed on the BSP and the292dispatched APs is well controlled. The MP Services Protocol does not guarantee293that the Procedure function is MP-safe. Hence, the tasks that can be run in294parallel are limited to certain independent tasks and well-controlled exclusive295code. EFI services and protocols may not be called by APs unless otherwise296specified.297298In blocking execution mode, BSP waits until all APs finish or299TimeoutInMicroSeconds expires.300301In non-blocking execution mode, BSP is freed to return to the caller and then302proceed to the next task without having to wait for APs. The following303sequence needs to occur in a non-blocking execution mode:304305-# The caller that intends to use this MP Services Protocol in non-blocking306mode creates WaitEvent by calling the EFI CreateEvent() service. The caller307invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent308is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests309the function specified by Procedure to be started on all the enabled APs,310and releases the BSP to continue with other tasks.311-# The caller can use the CheckEvent() and WaitForEvent() services to check312the state of the WaitEvent created in step 1.313-# When the APs complete their task or TimeoutInMicroSecondss expires, the MP314Service signals WaitEvent by calling the EFI SignalEvent() function. If315FailedCpuList is not NULL, its content is available when WaitEvent is316signaled. If all APs returned from Procedure prior to the timeout, then317FailedCpuList is set to NULL. If not all APs return from Procedure before318the timeout, then FailedCpuList is filled in with the list of the failed319APs. The buffer is allocated by MP Service Protocol using AllocatePool().320It is the caller's responsibility to free the buffer with FreePool() service.321-# This invocation of SignalEvent() function informs the caller that invoked322EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed323the specified task or a timeout occurred. The contents of FailedCpuList324can be examined to determine which APs did not complete the specified task325prior to the timeout.326327@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL328instance.329@param[in] Procedure A pointer to the function to be run on330enabled APs of the system. See type331EFI_AP_PROCEDURE.332@param[in] SingleThread If TRUE, then all the enabled APs execute333the function specified by Procedure one by334one, in ascending order of processor handle335number. If FALSE, then all the enabled APs336execute the function specified by Procedure337simultaneously.338@param[in] WaitEvent The event created by the caller with CreateEvent()339service. If it is NULL, then execute in340blocking mode. BSP waits until all APs finish341or TimeoutInMicroSeconds expires. If it's342not NULL, then execute in non-blocking mode.343BSP requests the function specified by344Procedure to be started on all the enabled345APs, and go on executing immediately. If346all return from Procedure, or TimeoutInMicroSeconds347expires, this event is signaled. The BSP348can use the CheckEvent() or WaitForEvent()349services to check the state of event. Type350EFI_EVENT is defined in CreateEvent() in351the Unified Extensible Firmware Interface352Specification.353@param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for354APs to return from Procedure, either for355blocking or non-blocking mode. Zero means356infinity. If the timeout expires before357all APs return from Procedure, then Procedure358on the failed APs is terminated. All enabled359APs are available for next function assigned360by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()361or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().362If the timeout expires in blocking mode,363BSP returns EFI_TIMEOUT. If the timeout364expires in non-blocking mode, WaitEvent365is signaled with SignalEvent().366@param[in] ProcedureArgument The parameter passed into Procedure for367all APs.368@param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise,369if all APs finish successfully, then its370content is set to NULL. If not all APs371finish before timeout expires, then its372content is set to address of the buffer373holding handle numbers of the failed APs.374The buffer is allocated by MP Service Protocol,375and it's the caller's responsibility to376free the buffer with FreePool() service.377In blocking mode, it is ready for consumption378when the call returns. In non-blocking mode,379it is ready when WaitEvent is signaled. The380list of failed CPU is terminated by381END_OF_CPU_LIST.382383@retval EFI_SUCCESS In blocking mode, all APs have finished before384the timeout expired.385@retval EFI_SUCCESS In non-blocking mode, function has been dispatched386to all enabled APs.387@retval EFI_UNSUPPORTED A non-blocking mode request was made after the388UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was389signaled.390@retval EFI_DEVICE_ERROR Caller processor is AP.391@retval EFI_NOT_STARTED No enabled APs exist in the system.392@retval EFI_NOT_READY Any enabled APs are busy.393@retval EFI_TIMEOUT In blocking mode, the timeout expired before394all enabled APs have finished.395@retval EFI_INVALID_PARAMETER Procedure is NULL.396397**/398typedef399EFI_STATUS400(EFIAPI *EFI_MP_SERVICES_STARTUP_ALL_APS)(401IN EFI_MP_SERVICES_PROTOCOL *This,402IN EFI_AP_PROCEDURE Procedure,403IN BOOLEAN SingleThread,404IN EFI_EVENT WaitEvent OPTIONAL,405IN UINTN TimeoutInMicroSeconds,406IN VOID *ProcedureArgument OPTIONAL,407OUT UINTN **FailedCpuList OPTIONAL408);409410/**411This service lets the caller get one enabled AP to execute a caller-provided412function. The caller can request the BSP to either wait for the completion413of the AP or just proceed with the next task by using the EFI event mechanism.414See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking415execution support. This service may only be called from the BSP.416417This function is used to dispatch one enabled AP to the function specified by418Procedure passing in the argument specified by ProcedureArgument. If WaitEvent419is NULL, execution is in blocking mode. The BSP waits until the AP finishes or420TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode.421BSP proceeds to the next task without waiting for the AP. If a non-blocking mode422is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled,423then EFI_UNSUPPORTED must be returned.424425If the timeout specified by TimeoutInMicroseconds expires before the AP returns426from Procedure, then execution of Procedure by the AP is terminated. The AP is427available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and428EFI_MP_SERVICES_PROTOCOL.StartupThisAP().429430@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL431instance.432@param[in] Procedure A pointer to the function to be run on the433designated AP of the system. See type434EFI_AP_PROCEDURE.435@param[in] ProcessorNumber The handle number of the AP. The range is436from 0 to the total number of logical437processors minus 1. The total number of438logical processors can be retrieved by439EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().440@param[in] WaitEvent The event created by the caller with CreateEvent()441service. If it is NULL, then execute in442blocking mode. BSP waits until this AP finish443or TimeoutInMicroSeconds expires. If it's444not NULL, then execute in non-blocking mode.445BSP requests the function specified by446Procedure to be started on this AP,447and go on executing immediately. If this AP448return from Procedure or TimeoutInMicroSeconds449expires, this event is signaled. The BSP450can use the CheckEvent() or WaitForEvent()451services to check the state of event. Type452EFI_EVENT is defined in CreateEvent() in453the Unified Extensible Firmware Interface454Specification.455@param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for456this AP to finish this Procedure, either for457blocking or non-blocking mode. Zero means458infinity. If the timeout expires before459this AP returns from Procedure, then Procedure460on the AP is terminated. The461AP is available for next function assigned462by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()463or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().464If the timeout expires in blocking mode,465BSP returns EFI_TIMEOUT. If the timeout466expires in non-blocking mode, WaitEvent467is signaled with SignalEvent().468@param[in] ProcedureArgument The parameter passed into Procedure on the469specified AP.470@param[out] Finished If NULL, this parameter is ignored. In471blocking mode, this parameter is ignored.472In non-blocking mode, if AP returns from473Procedure before the timeout expires, its474content is set to TRUE. Otherwise, the475value is set to FALSE. The caller can476determine if the AP returned from Procedure477by evaluating this value.478479@retval EFI_SUCCESS In blocking mode, specified AP finished before480the timeout expires.481@retval EFI_SUCCESS In non-blocking mode, the function has been482dispatched to specified AP.483@retval EFI_UNSUPPORTED A non-blocking mode request was made after the484UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was485signaled.486@retval EFI_DEVICE_ERROR The calling processor is an AP.487@retval EFI_TIMEOUT In blocking mode, the timeout expired before488the specified AP has finished.489@retval EFI_NOT_READY The specified AP is busy.490@retval EFI_NOT_FOUND The processor with the handle specified by491ProcessorNumber does not exist.492@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.493@retval EFI_INVALID_PARAMETER Procedure is NULL.494495**/496typedef497EFI_STATUS498(EFIAPI *EFI_MP_SERVICES_STARTUP_THIS_AP)(499IN EFI_MP_SERVICES_PROTOCOL *This,500IN EFI_AP_PROCEDURE Procedure,501IN UINTN ProcessorNumber,502IN EFI_EVENT WaitEvent OPTIONAL,503IN UINTN TimeoutInMicroseconds,504IN VOID *ProcedureArgument OPTIONAL,505OUT BOOLEAN *Finished OPTIONAL506);507508/**509This service switches the requested AP to be the BSP from that point onward.510This service changes the BSP for all purposes. This call can only be performed511by the current BSP.512513This service switches the requested AP to be the BSP from that point onward.514This service changes the BSP for all purposes. The new BSP can take over the515execution of the old BSP and continue seamlessly from where the old one left516off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT517is signaled.518519If the BSP cannot be switched prior to the return from this service, then520EFI_UNSUPPORTED must be returned.521522@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.523@param[in] ProcessorNumber The handle number of AP that is to become the new524BSP. The range is from 0 to the total number of525logical processors minus 1. The total number of526logical processors can be retrieved by527EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().528@param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an529enabled AP. Otherwise, it will be disabled.530531@retval EFI_SUCCESS BSP successfully switched.532@retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to533this service returning.534@retval EFI_UNSUPPORTED Switching the BSP is not supported.535@retval EFI_DEVICE_ERROR The calling processor is an AP.536@retval EFI_NOT_FOUND The processor with the handle specified by537ProcessorNumber does not exist.538@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or539a disabled AP.540@retval EFI_NOT_READY The specified AP is busy.541542**/543typedef544EFI_STATUS545(EFIAPI *EFI_MP_SERVICES_SWITCH_BSP)(546IN EFI_MP_SERVICES_PROTOCOL *This,547IN UINTN ProcessorNumber,548IN BOOLEAN EnableOldBSP549);550551/**552This service lets the caller enable or disable an AP from this point onward.553This service may only be called from the BSP.554555This service allows the caller enable or disable an AP from this point onward.556The caller can optionally specify the health status of the AP by Health. If557an AP is being disabled, then the state of the disabled AP is implementation558dependent. If an AP is enabled, then the implementation must guarantee that a559complete initialization sequence is performed on the AP, so the AP is in a state560that is compatible with an MP operating system. This service may not be supported561after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.562563If the enable or disable AP operation cannot be completed prior to the return564from this service, then EFI_UNSUPPORTED must be returned.565566@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.567@param[in] ProcessorNumber The handle number of AP.568The range is from 0 to the total number of569logical processors minus 1. The total number of570logical processors can be retrieved by571EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().572@param[in] EnableAP Specifies the new state for the processor for573enabled, FALSE for disabled.574@param[in] HealthFlag If not NULL, a pointer to a value that specifies575the new health status of the AP. This flag576corresponds to StatusFlag defined in577EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only578the PROCESSOR_HEALTH_STATUS_BIT is used. All other579bits are ignored. If it is NULL, this parameter580is ignored.581582@retval EFI_SUCCESS The specified AP was enabled or disabled successfully.583@retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed584prior to this service returning.585@retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.586@retval EFI_DEVICE_ERROR The calling processor is an AP.587@retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber588does not exist.589@retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.590591**/592typedef593EFI_STATUS594(EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)(595IN EFI_MP_SERVICES_PROTOCOL *This,596IN UINTN ProcessorNumber,597IN BOOLEAN EnableAP,598IN UINT32 *HealthFlag OPTIONAL599);600601/**602This return the handle number for the calling processor. This service may be603called from the BSP and APs.604605This service returns the processor handle number for the calling processor.606The returned value is in the range from 0 to the total number of logical607processors minus 1. The total number of logical processors can be retrieved608with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be609called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER610is returned. Otherwise, the current processors handle number is returned in611ProcessorNumber, and EFI_SUCCESS is returned.612613@param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.614@param[in] ProcessorNumber Pointer to the handle number of AP.615The range is from 0 to the total number of616logical processors minus 1. The total number of617logical processors can be retrieved by618EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().619620@retval EFI_SUCCESS The current processor handle number was returned621in ProcessorNumber.622@retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.623624**/625typedef626EFI_STATUS627(EFIAPI *EFI_MP_SERVICES_WHOAMI)(628IN EFI_MP_SERVICES_PROTOCOL *This,629OUT UINTN *ProcessorNumber630);631632///633/// When installed, the MP Services Protocol produces a collection of services634/// that are needed for MP management.635///636/// Before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the module637/// that produces this protocol is required to place all APs into an idle state638/// whenever the APs are disabled or the APs are not executing code as requested639/// through the StartupAllAPs() or StartupThisAP() services. The idle state of640/// an AP before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled is641/// implementation dependent.642///643/// After the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, all the APs644/// must be placed in the OS compatible CPU state as defined by the UEFI645/// Specification. Implementations of this protocol may use the UEFI event646/// EFI_EVENT_GROUP_READY_TO_BOOT to force APs into the OS compatible state as647/// defined by the UEFI Specification. Modules that use this protocol must648/// guarantee that all non-blocking mode requests on all APs have been completed649/// before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled. Since the650/// order that event notification functions in the same event group are executed651/// is not deterministic, an event of type EFI_EVENT_GROUP_READY_TO_BOOT cannot652/// be used to guarantee that APs have completed their non-blocking mode requests.653///654/// When the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the StartAllAPs()655/// and StartupThisAp() services must no longer support non-blocking mode requests.656/// The support for SwitchBSP() and EnableDisableAP() may no longer be supported657/// after this event is signaled. Since UEFI Applications and UEFI OS Loaders658/// execute after the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, these659/// UEFI images must be aware that the functionality of this protocol may be reduced.660///661struct _EFI_MP_SERVICES_PROTOCOL {662EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;663EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;664EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;665EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;666EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;667EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;668EFI_MP_SERVICES_WHOAMI WhoAmI;669};670671extern EFI_GUID gEfiMpServiceProtocolGuid;672673#endif674675676