]>
Commit | Line | Data |
---|---|---|
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 LG |
36 | Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>\r |
37 | This program and the accompanying materials are licensed and made available under\r | |
38 | the terms and conditions of the BSD License that accompanies this distribution.\r | |
f22f941e | 39 | The full text of the license may be found at\r |
1c2f052d LG |
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 | |
f22f941e | 43 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
b6d47a83 | 44 | \r |
ce9b1e3a | 45 | **/\r |
b6d47a83 | 46 | \r |
47 | #ifndef _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r | |
48 | #define _FRAMEWORK_MP_SERVICE_PROTOCOL_H_\r | |
49 | \r | |
2aa76eac | 50 | #include <FrameworkDxe.h>\r |
51 | \r | |
b6d47a83 | 52 | ///\r |
f22f941e | 53 | /// Global ID for the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL.\r |
b6d47a83 | 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 | |
f22f941e | 61 | /// Forward declaration for the EFI_MP_SERVICES_PROTOCOL.\r |
b6d47a83 | 62 | ///\r |
63 | typedef struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL FRAMEWORK_EFI_MP_SERVICES_PROTOCOL;\r | |
64 | \r | |
65 | ///\r | |
f22f941e | 66 | /// Fixed delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 67 | ///\r |
68 | #define DELIVERY_MODE_FIXED 0x0\r | |
69 | \r | |
70 | ///\r | |
1c2f052d | 71 | /// Lowest priority delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 72 | ///\r |
73 | #define DELIVERY_MODE_LOWEST_PRIORITY 0x1\r | |
74 | \r | |
75 | ///\r | |
1c2f052d | 76 | /// SMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 77 | ///\r |
78 | #define DELIVERY_MODE_SMI 0x2\r | |
79 | \r | |
80 | ///\r | |
1c2f052d | 81 | /// Remote read delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 82 | ///\r |
83 | #define DELIVERY_MODE_REMOTE_READ 0x3\r | |
84 | \r | |
85 | ///\r | |
1c2f052d | 86 | /// NMI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 87 | ///\r |
88 | #define DELIVERY_MODE_NMI 0x4\r | |
89 | \r | |
90 | ///\r | |
1c2f052d | 91 | /// INIT delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 92 | ///\r |
93 | #define DELIVERY_MODE_INIT 0x5\r | |
94 | \r | |
95 | ///\r | |
f22f941e | 96 | /// Startup IPI delivery mode that may be used as the DeliveryMode parameter in SendIpi().\r |
b6d47a83 | 97 | ///\r |
98 | #define DELIVERY_MODE_SIPI 0x6\r | |
99 | \r | |
100 | ///\r | |
f22f941e | 101 | /// The DeliveryMode parameter in SendIpi() must be less than this maximum value.\r |
b6d47a83 | 102 | ///\r |
103 | #define DELIVERY_MODE_MAX 0x7\r | |
104 | \r | |
105 | ///\r | |
f22f941e | 106 | /// IPF specific value for the state field of the Self Test State Parameter.\r |
b6d47a83 | 107 | ///\r |
108 | #define EFI_MP_HEALTH_FLAGS_STATUS_HEALTHY 0x0\r | |
109 | \r | |
110 | ///\r | |
f22f941e | 111 | /// IPF specific value for the state field of the Self Test State Parameter.\r |
b6d47a83 | 112 | ///\r |
113 | #define EFI_MP_HEALTH_FLAGS_STATUS_PERFORMANCE_RESTRICTED 0x1\r | |
114 | \r | |
115 | ///\r | |
f22f941e | 116 | /// IPF specific value for the state field of the Self Test State Parameter.\r |
b6d47a83 | 117 | ///\r |
118 | #define EFI_MP_HEALTH_FLAGS_STATUS_FUNCTIONALLY_RESTRICTED 0x2\r | |
119 | \r | |
120 | typedef union {\r | |
121 | ///\r | |
1c2f052d | 122 | /// Bitfield structure for the IPF Self Test State Parameter.\r |
b6d47a83 | 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 | |
f22f941e | 135 | /// IA32 and X64 BIST data of the processor.\r |
b6d47a83 | 136 | ///\r |
137 | UINT32 Uint32;\r | |
138 | } EFI_MP_HEALTH_FLAGS;\r | |
139 | \r | |
140 | typedef struct {\r | |
141 | ///\r | |
142 | /// @par IA32, X64:\r | |
f22f941e | 143 | /// BIST (built-in self-test) data of the processor.\r |
b6d47a83 | 144 | ///\r |
145 | /// @par IPF:\r | |
1c2f052d LG |
146 | /// Lower 32 bits of the self-test state parameter. For definition of self-test\r |
147 | /// state parameter, please refer to Intel(R) Itanium(R) Architecture Software\r | |
1910fbaf | 148 | /// Developer's Manual, Volume 2: System Architecture.\r |
b6d47a83 | 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 | |
161 | typedef enum {\r | |
f22f941e | 162 | EfiCpuAP = 0, ///< The CPU is an AP (Application Processor).\r |
163 | EfiCpuBSP, ///< The CPU is the BSP (Boot-Strap Processor).\r | |
b6d47a83 | 164 | EfiCpuDesignationMaximum\r |
165 | } EFI_CPU_DESIGNATION;\r | |
166 | \r | |
167 | typedef 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 | |
1c2f052d | 173 | /// The lower 16 bits contains id/eid as physical address of local SAPIC\r |
b6d47a83 | 174 | /// unit, and higher bits are reserved.\r |
175 | ///\r | |
176 | UINT32 ApicID;\r | |
177 | ///\r | |
1c2f052d | 178 | /// This field indicates whether the processor is enabled. If the value is\r |
b6d47a83 | 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 | |
1c2f052d | 184 | /// If the value is EfiCpuAP, then the processor is AP. If the value is\r |
b6d47a83 | 185 | /// EfiCpuBSP, then the processor is BSP.\r |
186 | ///\r | |
187 | EFI_CPU_DESIGNATION Designation;\r | |
188 | ///\r | |
189 | /// @par IA32, X64:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 192 | /// the value is always zero.\r |
193 | ///\r | |
194 | /// @par IPF:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 197 | /// Volume 2: System Architecture.\r |
198 | ///\r | |
199 | EFI_MP_HEALTH Health;\r | |
200 | ///\r | |
1c2f052d | 201 | /// Zero-based physical package number that identifies the cartridge of the\r |
b6d47a83 | 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 | |
1c2f052d | 222 | /// This field is a mask number that is handed off by the PAL about which\r |
b6d47a83 | 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 | |
f22f941e | 238 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 239 | instance.\r |
1c2f052d LG |
240 | @param[out] NumberOfCPUs The pointer to the total number of logical processors\r |
241 | in the system, including the BSP and disabled\r | |
b6d47a83 | 242 | APs. If NULL, this parameter is ignored.\r |
1c2f052d LG |
243 | @param[out] MaximumNumberOfCPUs Pointer to the maximum number of processors\r |
244 | supported by the system. If NULL, this\r | |
b6d47a83 | 245 | parameter is ignored.\r |
1c2f052d LG |
246 | @param[out] NumberOfEnabledCPUs The pointer to the number of enabled logical\r |
247 | processors that exist in system, including\r | |
b6d47a83 | 248 | the BSP. If NULL, this parameter is ignored.\r |
249 | @param[out] RendezvousIntNumber This parameter is only meaningful for IPF.\r | |
1c2f052d | 250 | - IA32, X64: The returned value is zero.\r |
b6d47a83 | 251 | If NULL, this parameter is ignored.\r |
1c2f052d | 252 | - IPF: Pointer to the rendezvous interrupt\r |
b6d47a83 | 253 | number that is used for AP wake-up.\r |
1c2f052d LG |
254 | @param[out] RendezvousProcLength The pointer to the length of rendezvous procedure.\r |
255 | - IA32, X64: The returned value is 0x1000.\r | |
b6d47a83 | 256 | If NULL, this parameter is ignored.\r |
257 | - IPF: The returned value is zero.\r | |
258 | \r | |
f22f941e | 259 | @retval EFI_SUCCESS Multiprocessor general information was successfully retrieved.\r |
b6d47a83 | 260 | \r |
261 | **/\r | |
262 | typedef\r | |
263 | EFI_STATUS\r | |
108854b2 | 264 | (EFIAPI *EFI_MP_SERVICES_GET_GENERAL_MP_INFO)(\r |
b6d47a83 | 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 | |
1c2f052d | 276 | This service gets detailed MP-related information of the requested processor\r |
b6d47a83 | 277 | at the instant this call is made. Note the following:\r |
1c2f052d LG |
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 | |
b6d47a83 | 280 | Information regarding the number of caches and their sizes, frequency of operation,\r |
1c2f052d LG |
281 | slot numbers is all considered platform-related information and will not be\r |
282 | presented here.\r | |
b6d47a83 | 283 | \r |
f22f941e | 284 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 285 | instance.\r |
286 | @param[in] ProcessorNumber The handle number of the processor. The range\r | |
1c2f052d LG |
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 | |
b6d47a83 | 290 | GetGeneralMPInfo().\r |
1c2f052d LG |
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 | |
b6d47a83 | 298 | input.\r |
1c2f052d LG |
299 | @param[out] ProcessorContextBuffer The pointer to the buffer where the data of\r |
300 | requested processor will be deposited.\r | |
301 | The buffer is allocated by caller.\r | |
b6d47a83 | 302 | \r |
f22f941e | 303 | @retval EFI_SUCCESS Processor information was successfully returned.\r |
1c2f052d LG |
304 | @retval EFI_BUFFER_TOO_SMALL The size of ProcessorContextBuffer is too small.\r |
305 | The value pointed by BufferLength has been updated\r | |
b6d47a83 | 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 | |
1c2f052d | 309 | @retval EFI_INVALID_PARAMETER IA32, X64:Processor with the handle specified by\r |
f22f941e | 310 | ProcessorNumber does not exist.\r |
1c2f052d | 311 | @retval EFI_NOT_FOUND IPF: Processor with the handle specified by\r |
f22f941e | 312 | ProcessorNumber does not exist.\r |
b6d47a83 | 313 | \r |
314 | **/\r | |
315 | typedef\r | |
316 | EFI_STATUS\r | |
108854b2 | 317 | (EFIAPI *EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT)(\r |
b6d47a83 | 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 | |
1c2f052d LG |
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 | |
b6d47a83 | 332 | can be run in parallel are limited to certain independent tasks and well-\r |
1c2f052d | 333 | controlled exclusive code. EFI services and protocols may not be called by APs\r |
b6d47a83 | 334 | unless otherwise specified.\r |
335 | \r | |
f22f941e | 336 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 337 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 341 | time or simultaneously.\r |
342 | - IA32, X64:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 348 | simultaneously.\r |
349 | - IPF:\r | |
1c2f052d | 350 | If TRUE, then all the enabled APs execute\r |
b6d47a83 | 351 | the function specified by Procedure simultaneously.\r |
1c2f052d LG |
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 | |
b6d47a83 | 356 | by WaitEvent and TimeoutInMicrosecs.\r |
357 | @param[in] WaitEvent Event to signal when APs have finished.\r | |
358 | - IA32, X64:\r | |
1c2f052d LG |
359 | If not NULL, when all APs finish after timeout\r |
360 | expires, the event will be signaled. If NULL,\r | |
b6d47a83 | 361 | the parameter is ignored.\r |
362 | - IPF:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 374 | Specification.\r |
375 | @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r | |
376 | - IA32, X64:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 381 | If timeout expires, EFI_TIMEOUT is returned,\r |
1c2f052d LG |
382 | and the BSP will then check APs?status\r |
383 | periodically, with time interval of 16\r | |
b6d47a83 | 384 | microseconds.\r |
385 | - IPF:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 402 | dispatch the next.\r |
1c2f052d | 403 | @param[in] ProcedureArgument The pointer to the optional parameter of the\r |
b6d47a83 | 404 | function specified by Procedure.\r |
405 | @param[out] FailedCPUList List of APs that did not finish.\r | |
406 | - IA32, X64:\r | |
1c2f052d LG |
407 | If not NULL, it records handle numbers of\r |
408 | all logical processors that fail to accept\r | |
b6d47a83 | 409 | caller-provided function (busy or disabled).\r |
410 | If NULL, this parameter is ignored.\r | |
411 | - IPF:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 419 | If timeout expires, the status is EFI_TIMEOUT.\r |
1c2f052d | 420 | Otherwise, the value is EFI_SUCCESS. If NULL,\r |
b6d47a83 | 421 | this parameter is ignored.\r |
422 | \r | |
1c2f052d | 423 | @retval EFI_SUCCESS IA32, X64: All dispatched APs have finished\r |
b6d47a83 | 424 | before the timeout expires.\r |
1c2f052d | 425 | @retval EFI_SUCCESS IA32, X64: Only 1 logical processor exists\r |
b6d47a83 | 426 | in system.\r |
1c2f052d LG |
427 | @retval EFI_INVALID_PARAMETER IA32, X64: Procedure is NULL.\r |
428 | @retval EFI_TIMEOUT IA32, X64: The timeout expires before all\r | |
b6d47a83 | 429 | dispatched APs have finished.\r |
1c2f052d | 430 | @retval EFI_SUCCESS IPF: This function always returns EFI_SUCCESS.\r |
b6d47a83 | 431 | \r |
432 | **/\r | |
433 | typedef\r | |
434 | EFI_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 | |
1c2f052d | 440 | IN UINTN TimeoutInMicroSecs,\r |
b6d47a83 | 441 | IN VOID *ProcArguments OPTIONAL,\r |
442 | OUT UINTN *FailedCPUList OPTIONAL\r | |
443 | );\r | |
444 | \r | |
445 | /**\r | |
1c2f052d LG |
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 | |
b6d47a83 | 448 | proceed with the next task.\r |
449 | \r | |
f22f941e | 450 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 451 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 457 | processors can be retrieved by GetGeneralMPInfo().\r |
458 | @param[in] WaitEvent Event to signal when APs have finished.\r | |
459 | - IA32, X64:\r | |
1c2f052d LG |
460 | If not NULL, when the AP finishes after timeout\r |
461 | expires, the event will be signaled. If NULL,\r | |
b6d47a83 | 462 | the parameter is ignored.\r |
463 | - IPF:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 469 | time interval is determined by TimeoutInMicrosecs.\r |
1c2f052d LG |
470 | Type EFI_EVENT is defined in CreateEvent()\r |
471 | in the Unified Extensible Firmware Interface\r | |
b6d47a83 | 472 | Specification.\r |
473 | @param[in] TimeoutInMicrosecsond Time to wait for APs to finish.\r | |
474 | - IA32, X64:\r | |
1c2f052d LG |
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 | |
b6d47a83 | 481 | with time interval of 16 microseconds.\r |
482 | - IPF:\r | |
483 | If WaitEvent is NULL, this parameter is ignored.\r | |
1c2f052d LG |
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 | |
b6d47a83 | 488 | non-zero, the BSP waits until the AP finishes.\r |
1c2f052d | 489 | @param[in] ProcedureArgument The pointer to the optional parameter of the\r |
b6d47a83 | 490 | function specified by Procedure.\r |
491 | \r | |
1c2f052d | 492 | @retval EFI_SUCCESS Specified AP has finished before the timeout\r |
b6d47a83 | 493 | expires.\r |
1c2f052d | 494 | @retval EFI_TIMEOUT The timeout expires before specified AP has\r |
b6d47a83 | 495 | finished.\r |
1c2f052d | 496 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r |
b6d47a83 | 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 | |
507 | typedef\r | |
508 | EFI_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 | |
1c2f052d LG |
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 | |
b6d47a83 | 522 | current BSP.\r |
523 | \r | |
f22f941e | 524 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 525 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 529 | retrieved by GetGeneralMPInfo().\r |
1c2f052d | 530 | @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an\r |
b6d47a83 | 531 | enabled AP. Otherwise, it will be disabled.\r |
532 | \r | |
533 | @retval EFI_SUCCESS BSP successfully switched.\r | |
1c2f052d | 534 | @retval EFI_INVALID_PARAMETER The processor with the handle specified by\r |
b6d47a83 | 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 | |
543 | typedef\r | |
544 | EFI_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 | |
1c2f052d | 552 | This service sends an IPI to a specified AP. Caller can specify vector number\r |
b6d47a83 | 553 | and delivery mode of the interrupt.\r |
554 | \r | |
f22f941e | 555 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 556 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 560 | retrieved by GetGeneralMPInfo().\r |
f22f941e | 561 | @param[in] VectorNumber The vector number of the interrupt.\r |
562 | @param[in] DeliveryMode The delivery mode of the interrupt.\r | |
b6d47a83 | 563 | \r |
f22f941e | 564 | @retval EFI_SUCCESS IPI was successfully sent.\r |
b6d47a83 | 565 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r |
1c2f052d | 566 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r |
b6d47a83 | 567 | by ProcessorNumber does not exist.\r |
568 | @retval EFI_INVALID_PARAMETER IA32, X64: VectorNumber is greater than 255.\r | |
1c2f052d | 569 | @retval EFI_INVALID_PARAMETER IA32, X64: DeliveryMode is greater than or equal\r |
b6d47a83 | 570 | to DELIVERY_MODE_MAX.\r |
1c2f052d | 571 | @retval EFI_NOT_READY IA32, X64: IPI is not accepted by the target\r |
b6d47a83 | 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 | |
578 | typedef\r | |
579 | EFI_STATUS\r | |
108854b2 | 580 | (EFIAPI *EFI_MP_SERVICES_SEND_IPI)(\r |
b6d47a83 | 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 | |
1c2f052d LG |
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 | |
b6d47a83 | 590 | health status of the processor after some processor test.\r |
591 | \r | |
f22f941e | 592 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 593 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 597 | retrieved by GetGeneralMPInfo().\r |
1c2f052d LG |
598 | @param[in] NewAPState Indicates whether the new, desired state of the\r |
599 | AP is enabled or disabled. TRUE for enabling,\r | |
b6d47a83 | 600 | FALSE otherwise.\r |
1c2f052d LG |
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 | |
b6d47a83 | 604 | \r |
605 | @retval EFI_SUCCESS AP successfully enabled or disabled.\r | |
606 | @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r | |
1c2f052d | 607 | @retval EFI_INVALID_PARAMETER IA32, X64: Processor with the handle specified\r |
b6d47a83 | 608 | by ProcessorNumber does not exist.\r |
1c2f052d | 609 | @retval EFI_INVALID_PARAMETER IPF: If an unhealthy or untested AP is to be\r |
b6d47a83 | 610 | enabled.\r |
611 | \r | |
612 | **/\r | |
613 | typedef\r | |
614 | EFI_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 | |
1c2f052d LG |
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 | |
b6d47a83 | 627 | from the BSP and APs.\r |
628 | \r | |
f22f941e | 629 | @param[in] This The pointer to the FRAMEWORK_EFI_MP_SERVICES_PROTOCOL\r |
b6d47a83 | 630 | instance.\r |
1c2f052d LG |
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 | |
b6d47a83 | 634 | can be retrieved by GetGeneralMPInfo().\r |
635 | \r | |
636 | @retval EFI_SUCCESS This function always returns EFI_SUCCESS.\r | |
637 | \r | |
638 | **/\r | |
639 | typedef\r | |
640 | EFI_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 | |
f22f941e | 647 | /// Framework MP Services Protocol structure.\r |
b6d47a83 | 648 | ///\r |
2aa76eac | 649 | struct _FRAMEWORK_EFI_MP_SERVICES_PROTOCOL {\r |
108854b2 LG |
650 | EFI_MP_SERVICES_GET_GENERAL_MP_INFO GetGeneralMPInfo;\r |
651 | EFI_MP_SERVICES_GET_PROCESSOR_CONTEXT GetProcessorContext;\r | |
b6d47a83 | 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 | |
108854b2 | 655 | EFI_MP_SERVICES_SEND_IPI SendIPI;\r |
b6d47a83 | 656 | FRAMEWORK_EFI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r |
657 | FRAMEWORK_EFI_MP_SERVICES_WHOAMI WhoAmI;\r | |
658 | };\r | |
659 | \r | |
660 | extern EFI_GUID gFrameworkEfiMpServiceProtocolGuid;\r | |
661 | \r | |
662 | #endif\r |