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