13UINTN mNumberOfProcessors = 1;
69 if ((NumberOfProcessors ==
NULL) || (NumberOfEnabledProcessors ==
NULL)) {
70 return EFI_INVALID_PARAMETER;
75 NumberOfEnabledProcessors
257 IN BOOLEAN SingleThread,
259 IN UINTN TimeoutInMicroseconds,
260 IN VOID *ProcedureArgument OPTIONAL,
268 TimeoutInMicroseconds,
367 IN UINTN TimeoutInMicroseconds,
368 IN VOID *ProcedureArgument OPTIONAL,
369 OUT BOOLEAN *Finished OPTIONAL
376 TimeoutInMicroseconds,
422 IN BOOLEAN EnableOldBSP
475 IN UINT32 *HealthFlag OPTIONAL
533 UINTN ProcessorNumber;
536 UINTN CpuInstanceNumber;
545 if (GuidHob !=
NULL) {
557 if (GuidHob !=
NULL) {
564 BspCpuInstance.CpuLocation =
GetApicId ();
566 CpuInstance = &BspCpuInstance;
568 DEBUG ((DEBUG_INFO,
"Does not find any HOB stored CPU BIST information!\n"));
576 for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {
578 for (CpuInstanceNumber = 0; CpuInstanceNumber < NumberOfData; CpuInstanceNumber++) {
579 if (ProcessorInfo.
ProcessorId == CpuInstance[CpuInstanceNumber].CpuLocation) {
583 BistData = CpuInstance[CpuInstanceNumber].InfoRecord.IA32HealthFlags;
587 if (BistData.Uint32 != 0) {
592 EFI_ERROR_CODE | EFI_ERROR_MAJOR,
593 (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST)
629 if (EFI_ERROR (Status)) {
630 DEBUG ((DEBUG_ERROR,
"[%a] - Failed to get processor number. The exception stack was not initialized.\n", __func__));
640 if ((SwitchStackData[Index].Status == EFI_NOT_STARTED) || (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL)) {
641 SwitchStackData[Index].Status = InitializeSeparateExceptionStacks (SwitchStackData[Index].Buffer, &SwitchStackData[Index].BufferSize);
664 ASSERT (SwitchStackData !=
NULL);
665 for (Index = 0; Index < mNumberOfProcessors; ++Index) {
670 SwitchStackData[Index].Status = EFI_NOT_STARTED;
681 for (Index = 0; Index < mNumberOfProcessors; ++Index) {
682 if (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL) {
683 ASSERT (SwitchStackData[Index].BufferSize != 0);
684 BufferSize += SwitchStackData[Index].BufferSize;
686 ASSERT (SwitchStackData[Index].Status ==
EFI_SUCCESS);
687 ASSERT (SwitchStackData[Index].BufferSize == 0);
691 if (BufferSize != 0) {
693 ASSERT (Buffer !=
NULL);
695 for (Index = 0; Index < mNumberOfProcessors; ++Index) {
696 if (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL) {
697 SwitchStackData[Index].Buffer = (VOID *)(&Buffer[BufferSize]);
698 BufferSize += SwitchStackData[Index].BufferSize;
701 "Buffer[cpu%lu] for InitializeExceptionStackSwitchHandlers: 0x%lX with size 0x%lX\n",
702 (UINT64)(
UINTN)Index,
703 (UINT64)(
UINTN)SwitchStackData[Index].Buffer,
704 (UINT64)(
UINTN)SwitchStackData[Index].BufferSize
715 for (Index = 0; Index < mNumberOfProcessors; ++Index) {
716 ASSERT (SwitchStackData[Index].Status ==
EFI_SUCCESS);
736 if (HEAP_GUARD_NONSTOP_MODE || NULL_DETECTION_NONSTOP_MODE) {
759 UINTN NumberOfProcessors;
760 UINTN NumberOfEnabledProcessors;
770 if (!EFI_ERROR (Status)) {
771 mNumberOfProcessors = NumberOfProcessors;
772 DEBUG ((DEBUG_INFO,
"Detect CPU count: %d\n", mNumberOfProcessors));
784 Status =
gBS->InstallMultipleProtocolInterfaces (
786 &gEfiMpServiceProtocolGuid,
787 &mMpServicesTemplate,
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
EFI_STATUS EFIAPI SecPlatformInformation2(IN CONST EFI_PEI_SERVICES **PeiServices, IN OUT UINT64 *StructureSize, OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2)
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)
EFI_STATUS EFIAPI EnableDisableAP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
VOID EFIAPI InitializeExceptionStackSwitchHandlers(IN OUT VOID *Buffer)
EFI_STATUS EFIAPI WhoAmI(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *ProcessorNumber)
VOID InitializeMpExceptionStackSwitchHandlers(VOID)
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)
VOID CollectBistDataFromHob(VOID)
EFI_STATUS EFIAPI GetNumberOfProcessors(IN EFI_MP_SERVICES_PROTOCOL *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
EFI_STATUS EFIAPI SwitchBSP(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
EFI_STATUS EFIAPI GetProcessorInfo(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
VOID InitializeMpSupport(VOID)
VOID InitializeMpExceptionHandlers(VOID)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateRuntimeZeroPool(IN UINTN AllocationSize)
UINT32 EFIAPI GetApicId(VOID)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define REPORT_STATUS_CODE(Type, Value)
EFI_STATUS EFIAPI MpInitLibEnableDisableAP(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
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)
EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL)
EFI_STATUS EFIAPI MpInitLibSwitchBSP(IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
EFI_STATUS EFIAPI MpInitLibStartupAllCPUs(IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL)
EFI_STATUS EFIAPI MpInitLibGetProcessorInfo(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL)
EFI_STATUS EFIAPI MpInitLibInitialize(VOID)
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)
#define PcdGetBool(TokenName)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
VOID EFIAPI PageFaultExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)
VOID EFIAPI DebugExceptionHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext)