]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/CpuMpPei/PeiMpServices.h
UefiCpuPkg/CpuMpPei: Remove unused files and codes
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / PeiMpServices.h
CommitLineData
ea0f431c
JF
1/** @file\r
2 Functions prototype of Multiple Processor PPI services.\r
3\r
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
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#ifndef _PEI_MP_SERVICES_H_\r
16#define _PEI_MP_SERVICES_H_\r
17\r
18#include "CpuMpPei.h"\r
19\r
ea0f431c
JF
20\r
21/**\r
22 This service retrieves the number of logical processor in the platform\r
23 and the number of those logical processors that are enabled on this boot.\r
24 This service may only be called from the BSP.\r
25\r
26 This function is used to retrieve the following information:\r
27 - The number of logical processors that are present in the system.\r
28 - The number of enabled logical processors in the system at the instant\r
29 this call is made.\r
30\r
31 Because MP Service Ppi provides services to enable and disable processors\r
32 dynamically, the number of enabled logical processors may vary during the\r
33 course of a boot session.\r
34\r
35 If this service is called from an AP, then EFI_DEVICE_ERROR is returned.\r
36 If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then\r
37 EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors\r
38 is returned in NumberOfProcessors, the number of currently enabled processor\r
39 is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.\r
40\r
41 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
42 published by the PEI Foundation.\r
43 @param[in] This Pointer to this instance of the PPI.\r
44 @param[out] NumberOfProcessors Pointer to the total number of logical processors in\r
45 the system, including the BSP and disabled APs.\r
46 @param[out] NumberOfEnabledProcessors\r
47 Number of processors in the system that are enabled.\r
48\r
49 @retval EFI_SUCCESS The number of logical processors and enabled\r
50 logical processors was retrieved.\r
51 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
52 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r
53 NumberOfEnabledProcessors is NULL.\r
54**/\r
55EFI_STATUS\r
56EFIAPI\r
57PeiGetNumberOfProcessors (\r
58 IN CONST EFI_PEI_SERVICES **PeiServices,\r
59 IN EFI_PEI_MP_SERVICES_PPI *This,\r
60 OUT UINTN *NumberOfProcessors,\r
61 OUT UINTN *NumberOfEnabledProcessors\r
62 );\r
63\r
64/**\r
65 Gets detailed MP-related information on the requested processor at the\r
66 instant this call is made. This service may only be called from the BSP.\r
67\r
68 This service retrieves detailed MP-related information about any processor\r
69 on the platform. Note the following:\r
70 - The processor information may change during the course of a boot session.\r
71 - The information presented here is entirely MP related.\r
72\r
73 Information regarding the number of caches and their sizes, frequency of operation,\r
74 slot numbers is all considered platform-related information and is not provided\r
75 by this service.\r
76\r
77 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
78 published by the PEI Foundation.\r
79 @param[in] This Pointer to this instance of the PPI.\r
80 @param[in] ProcessorNumber Pointer to the total number of logical processors in\r
81 the system, including the BSP and disabled APs.\r
82 @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.\r
83\r
84 @retval EFI_SUCCESS Processor information was returned.\r
85 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
86 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
87 @retval EFI_NOT_FOUND The processor with the handle specified by\r
88 ProcessorNumber does not exist in the platform.\r
89**/\r
90EFI_STATUS\r
91EFIAPI\r
92PeiGetProcessorInfo (\r
93 IN CONST EFI_PEI_SERVICES **PeiServices,\r
94 IN EFI_PEI_MP_SERVICES_PPI *This,\r
95 IN UINTN ProcessorNumber,\r
96 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
97 );\r
98\r
99/**\r
100 This service executes a caller provided function on all enabled APs. APs can\r
101 run either simultaneously or one at a time in sequence. This service supports\r
102 both blocking requests only. This service may only\r
103 be called from the BSP.\r
104\r
105 This function is used to dispatch all the enabled APs to the function specified\r
106 by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned\r
107 immediately and Procedure is not started on any AP.\r
108\r
109 If SingleThread is TRUE, all the enabled APs execute the function specified by\r
110 Procedure one by one, in ascending order of processor handle number. Otherwise,\r
111 all the enabled APs execute the function specified by Procedure simultaneously.\r
112\r
113 If the timeout specified by TimeoutInMicroSeconds expires before all APs return\r
114 from Procedure, then Procedure on the failed APs is terminated. All enabled APs\r
115 are always available for further calls to EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
116 and EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If FailedCpuList is not NULL, its\r
117 content points to the list of processor handle numbers in which Procedure was\r
118 terminated.\r
119\r
120 Note: It is the responsibility of the consumer of the EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
121 to make sure that the nature of the code that is executed on the BSP and the\r
122 dispatched APs is well controlled. The MP Services Ppi does not guarantee\r
123 that the Procedure function is MP-safe. Hence, the tasks that can be run in\r
124 parallel are limited to certain independent tasks and well-controlled exclusive\r
125 code. PEI services and Ppis may not be called by APs unless otherwise\r
126 specified.\r
127\r
128 In blocking execution mode, BSP waits until all APs finish or\r
129 TimeoutInMicroSeconds expires.\r
130\r
131 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
132 published by the PEI Foundation.\r
133 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
134 @param[in] Procedure A pointer to the function to be run on enabled APs of\r
135 the system.\r
136 @param[in] SingleThread If TRUE, then all the enabled APs execute the function\r
137 specified by Procedure one by one, in ascending order\r
138 of processor handle number. If FALSE, then all the\r
139 enabled APs execute the function specified by Procedure\r
140 simultaneously.\r
141 @param[in] TimeoutInMicroSeconds\r
142 Indicates the time limit in microseconds for APs to\r
143 return from Procedure, for blocking mode only. Zero\r
144 means infinity. If the timeout expires before all APs\r
145 return from Procedure, then Procedure on the failed APs\r
146 is terminated. All enabled APs are available for next\r
147 function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
148 or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
149 timeout expires in blocking mode, BSP returns\r
150 EFI_TIMEOUT.\r
151 @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
152\r
153 @retval EFI_SUCCESS In blocking mode, all APs have finished before the\r
154 timeout expired.\r
155 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
156 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
157 @retval EFI_NOT_READY Any enabled APs are busy.\r
158 @retval EFI_TIMEOUT In blocking mode, the timeout expired before all\r
159 enabled APs have finished.\r
160 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
161**/\r
162EFI_STATUS\r
163EFIAPI\r
164PeiStartupAllAPs (\r
165 IN CONST EFI_PEI_SERVICES **PeiServices,\r
166 IN EFI_PEI_MP_SERVICES_PPI *This,\r
167 IN EFI_AP_PROCEDURE Procedure,\r
168 IN BOOLEAN SingleThread,\r
169 IN UINTN TimeoutInMicroSeconds,\r
170 IN VOID *ProcedureArgument OPTIONAL\r
171 );\r
172\r
173/**\r
174 This service lets the caller get one enabled AP to execute a caller-provided\r
175 function. The caller can request the BSP to wait for the completion\r
176 of the AP. This service may only be called from the BSP.\r
177\r
178 This function is used to dispatch one enabled AP to the function specified by\r
179 Procedure passing in the argument specified by ProcedureArgument.\r
180 The execution is in blocking mode. The BSP waits until the AP finishes or\r
181 TimeoutInMicroSecondss expires.\r
182\r
183 If the timeout specified by TimeoutInMicroseconds expires before the AP returns\r
184 from Procedure, then execution of Procedure by the AP is terminated. The AP is\r
185 available for subsequent calls to EFI_PEI_MP_SERVICES_PPI.StartupAllAPs() and\r
186 EFI_PEI_MP_SERVICES_PPI.StartupThisAP().\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 A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
191 @param[in] Procedure A pointer to the function to be run on enabled APs of\r
192 the system.\r
193 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
194 total number of logical processors minus 1. The total\r
195 number of logical processors can be retrieved by\r
196 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
197 @param[in] TimeoutInMicroseconds\r
198 Indicates the time limit in microseconds for APs to\r
199 return from Procedure, for blocking mode only. Zero\r
200 means infinity. If the timeout expires before all APs\r
201 return from Procedure, then Procedure on the failed APs\r
202 is terminated. All enabled APs are available for next\r
203 function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
204 or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
205 timeout expires in blocking mode, BSP returns\r
206 EFI_TIMEOUT.\r
207 @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
208\r
209 @retval EFI_SUCCESS In blocking mode, specified AP finished before the\r
210 timeout expires.\r
211 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
212 @retval EFI_TIMEOUT In blocking mode, the timeout expired before the\r
213 specified AP has finished.\r
214 @retval EFI_NOT_FOUND The processor with the handle specified by\r
215 ProcessorNumber does not exist.\r
216 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
217 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
218**/\r
219EFI_STATUS\r
220EFIAPI\r
221PeiStartupThisAP (\r
222 IN CONST EFI_PEI_SERVICES **PeiServices,\r
223 IN EFI_PEI_MP_SERVICES_PPI *This,\r
224 IN EFI_AP_PROCEDURE Procedure,\r
225 IN UINTN ProcessorNumber,\r
226 IN UINTN TimeoutInMicroseconds,\r
227 IN VOID *ProcedureArgument OPTIONAL\r
228 );\r
229\r
230/**\r
231 This service switches the requested AP to be the BSP from that point onward.\r
232 This service changes the BSP for all purposes. This call can only be performed\r
233 by the current BSP.\r
234\r
235 This service switches the requested AP to be the BSP from that point onward.\r
236 This service changes the BSP for all purposes. The new BSP can take over the\r
237 execution of the old BSP and continue seamlessly from where the old one left\r
238 off.\r
239\r
240 If the BSP cannot be switched prior to the return from this service, then\r
241 EFI_UNSUPPORTED must be returned.\r
242\r
243 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
244 published by the PEI Foundation.\r
245 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
246 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
247 total number of logical processors minus 1. The total\r
248 number of logical processors can be retrieved by\r
249 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
250 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled\r
251 AP. Otherwise, it will be disabled.\r
252\r
253 @retval EFI_SUCCESS BSP successfully switched.\r
254 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this\r
255 service returning.\r
256 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
257 @retval EFI_SUCCESS The calling processor is an AP.\r
258 @retval EFI_NOT_FOUND The processor with the handle specified by\r
259 ProcessorNumber does not exist.\r
260 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled\r
261 AP.\r
262 @retval EFI_NOT_READY The specified AP is busy.\r
263**/\r
264EFI_STATUS\r
265EFIAPI\r
266PeiSwitchBSP (\r
267 IN CONST EFI_PEI_SERVICES **PeiServices,\r
268 IN EFI_PEI_MP_SERVICES_PPI *This,\r
269 IN UINTN ProcessorNumber,\r
270 IN BOOLEAN EnableOldBSP\r
271 );\r
272\r
273/**\r
274 This service lets the caller enable or disable an AP from this point onward.\r
275 This service may only be called from the BSP.\r
276\r
277 This service allows the caller enable or disable an AP from this point onward.\r
278 The caller can optionally specify the health status of the AP by Health. If\r
279 an AP is being disabled, then the state of the disabled AP is implementation\r
280 dependent. If an AP is enabled, then the implementation must guarantee that a\r
281 complete initialization sequence is performed on the AP, so the AP is in a state\r
282 that is compatible with an MP operating system.\r
283\r
284 If the enable or disable AP operation cannot be completed prior to the return\r
285 from this service, then EFI_UNSUPPORTED must be returned.\r
286\r
287 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
288 published by the PEI Foundation.\r
289 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
290 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
291 total number of logical processors minus 1. The total\r
292 number of logical processors can be retrieved by\r
293 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
294 @param[in] EnableAP Specifies the new state for the processor for enabled,\r
295 FALSE for disabled.\r
296 @param[in] HealthFlag If not NULL, a pointer to a value that specifies the\r
297 new health status of the AP. This flag corresponds to\r
298 StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().\r
299 Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
300 bits are ignored. If it is NULL, this parameter is\r
301 ignored.\r
302\r
303 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
304 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior\r
305 to this service returning.\r
306 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
307 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
308 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
309 does not exist.\r
310 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
311**/\r
312EFI_STATUS\r
313EFIAPI\r
314PeiEnableDisableAP (\r
315 IN CONST EFI_PEI_SERVICES **PeiServices,\r
316 IN EFI_PEI_MP_SERVICES_PPI *This,\r
317 IN UINTN ProcessorNumber,\r
318 IN BOOLEAN EnableAP,\r
319 IN UINT32 *HealthFlag OPTIONAL\r
320 );\r
321\r
322/**\r
323 This return the handle number for the calling processor. This service may be\r
324 called from the BSP and APs.\r
325\r
326 This service returns the processor handle number for the calling processor.\r
327 The returned value is in the range from 0 to the total number of logical\r
328 processors minus 1. The total number of logical processors can be retrieved\r
329 with EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors(). This service may be\r
330 called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r
331 is returned. Otherwise, the current processors handle number is returned in\r
332 ProcessorNumber, and EFI_SUCCESS is returned.\r
333\r
334 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
335 published by the PEI Foundation.\r
336 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
337 @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
338 total number of logical processors minus 1. The total\r
339 number of logical processors can be retrieved by\r
340 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
341\r
342 @retval EFI_SUCCESS The current processor handle number was returned in\r
343 ProcessorNumber.\r
344 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
345**/\r
346EFI_STATUS\r
347EFIAPI\r
348PeiWhoAmI (\r
349 IN CONST EFI_PEI_SERVICES **PeiServices,\r
350 IN EFI_PEI_MP_SERVICES_PPI *This,\r
351 OUT UINTN *ProcessorNumber\r
352 );\r
353\r
354#endif\r