28 EFI_PEI_PPI_DESCRIPTOR_PPI,
29 &gEdkiiPeiMpServices2PpiGuid,
33 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
34 &gEfiPeiMpServicesPpiGuid,
82 if ((NumberOfProcessors ==
NULL) || (NumberOfEnabledProcessors ==
NULL)) {
83 return EFI_INVALID_PARAMETER;
88 NumberOfEnabledProcessors
199 IN BOOLEAN SingleThread,
200 IN UINTN TimeoutInMicroSeconds,
201 IN VOID *ProcedureArgument OPTIONAL
208 TimeoutInMicroSeconds,
267 IN UINTN TimeoutInMicroseconds,
268 IN VOID *ProcedureArgument OPTIONAL
275 TimeoutInMicroseconds,
321 IN BOOLEAN EnableOldBSP
373 IN UINT32 *HealthFlag OPTIONAL
443 if (EFI_ERROR (Status)) {
444 DEBUG ((DEBUG_ERROR,
"%a - Failed to allocate Switch Stack pages.\n", __func__));
454 if ((SwitchStackData[Index].Status == EFI_NOT_STARTED) || (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL)) {
455 SwitchStackData[Index].Status = InitializeSeparateExceptionStacks (SwitchStackData[Index].Buffer, &SwitchStackData[Index].BufferSize);
472 UINTN NumberOfProcessors;
485 if (EFI_ERROR (Status)) {
486 NumberOfProcessors = 1;
490 if (SwitchStackData ==
NULL) {
491 ASSERT (SwitchStackData !=
NULL);
492 DEBUG ((DEBUG_ERROR,
"%a - Failed to allocate Switch Stack pages.\n", __func__));
497 for (Index = 0; Index < NumberOfProcessors; ++Index) {
502 SwitchStackData[Index].Status = EFI_NOT_STARTED;
513 for (Index = 0; Index < NumberOfProcessors; ++Index) {
514 if (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL) {
515 ASSERT (SwitchStackData[Index].BufferSize != 0);
516 BufferSize += SwitchStackData[Index].BufferSize;
518 ASSERT (SwitchStackData[Index].Status ==
EFI_SUCCESS);
519 ASSERT (SwitchStackData[Index].BufferSize == 0);
523 if (BufferSize != 0) {
525 if (Buffer ==
NULL) {
526 ASSERT (Buffer !=
NULL);
527 DEBUG ((DEBUG_ERROR,
"%a - Failed to allocate Buffer pages.\n", __func__));
532 for (Index = 0; Index < NumberOfProcessors; ++Index) {
533 if (SwitchStackData[Index].Status == EFI_BUFFER_TOO_SMALL) {
534 SwitchStackData[Index].Buffer = (VOID *)(&Buffer[BufferSize]);
535 BufferSize += SwitchStackData[Index].BufferSize;
538 "Buffer[cpu%lu] for InitializeExceptionStackSwitchHandlers: 0x%lX with size 0x%lX\n",
539 (UINT64)(
UINTN)Index,
540 (UINT64)(
UINTN)SwitchStackData[Index].Buffer,
541 (UINT64)(
UINTN)SwitchStackData[Index].BufferSize
552 for (Index = 0; Index < NumberOfProcessors; ++Index) {
553 ASSERT (SwitchStackData[Index].Status ==
EFI_SUCCESS);
574 UINTN ProcessorIndex;
579 CoreTypes = (UINT8 *)Buffer;
581 CoreTypes[ProcessorIndex] = (UINT8)NativeModelIdAndCoreTypeEax.
Bits.
CoreType;
593 UINTN ProcessorIndex;
594 UINTN NumberOfProcessors;
595 UINTN NumberOfEnabledProcessors;
596 UINTN NumberOfProcessorsInHob;
597 UINTN MaxProcessorsPerHob;
602 UINT32 CpuidMaxInput;
606 MpInformation2HobData =
NULL;
607 MpInformation2Entry =
NULL;
621 ASSERT (CoreTypes !=
NULL);
632 NumberOfProcessorsInHob = MaxProcessorsPerHob;
640 while (NumberOfProcessorsInHob != 0) {
641 NumberOfProcessorsInHob =
MIN (NumberOfProcessors - ProcessorIndex, MaxProcessorsPerHob);
643 &gMpInformation2HobGuid,
646 ASSERT (MpInformation2HobData !=
NULL);
648 MpInformation2HobData->Version = MP_INFORMATION2_HOB_REVISION;
649 MpInformation2HobData->ProcessorIndex = ProcessorIndex;
650 MpInformation2HobData->NumberOfProcessors = (UINT16)NumberOfProcessorsInHob;
653 DEBUG ((DEBUG_INFO,
"Creating MpInformation2 HOB...\n"));
655 for (Index = 0; Index < NumberOfProcessorsInHob; Index++) {
656 MpInformation2Entry = &MpInformation2HobData->Entry[Index];
659 &MpInformation2Entry->ProcessorInfo,
664 MpInformation2Entry->CoreType = (CoreTypes !=
NULL) ? CoreTypes[Index + ProcessorIndex] : 0;
668 " Processor[%04d]: ProcessorId = 0x%lx, StatusFlag = 0x%x, CoreType = 0x%x\n",
669 Index + ProcessorIndex,
671 MpInformation2Entry->ProcessorInfo.
StatusFlag,
672 MpInformation2Entry->CoreType
676 " Location = Package:%d Core:%d Thread:%d\n",
683 " Location2 = Package:%d Die:%d Tile:%d Module:%d Core:%d Thread:%d\n",
693 ProcessorIndex += NumberOfProcessorsInHob;
696 if (CoreTypes !=
NULL) {
724 &gEfiVectorHandoffInfoPpiGuid,
727 (VOID **)&VectorHandoffInfoPpi
730 VectorInfo = VectorHandoffInfoPpi->Info;
736 Status = InitializeCpuExceptionHandlers (VectorInfo);
737 if (EFI_ERROR (Status)) {
742 if (EFI_ERROR (Status)) {
VOID *EFIAPI BuildGuidHob(IN CONST EFI_GUID *Guid, IN UINTN DataLength)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID CollectBistDataFromPpi(IN CONST EFI_PEI_SERVICES **PeiServices)
UINT32 EFIAPI AsmCpuidEx(IN UINT32 Index, IN UINT32 SubIndex, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
VOID EFIAPI InitializeExceptionStackSwitchHandlers(IN OUT VOID *Buffer)
EFI_STATUS EFIAPI CpuMpPeimInit(IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices)
EFI_STATUS EFIAPI PeiGetProcessorInfo(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
VOID InitializeMpExceptionStackSwitchHandlers(VOID)
EFI_STATUS EFIAPI PeiWhoAmI(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, OUT UINTN *ProcessorNumber)
EFI_STATUS EFIAPI PeiStartupAllAPs(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN UINTN TimeoutInMicroSeconds, IN VOID *ProcedureArgument OPTIONAL)
VOID BuildMpInformationHob(VOID)
EFI_STATUS EFIAPI PeiEnableDisableAP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
EFI_STATUS EFIAPI PeiSwitchBSP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableOldBSP)
EFI_STATUS InitializeCpuMpWorker(IN CONST EFI_PEI_SERVICES **PeiServices)
VOID EFIAPI GetProcessorCoreType(IN OUT VOID *Buffer)
EFI_STATUS EFIAPI PeiStartupThisAP(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL)
EFI_STATUS EFIAPI PeiGetNumberOfProcessors(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_MP_SERVICES_PPI *This, OUT UINTN *NumberOfProcessors, OUT UINTN *NumberOfEnabledProcessors)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
EFI_STATUS EFIAPI PeiServicesLocatePpi(IN CONST EFI_GUID *Guid, IN UINTN Instance, IN OUT EFI_PEI_PPI_DESCRIPTOR **PpiDescriptor, IN OUT VOID **Ppi)
EFI_STATUS EFIAPI PeiServicesNotifyPpi(IN CONST EFI_PEI_NOTIFY_DESCRIPTOR *NotifyList)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
#define CPUID_HYBRID_INFORMATION_MAIN_LEAF
#define CPUID_HYBRID_INFORMATION
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
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 CPU_V2_EXTENDED_TOPOLOGY
#define PcdGetBool(TokenName)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
VOID * EFI_PEI_FILE_HANDLE
VOID *EFIAPI AllocatePages(IN UINTN Pages)
#define EFI_SIZE_TO_PAGES(Size)
EXTENDED_PROCESSOR_INFORMATION ExtendedInformation
EFI_CPU_PHYSICAL_LOCATION Location
struct CPUID_NATIVE_MODEL_ID_AND_CORE_TYPE_EAX::@748 Bits
EFI_CPU_PHYSICAL_LOCATION2 Location2