]>
Commit | Line | Data |
---|---|---|
ea0f431c JF |
1 | /** @file\r |
2 | Implementation of Multiple Processor PPI services.\r | |
3 | \r | |
a742e186 | 4 | Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r |
ea0f431c JF |
5 | This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "PeiMpServices.h"\r | |
16 | \r | |
17 | //\r | |
18 | // CPU MP PPI to be installed\r | |
19 | //\r | |
20 | EFI_PEI_MP_SERVICES_PPI mMpServicesPpi = {\r | |
21 | PeiGetNumberOfProcessors,\r | |
22 | PeiGetProcessorInfo,\r | |
23 | PeiStartupAllAPs,\r | |
24 | PeiStartupThisAP,\r | |
25 | PeiSwitchBSP,\r | |
26 | PeiEnableDisableAP,\r | |
27 | PeiWhoAmI,\r | |
28 | };\r | |
29 | \r | |
30 | EFI_PEI_PPI_DESCRIPTOR mPeiCpuMpPpiDesc = {\r | |
31 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r | |
32 | &gEfiPeiMpServicesPpiGuid,\r | |
33 | &mMpServicesPpi\r | |
34 | };\r | |
35 | \r | |
a1a4c7a4 | 36 | \r |
ea0f431c JF |
37 | /**\r |
38 | Get CPU Package/Core/Thread location information.\r | |
39 | \r | |
40 | @param InitialApicId CPU APIC ID\r | |
41 | @param Location Pointer to CPU location information\r | |
42 | **/\r | |
a1a4c7a4 | 43 | STATIC\r |
ea0f431c JF |
44 | VOID\r |
45 | ExtractProcessorLocation (\r | |
46 | IN UINT32 InitialApicId,\r | |
47 | OUT EFI_CPU_PHYSICAL_LOCATION *Location\r | |
48 | )\r | |
49 | {\r | |
50 | BOOLEAN TopologyLeafSupported;\r | |
51 | UINTN ThreadBits;\r | |
52 | UINTN CoreBits;\r | |
53 | UINT32 RegEax;\r | |
54 | UINT32 RegEbx;\r | |
55 | UINT32 RegEcx;\r | |
56 | UINT32 RegEdx;\r | |
57 | UINT32 MaxCpuIdIndex;\r | |
58 | UINT32 SubIndex;\r | |
59 | UINTN LevelType;\r | |
60 | UINT32 MaxLogicProcessorsPerPackage;\r | |
61 | UINT32 MaxCoresPerPackage;\r | |
62 | \r | |
63 | //\r | |
64 | // Check if the processor is capable of supporting more than one logical processor.\r | |
65 | //\r | |
66 | AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL, &RegEdx);\r | |
67 | if ((RegEdx & BIT28) == 0) {\r | |
68 | Location->Thread = 0;\r | |
69 | Location->Core = 0;\r | |
70 | Location->Package = 0;\r | |
71 | return;\r | |
72 | }\r | |
73 | \r | |
74 | ThreadBits = 0;\r | |
75 | CoreBits = 0;\r | |
76 | \r | |
77 | //\r | |
78 | // Assume three-level mapping of APIC ID: Package:Core:SMT.\r | |
79 | //\r | |
80 | \r | |
81 | TopologyLeafSupported = FALSE;\r | |
82 | //\r | |
83 | // Get the max index of basic CPUID\r | |
84 | //\r | |
85 | AsmCpuid (CPUID_SIGNATURE, &MaxCpuIdIndex, NULL, NULL, NULL);\r | |
86 | \r | |
87 | //\r | |
88 | // If the extended topology enumeration leaf is available, it\r | |
89 | // is the preferred mechanism for enumerating topology.\r | |
90 | //\r | |
91 | if (MaxCpuIdIndex >= CPUID_EXTENDED_TOPOLOGY) {\r | |
92 | AsmCpuidEx (CPUID_EXTENDED_TOPOLOGY, 0, &RegEax, &RegEbx, &RegEcx, NULL);\r | |
93 | //\r | |
94 | // If CPUID.(EAX=0BH, ECX=0H):EBX returns zero and maximum input value for\r | |
95 | // basic CPUID information is greater than 0BH, then CPUID.0BH leaf is not\r | |
96 | // supported on that processor.\r | |
97 | //\r | |
98 | if (RegEbx != 0) {\r | |
99 | TopologyLeafSupported = TRUE;\r | |
100 | \r | |
101 | //\r | |
102 | // Sub-leaf index 0 (ECX= 0 as input) provides enumeration parameters to extract\r | |
103 | // the SMT sub-field of x2APIC ID.\r | |
104 | //\r | |
105 | LevelType = (RegEcx >> 8) & 0xff;\r | |
106 | ASSERT (LevelType == CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_SMT);\r | |
107 | ThreadBits = RegEax & 0x1f;\r | |
108 | \r | |
109 | //\r | |
110 | // Software must not assume any "level type" encoding\r | |
111 | // value to be related to any sub-leaf index, except sub-leaf 0.\r | |
112 | //\r | |
113 | SubIndex = 1;\r | |
114 | do {\r | |
115 | AsmCpuidEx (CPUID_EXTENDED_TOPOLOGY, SubIndex, &RegEax, NULL, &RegEcx, NULL);\r | |
116 | LevelType = (RegEcx >> 8) & 0xff;\r | |
117 | if (LevelType == CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_CORE) {\r | |
118 | CoreBits = (RegEax & 0x1f) - ThreadBits;\r | |
119 | break;\r | |
120 | }\r | |
121 | SubIndex++;\r | |
122 | } while (LevelType != CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID);\r | |
123 | }\r | |
124 | }\r | |
125 | \r | |
126 | if (!TopologyLeafSupported) {\r | |
127 | AsmCpuid (CPUID_VERSION_INFO, NULL, &RegEbx, NULL, NULL);\r | |
128 | MaxLogicProcessorsPerPackage = (RegEbx >> 16) & 0xff;\r | |
129 | if (MaxCpuIdIndex >= CPUID_CACHE_PARAMS) {\r | |
130 | AsmCpuidEx (CPUID_CACHE_PARAMS, 0, &RegEax, NULL, NULL, NULL);\r | |
131 | MaxCoresPerPackage = (RegEax >> 26) + 1;\r | |
132 | } else {\r | |
133 | //\r | |
134 | // Must be a single-core processor.\r | |
135 | //\r | |
136 | MaxCoresPerPackage = 1;\r | |
137 | }\r | |
138 | \r | |
139 | ThreadBits = (UINTN) (HighBitSet32 (MaxLogicProcessorsPerPackage / MaxCoresPerPackage - 1) + 1);\r | |
140 | CoreBits = (UINTN) (HighBitSet32 (MaxCoresPerPackage - 1) + 1);\r | |
141 | }\r | |
142 | \r | |
143 | Location->Thread = InitialApicId & ~((-1) << ThreadBits);\r | |
144 | Location->Core = (InitialApicId >> ThreadBits) & ~((-1) << CoreBits);\r | |
145 | Location->Package = (InitialApicId >> (ThreadBits + CoreBits));\r | |
146 | }\r | |
147 | \r | |
ea0f431c JF |
148 | /**\r |
149 | Worker function for SwitchBSP().\r | |
150 | \r | |
151 | Worker function for SwitchBSP(), assigned to the AP which is intended to become BSP.\r | |
152 | \r | |
153 | @param Buffer Pointer to CPU MP Data\r | |
154 | **/\r | |
a1a4c7a4 | 155 | STATIC\r |
ea0f431c JF |
156 | VOID\r |
157 | EFIAPI\r | |
158 | FutureBSPProc (\r | |
159 | IN VOID *Buffer\r | |
160 | )\r | |
161 | {\r | |
162 | PEI_CPU_MP_DATA *DataInHob;\r | |
163 | \r | |
164 | DataInHob = (PEI_CPU_MP_DATA *) Buffer;\r | |
165 | AsmExchangeRole (&DataInHob->APInfo, &DataInHob->BSPInfo);\r | |
166 | }\r | |
167 | \r | |
168 | /**\r | |
169 | This service retrieves the number of logical processor in the platform\r | |
170 | and the number of those logical processors that are enabled on this boot.\r | |
171 | This service may only be called from the BSP.\r | |
172 | \r | |
173 | This function is used to retrieve the following information:\r | |
174 | - The number of logical processors that are present in the system.\r | |
175 | - The number of enabled logical processors in the system at the instant\r | |
176 | this call is made.\r | |
177 | \r | |
178 | Because MP Service Ppi provides services to enable and disable processors\r | |
179 | dynamically, the number of enabled logical processors may vary during the\r | |
180 | course of a boot session.\r | |
181 | \r | |
182 | If this service is called from an AP, then EFI_DEVICE_ERROR is returned.\r | |
183 | If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then\r | |
184 | EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors\r | |
185 | is returned in NumberOfProcessors, the number of currently enabled processor\r | |
186 | is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.\r | |
187 | \r | |
188 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
189 | published by the PEI Foundation.\r | |
190 | @param[in] This Pointer to this instance of the PPI.\r | |
191 | @param[out] NumberOfProcessors Pointer to the total number of logical processors in\r | |
192 | the system, including the BSP and disabled APs.\r | |
193 | @param[out] NumberOfEnabledProcessors\r | |
194 | Number of processors in the system that are enabled.\r | |
195 | \r | |
196 | @retval EFI_SUCCESS The number of logical processors and enabled\r | |
197 | logical processors was retrieved.\r | |
198 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
199 | @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r | |
200 | NumberOfEnabledProcessors is NULL.\r | |
201 | **/\r | |
202 | EFI_STATUS\r | |
203 | EFIAPI\r | |
204 | PeiGetNumberOfProcessors (\r | |
205 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
206 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
207 | OUT UINTN *NumberOfProcessors,\r | |
208 | OUT UINTN *NumberOfEnabledProcessors\r | |
209 | )\r | |
210 | {\r | |
ea0f431c JF |
211 | if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) {\r |
212 | return EFI_INVALID_PARAMETER;\r | |
213 | }\r | |
214 | \r | |
a1a4c7a4 JF |
215 | return MpInitLibGetNumberOfProcessors (\r |
216 | NumberOfProcessors,\r | |
217 | NumberOfEnabledProcessors\r | |
218 | );\r | |
ea0f431c JF |
219 | }\r |
220 | \r | |
221 | /**\r | |
222 | Gets detailed MP-related information on the requested processor at the\r | |
223 | instant this call is made. This service may only be called from the BSP.\r | |
224 | \r | |
225 | This service retrieves detailed MP-related information about any processor\r | |
226 | on the platform. Note the following:\r | |
227 | - The processor information may change during the course of a boot session.\r | |
228 | - The information presented here is entirely MP related.\r | |
229 | \r | |
230 | Information regarding the number of caches and their sizes, frequency of operation,\r | |
231 | slot numbers is all considered platform-related information and is not provided\r | |
232 | by this service.\r | |
233 | \r | |
234 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
235 | published by the PEI Foundation.\r | |
236 | @param[in] This Pointer to this instance of the PPI.\r | |
237 | @param[in] ProcessorNumber Pointer to the total number of logical processors in\r | |
238 | the system, including the BSP and disabled APs.\r | |
239 | @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.\r | |
240 | \r | |
241 | @retval EFI_SUCCESS Processor information was returned.\r | |
242 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
243 | @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r | |
244 | @retval EFI_NOT_FOUND The processor with the handle specified by\r | |
245 | ProcessorNumber does not exist in the platform.\r | |
246 | **/\r | |
247 | EFI_STATUS\r | |
248 | EFIAPI\r | |
249 | PeiGetProcessorInfo (\r | |
250 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
251 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
252 | IN UINTN ProcessorNumber,\r | |
253 | OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r | |
254 | )\r | |
255 | {\r | |
a1a4c7a4 | 256 | return MpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, NULL);\r |
ea0f431c JF |
257 | }\r |
258 | \r | |
259 | /**\r | |
260 | This service executes a caller provided function on all enabled APs. APs can\r | |
261 | run either simultaneously or one at a time in sequence. This service supports\r | |
262 | both blocking requests only. This service may only\r | |
263 | be called from the BSP.\r | |
264 | \r | |
265 | This function is used to dispatch all the enabled APs to the function specified\r | |
266 | by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned\r | |
267 | immediately and Procedure is not started on any AP.\r | |
268 | \r | |
269 | If SingleThread is TRUE, all the enabled APs execute the function specified by\r | |
270 | Procedure one by one, in ascending order of processor handle number. Otherwise,\r | |
271 | all the enabled APs execute the function specified by Procedure simultaneously.\r | |
272 | \r | |
273 | If the timeout specified by TimeoutInMicroSeconds expires before all APs return\r | |
274 | from Procedure, then Procedure on the failed APs is terminated. All enabled APs\r | |
275 | are always available for further calls to EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r | |
276 | and EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If FailedCpuList is not NULL, its\r | |
277 | content points to the list of processor handle numbers in which Procedure was\r | |
278 | terminated.\r | |
279 | \r | |
280 | Note: It is the responsibility of the consumer of the EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r | |
281 | to make sure that the nature of the code that is executed on the BSP and the\r | |
282 | dispatched APs is well controlled. The MP Services Ppi does not guarantee\r | |
283 | that the Procedure function is MP-safe. Hence, the tasks that can be run in\r | |
284 | parallel are limited to certain independent tasks and well-controlled exclusive\r | |
285 | code. PEI services and Ppis may not be called by APs unless otherwise\r | |
286 | specified.\r | |
287 | \r | |
288 | In blocking execution mode, BSP waits until all APs finish or\r | |
289 | TimeoutInMicroSeconds expires.\r | |
290 | \r | |
291 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
292 | published by the PEI Foundation.\r | |
293 | @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r | |
294 | @param[in] Procedure A pointer to the function to be run on enabled APs of\r | |
295 | the system.\r | |
296 | @param[in] SingleThread If TRUE, then all the enabled APs execute the function\r | |
297 | specified by Procedure one by one, in ascending order\r | |
298 | of processor handle number. If FALSE, then all the\r | |
299 | enabled APs execute the function specified by Procedure\r | |
300 | simultaneously.\r | |
301 | @param[in] TimeoutInMicroSeconds\r | |
302 | Indicates the time limit in microseconds for APs to\r | |
303 | return from Procedure, for blocking mode only. Zero\r | |
304 | means infinity. If the timeout expires before all APs\r | |
305 | return from Procedure, then Procedure on the failed APs\r | |
306 | is terminated. All enabled APs are available for next\r | |
307 | function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r | |
308 | or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r | |
309 | timeout expires in blocking mode, BSP returns\r | |
310 | EFI_TIMEOUT.\r | |
311 | @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r | |
312 | \r | |
313 | @retval EFI_SUCCESS In blocking mode, all APs have finished before the\r | |
314 | timeout expired.\r | |
315 | @retval EFI_DEVICE_ERROR Caller processor is AP.\r | |
316 | @retval EFI_NOT_STARTED No enabled APs exist in the system.\r | |
317 | @retval EFI_NOT_READY Any enabled APs are busy.\r | |
318 | @retval EFI_TIMEOUT In blocking mode, the timeout expired before all\r | |
319 | enabled APs have finished.\r | |
320 | @retval EFI_INVALID_PARAMETER Procedure is NULL.\r | |
321 | **/\r | |
322 | EFI_STATUS\r | |
323 | EFIAPI\r | |
324 | PeiStartupAllAPs (\r | |
325 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
326 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
327 | IN EFI_AP_PROCEDURE Procedure,\r | |
328 | IN BOOLEAN SingleThread,\r | |
329 | IN UINTN TimeoutInMicroSeconds,\r | |
330 | IN VOID *ProcedureArgument OPTIONAL\r | |
331 | )\r | |
332 | {\r | |
a1a4c7a4 JF |
333 | return MpInitLibStartupAllAPs (\r |
334 | Procedure,\r | |
335 | SingleThread,\r | |
336 | NULL,\r | |
337 | TimeoutInMicroSeconds,\r | |
338 | ProcedureArgument,\r | |
339 | NULL\r | |
340 | );\r | |
ea0f431c JF |
341 | }\r |
342 | \r | |
343 | /**\r | |
344 | This service lets the caller get one enabled AP to execute a caller-provided\r | |
345 | function. The caller can request the BSP to wait for the completion\r | |
346 | of the AP. This service may only be called from the BSP.\r | |
347 | \r | |
348 | This function is used to dispatch one enabled AP to the function specified by\r | |
349 | Procedure passing in the argument specified by ProcedureArgument.\r | |
350 | The execution is in blocking mode. The BSP waits until the AP finishes or\r | |
351 | TimeoutInMicroSecondss expires.\r | |
352 | \r | |
353 | If the timeout specified by TimeoutInMicroseconds expires before the AP returns\r | |
354 | from Procedure, then execution of Procedure by the AP is terminated. The AP is\r | |
355 | available for subsequent calls to EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() and\r | |
356 | EFI_PEI_MP_SERVICES_PPI.StartupThisAP().\r | |
357 | \r | |
358 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
359 | published by the PEI Foundation.\r | |
360 | @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r | |
361 | @param[in] Procedure A pointer to the function to be run on enabled APs of\r | |
362 | the system.\r | |
363 | @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r | |
364 | total number of logical processors minus 1. The total\r | |
365 | number of logical processors can be retrieved by\r | |
366 | EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r | |
367 | @param[in] TimeoutInMicroseconds\r | |
368 | Indicates the time limit in microseconds for APs to\r | |
369 | return from Procedure, for blocking mode only. Zero\r | |
370 | means infinity. If the timeout expires before all APs\r | |
371 | return from Procedure, then Procedure on the failed APs\r | |
372 | is terminated. All enabled APs are available for next\r | |
373 | function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r | |
374 | or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r | |
375 | timeout expires in blocking mode, BSP returns\r | |
376 | EFI_TIMEOUT.\r | |
377 | @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r | |
378 | \r | |
379 | @retval EFI_SUCCESS In blocking mode, specified AP finished before the\r | |
380 | timeout expires.\r | |
381 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
382 | @retval EFI_TIMEOUT In blocking mode, the timeout expired before the\r | |
383 | specified AP has finished.\r | |
384 | @retval EFI_NOT_FOUND The processor with the handle specified by\r | |
385 | ProcessorNumber does not exist.\r | |
386 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r | |
387 | @retval EFI_INVALID_PARAMETER Procedure is NULL.\r | |
388 | **/\r | |
389 | EFI_STATUS\r | |
390 | EFIAPI\r | |
391 | PeiStartupThisAP (\r | |
392 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
393 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
394 | IN EFI_AP_PROCEDURE Procedure,\r | |
395 | IN UINTN ProcessorNumber,\r | |
396 | IN UINTN TimeoutInMicroseconds,\r | |
397 | IN VOID *ProcedureArgument OPTIONAL\r | |
398 | )\r | |
399 | {\r | |
a1a4c7a4 JF |
400 | return MpInitLibStartupThisAP (\r |
401 | Procedure,\r | |
402 | ProcessorNumber,\r | |
403 | NULL,\r | |
404 | TimeoutInMicroseconds,\r | |
405 | ProcedureArgument,\r | |
406 | NULL\r | |
407 | );\r | |
ea0f431c JF |
408 | }\r |
409 | \r | |
410 | /**\r | |
411 | This service switches the requested AP to be the BSP from that point onward.\r | |
412 | This service changes the BSP for all purposes. This call can only be performed\r | |
413 | by the current BSP.\r | |
414 | \r | |
415 | This service switches the requested AP to be the BSP from that point onward.\r | |
416 | This service changes the BSP for all purposes. The new BSP can take over the\r | |
417 | execution of the old BSP and continue seamlessly from where the old one left\r | |
418 | off.\r | |
419 | \r | |
420 | If the BSP cannot be switched prior to the return from this service, then\r | |
421 | EFI_UNSUPPORTED must be returned.\r | |
422 | \r | |
423 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
424 | published by the PEI Foundation.\r | |
425 | @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r | |
426 | @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r | |
427 | total number of logical processors minus 1. The total\r | |
428 | number of logical processors can be retrieved by\r | |
429 | EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r | |
430 | @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled\r | |
431 | AP. Otherwise, it will be disabled.\r | |
432 | \r | |
433 | @retval EFI_SUCCESS BSP successfully switched.\r | |
434 | @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this\r | |
435 | service returning.\r | |
436 | @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r | |
437 | @retval EFI_SUCCESS The calling processor is an AP.\r | |
438 | @retval EFI_NOT_FOUND The processor with the handle specified by\r | |
439 | ProcessorNumber does not exist.\r | |
440 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled\r | |
441 | AP.\r | |
442 | @retval EFI_NOT_READY The specified AP is busy.\r | |
443 | **/\r | |
444 | EFI_STATUS\r | |
445 | EFIAPI\r | |
446 | PeiSwitchBSP (\r | |
447 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
448 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
449 | IN UINTN ProcessorNumber,\r | |
450 | IN BOOLEAN EnableOldBSP\r | |
451 | )\r | |
452 | {\r | |
a1a4c7a4 | 453 | return MpInitLibSwitchBSP (ProcessorNumber, EnableOldBSP);\r |
ea0f431c JF |
454 | }\r |
455 | \r | |
456 | /**\r | |
457 | This service lets the caller enable or disable an AP from this point onward.\r | |
458 | This service may only be called from the BSP.\r | |
459 | \r | |
460 | This service allows the caller enable or disable an AP from this point onward.\r | |
461 | The caller can optionally specify the health status of the AP by Health. If\r | |
462 | an AP is being disabled, then the state of the disabled AP is implementation\r | |
463 | dependent. If an AP is enabled, then the implementation must guarantee that a\r | |
464 | complete initialization sequence is performed on the AP, so the AP is in a state\r | |
465 | that is compatible with an MP operating system.\r | |
466 | \r | |
467 | If the enable or disable AP operation cannot be completed prior to the return\r | |
468 | from this service, then EFI_UNSUPPORTED must be returned.\r | |
469 | \r | |
470 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
471 | published by the PEI Foundation.\r | |
472 | @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r | |
473 | @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r | |
474 | total number of logical processors minus 1. The total\r | |
475 | number of logical processors can be retrieved by\r | |
476 | EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r | |
477 | @param[in] EnableAP Specifies the new state for the processor for enabled,\r | |
478 | FALSE for disabled.\r | |
479 | @param[in] HealthFlag If not NULL, a pointer to a value that specifies the\r | |
480 | new health status of the AP. This flag corresponds to\r | |
481 | StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().\r | |
482 | Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r | |
483 | bits are ignored. If it is NULL, this parameter is\r | |
484 | ignored.\r | |
485 | \r | |
486 | @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r | |
487 | @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior\r | |
488 | to this service returning.\r | |
489 | @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r | |
490 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
491 | @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r | |
492 | does not exist.\r | |
493 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r | |
494 | **/\r | |
495 | EFI_STATUS\r | |
496 | EFIAPI\r | |
497 | PeiEnableDisableAP (\r | |
498 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
499 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
500 | IN UINTN ProcessorNumber,\r | |
501 | IN BOOLEAN EnableAP,\r | |
502 | IN UINT32 *HealthFlag OPTIONAL\r | |
503 | )\r | |
504 | {\r | |
a1a4c7a4 | 505 | return MpInitLibEnableDisableAP (ProcessorNumber, EnableAP, HealthFlag);\r |
ea0f431c JF |
506 | }\r |
507 | \r | |
508 | /**\r | |
509 | This return the handle number for the calling processor. This service may be\r | |
510 | called from the BSP and APs.\r | |
511 | \r | |
512 | This service returns the processor handle number for the calling processor.\r | |
513 | The returned value is in the range from 0 to the total number of logical\r | |
514 | processors minus 1. The total number of logical processors can be retrieved\r | |
515 | with EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). This service may be\r | |
516 | called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r | |
517 | is returned. Otherwise, the current processors handle number is returned in\r | |
518 | ProcessorNumber, and EFI_SUCCESS is returned.\r | |
519 | \r | |
520 | @param[in] PeiServices An indirect pointer to the PEI Services Table\r | |
521 | published by the PEI Foundation.\r | |
522 | @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r | |
523 | @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the\r | |
524 | total number of logical processors minus 1. The total\r | |
525 | number of logical processors can be retrieved by\r | |
526 | EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r | |
527 | \r | |
528 | @retval EFI_SUCCESS The current processor handle number was returned in\r | |
529 | ProcessorNumber.\r | |
530 | @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r | |
531 | **/\r | |
532 | EFI_STATUS\r | |
533 | EFIAPI\r | |
534 | PeiWhoAmI (\r | |
535 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
536 | IN EFI_PEI_MP_SERVICES_PPI *This,\r | |
537 | OUT UINTN *ProcessorNumber\r | |
538 | )\r | |
539 | {\r | |
a1a4c7a4 | 540 | return MpInitLibWhoAmI (ProcessorNumber);\r |
ea0f431c | 541 | }\r |