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