4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <Protocol/MpService.h>
19 #include <Library/SynchronizationLib.h>
22 Initialize Multi-processor support.
32 (EFIAPI
*STACKLESS_AP_ENTRY_POINT
)(
37 Starts the Application Processors and directs them to jump to the
40 The processor jumps to this code in flat mode, but the processor's
41 stack is not initialized.
43 @param ApEntryPoint Pointer to the Entry Point routine
45 @retval EFI_SUCCESS The APs were started
46 @retval EFI_OUT_OF_RESOURCES Cannot allocate memory to start APs
51 IN STACKLESS_AP_ENTRY_POINT ApEntryPoint
55 The AP entry point that the Startup-IPI target code will jump to.
57 The processor jumps to this code in flat mode, but the processor's
58 stack is not initialized.
68 Releases the lock preventing other APs from using the shared AP
71 Once the AP has transitioned to using a new stack, it can call this
72 function to allow another AP to proceed with using the shared stack.
77 AsmApDoneWithCommonStack (
90 Define Individual Processor Data block.
94 EFI_PROCESSOR_INFORMATION Info
;
95 SPIN_LOCK CpuDataLock
;
96 volatile CPU_STATE State
;
98 EFI_AP_PROCEDURE Procedure
;
103 Define MP data block which consumes individual processor block.
107 CPU_DATA_BLOCK
*CpuDatas
;
108 UINTN NumberOfProcessors
;
109 UINTN NumberOfEnabledProcessors
;
113 This function is called by all processors (both BSP and AP) once and collects MP related data.
115 @param Bsp TRUE if the CPU is BSP
116 @param ProcessorNumber The specific processor number
118 @retval EFI_SUCCESS Data for the processor collected and filled in
122 FillInProcessorInformation (
124 IN UINTN ProcessorNumber
128 This service retrieves the number of logical processor in the platform
129 and the number of those logical processors that are enabled on this boot.
130 This service may only be called from the BSP.
132 This function is used to retrieve the following information:
133 - The number of logical processors that are present in the system.
134 - The number of enabled logical processors in the system at the instant
137 Because MP Service Protocol provides services to enable and disable processors
138 dynamically, the number of enabled logical processors may vary during the
139 course of a boot session.
141 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.
142 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then
143 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors
144 is returned in NumberOfProcessors, the number of currently enabled processor
145 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.
147 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL
149 @param[out] NumberOfProcessors Pointer to the total number of logical
150 processors in the system, including the BSP
152 @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical
153 processors that exist in system, including
156 @retval EFI_SUCCESS The number of logical processors and enabled
157 logical processors was retrieved.
158 @retval EFI_DEVICE_ERROR The calling processor is an AP.
159 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.
160 @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL.
165 GetNumberOfProcessors (
166 IN EFI_MP_SERVICES_PROTOCOL
*This
,
167 OUT UINTN
*NumberOfProcessors
,
168 OUT UINTN
*NumberOfEnabledProcessors
172 This return the handle number for the calling processor. This service may be
173 called from the BSP and APs.
175 This service returns the processor handle number for the calling processor.
176 The returned value is in the range from 0 to the total number of logical
177 processors minus 1. The total number of logical processors can be retrieved
178 with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be
179 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
180 is returned. Otherwise, the current processors handle number is returned in
181 ProcessorNumber, and EFI_SUCCESS is returned.
183 @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.
184 @param[out] ProcessorNumber The handle number of AP that is to become the new
185 BSP. The range is from 0 to the total number of
186 logical processors minus 1. The total number of
187 logical processors can be retrieved by
188 EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().
190 @retval EFI_SUCCESS The current processor handle number was returned
192 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
198 IN EFI_MP_SERVICES_PROTOCOL
*This
,
199 OUT UINTN
*ProcessorNumber