]>
Commit | Line | Data |
---|---|---|
82336c28 | 1 | /** @file\r |
2 | When installed, the MP Services Protocol produces a collection of services \r | |
3 | that are needed for MP management.\r | |
4 | \r | |
5 | The MP Services Protocol provides a generalized way of performing following tasks:\r | |
6 | - Retrieving information of multi-processor environment and MP-related status of\r | |
7 | specific processors.\r | |
8 | - Dispatching user-provided function to APs.\r | |
9 | - Maintain MP-related processor status.\r | |
10 | \r | |
11 | The MP Services Protocol must be produced on any system with more than one logical\r | |
12 | processor.\r | |
13 | \r | |
14 | The Protocol is available only during boot time.\r | |
15 | \r | |
16 | MP Services Protocol is hardware-independent. Most of the logic of this protocol\r | |
17 | is architecturally neutral. It abstracts the multi-processor environment and \r | |
18 | status of processors, and provides interfaces to retrieve information, maintain, \r | |
19 | and dispatch.\r | |
20 | \r | |
21 | MP Services Protocol may be consumed by ACPI module. The ACPI module may use this \r | |
22 | protocol to retrieve data that are needed for an MP platform and report them to OS.\r | |
23 | MP Services Protocol may also be used to program and configure processors, such \r | |
24 | as MTRR synchronization for memory space attributes setting in DXE Services.\r | |
25 | MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot \r | |
26 | by taking advantage of the processing capabilities of the APs, for example, using \r | |
27 | APs to help test system memory in parallel with other device initialization.\r | |
28 | Diagnostics applications may also use this protocol for multi-processor.\r | |
29 | \r | |
30 | Copyright (c) 2006 - 2009, Intel Corporation.<BR>\r | |
31 | All rights reserved. This program and the accompanying materials\r | |
32 | are licensed and made available under the terms and conditions of the BSD License\r | |
33 | which accompanies this distribution. The full text of the license may be found at<BR>\r | |
34 | http://opensource.org/licenses/bsd-license.php\r | |
35 | \r | |
36 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
37 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
38 | \r | |
39 | @par Revision Reference:\r | |
40 | This Protocol is defined in the UEFI Platform Initialization Specification 1.2, \r | |
41 | Volume 2:Driver Execution Environment Core Interface.\r | |
42 | \r | |
43 | **/\r | |
44 | \r | |
45 | #ifndef _MP_SERVICE_PROTOCOL_H_\r | |
46 | #define _MP_SERVICE_PROTOCOL_H_\r | |
47 | \r | |
48 | ///\r | |
49 | /// Global ID for the EFI_MP_SERVICES_PROTOCOL\r | |
50 | ///\r | |
51 | #define EFI_MP_SERVICES_PROTOCOL_GUID \\r | |
52 | { \\r | |
53 | 0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} \\r | |
54 | }\r | |
55 | \r | |
56 | ///\r | |
57 | /// Forward declaration for the EFI_MP_SERVICES_PROTOCOL\r | |
58 | ///\r | |
59 | typedef struct _EFI_MP_SERVICES_PROTOCOL EFI_MP_SERVICES_PROTOCOL;\r | |
60 | \r | |
61 | ///\r | |
62 | /// Terminator for a list of failed CPUs returned by StartAllAPs().\r | |
63 | ///\r | |
64 | #define END_OF_CPU_LIST 0xffffffff\r | |
65 | \r | |
66 | ///\r | |
67 | /// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and \r | |
68 | /// indicates whether the processor is playing the role of BSP. If the bit is 1,\r | |
69 | /// then the processor is BSP. Otherwise, it is AP.\r | |
70 | ///\r | |
71 | #define PROCESSOR_AS_BSP_BIT 0x00000001\r | |
72 | \r | |
73 | ///\r | |
74 | /// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and \r | |
75 | /// indicates whether the processor is enabled. If the bit is 1, then the \r | |
76 | /// processor is enabled. Otherwise, it is disabled.\r | |
77 | ///\r | |
78 | #define PROCESSOR_ENABLED_BIT 0x00000002\r | |
79 | \r | |
80 | ///\r | |
81 | /// This bit is used in the StatusFlag field of EFI_PROCESSOR_INFORMATION and \r | |
82 | /// indicates whether the processor is healthy. If the bit is 1, then the \r | |
83 | /// processor is healthy. Otherwise, some fault has been detected for the processor.\r | |
84 | ///\r | |
85 | #define PROCESSOR_HEALTH_STATUS_BIT 0x00000004\r | |
86 | \r | |
87 | ///\r | |
88 | /// Structure that describes the pyhiscal location of a logical CPU.\r | |
89 | ///\r | |
90 | typedef struct {\r | |
91 | ///\r | |
92 | /// Zero-based physical package number that identifies the cartridge of the processor.\r | |
93 | ///\r | |
94 | UINT32 Package;\r | |
95 | ///\r | |
96 | /// Zero-based physical core number within package of the processor.\r | |
97 | ///\r | |
98 | UINT32 Core;\r | |
99 | ///\r | |
100 | /// Zero-based logical thread number within core of the processor.\r | |
101 | ///\r | |
102 | UINT32 Thread;\r | |
103 | } EFI_CPU_PHYSICAL_LOCATION;\r | |
104 | \r | |
105 | ///\r | |
106 | /// Structure that describes information about a logical CPU.\r | |
107 | ///\r | |
108 | typedef struct {\r | |
109 | ///\r | |
110 | /// The unique processor ID determined by system hardware. For IA32 and X64, \r | |
111 | /// the processor ID is the same as the Local APIC ID. Only the lower 8 bits \r | |
112 | /// are used, and higher bits are reserved. For IPF, the lower 16 bits contains\r | |
113 | /// id/eid, and higher bits are reserved.\r | |
114 | ///\r | |
115 | UINT64 ProcessorId; \r | |
116 | ///\r | |
117 | /// Flags indicating if the processor is BSP or AP, if the processor is enabled \r | |
118 | /// or disabled, and if the processor is healthy. Bits 3..31 are reserved and \r | |
119 | /// must be 0. \r | |
120 | /// \r | |
121 | /// <pre>\r | |
122 | /// BSP ENABLED HEALTH Description\r | |
123 | /// === ======= ====== ===================================================\r | |
124 | /// 0 0 0 Unhealthy Disabled AP.\r | |
125 | /// 0 0 1 Healthy Disabled AP.\r | |
126 | /// 0 1 0 Unhealthy Enabled AP.\r | |
127 | /// 0 1 1 Healthy Enabled AP.\r | |
128 | /// 1 0 0 Invalid. The BSP can never be in the disabled state.\r | |
129 | /// 1 0 1 Invalid. The BSP can never be in the disabled state.\r | |
130 | /// 1 1 0 Unhealthy Enabled BSP.\r | |
131 | /// 1 1 1 Healthy Enabled BSP\r | |
132 | /// </pre>\r | |
133 | ///\r | |
134 | UINT32 StatusFlag;\r | |
135 | ///\r | |
136 | /// The physical location of the processor, including the physical package number\r | |
137 | /// that identifies the cartridge, the physical core number within package, and \r | |
138 | /// logical threadnumber within core.\r | |
139 | ///\r | |
140 | EFI_CPU_PHYSICAL_LOCATION Location;\r | |
141 | } EFI_PROCESSOR_INFORMATION;\r | |
142 | \r | |
143 | /**\r | |
144 | Functions of this type are passed into StartUpAllAPs() and StartThisAP() to\r | |
145 | execute a procedure on enabled APs. The context the AP should use durng \r | |
146 | execution is specified by ProcedureArgument.\r | |
147 | \r | |
148 | @param[in] ProcedureArgument Pointer to the procedure's argument.\r | |
149 | \r | |
150 | **/\r | |
151 | typedef\r | |
152 | VOID\r | |
153 | (EFIAPI *EFI_AP_PROCEDURE)(\r | |
154 | IN VOID *ProcedureArgument\r | |
155 | );\r | |
156 | \r | |
157 | /**\r | |
158 | This service retrieves the number of logical processor in the platform\r | |
159 | and the number of those logical processors that are enabled on this boot.\r | |
160 | This service may only be called from the BSP.\r | |
161 | \r | |
162 | This function is used to retrieve the following information:\r | |
163 | - The number of logical processors that are present in the system\r | |
164 | - The number of enabled logical processors in the system at the instant \r | |
165 | this call is made.\r | |
166 | \r | |
167 | Since MP Service Protocol provides services to enable and disable processors \r | |
168 | dynamically, the number of enabled logical processors may vary during the \r | |
169 | course of a boot session.\r | |
170 | \r | |
171 | If this service is called from an AP, then EFI_DEVICE_ERROR is returned. \r | |
172 | If NumberOfProcessors or NumberOfEnabledProcessors is NULL, then \r | |
173 | EFI_INVALID_PARAMETER is returned. Otherwise, the total number of processors \r | |
174 | is returned in NumberOfProcessors, the number of currently enabled processor \r | |
175 | is returned in NumberOfEnabledProcessors, and EFI_SUCCESS is returned.\r | |
176 | \r | |
177 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r | |
178 | instance.\r | |
179 | @param[out] NumberOfProcessors Pointer to the total number of logical\r | |
180 | processors in the system, including the BSP\r | |
181 | and disabled APs.\r | |
182 | @param[out] NumberOfEnabledProcessors Pointer to the number of enabled logical\r | |
183 | processors that exist in system, including\r | |
184 | the BSP.\r | |
185 | \r | |
186 | @retval EFI_SUCCESS The number of logical processors and enabled \r | |
187 | logical processors was retrieved.\r | |
188 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
189 | @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL\r | |
190 | @retval EFI_INVALID_PARAMETER NumberOfEnabledProcessors is NULL\r | |
191 | \r | |
192 | **/\r | |
193 | typedef\r | |
194 | EFI_STATUS\r | |
195 | (EFIAPI *EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS)(\r | |
196 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
197 | OUT UINTN *NumberOfProcessors,\r | |
198 | OUT UINTN *NumberOfEnabledProcessors\r | |
199 | );\r | |
200 | \r | |
201 | /**\r | |
202 | Gets detailed MP-related information on the requested processor at the\r | |
203 | instant this call is made. This service may only be called from the BSP.\r | |
204 | \r | |
205 | This service retrieves detailed MP-related information about any processor \r | |
206 | on the platform. Note the following:\r | |
207 | - The processor information may change during the course of a boot session.\r | |
208 | - The information presented here is entirely MP related.\r | |
209 | \r | |
210 | Information regarding the number of caches and their sizes, frequency of operation,\r | |
211 | slot numbers is all considered platform-related information and is not provided \r | |
212 | by this service.\r | |
213 | \r | |
214 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r | |
215 | instance.\r | |
216 | @param[in] ProcessorNumber The handle number of processor.\r | |
217 | @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r | |
218 | the requested processor is deposited.\r | |
219 | \r | |
220 | @retval EFI_SUCCESS Processor information was returned.\r | |
221 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
222 | @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r | |
223 | @retval EFI_NOT_FOUND The processor with the handle specified by\r | |
224 | ProcessorNumber does not exist in the platform.\r | |
225 | \r | |
226 | **/\r | |
227 | typedef\r | |
228 | EFI_STATUS\r | |
229 | (EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_INFO)(\r | |
230 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
231 | IN UINTN ProcessorNumber,\r | |
b635c768 | 232 | OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r |
82336c28 | 233 | );\r |
234 | \r | |
235 | /**\r | |
236 | This service executes a caller provided function on all enabled APs. APs can \r | |
237 | run either simultaneously or one at a time in sequence. This service supports \r | |
238 | both blocking and non-blocking requests. The non-blocking requests use EFI \r | |
239 | events so the BSP can detect when the APs have finished. This service may only \r | |
240 | be called from the BSP.\r | |
241 | \r | |
242 | This function is used to dispatch all the enabled APs to the function specified \r | |
243 | by Procedure. If any enabled AP is busy, then EFI_NOT_READY is returned \r | |
244 | immediately and Procedure is not started on any AP.\r | |
245 | \r | |
246 | If SingleThread is TRUE, all the enabled APs execute the function specified by \r | |
247 | Procedure one by one, in ascending order of processor handle number. Otherwise, \r | |
248 | all the enabled APs execute the function specified by Procedure simultaneously.\r | |
249 | \r | |
250 | If WaitEvent is NULL, execution is in blocking mode. The BSP waits until all \r | |
251 | APs finish or TimeoutInMicroSecs expires. Otherwise, execution is in non-blocking \r | |
252 | mode, and the BSP returns from this service without waiting for APs. If a \r | |
253 | non-blocking mode is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT \r | |
254 | is signaled, then EFI_UNSUPPORTED must be returned.\r | |
255 | \r | |
256 | If the timeout specified by TimeoutInMicroseconds expires before all APs return \r | |
257 | from Procedure, then Procedure on the failed APs is terminated. All enabled APs \r | |
258 | are always available for further calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r | |
259 | and EFI_MP_SERVICES_PROTOCOL.StartupThisAP(). If FailedCpuList is not NULL, its \r | |
260 | content points to the list of processor handle numbers in which Procedure was \r | |
261 | terminated.\r | |
262 | \r | |
263 | Note: It is the responsibility of the consumer of the EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() \r | |
264 | to make sure that the nature of the code that is executed on the BSP and the \r | |
265 | dispatched APs is well controlled. The MP Services Protocol does not guarantee \r | |
266 | that the Procedure function is MP-safe. Hence, the tasks that can be run in \r | |
267 | parallel are limited to certain independent tasks and well-controlled exclusive \r | |
268 | code. EFI services and protocols may not be called by APs unless otherwise \r | |
269 | specified.\r | |
270 | \r | |
271 | In blocking execution mode, BSP waits until all APs finish or \r | |
272 | TimeoutInMicroSeconds expires.\r | |
273 | \r | |
274 | In non-blocking execution mode, BSP is freed to return to the caller and then \r | |
275 | proceed to the next task without having to wait for APs. The following \r | |
276 | sequence needs to occur in a non-blocking execution mode:\r | |
277 | \r | |
278 | -# The caller that intends to use this MP Services Protocol in non-blocking \r | |
279 | mode creates WaitEvent by calling the EFI CreateEvent() service. The caller \r | |
280 | invokes EFI_MP_SERVICES_PROTOCOL.StartupAllAPs(). If the parameter WaitEvent \r | |
281 | is not NULL, then StartupAllAPs() executes in non-blocking mode. It requests \r | |
282 | the function specified by Procedure to be started on all the enabled APs, \r | |
283 | and releases the BSP to continue with other tasks.\r | |
284 | -# The caller can use the CheckEvent() and WaitForEvent() services to check \r | |
285 | the state of the WaitEvent created in step 1.\r | |
286 | -# When the APs complete their task or TimeoutInMicroSecondss expires, the MP \r | |
287 | Service signals WaitEvent by calling the EFI SignalEvent() function. If \r | |
288 | FailedCpuList is not NULL, its content is available when WaitEvent is \r | |
289 | signaled. If all APs returned from Procedure prior to the timeout, then \r | |
290 | FailedCpuList is set to NULL. If not all APs return from Procedure before \r | |
291 | the timeout, then FailedCpuList is filled in with the list of the failed \r | |
292 | APs. The buffer is allocated by MP Service Protocol using AllocatePool(). \r | |
e8b9799c | 293 | It is the caller's responsibility to free the buffer with FreePool() service.\r |
82336c28 | 294 | -# This invocation of SignalEvent() function informs the caller that invoked\r |
295 | EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() that either all the APs completed\r | |
296 | the specified task or a timeout occurred. The contents of FailedCpuList \r | |
297 | can be examined to determine which APs did not complete the specified task \r | |
298 | prior to the timeout.\r | |
299 | \r | |
300 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r | |
301 | instance.\r | |
302 | @param[in] Procedure A pointer to the function to be run on \r | |
303 | enabled APs of the system. See type\r | |
304 | EFI_AP_PROCEDURE.\r | |
305 | @param[in] SingleThread If TRUE, then all the enabled APs execute \r | |
306 | the function specified by Procedure one by \r | |
307 | one, in ascending order of processor handle \r | |
308 | number. If FALSE, then all the enabled APs \r | |
309 | execute the function specified by Procedure\r | |
310 | simultaneously.\r | |
311 | @param[in] WaitEvent The event created by the caller with CreateEvent()\r | |
312 | service. If it is NULL, then execute in \r | |
313 | blocking mode. BSP waits until all APs finish \r | |
314 | or TimeoutInMicroSeconds expires. If it's \r | |
315 | not NULL, then execute in non-blocking mode. \r | |
316 | BSP requests the function specified by \r | |
317 | Procedure to be started on all the enabled \r | |
318 | APs, and go on executing immediately. If \r | |
319 | all return from Procedure or TimeoutInMicroSeconds\r | |
320 | expires, this event is signaled. The BSP \r | |
321 | can use the CheckEvent() or WaitForEvent() \r | |
322 | services to check the state of event. Type \r | |
323 | EFI_EVENT is defined in CreateEvent() in \r | |
324 | the Unified Extensible Firmware Interface \r | |
325 | Specification. \r | |
326 | @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for \r | |
327 | APs to return from Procedure, either for \r | |
328 | blocking or non-blocking mode. Zero means \r | |
329 | infinity. If the timeout expires before \r | |
330 | all APs return from Procedure, then Procedure\r | |
331 | on the failed APs is terminated. All enabled \r | |
332 | APs are available for next function assigned \r | |
333 | by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() \r | |
334 | or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r | |
335 | If the timeout expires in blocking mode, \r | |
336 | BSP returns EFI_TIMEOUT. If the timeout \r | |
337 | expires in non-blocking mode, WaitEvent \r | |
338 | is signaled with SignalEvent().\r | |
339 | @param[in] ProcedureArgument The parameter passed into Procedure for \r | |
340 | all APs.\r | |
341 | @param[out] FailedCpuList If NULL, this parameter is ignored. Otherwise, \r | |
342 | if all APs finish successfully, then its \r | |
343 | content is set to NULL. If not all APs \r | |
344 | finish before timeout expires, then its \r | |
345 | content is set to address of the buffer \r | |
346 | holding handle numbers of the failed APs. \r | |
347 | The buffer is allocated by MP Service Protocol, \r | |
348 | and it's the caller's responsibility to \r | |
349 | free the buffer with FreePool() service.\r | |
350 | In blocking mode, it is ready for consumption \r | |
351 | when the call returns. In non-blocking mode, \r | |
352 | it is ready when WaitEvent is signaled. The \r | |
353 | list of failed CPU is terminated by \r | |
354 | END_OF_CPU_LIST.\r | |
355 | \r | |
356 | @retval EFI_SUCCESS In blocking mode, all APs have finished before \r | |
357 | the timeout expired.\r | |
358 | @retval EFI_SUCCESS In non-blocking mode, function has been dispatched \r | |
359 | to all enabled APs.\r | |
360 | @retval EFI_UNSUPPORTED A non-blocking mode request was made after the \r | |
361 | UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was \r | |
362 | signaled.\r | |
363 | @retval EFI_DEVICE_ERROR Caller processor is AP.\r | |
364 | @retval EFI_NOT_STARTED No enabled APs exist in the system.\r | |
365 | @retval EFI_NOT_READY Any enabled APs are busy.\r | |
366 | @retval EFI_TIMEOUT In blocking mode, the timeout expired before \r | |
367 | all enabled APs have finished.\r | |
368 | @retval EFI_INVALID_PARAMETER Procedure is NULL.\r | |
369 | \r | |
370 | **/\r | |
371 | typedef\r | |
372 | EFI_STATUS\r | |
373 | (EFIAPI *EFI_MP_SERVICES_STARTUP_ALL_APS)(\r | |
374 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
375 | IN EFI_AP_PROCEDURE Procedure,\r | |
376 | IN BOOLEAN SingleThread,\r | |
377 | IN EFI_EVENT WaitEvent OPTIONAL,\r | |
378 | IN UINTN TimeoutInMicroSeconds,\r | |
379 | IN VOID *ProcedureArgument OPTIONAL,\r | |
380 | OUT UINTN **FailedCpuList OPTIONAL\r | |
381 | );\r | |
382 | \r | |
383 | /**\r | |
384 | This service lets the caller get one enabled AP to execute a caller-provided \r | |
385 | function. The caller can request the BSP to either wait for the completion \r | |
386 | of the AP or just proceed with the next task by using the EFI event mechanism. \r | |
387 | See EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() for more details on non-blocking \r | |
388 | execution support. This service may only be called from the BSP.\r | |
389 | \r | |
390 | This function is used to dispatch one enabled AP to the function specified by \r | |
391 | Procedure passing in the argument specified by ProcedureArgument. If WaitEvent \r | |
392 | is NULL, execution is in blocking mode. The BSP waits until the AP finishes or \r | |
393 | TimeoutInMicroSecondss expires. Otherwise, execution is in non-blocking mode. \r | |
394 | BSP proceeds to the next task without waiting for the AP. If a non-blocking mode \r | |
395 | is requested after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, \r | |
396 | then EFI_UNSUPPORTED must be returned.\r | |
397 | \r | |
398 | If the timeout specified by TimeoutInMicroseconds expires before the AP returns \r | |
399 | from Procedure, then execution of Procedure by the AP is terminated. The AP is \r | |
400 | available for subsequent calls to EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() and \r | |
401 | EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r | |
402 | \r | |
403 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL\r | |
404 | instance.\r | |
405 | @param[in] Procedure A pointer to the function to be run on \r | |
406 | enabled APs of the system. See type\r | |
407 | EFI_AP_PROCEDURE.\r | |
408 | @param[in] ProcessorNumber The handle number of the AP. The range is \r | |
409 | from 0 to the total number of logical\r | |
410 | processors minus 1. The total number of \r | |
411 | logical processors can be retrieved by\r | |
412 | EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r | |
413 | @param[in] WaitEvent The event created by the caller with CreateEvent()\r | |
414 | service. If it is NULL, then execute in \r | |
415 | blocking mode. BSP waits until all APs finish \r | |
416 | or TimeoutInMicroSeconds expires. If it's \r | |
417 | not NULL, then execute in non-blocking mode. \r | |
418 | BSP requests the function specified by \r | |
419 | Procedure to be started on all the enabled \r | |
420 | APs, and go on executing immediately. If \r | |
421 | all return from Procedure or TimeoutInMicroSeconds\r | |
422 | expires, this event is signaled. The BSP \r | |
423 | can use the CheckEvent() or WaitForEvent() \r | |
424 | services to check the state of event. Type \r | |
425 | EFI_EVENT is defined in CreateEvent() in \r | |
426 | the Unified Extensible Firmware Interface \r | |
427 | Specification. \r | |
428 | @param[in] TimeoutInMicrosecsond Indicates the time limit in microseconds for \r | |
429 | APs to return from Procedure, either for \r | |
430 | blocking or non-blocking mode. Zero means \r | |
431 | infinity. If the timeout expires before \r | |
432 | all APs return from Procedure, then Procedure\r | |
433 | on the failed APs is terminated. All enabled \r | |
434 | APs are available for next function assigned \r | |
435 | by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs() \r | |
436 | or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r | |
437 | If the timeout expires in blocking mode, \r | |
438 | BSP returns EFI_TIMEOUT. If the timeout \r | |
439 | expires in non-blocking mode, WaitEvent \r | |
440 | is signaled with SignalEvent().\r | |
441 | @param[in] ProcedureArgument The parameter passed into Procedure for \r | |
442 | all APs.\r | |
443 | @param[out] Finished If NULL, this parameter is ignored. In \r | |
444 | blocking mode, this parameter is ignored.\r | |
445 | In non-blocking mode, if AP returns from \r | |
446 | Procedure before the timeout expires, its\r | |
447 | content is set to TRUE. Otherwise, the \r | |
448 | value is set to FALSE. The caller can\r | |
449 | determine if the AP returned from Procedure \r | |
450 | by evaluating this value.\r | |
451 | \r | |
452 | @retval EFI_SUCCESS In blocking mode, specified AP finished before \r | |
453 | the timeout expires.\r | |
454 | @retval EFI_SUCCESS In non-blocking mode, the function has been \r | |
455 | dispatched to specified AP.\r | |
456 | @retval EFI_UNSUPPORTED A non-blocking mode request was made after the \r | |
457 | UEFI event EFI_EVENT_GROUP_READY_TO_BOOT was \r | |
458 | signaled.\r | |
459 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
460 | @retval EFI_TIMEOUT In blocking mode, the timeout expired before \r | |
461 | the specified AP has finished.\r | |
462 | @retval EFI_NOT_READY The specified AP is busy.\r | |
463 | @retval EFI_NOT_FOUND The processor with the handle specified by \r | |
464 | ProcessorNumber does not exist.\r | |
465 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r | |
466 | @retval EFI_INVALID_PARAMETER Procedure is NULL.\r | |
467 | \r | |
468 | **/\r | |
469 | typedef\r | |
470 | EFI_STATUS\r | |
471 | (EFIAPI *EFI_MP_SERVICES_STARTUP_THIS_AP)(\r | |
472 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
473 | IN EFI_AP_PROCEDURE Procedure,\r | |
474 | IN UINTN ProcessorNumber,\r | |
475 | IN EFI_EVENT WaitEvent OPTIONAL,\r | |
476 | IN UINTN TimeoutInMicroseconds,\r | |
477 | IN VOID *ProcedureArgument OPTIONAL,\r | |
478 | OUT BOOLEAN *Finished OPTIONAL\r | |
479 | );\r | |
480 | \r | |
481 | /**\r | |
482 | This service switches the requested AP to be the BSP from that point onward. \r | |
483 | This service changes the BSP for all purposes. This call can only be performed \r | |
484 | by the current BSP.\r | |
485 | \r | |
486 | This service switches the requested AP to be the BSP from that point onward. \r | |
487 | This service changes the BSP for all purposes. The new BSP can take over the \r | |
488 | execution of the old BSP and continue seamlessly from where the old one left \r | |
489 | off. This service may not be supported after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT \r | |
490 | is signaled.\r | |
491 | \r | |
492 | If the BSP cannot be switched prior to the return from this service, then \r | |
493 | EFI_UNSUPPORTED must be returned.\r | |
494 | \r | |
495 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r | |
496 | @param[in] ProcessorNumber The handle number of AP that is to become the new \r | |
497 | BSP. The range is from 0 to the total number of \r | |
498 | logical processors minus 1. The total number of \r | |
499 | logical processors can be retrieved by\r | |
500 | EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r | |
501 | @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an \r | |
502 | enabled AP. Otherwise, it will be disabled.\r | |
503 | \r | |
504 | @retval EFI_SUCCESS BSP successfully switched.\r | |
505 | @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to \r | |
506 | this service returning.\r | |
507 | @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r | |
508 | @retval EFI_SUCCESS The calling processor is an AP.\r | |
509 | @retval EFI_NOT_FOUND The processor with the handle specified by\r | |
510 | ProcessorNumber does not exist.\r | |
511 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or \r | |
512 | a disabled AP.\r | |
513 | @retval EFI_NOT_READY The specified AP is busy.\r | |
514 | \r | |
515 | **/\r | |
516 | typedef\r | |
517 | EFI_STATUS\r | |
518 | (EFIAPI *EFI_MP_SERVICES_SWITCH_BSP)(\r | |
519 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
520 | IN UINTN ProcessorNumber,\r | |
521 | IN BOOLEAN EnableOldBSP\r | |
522 | );\r | |
523 | \r | |
524 | /**\r | |
525 | This service lets the caller enable or disable an AP from this point onward. \r | |
526 | This service may only be called from the BSP.\r | |
527 | \r | |
528 | This service allows the caller enable or disable an AP from this point onward. \r | |
529 | The caller can optionally specify the health status of the AP by Health. If \r | |
530 | an AP is being disabled, then the state of the disabled AP is implementation \r | |
531 | dependent. If an AP is enabled, then the implementation must guarantee that a \r | |
532 | complete initialization sequence is performed on the AP, so the AP is in a state \r | |
533 | that is compatible with an MP operating system. This service may not be supported \r | |
534 | after the UEFI Event EFI_EVENT_GROUP_READY_TO_BOOT is signaled.\r | |
535 | \r | |
536 | If the enable or disable AP operation cannot be completed prior to the return \r | |
537 | from this service, then EFI_UNSUPPORTED must be returned.\r | |
538 | \r | |
539 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r | |
540 | @param[in] ProcessorNumber The handle number of AP that is to become the new \r | |
541 | BSP. The range is from 0 to the total number of \r | |
542 | logical processors minus 1. The total number of \r | |
543 | logical processors can be retrieved by\r | |
544 | EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r | |
545 | @param[in] EnableAP Specifies the new state for the processor for \r | |
546 | enabled, FALSE for disabled.\r | |
547 | @param[in] HealthFlag If not NULL, a pointer to a value that specifies \r | |
548 | the new health status of the AP. This flag \r | |
549 | corresponds to StatusFlag defined in \r | |
550 | EFI_MP_SERVICES_PROTOCOL.GetProcessorInfo(). Only \r | |
551 | the PROCESSOR_HEALTH_STATUS_BIT is used. All other \r | |
552 | bits are ignored. If it is NULL, this parameter \r | |
553 | is ignored.\r | |
554 | \r | |
555 | @retval EFI_SUCCESS The specified AP successfully enabled or disabled.\r | |
556 | @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed \r | |
557 | prior to this service returning.\r | |
558 | @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r | |
559 | @retval EFI_DEVICE_ERROR The calling processor is an AP.\r | |
560 | @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r | |
561 | does not exist.\r | |
562 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r | |
563 | \r | |
564 | **/\r | |
565 | typedef\r | |
566 | EFI_STATUS\r | |
567 | (EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)(\r | |
568 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
569 | IN UINTN ProcessorNumber,\r | |
b635c768 | 570 | IN BOOLEAN EnableAP,\r |
82336c28 | 571 | IN UINT32 *HealthFlag OPTIONAL\r |
572 | );\r | |
573 | \r | |
574 | /**\r | |
575 | This return the handle number for the calling processor. This service may be \r | |
576 | called from the BSP and APs.\r | |
577 | \r | |
578 | This service returns the processor handle number for the calling processor. \r | |
579 | The returned value is in the range from 0 to the total number of logical \r | |
580 | processors minus 1. The total number of logical processors can be retrieved \r | |
581 | with EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors(). This service may be \r | |
582 | called from the BSP and APs. If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER \r | |
583 | is returned. Otherwise, the current processors handle number is returned in \r | |
584 | ProcessorNumber, and EFI_SUCCESS is returned.\r | |
585 | \r | |
586 | @param[in] This A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r | |
587 | @param[in] ProcessorNumber The handle number of AP that is to become the new \r | |
588 | BSP. The range is from 0 to the total number of \r | |
589 | logical processors minus 1. The total number of \r | |
590 | logical processors can be retrieved by\r | |
591 | EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r | |
592 | \r | |
593 | @retval EFI_SUCCESS The current processor handle number was returned \r | |
594 | in ProcessorNumber.\r | |
595 | @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL\r | |
596 | \r | |
597 | **/\r | |
598 | typedef\r | |
599 | EFI_STATUS\r | |
600 | (EFIAPI *EFI_MP_SERVICES_WHOAMI)(\r | |
601 | IN EFI_MP_SERVICES_PROTOCOL *This,\r | |
602 | OUT UINTN *ProcessorNumber\r | |
603 | );\r | |
604 | \r | |
605 | ///\r | |
606 | /// When installed, the MP Services Protocol produces a collection of services \r | |
607 | /// that are needed for MP management.\r | |
608 | ///\r | |
609 | /// Before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the module \r | |
610 | /// that produces this protocol is required to place all APs into an idle state \r | |
611 | /// whenever the APs are disabled or the APs are not executing code as requested \r | |
612 | /// through the StartupAllAPs() or StartupThisAP() services. The idle state of \r | |
613 | /// an AP before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled is \r | |
614 | /// implementation dependent.\r | |
615 | ///\r | |
616 | /// After the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, all the APs \r | |
617 | /// must be placed in the OS compatible CPU state as defined by the UEFI \r | |
618 | /// Specification. Implementations of this protocol may use the UEFI event \r | |
619 | /// EFI_EVENT_GROUP_READY_TO_BOOT to force APs into the OS compatible state as \r | |
620 | /// defined by the UEFI Specification. Modules that use this protocol must \r | |
621 | /// guarantee that all non-blocking mode requests on all APs have been completed \r | |
622 | /// before the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled. Since the \r | |
623 | /// order that event notification functions in the same event group are executed \r | |
624 | /// is not deterministic, an event of type EFI_EVENT_GROUP_READY_TO_BOOT can not \r | |
625 | /// be used to guarantee that APs have completed their non-blocking mode requests.\r | |
626 | ///\r | |
627 | /// When the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, the StartAllAPs() \r | |
628 | /// and StartupThisAp() services must no longer support non-blocking mode requests. \r | |
629 | /// The support for SwitchBSP() and EnableDisableAP() may no longer be supported \r | |
630 | /// after this event is signaled. Since UEFI Applications and UEFI OS Loaders \r | |
631 | /// execute after the UEFI event EFI_EVENT_GROUP_READY_TO_BOOT is signaled, these \r | |
632 | /// UEFI images must be aware that the functionality of this protocol may be reduced.\r | |
633 | /// \r | |
634 | struct _EFI_MP_SERVICES_PROTOCOL {\r | |
635 | EFI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;\r | |
636 | EFI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;\r | |
637 | EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;\r | |
638 | EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;\r | |
639 | EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;\r | |
640 | EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r | |
641 | EFI_MP_SERVICES_WHOAMI WhoAmI;\r | |
642 | };\r | |
643 | \r | |
644 | extern EFI_GUID gEfiMpServiceProtocolGuid;\r | |
645 | \r | |
646 | #endif\r |