TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuMp.c
Go to the documentation of this file.
1
9#include "CpuDxe.h"
10#include "CpuMp.h"
11
12EFI_HANDLE mMpServiceHandle = NULL;
13UINTN mNumberOfProcessors = 1;
14
15EFI_MP_SERVICES_PROTOCOL mMpServicesTemplate = {
22 WhoAmI
23};
24
62EFIAPI
65 OUT UINTN *NumberOfProcessors,
66 OUT UINTN *NumberOfEnabledProcessors
67 )
68{
69 if ((NumberOfProcessors == NULL) || (NumberOfEnabledProcessors == NULL)) {
70 return EFI_INVALID_PARAMETER;
71 }
72
74 NumberOfProcessors,
75 NumberOfEnabledProcessors
76 );
77}
78
106EFIAPI
109 IN UINTN ProcessorNumber,
110 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
111 )
112{
113 return MpInitLibGetProcessorInfo (ProcessorNumber, ProcessorInfoBuffer, NULL);
114}
115
253EFIAPI
256 IN EFI_AP_PROCEDURE Procedure,
257 IN BOOLEAN SingleThread,
258 IN EFI_EVENT WaitEvent OPTIONAL,
259 IN UINTN TimeoutInMicroseconds,
260 IN VOID *ProcedureArgument OPTIONAL,
261 OUT UINTN **FailedCpuList OPTIONAL
262 )
263{
265 Procedure,
266 SingleThread,
267 WaitEvent,
268 TimeoutInMicroseconds,
269 ProcedureArgument,
270 FailedCpuList
271 );
272}
273
361EFIAPI
364 IN EFI_AP_PROCEDURE Procedure,
365 IN UINTN ProcessorNumber,
366 IN EFI_EVENT WaitEvent OPTIONAL,
367 IN UINTN TimeoutInMicroseconds,
368 IN VOID *ProcedureArgument OPTIONAL,
369 OUT BOOLEAN *Finished OPTIONAL
370 )
371{
373 Procedure,
374 ProcessorNumber,
375 WaitEvent,
376 TimeoutInMicroseconds,
377 ProcedureArgument,
378 Finished
379 );
380}
381
418EFIAPI
421 IN UINTN ProcessorNumber,
422 IN BOOLEAN EnableOldBSP
423 )
424{
425 return MpInitLibSwitchBSP (ProcessorNumber, EnableOldBSP);
426}
427
470EFIAPI
473 IN UINTN ProcessorNumber,
474 IN BOOLEAN EnableAP,
475 IN UINT32 *HealthFlag OPTIONAL
476 )
477{
478 return MpInitLibEnableDisableAP (ProcessorNumber, EnableAP, HealthFlag);
479}
480
506EFIAPI
509 OUT UINTN *ProcessorNumber
510 )
511{
512 return MpInitLibWhoAmI (ProcessorNumber);
513}
514
518VOID
520 VOID
521 )
522{
523 EFI_STATUS Status;
524 UINTN NumberOfProcessors;
525 UINTN NumberOfEnabledProcessors;
526
527 //
528 // Wakeup APs to do initialization
529 //
530 Status = MpInitLibInitialize ();
531 ASSERT_EFI_ERROR (Status);
532
533 MpInitLibGetNumberOfProcessors (&NumberOfProcessors, &NumberOfEnabledProcessors);
534 mNumberOfProcessors = NumberOfProcessors;
535 DEBUG ((DEBUG_INFO, "Detect CPU count: %d\n", mNumberOfProcessors));
536
537 Status = gBS->InstallMultipleProtocolInterfaces (
538 &mMpServiceHandle,
539 &gEfiMpServiceProtocolGuid,
540 &mMpServicesTemplate,
541 NULL
542 );
543 ASSERT_EFI_ERROR (Status);
544}
UINT64 UINTN
EFI_STATUS EFIAPI StartupThisAP(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)
Definition: CpuMp.c:362
EFI_STATUS EFIAPI EnableDisableAP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: CpuMp.c:471
EFI_STATUS EFIAPI WhoAmI(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *ProcessorNumber)
Definition: CpuMp.c:507
EFI_STATUS EFIAPI StartupAllAPs(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)
Definition: CpuMp.c:254
EFI_STATUS EFIAPI GetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
Definition: CpuMp.c:63
EFI_STATUS EFIAPI SwitchBSP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: CpuMp.c:419
EFI_STATUS EFIAPI GetProcessorInfo(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
Definition: CpuMp.c:107
VOID InitializeMpSupport(VOID)
Definition: CpuMp.c:754
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_STATUS EFIAPI MpInitLibEnableDisableAP(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
Definition: DxeMpLib.c:920
EFI_STATUS EFIAPI MpInitLibStartupAllAPs(IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL)
Definition: DxeMpLib.c:682
EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
Definition: MpLib.c:1522
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL)
Definition: MpLib.c:1559
EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
Definition: DxeMpLib.c:847
EFI_STATUS EFIAPI MpInitLibGetProcessorInfo(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL)
Definition: MpLib.c:1452
EFI_STATUS EFIAPI MpInitLibInitialize(VOID)
Definition: MpLib.c:1319
EFI_STATUS EFIAPI MpInitLibStartupThisAP(IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL)
Definition: DxeMpLib.c:789
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_BOOT_SERVICES * gBS