]>
Commit | Line | Data |
---|---|---|
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 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
37 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
38 | \r | |
39 | **/\r | |
40 | \r | |
41 | #ifndef _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r | |
42 | #define _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r | |
43 | \r | |
44 | #include <FrameworkDxe.h>\r | |
45 | \r | |
46 | ///\r | |
47 | /// Global ID for the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL.\r | |
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 | |
55 | /// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.\r | |
56 | ///\r | |
57 | typedef struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL FRAMEWORK_EFI_MP_SERVICES_PROTOCOL;\r | |
58 | \r | |
59 | ///\r | |
60 | /// Fixed delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
61 | ///\r | |
62 | #define DELIVERY_MODE_FIXED 0x0\r | |
63 | \r | |
64 | ///\r | |
65 | /// Lowest priority delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
66 | ///\r | |
67 | #define DELIVERY_MODE_LOWEST_PRIORITY 0x1\r | |
68 | \r | |
69 | ///\r | |
70 | /// SMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
71 | ///\r | |
72 | #define DELIVERY_MODE_SMI 0x2\r | |
73 | \r | |
74 | ///\r | |
75 | /// Remote read delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
76 | ///\r | |
77 | #define DELIVERY_MODE_REMOTE_READ 0x3\r | |
78 | \r | |
79 | ///\r | |
80 | /// NMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
81 | ///\r | |
82 | #define DELIVERY_MODE_NMI 0x4\r | |
83 | \r | |
84 | ///\r | |
85 | /// INIT delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
86 | ///\r | |
87 | #define DELIVERY_MODE_INIT 0x5\r | |
88 | \r | |
89 | ///\r | |
90 | /// Startup IPI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r | |
91 | ///\r | |
92 | #define DELIVERY_MODE_SIPI 0x6\r | |
93 | \r | |
94 | ///\r | |
95 | /// The DeliveryMode parameter in SendIpi() must be less than this maximum value.\r | |
96 | ///\r | |
97 | #define DELIVERY_MODE_MAX 0x7\r | |
98 | \r | |
99 | ///\r | |
100 | /// IPF specific value for the state field of the Self Test State Parameter.\r | |
101 | ///\r | |
102 | #define EFI_MP_HEALTH_FLAGS_STATUS_HEALTHY 0x0\r | |
103 | \r | |
104 | ///\r | |
105 | /// IPF specific value for the state field of the Self Test State Parameter.\r | |
106 | ///\r | |
107 | #define EFI_MP_HEALTH_FLAGS_STATUS_PERFORMANCE_RESTRICTED 0x1\r | |
108 | \r | |
109 | ///\r | |
110 | /// IPF specific value for the state field of the Self Test State Parameter.\r | |
111 | ///\r | |
112 | #define EFI_MP_HEALTH_FLAGS_STATUS_FUNCTIONALLY_RESTRICTED 0x2\r | |
113 | \r | |
114 | typedef union {\r | |
115 | ///\r | |
116 | /// Bitfield structure for the IPF Self Test State Parameter.\r | |
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 | |
129 | /// IA32 and X64 BIST data of the processor.\r | |
130 | ///\r | |
131 | UINT32 Uint32;\r | |
132 | } EFI_MP_HEALTH_FLAGS;\r | |
133 | \r | |
134 | typedef struct {\r | |
135 | ///\r | |
136 | /// @par IA32, X64:\r | |
137 | /// BIST (built-in self-test) data of the processor.\r | |
138 | ///\r | |
139 | /// @par IPF:\r | |
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 | |
142 | /// Developer's Manual, Volume 2: System Architecture.\r | |
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 | |
155 | typedef enum {\r | |
156 | EfiCpuAP = 0, ///< The CPU is an AP (Application Processor).\r | |
157 | EfiCpuBSP, ///< The CPU is the BSP (Boot-Strap Processor).\r | |
158 | EfiCpuDesignationMaximum\r | |
159 | } EFI_CPU_DESIGNATION;\r | |
160 | \r | |
161 | typedef 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 | |
167 | /// The lower 16 bits contains id/eid as physical address of local SAPIC\r | |
168 | /// unit, and higher bits are reserved.\r | |
169 | ///\r | |
170 | UINT32 ApicID;\r | |
171 | ///\r | |
172 | /// This field indicates whether the processor is enabled. If the value is\r | |
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 | |
178 | /// If the value is EfiCpuAP, then the processor is AP. If the value is\r | |
179 | /// EfiCpuBSP, then the processor is BSP.\r | |
180 | ///\r | |
181 | EFI_CPU_DESIGNATION Designation;\r | |
182 | ///\r | |
183 | /// @par IA32, X64:\r | |
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 | |
186 | /// the value is always zero.\r | |
187 | ///\r | |
188 | /// @par IPF:\r | |
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 | |
191 | /// Volume 2: System Architecture.\r | |
192 | ///\r | |
193 | EFI_MP_HEALTH Health;\r | |
194 | ///\r | |
195 | /// Zero-based physical package number that identifies the cartridge of the\r | |
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 | |
216 | /// This field is a mask number that is handed off by the PAL about which\r | |
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 | |
232 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
233 | instance.\r | |
234 | @param[out] NumberOfCPUs The pointer to the total number of logical processors\r | |
235 | in the system, including the BSP and disabled\r | |
236 | APs. If NULL, this parameter is ignored.\r | |
237 | @param[out] MaximumNumberOfCPUs Pointer to the maximum number of processors\r | |
238 | supported by the system. If NULL, this\r | |
239 | parameter is ignored.\r | |
240 | @param[out] NumberOfEnabledCPUs The pointer to the number of enabled logical\r | |
241 | processors that exist in system, including\r | |
242 | the BSP. If NULL, this parameter is ignored.\r | |
243 | @param[out] RendezvousIntNumber This parameter is only meaningful for IPF.\r | |
244 | - IA32, X64: The returned value is zero.\r | |
245 | If NULL, this parameter is ignored.\r | |
246 | - IPF: Pointer to the rendezvous interrupt\r | |
247 | number that is used for AP wake-up.\r | |
248 | @param[out] RendezvousProcLength The pointer to the length of rendezvous procedure.\r | |
249 | - IA32, X64: The returned value is 0x1000.\r | |
250 | If NULL, this parameter is ignored.\r | |
251 | - IPF: The returned value is zero.\r | |
252 | \r | |
253 | @retval EFI_SUCCESS Multiprocessor general information was successfully retrieved.\r | |
254 | \r | |
255 | **/\r | |
256 | typedef\r | |
257 | EFI_STATUS\r | |
258 | (EFIAPI *EFI_MP_SERVICES_GET_GENERAL_MP_INFO)(\r | |
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 | |
270 | This service gets detailed MP-related information of the requested processor\r | |
271 | at the instant this call is made. Note the following:\r | |
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 | |
274 | Information regarding the number of caches and their sizes, frequency of operation,\r | |
275 | slot numbers is all considered platform-related information and will not be\r | |
276 | presented here.\r | |
277 | \r | |
278 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
279 | instance.\r | |
280 | @param[in] ProcessorNumber The handle number of the processor. The range\r | |
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 | |
284 | GetGeneralMPInfo().\r | |
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 | |
292 | input.\r | |
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 | |
296 | \r | |
297 | @retval EFI_SUCCESS Processor information was successfully returned.\r | |
298 | @retval EFI_BUFFER_TOO_SMALL The size of ProcessorContextBuffer is too small.\r | |
299 | The value pointed by BufferLength has been updated\r | |
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 | |
303 | @retval EFI_INVALID_PARAMETER IA32, X64:Processor with the handle specified by\r | |
304 | ProcessorNumber does not exist.\r | |
305 | @retval EFI_NOT_FOUND IPF: Processor with the handle specified by\r | |
306 | ProcessorNumber does not exist.\r | |
307 | \r | |
308 | **/\r | |
309 | typedef\r | |
310 | EFI_STATUS\r | |
311 | (EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT)(\r | |
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 | |
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 | |
326 | can be run in parallel are limited to certain independent tasks and well-\r | |
327 | controlled exclusive code. EFI services and protocols may not be called by APs\r | |
328 | unless otherwise specified.\r | |
329 | \r | |
330 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
331 | instance.\r | |
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 | |
335 | time or simultaneously.\r | |
336 | - IA32, X64:\r | |
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 | |
342 | simultaneously.\r | |
343 | - IPF:\r | |
344 | If TRUE, then all the enabled APs execute\r | |
345 | the function specified by Procedure simultaneously.\r | |
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 | |
350 | by WaitEvent and TimeoutInMicrosecs.\r | |
351 | @param[in] WaitEvent Event to signal when APs have finished.\r | |
352 | - IA32, X64:\r | |
353 | If not NULL, when all APs finish after timeout\r | |
354 | expires, the event will be signaled. If NULL,\r | |
355 | the parameter is ignored.\r | |
356 | - IPF:\r | |
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 | |
368 | Specification.\r | |
369 | @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r | |
370 | - IA32, X64:\r | |
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 | |
375 | If timeout expires, EFI_TIMEOUT is returned,\r | |
376 | and the BSP will then check APs?status\r | |
377 | periodically, with time interval of 16\r | |
378 | microseconds.\r | |
379 | - IPF:\r | |
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 | |
396 | dispatch the next.\r | |
397 | @param[in] ProcedureArgument The pointer to the optional parameter of the\r | |
398 | function specified by Procedure.\r | |
399 | @param[out] FailedCPUList List of APs that did not finish.\r | |
400 | - IA32, X64:\r | |
401 | If not NULL, it records handle numbers of\r | |
402 | all logical processors that fail to accept\r | |
403 | caller-provided function (busy or disabled).\r | |
404 | If NULL, this parameter is ignored.\r | |
405 | - IPF:\r | |
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 | |
413 | If timeout expires, the status is EFI_TIMEOUT.\r | |
414 | Otherwise, the value is EFI_SUCCESS. If NULL,\r | |
415 | this parameter is ignored.\r | |
416 | \r | |
417 | @retval EFI_SUCCESS IA32, X64: All dispatched APs have finished\r | |
418 | before the timeout expires.\r | |
419 | @retval EFI_SUCCESS IA32, X64: Only 1 logical processor exists\r | |
420 | in system.\r | |
421 | @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.\r | |
422 | @retval EFI_TIMEOUT IA32, X64: The timeout expires before all\r | |
423 | dispatched APs have finished.\r | |
424 | @retval EFI_SUCCESS IPF: This function always returns EFI_SUCCESS.\r | |
425 | \r | |
426 | **/\r | |
427 | typedef\r | |
428 | EFI_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 | |
434 | IN UINTN TimeoutInMicroSecs,\r | |
435 | IN VOID *ProcArguments OPTIONAL,\r | |
436 | OUT UINTN *FailedCPUList OPTIONAL\r | |
437 | );\r | |
438 | \r | |
439 | /**\r | |
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 | |
442 | proceed with the next task.\r | |
443 | \r | |
444 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
445 | instance.\r | |
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 | |
451 | processors can be retrieved by GetGeneralMPInfo().\r | |
452 | @param[in] WaitEvent Event to signal when APs have finished.\r | |
453 | - IA32, X64:\r | |
454 | If not NULL, when the AP finishes after timeout\r | |
455 | expires, the event will be signaled. If NULL,\r | |
456 | the parameter is ignored.\r | |
457 | - IPF:\r | |
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 | |
463 | time interval is determined by TimeoutInMicrosecs.\r | |
464 | Type EFI_EVENT is defined in CreateEvent()\r | |
465 | in the Unified Extensible Firmware Interface\r | |
466 | Specification.\r | |
467 | @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r | |
468 | - IA32, X64:\r | |
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 | |
475 | with time interval of 16 microseconds.\r | |
476 | - IPF:\r | |
477 | If WaitEvent is NULL, this parameter is ignored.\r | |
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 | |
482 | non-zero, the BSP waits until the AP finishes.\r | |
483 | @param[in] ProcedureArgument The pointer to the optional parameter of the\r | |
484 | function specified by Procedure.\r | |
485 | \r | |
486 | @retval EFI_SUCCESS Specified AP has finished before the timeout\r | |
487 | expires.\r | |
488 | @retval EFI_TIMEOUT The timeout expires before specified AP has\r | |
489 | finished.\r | |
490 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r | |
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 | |
501 | typedef\r | |
502 | EFI_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 | |
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 | |
516 | current BSP.\r | |
517 | \r | |
518 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
519 | instance.\r | |
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 | |
523 | retrieved by GetGeneralMPInfo().\r | |
524 | @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r | |
525 | enabled AP. Otherwise, it will be disabled.\r | |
526 | \r | |
527 | @retval EFI_SUCCESS BSP successfully switched.\r | |
528 | @retval EFI_INVALID_PARAMETER The processor with the handle specified by\r | |
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 | |
537 | typedef\r | |
538 | EFI_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 | |
546 | This service sends an IPI to a specified AP. Caller can specify vector number\r | |
547 | and delivery mode of the interrupt.\r | |
548 | \r | |
549 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
550 | instance.\r | |
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 | |
554 | retrieved by GetGeneralMPInfo().\r | |
555 | @param[in] VectorNumber The vector number of the interrupt.\r | |
556 | @param[in] DeliveryMode The delivery mode of the interrupt.\r | |
557 | \r | |
558 | @retval EFI_SUCCESS IPI was successfully sent.\r | |
559 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r | |
560 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r | |
561 | by ProcessorNumber does not exist.\r | |
562 | @retval EFI_INVALID_PARAMETER IA32, X64: VectorNumber is greater than 255.\r | |
563 | @retval EFI_INVALID_PARAMETER IA32, X64: DeliveryMode is greater than or equal\r | |
564 | to DELIVERY_MODE_MAX.\r | |
565 | @retval EFI_NOT_READY IA32, X64: IPI is not accepted by the target\r | |
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 | |
572 | typedef\r | |
573 | EFI_STATUS\r | |
574 | (EFIAPI *EFI_MP_SERVICES_SEND_IPI)(\r | |
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 | |
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 | |
584 | health status of the processor after some processor test.\r | |
585 | \r | |
586 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
587 | instance.\r | |
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 | |
591 | retrieved by GetGeneralMPInfo().\r | |
592 | @param[in] NewAPState Indicates whether the new, desired state of the\r | |
593 | AP is enabled or disabled. TRUE for enabling,\r | |
594 | FALSE otherwise.\r | |
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 | |
598 | \r | |
599 | @retval EFI_SUCCESS AP successfully enabled or disabled.\r | |
600 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r | |
601 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r | |
602 | by ProcessorNumber does not exist.\r | |
603 | @retval EFI_INVALID_PARAMETER IPF: If an unhealthy or untested AP is to be\r | |
604 | enabled.\r | |
605 | \r | |
606 | **/\r | |
607 | typedef\r | |
608 | EFI_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 | |
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 | |
621 | from the BSP and APs.\r | |
622 | \r | |
623 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r | |
624 | instance.\r | |
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 | |
628 | can be retrieved by GetGeneralMPInfo().\r | |
629 | \r | |
630 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r | |
631 | \r | |
632 | **/\r | |
633 | typedef\r | |
634 | EFI_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 | |
641 | /// Framework MP Services Protocol structure.\r | |
642 | ///\r | |
643 | struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL {\r | |
644 | EFI_MP_SERVICES_GET_GENERAL_MP_INFO GetGeneralMPInfo;\r | |
645 | EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT GetProcessorContext;\r | |
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 | |
649 | EFI_MP_SERVICES_SEND_IPI SendIPI;\r | |
650 | FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r | |
651 | FRAMEWORK_EFI_MP_SERVICES_WHOAMI WhoAmI;\r | |
652 | };\r | |
653 | \r | |
654 | extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;\r | |
655 | \r | |
656 | #endif\r |