]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkPkg/Include/Protocol/FrameworkMpService.h
Remove IntelFrameworkModulePkg
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / FrameworkMpService.h
CommitLineData
b6d47a83 1/** @file\r
1c2f052d
LG
2 When installed, the Framework MP Services Protocol produces a collection of\r
3 services that are needed for MP management, such as initialization and management\r
4 of application processors.\r
5\r
6 @par Note:\r
7 This protocol has been deprecated and has been replaced by the MP Services\r
b6d47a83 8 Protocol from the UEFI Platform Initialization Specification 1.2, Volume 2:\r
9 Driver Execution Environment Core Interface.\r
10\r
11 The MP Services Protocol provides a generalized way of performing following tasks:\r
12 - Retrieving information of multi-processor environment and MP-related status of\r
13 specific processors.\r
14 - Dispatching user-provided function to APs.\r
15 - Maintain MP-related processor status.\r
16\r
17 The MP Services Protocol must be produced on any system with more than one logical\r
18 processor.\r
19\r
20 The Protocol is available only during boot time.\r
21\r
22 MP Services Protocol is hardware-independent. Most of the logic of this protocol\r
1c2f052d
LG
23 is architecturally neutral. It abstracts the multi-processor environment and\r
24 status of processors, and provides interfaces to retrieve information, maintain,\r
b6d47a83 25 and dispatch.\r
26\r
1c2f052d 27 MP Services Protocol may be consumed by ACPI module. The ACPI module may use this\r
b6d47a83 28 protocol to retrieve data that are needed for an MP platform and report them to OS.\r
1c2f052d 29 MP Services Protocol may also be used to program and configure processors, such\r
b6d47a83 30 as MTRR synchronization for memory space attributes setting in DXE Services.\r
1c2f052d
LG
31 MP Services Protocol may be used by non-CPU DXE drivers to speed up platform boot\r
32 by taking advantage of the processing capabilities of the APs, for example, using\r
b6d47a83 33 APs to help test system memory in parallel with other device initialization.\r
34 Diagnostics applications may also use this protocol for multi-processor.\r
35\r
1c2f052d 36Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r
22a69a5e 37SPDX-License-Identifier: BSD-2-Clause-Patent\r
b6d47a83 38\r
ce9b1e3a 39**/\r
b6d47a83 40\r
41#ifndef _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r
42#define _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r
43\r
2aa76eac 44#include <FrameworkDxe.h>\r
45\r
b6d47a83 46///\r
f22f941e 47/// Global ID for the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL.\r
b6d47a83 48///\r
49#define FRAMEWORK_EFI_MP_SERVICES_PROTOCOL_GUID \\r
50 { \\r
51 0xf33261e7, 0x23cb, 0x11d5, {0xbd, 0x5c, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} \\r
52 }\r
53\r
54///\r
f22f941e 55/// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.\r
b6d47a83 56///\r
57typedef struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL FRAMEWORK_EFI_MP_SERVICES_PROTOCOL;\r
58\r
59///\r
f22f941e 60/// Fixed delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 61///\r
62#define DELIVERY_MODE_FIXED 0x0\r
63\r
64///\r
1c2f052d 65/// Lowest priority delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 66///\r
67#define DELIVERY_MODE_LOWEST_PRIORITY 0x1\r
68\r
69///\r
1c2f052d 70/// SMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 71///\r
72#define DELIVERY_MODE_SMI 0x2\r
73\r
74///\r
1c2f052d 75/// Remote read delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 76///\r
77#define DELIVERY_MODE_REMOTE_READ 0x3\r
78\r
79///\r
1c2f052d 80/// NMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 81///\r
82#define DELIVERY_MODE_NMI 0x4\r
83\r
84///\r
1c2f052d 85/// INIT delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 86///\r
87#define DELIVERY_MODE_INIT 0x5\r
88\r
89///\r
f22f941e 90/// Startup IPI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r
b6d47a83 91///\r
92#define DELIVERY_MODE_SIPI 0x6\r
93\r
94///\r
f22f941e 95/// The DeliveryMode parameter in SendIpi() must be less than this maximum value.\r
b6d47a83 96///\r
97#define DELIVERY_MODE_MAX 0x7\r
98\r
99///\r
f22f941e 100/// IPF specific value for the state field of the Self Test State Parameter.\r
b6d47a83 101///\r
102#define EFI_MP_HEALTH_FLAGS_STATUS_HEALTHY 0x0\r
103\r
104///\r
f22f941e 105/// IPF specific value for the state field of the Self Test State Parameter.\r
b6d47a83 106///\r
107#define EFI_MP_HEALTH_FLAGS_STATUS_PERFORMANCE_RESTRICTED 0x1\r
108\r
109///\r
f22f941e 110/// IPF specific value for the state field of the Self Test State Parameter.\r
b6d47a83 111///\r
112#define EFI_MP_HEALTH_FLAGS_STATUS_FUNCTIONALLY_RESTRICTED 0x2\r
113\r
114typedef union {\r
115 ///\r
1c2f052d 116 /// Bitfield structure for the IPF Self Test State Parameter.\r
b6d47a83 117 ///\r
118 struct {\r
119 UINT32 Status:2;\r
120 UINT32 Tested:1;\r
121 UINT32 Reserved1:13;\r
122 UINT32 VirtualMemoryUnavailable:1;\r
123 UINT32 Ia32ExecutionUnavailable:1;\r
124 UINT32 FloatingPointUnavailable:1;\r
125 UINT32 MiscFeaturesUnavailable:1;\r
126 UINT32 Reserved2:12;\r
127 } Bits;\r
128 ///\r
f22f941e 129 /// IA32 and X64 BIST data of the processor.\r
b6d47a83 130 ///\r
131 UINT32 Uint32;\r
132} EFI_MP_HEALTH_FLAGS;\r
133\r
134typedef struct {\r
135 ///\r
136 /// @par IA32, X64:\r
f22f941e 137 /// BIST (built-in self-test) data of the processor.\r
b6d47a83 138 ///\r
139 /// @par IPF:\r
1c2f052d
LG
140 /// Lower 32 bits of the self-test state parameter. For definition of self-test\r
141 /// state parameter, please refer to Intel(R) Itanium(R) Architecture Software\r
1910fbaf 142 /// Developer's Manual, Volume 2: System Architecture.\r
b6d47a83 143 ///\r
144 EFI_MP_HEALTH_FLAGS Flags;\r
145 ///\r
146 /// @par IA32, X64:\r
147 /// Not used.\r
148 ///\r
149 /// @par IPF:\r
150 /// Higher 32 bits of self test state parameter.\r
151 ///\r
152 UINT32 TestStatus;\r
153} EFI_MP_HEALTH;\r
154\r
155typedef enum {\r
f22f941e 156 EfiCpuAP = 0, ///< The CPU is an AP (Application Processor).\r
157 EfiCpuBSP, ///< The CPU is the BSP (Boot-Strap Processor).\r
b6d47a83 158 EfiCpuDesignationMaximum\r
159} EFI_CPU_DESIGNATION;\r
160\r
161typedef struct {\r
162 ///\r
163 /// @par IA32, X64:\r
164 /// The lower 8 bits contains local APIC ID, and higher bits are reserved.\r
165 ///\r
166 /// @par IPF:\r
1c2f052d 167 /// The lower 16 bits contains id/eid as physical address of local SAPIC\r
b6d47a83 168 /// unit, and higher bits are reserved.\r
169 ///\r
170 UINT32 ApicID;\r
171 ///\r
1c2f052d 172 /// This field indicates whether the processor is enabled. If the value is\r
b6d47a83 173 /// TRUE, then the processor is enabled. Otherwise, it is disabled.\r
174 ///\r
175 BOOLEAN Enabled;\r
176 ///\r
177 /// This field indicates whether the processor is playing the role of BSP.\r
1c2f052d 178 /// If the value is EfiCpuAP, then the processor is AP. If the value is\r
b6d47a83 179 /// EfiCpuBSP, then the processor is BSP.\r
180 ///\r
181 EFI_CPU_DESIGNATION Designation;\r
182 ///\r
183 /// @par IA32, X64:\r
1c2f052d
LG
184 /// The Flags field of this EFI_MP_HEALTH data structure holds BIST (built-in\r
185 /// self test) data of the processor. The TestStatus field is not used, and\r
b6d47a83 186 /// the value is always zero.\r
187 ///\r
188 /// @par IPF:\r
1c2f052d
LG
189 /// Bit format of this field is the same as the definition of self-test state\r
190 /// parameter, in Intel(R) Itanium(R) Architecture Software Developer's Manual,\r
b6d47a83 191 /// Volume 2: System Architecture.\r
192 ///\r
193 EFI_MP_HEALTH Health;\r
194 ///\r
1c2f052d 195 /// Zero-based physical package number that identifies the cartridge of the\r
b6d47a83 196 /// processor.\r
197 ///\r
198 UINTN PackageNumber;\r
199 ///\r
200 /// Zero-based physical core number within package of the processor.\r
201 ///\r
202 UINTN NumberOfCores;\r
203 ///\r
204 /// Zero-based logical thread number within core of the processor.\r
205 ///\r
206 UINTN NumberOfThreads;\r
207 ///\r
208 /// This field is reserved.\r
209 ///\r
210 UINT64 ProcessorPALCompatibilityFlags;\r
211 ///\r
212 /// @par IA32, X64:\r
213 /// This field is not used, and the value is always zero.\r
214 ///\r
215 /// @par IPF:\r
1c2f052d 216 /// This field is a mask number that is handed off by the PAL about which\r
b6d47a83 217 /// processor tests are performed and which are masked.\r
218 ///\r
219 UINT64 ProcessorTestMask;\r
220} EFI_MP_PROC_CONTEXT;\r
221\r
222/**\r
223 This service retrieves general information of multiprocessors in the system.\r
224\r
225 This function is used to get the following information:\r
226 - Number of logical processors in system\r
227 - Maximal number of logical processors supported by system\r
228 - Number of enabled logical processors.\r
229 - Rendezvous interrupt number (IPF-specific)\r
230 - Length of the rendezvous procedure.\r
231\r
f22f941e 232 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 233 instance.\r
1c2f052d
LG
234 @param[out] NumberOfCPUs The pointer to the total number of logical processors\r
235 in the system, including the BSP and disabled\r
b6d47a83 236 APs. If NULL, this parameter is ignored.\r
1c2f052d
LG
237 @param[out] MaximumNumberOfCPUs Pointer to the maximum number of processors\r
238 supported by the system. If NULL, this\r
b6d47a83 239 parameter is ignored.\r
1c2f052d
LG
240 @param[out] NumberOfEnabledCPUs The pointer to the number of enabled logical\r
241 processors that exist in system, including\r
b6d47a83 242 the BSP. If NULL, this parameter is ignored.\r
243 @param[out] RendezvousIntNumber This parameter is only meaningful for IPF.\r
1c2f052d 244 - IA32, X64: The returned value is zero.\r
b6d47a83 245 If NULL, this parameter is ignored.\r
1c2f052d 246 - IPF: Pointer to the rendezvous interrupt\r
b6d47a83 247 number that is used for AP wake-up.\r
1c2f052d
LG
248 @param[out] RendezvousProcLength The pointer to the length of rendezvous procedure.\r
249 - IA32, X64: The returned value is 0x1000.\r
b6d47a83 250 If NULL, this parameter is ignored.\r
251 - IPF: The returned value is zero.\r
252\r
f22f941e 253 @retval EFI_SUCCESS Multiprocessor general information was successfully retrieved.\r
b6d47a83 254\r
255**/\r
256typedef\r
257EFI_STATUS\r
108854b2 258(EFIAPI *EFI_MP_SERVICES_GET_GENERAL_MP_INFO)(\r
b6d47a83 259 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
260 OUT UINTN *NumberOfCPUs OPTIONAL,\r
261 OUT UINTN *MaximumNumberOfCPUs OPTIONAL,\r
262 OUT UINTN *NumberOfEnabledCPUs OPTIONAL,\r
263 OUT UINTN *RendezvousIntNumber OPTIONAL,\r
264 OUT UINTN *RendezvousProcLength OPTIONAL\r
265 );\r
266\r
267/**\r
268 This service gets detailed MP-related information of the requested processor.\r
269\r
1c2f052d 270 This service gets detailed MP-related information of the requested processor\r
b6d47a83 271 at the instant this call is made. Note the following:\r
1c2f052d
LG
272 - The processor information may change during the course of a boot session.\r
273 - The data of information presented here is entirely MP related.\r
b6d47a83 274 Information regarding the number of caches and their sizes, frequency of operation,\r
1c2f052d
LG
275 slot numbers is all considered platform-related information and will not be\r
276 presented here.\r
b6d47a83 277\r
f22f941e 278 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 279 instance.\r
280 @param[in] ProcessorNumber The handle number of the processor. The range\r
1c2f052d
LG
281 is from 0 to the total number of logical\r
282 processors minus 1. The total number of\r
283 logical processors can be retrieved by\r
b6d47a83 284 GetGeneralMPInfo().\r
1c2f052d
LG
285 @param[in,out] BufferLength On input, pointer to the size in bytes of\r
286 ProcessorContextBuffer. On output, if the\r
287 size of ProcessorContextBuffer is not large\r
288 enough, the value pointed by this parameter\r
289 is updated to size in bytes that is needed.\r
290 If the size of ProcessorContextBuffer is\r
291 sufficient, the value is not changed from\r
b6d47a83 292 input.\r
1c2f052d
LG
293 @param[out] ProcessorContextBuffer The pointer to the buffer where the data of\r
294 requested processor will be deposited.\r
295 The buffer is allocated by caller.\r
b6d47a83 296\r
f22f941e 297 @retval EFI_SUCCESS Processor information was successfully returned.\r
1c2f052d
LG
298 @retval EFI_BUFFER_TOO_SMALL The size of ProcessorContextBuffer is too small.\r
299 The value pointed by BufferLength has been updated\r
b6d47a83 300 to size in bytes that is needed.\r
301 @retval EFI_INVALID_PARAMETER IA32, X64:BufferLength is NULL.\r
302 @retval EFI_INVALID_PARAMETER IA32, X64:ProcessorContextBuffer is NULL.\r
1c2f052d 303 @retval EFI_INVALID_PARAMETER IA32, X64:Processor with the handle specified by\r
f22f941e 304 ProcessorNumber does not exist.\r
1c2f052d 305 @retval EFI_NOT_FOUND IPF: Processor with the handle specified by\r
f22f941e 306 ProcessorNumber does not exist.\r
b6d47a83 307\r
308**/\r
309typedef\r
310EFI_STATUS\r
108854b2 311(EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT)(\r
b6d47a83 312 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
313 IN UINTN ProcessorNumber,\r
314 IN OUT UINTN *BufferLength,\r
315 OUT EFI_MP_PROC_CONTEXT *ProcessorContextBuffer\r
316 );\r
317\r
318/**\r
1c2f052d
LG
319 This function is used to dispatch all enabled APs to the function specified\r
320 by Procedure. APs can run either simultaneously or one by one. The caller can\r
321 also configure the BSP to either wait for APs or just proceed with the next\r
322 task. It is the responsibility of the caller of the StartupAllAPs() to make\r
323 sure that the nature of the code that will be run on the BSP and the dispatched\r
324 APs is well controlled. The MP Services Protocol does not guarantee that the\r
325 function that either processor is executing is MP-safe. Hence, the tasks that\r
b6d47a83 326 can be run in parallel are limited to certain independent tasks and well-\r
1c2f052d 327 controlled exclusive code. EFI services and protocols may not be called by APs\r
b6d47a83 328 unless otherwise specified.\r
329\r
f22f941e 330 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 331 instance.\r
1c2f052d
LG
332 @param[in] Procedure A pointer to the function to be run on enabled\r
333 APs of the system.\r
334 @param[in] SingleThread Flag that requests APs to execute one at a\r
b6d47a83 335 time or simultaneously.\r
336 - IA32, X64:\r
1c2f052d
LG
337 If TRUE, then all the enabled APs execute\r
338 the function specified by Procedure one by\r
339 one, in ascending order of processor handle\r
340 number. If FALSE, then all the enabled APs\r
341 execute the function specified by Procedure\r
b6d47a83 342 simultaneously.\r
343 - IPF:\r
1c2f052d 344 If TRUE, then all the enabled APs execute\r
b6d47a83 345 the function specified by Procedure simultaneously.\r
1c2f052d
LG
346 If FALSE, then all the enabled APs execute the\r
347 function specified by Procedure one by one, in\r
348 ascending order of processor handle number. The\r
349 time interval of AP dispatching is determined\r
b6d47a83 350 by WaitEvent and TimeoutInMicrosecs.\r
351 @param[in] WaitEvent Event to signal when APs have finished.\r
352 - IA32, X64:\r
1c2f052d
LG
353 If not NULL, when all APs finish after timeout\r
354 expires, the event will be signaled. If NULL,\r
b6d47a83 355 the parameter is ignored.\r
356 - IPF:\r
1c2f052d
LG
357 If SingleThread is TRUE, this parameter\r
358 is ignored. If SingleThread is FALSE (i.e.\r
359 dispatch APs one by one), this parameter\r
360 determines whether the BSP waits after each\r
361 AP is dispatched. If it is NULL, the BSP\r
362 does not wait after each AP is dispatched.\r
363 If it is not NULL, the BSP waits after each\r
364 AP is dispatched, and the time interval is\r
365 determined by TimeoutInMicrosecs. Type\r
366 EFI_EVENT is defined in CreateEvent() in\r
367 the Unified Extensible Firmware Interface\r
b6d47a83 368 Specification.\r
369 @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r
370 - IA32, X64:\r
1c2f052d
LG
371 If the value is zero, it means no timeout\r
372 limit. The BSP waits until all APs finish.\r
373 If the value is not zero, the BSP waits\r
374 until all APs finish or timeout expires.\r
b6d47a83 375 If timeout expires, EFI_TIMEOUT is returned,\r
1c2f052d
LG
376 and the BSP will then check APs?status\r
377 periodically, with time interval of 16\r
b6d47a83 378 microseconds.\r
379 - IPF:\r
1c2f052d
LG
380 If SingleThread is TRUE and FailedCPUList\r
381 is NULL, this parameter is ignored. If\r
382 SingleThread is TRUE and FailedCPUList is\r
383 not NULL, this parameter determines whether\r
384 the BSP waits until all APs finish their\r
385 procedure. If it is zero, the BSP does not\r
386 wait for APs. If it is non-zero, it waits\r
387 until all APs finish. If SingleThread is\r
388 FALSE and WaitEvent is NULL, this parameter\r
389 is ignored. If SingleThread is FALSE and\r
390 WaitEvent is not NULL, the BSP waits after\r
391 each AP is dispatched and this value\r
392 determines time interval. If the value is\r
393 zero, the length of time interval is 10ms.\r
394 If the value is non-zero, the BSP waits\r
395 until dispatched AP finishes and then\r
b6d47a83 396 dispatch the next.\r
1c2f052d 397 @param[in] ProcedureArgument The pointer to the optional parameter of the\r
b6d47a83 398 function specified by Procedure.\r
399 @param[out] FailedCPUList List of APs that did not finish.\r
400 - IA32, X64:\r
1c2f052d
LG
401 If not NULL, it records handle numbers of\r
402 all logical processors that fail to accept\r
b6d47a83 403 caller-provided function (busy or disabled).\r
404 If NULL, this parameter is ignored.\r
405 - IPF:\r
1c2f052d
LG
406 If not NULL, it records status of all\r
407 logical processors, with processor handle\r
408 number as index. If a logical processor\r
409 fails to accept caller-provided function\r
410 because it is busy, the status is EFI_NOT_READY.\r
411 If it fails to accept function due to other\r
412 reasons, the status is EFI_NOT_AVAILABLE_YET.\r
b6d47a83 413 If timeout expires, the status is EFI_TIMEOUT.\r
1c2f052d 414 Otherwise, the value is EFI_SUCCESS. If NULL,\r
b6d47a83 415 this parameter is ignored.\r
416\r
1c2f052d 417 @retval EFI_SUCCESS IA32, X64: All dispatched APs have finished\r
b6d47a83 418 before the timeout expires.\r
1c2f052d 419 @retval EFI_SUCCESS IA32, X64: Only 1 logical processor exists\r
b6d47a83 420 in system.\r
1c2f052d
LG
421 @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.\r
422 @retval EFI_TIMEOUT IA32, X64: The timeout expires before all\r
b6d47a83 423 dispatched APs have finished.\r
1c2f052d 424 @retval EFI_SUCCESS IPF: This function always returns EFI_SUCCESS.\r
b6d47a83 425\r
426**/\r
427typedef\r
428EFI_STATUS\r
429(EFIAPI *FRAMEWORK_EFI_MP_SERVICES_STARTUP_ALL_APS)(\r
430 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
431 IN FRAMEWORK_EFI_AP_PROCEDURE Procedure,\r
432 IN BOOLEAN SingleThread,\r
433 IN EFI_EVENT WaitEvent OPTIONAL,\r
1c2f052d 434 IN UINTN TimeoutInMicroSecs,\r
b6d47a83 435 IN VOID *ProcArguments OPTIONAL,\r
436 OUT UINTN *FailedCPUList OPTIONAL\r
437 );\r
438\r
439/**\r
1c2f052d
LG
440 This function is used to dispatch one enabled AP to the function provided by\r
441 the caller. The caller can request the BSP to either wait for the AP or just\r
b6d47a83 442 proceed with the next task.\r
443\r
f22f941e 444 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 445 instance.\r
1c2f052d
LG
446 @param[in] Procedure A pointer to the function to be run on the\r
447 designated AP.\r
448 @param[in] ProcessorNumber The handle number of AP. The range is from\r
449 0 to the total number of logical processors\r
450 minus 1. The total number of logical\r
b6d47a83 451 processors can be retrieved by GetGeneralMPInfo().\r
452 @param[in] WaitEvent Event to signal when APs have finished.\r
453 - IA32, X64:\r
1c2f052d
LG
454 If not NULL, when the AP finishes after timeout\r
455 expires, the event will be signaled. If NULL,\r
b6d47a83 456 the parameter is ignored.\r
457 - IPF:\r
1c2f052d
LG
458 This parameter determines whether the BSP\r
459 waits after the AP is dispatched. If it is\r
460 NULL, the BSP does not wait after the AP\r
461 is dispatched. If it is not NULL, the BSP\r
462 waits after the AP is dispatched, and the\r
b6d47a83 463 time interval is determined by TimeoutInMicrosecs.\r
1c2f052d
LG
464 Type EFI_EVENT is defined in CreateEvent()\r
465 in the Unified Extensible Firmware Interface\r
b6d47a83 466 Specification.\r
467 @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r
468 - IA32, X64:\r
1c2f052d
LG
469 If the value is zero, it means no timeout\r
470 limit. The BSP waits until the AP finishes.\r
471 If the value is not zero, the BSP waits until\r
472 the AP finishes or timeout expires. If timeout\r
473 expires, EFI_TIMEOUT is returned, and the\r
474 BSP will then check the AP's status periodically,\r
b6d47a83 475 with time interval of 16 microseconds.\r
476 - IPF:\r
477 If WaitEvent is NULL, this parameter is ignored.\r
1c2f052d
LG
478 If WaitEvent is not NULL, the BSP waits after\r
479 the AP is dispatched and this value determines\r
480 time interval. If the value is zero, the length\r
481 of time interval is 10ms. If the value is\r
b6d47a83 482 non-zero, the BSP waits until the AP finishes.\r
1c2f052d 483 @param[in] ProcedureArgument The pointer to the optional parameter of the\r
b6d47a83 484 function specified by Procedure.\r
485\r
1c2f052d 486 @retval EFI_SUCCESS Specified AP has finished before the timeout\r
b6d47a83 487 expires.\r
1c2f052d 488 @retval EFI_TIMEOUT The timeout expires before specified AP has\r
b6d47a83 489 finished.\r
1c2f052d 490 @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r
b6d47a83 491 by ProcessorNumber does not exist.\r
492 @retval EFI_INVALID_PARAMETER IA32, X64: Specified AP is busy or disabled.\r
493 @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.\r
494 @retval EFI_INVALID_PARAMETER IA32, X64: ProcessorNumber specifies the BSP\r
495 @retval EFI_NOT_READY IPF: Specified AP is busy\r
496 @retval EFI_NOT_AVAILABLE_YET IPF: ProcessorNumber specifies the BSP\r
497 @retval EFI_NOT_AVAILABLE_YET IPF: Specified AP is disabled.\r
498 @retval EFI_NOT_AVAILABLE_YET IPF: Specified AP is unhealthy or untested.\r
499\r
500**/\r
501typedef\r
502EFI_STATUS\r
503(EFIAPI *FRAMEWORK_EFI_MP_SERVICES_STARTUP_THIS_AP)(\r
504 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
505 IN FRAMEWORK_EFI_AP_PROCEDURE Procedure,\r
506 IN UINTN ProcessorNumber,\r
507 IN EFI_EVENT WaitEvent OPTIONAL,\r
508 IN UINTN TimeoutInMicroSecs,\r
509 IN OUT VOID *ProcArguments OPTIONAL\r
510 );\r
511\r
512/**\r
1c2f052d
LG
513 This service switches the requested AP to be the BSP from that point onward.\r
514 The new BSP can take over the execution of the old BSP and continue seamlessly\r
515 from where the old one left off. This call can only be performed by the\r
b6d47a83 516 current BSP.\r
517\r
f22f941e 518 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 519 instance.\r
1c2f052d
LG
520 @param[in] ProcessorNumber The handle number of AP. The range is from 0 to\r
521 the total number of logical processors minus 1.\r
522 The total number of logical processors can be\r
b6d47a83 523 retrieved by GetGeneralMPInfo().\r
1c2f052d 524 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r
b6d47a83 525 enabled AP. Otherwise, it will be disabled.\r
526\r
527 @retval EFI_SUCCESS BSP successfully switched.\r
1c2f052d 528 @retval EFI_INVALID_PARAMETER The processor with the handle specified by\r
b6d47a83 529 ProcessorNumber does not exist.\r
530 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
531 @retval EFI_NOT_READY IA32, X64: Specified AP is busy or disabled.\r
532 @retval EFI_INVALID_PARAMETER IPF: Specified AP is disabled.\r
533 @retval EFI_INVALID_PARAMETER IPF: Specified AP is unhealthy or untested.\r
534 @retval EFI_NOT_READY IPF: Specified AP is busy.\r
535\r
536**/\r
537typedef\r
538EFI_STATUS\r
539(EFIAPI *FRAMEWORK_EFI_MP_SERVICES_SWITCH_BSP)(\r
540 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
541 IN UINTN ProcessorNumber,\r
542 IN BOOLEAN EnableOldBSP\r
543 );\r
544\r
545/**\r
1c2f052d 546 This service sends an IPI to a specified AP. Caller can specify vector number\r
b6d47a83 547 and delivery mode of the interrupt.\r
548\r
f22f941e 549 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 550 instance.\r
1c2f052d
LG
551 @param[in] ProcessorNumber The handle number of AP. The range is from 0 to\r
552 the total number of logical processors minus 1.\r
553 The total number of logical processors can be\r
b6d47a83 554 retrieved by GetGeneralMPInfo().\r
f22f941e 555 @param[in] VectorNumber The vector number of the interrupt.\r
556 @param[in] DeliveryMode The delivery mode of the interrupt.\r
b6d47a83 557\r
f22f941e 558 @retval EFI_SUCCESS IPI was successfully sent.\r
b6d47a83 559 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
1c2f052d 560 @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r
b6d47a83 561 by ProcessorNumber does not exist.\r
562 @retval EFI_INVALID_PARAMETER IA32, X64: VectorNumber is greater than 255.\r
1c2f052d 563 @retval EFI_INVALID_PARAMETER IA32, X64: DeliveryMode is greater than or equal\r
b6d47a83 564 to DELIVERY_MODE_MAX.\r
1c2f052d 565 @retval EFI_NOT_READY IA32, X64: IPI is not accepted by the target\r
b6d47a83 566 processor within 10 microseconds.\r
567 @retval EFI_INVALID_PARAMETER IPF: Specified AP is disabled.\r
568 @retval EFI_INVALID_PARAMETER IPF: Specified AP is unhealthy or untested.\r
569 @retval EFI_NOT_READY IPF: Specified AP is busy.\r
570\r
571**/\r
572typedef\r
573EFI_STATUS\r
108854b2 574(EFIAPI *EFI_MP_SERVICES_SEND_IPI)(\r
b6d47a83 575 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
576 IN UINTN ProcessorNumber,\r
577 IN UINTN VectorNumber,\r
578 IN UINTN DeliveryMode\r
579 );\r
580\r
581/**\r
1c2f052d
LG
582 This service lets the caller enable or disable an AP. The caller can optionally\r
583 specify the health status of the AP by Health. It is usually used to update the\r
b6d47a83 584 health status of the processor after some processor test.\r
585\r
f22f941e 586 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 587 instance.\r
1c2f052d
LG
588 @param[in] ProcessorNumber The handle number of AP. The range is from 0 to\r
589 the total number of logical processors minus 1.\r
590 The total number of logical processors can be\r
b6d47a83 591 retrieved by GetGeneralMPInfo().\r
1c2f052d
LG
592 @param[in] NewAPState Indicates whether the new, desired state of the\r
593 AP is enabled or disabled. TRUE for enabling,\r
b6d47a83 594 FALSE otherwise.\r
1c2f052d
LG
595 @param[in] HealthState If not NULL, it points to the value that specifies\r
596 the new health status of the AP. If it is NULL,\r
597 this parameter is ignored.\r
b6d47a83 598\r
599 @retval EFI_SUCCESS AP successfully enabled or disabled.\r
600 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
1c2f052d 601 @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r
b6d47a83 602 by ProcessorNumber does not exist.\r
1c2f052d 603 @retval EFI_INVALID_PARAMETER IPF: If an unhealthy or untested AP is to be\r
b6d47a83 604 enabled.\r
605\r
606**/\r
607typedef\r
608EFI_STATUS\r
609(EFIAPI *FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP)(\r
610 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
611 IN UINTN ProcessorNumber,\r
612 IN BOOLEAN NewAPState,\r
613 IN EFI_MP_HEALTH *HealthState OPTIONAL\r
614 );\r
615\r
616/**\r
1c2f052d
LG
617 This service lets the caller processor get its handle number, with which any\r
618 processor in the system can be uniquely identified. The range is from 0 to the\r
619 total number of logical processors minus 1. The total number of logical\r
620 processors can be retrieved by GetGeneralMPInfo(). This service may be called\r
b6d47a83 621 from the BSP and APs.\r
622\r
f22f941e 623 @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r
b6d47a83 624 instance.\r
1c2f052d
LG
625 @param[out] ProcessorNumber A pointer to the handle number of AP. The range is\r
626 from 0 to the total number of logical processors\r
627 minus 1. The total number of logical processors\r
b6d47a83 628 can be retrieved by GetGeneralMPInfo().\r
629\r
630@retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r
631\r
632**/\r
633typedef\r
634EFI_STATUS\r
635(EFIAPI *FRAMEWORK_EFI_MP_SERVICES_WHOAMI)(\r
636 IN FRAMEWORK_EFI_MP_SERVICES_PROTOCOL *This,\r
637 OUT UINTN *ProcessorNumber\r
638 );\r
639\r
640///\r
f22f941e 641/// Framework MP Services Protocol structure.\r
b6d47a83 642///\r
2aa76eac 643struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL {\r
108854b2
LG
644 EFI_MP_SERVICES_GET_GENERAL_MP_INFO GetGeneralMPInfo;\r
645 EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT GetProcessorContext;\r
b6d47a83 646 FRAMEWORK_EFI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;\r
647 FRAMEWORK_EFI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;\r
648 FRAMEWORK_EFI_MP_SERVICES_SWITCH_BSP SwitchBSP;\r
108854b2 649 EFI_MP_SERVICES_SEND_IPI SendIPI;\r
b6d47a83 650 FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r
651 FRAMEWORK_EFI_MP_SERVICES_WHOAMI WhoAmI;\r
652};\r
653\r
654extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;\r
655\r
656#endif\r