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