15#define INVALID_APIC_ID 0xFFFFFFFF
17EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID;
31 return CpuData->State;
47 CpuData->State = State;
63 CpuNum =
CsrRead (LOONGARCH_CSR_CPUID);
65 return CpuNum & 0x3ff;
83 UINTN TotalProcessorNumber;
89 TotalProcessorNumber = CpuMpData->CpuCount;
90 for (Index = 0; Index < TotalProcessorNumber; Index++) {
91 if (CpuInfoInHob[Index].ApicId ==
GetApicId ()) {
92 *ProcessorNumber = Index;
120 volatile UINT32 *StartupApSignal;
122 ApCount = CpuMpData->CpuCount - 1;
126 for (Index1 = (
PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1); Index1 > 0; Index1--) {
127 if (CpuInfoInHob[Index1].ApicId != INVALID_APIC_ID) {
128 if (Index1 == ApCount) {
131 for ( ; Index2 <= ApCount; Index2++) {
132 if (CpuInfoInHob[Index2].ApicId == INVALID_APIC_ID) {
134 CopyMem (CpuMpData->CpuData + Index2, CpuMpData->CpuData + Index1, sizeof (
CPU_AP_DATA));
135 CpuInfoInHob[Index1].ApicId = INVALID_APIC_ID;
145 for (Index1 = 0; Index1 < ApCount; Index1++) {
150 ApicId = CpuInfoInHob[Index1].ApicId;
151 for (Index2 = Index1 + 1; Index2 <= ApCount; Index2++) {
152 if (ApicId > CpuInfoInHob[Index2].ApicId) {
154 ApicId = CpuInfoInHob[Index2].ApicId;
158 if (Index3 != Index1) {
161 &CpuInfoInHob[Index3],
162 &CpuInfoInHob[Index1],
170 StartupApSignal = CpuMpData->CpuData[Index3].StartupApSignal;
171 CpuMpData->CpuData[Index3].StartupApSignal =
172 CpuMpData->CpuData[Index1].StartupApSignal;
173 CpuMpData->CpuData[Index1].StartupApSignal = StartupApSignal;
181 for (Index1 = 0; Index1 < CpuMpData->CpuCount; Index1++) {
182 if (CpuInfoInHob[Index1].ApicId == ApicId) {
183 CpuMpData->BspNumber = (UINT32)Index1;
206 if (GuidHob !=
NULL) {
207 DataInHob = GET_GUID_HOB_DATA (GuidHob);
230 ProcessorResourceData =
NULL;
235 CpuMpData->ApLoopMode = ApInRunLoop;
245 if (ProcessorResourceData !=
NULL) {
246 CpuMpData->ApLoopMode = ApInHltLoop;
247 CpuMpData->CpuCount = ProcessorResourceData->NumberOfProcessor;
250 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
251 CpuInfoInHob[Index].ApicId = ProcessorResourceData->ApicId[Index];
258 CpuMpData->InitFlag = ApInitConfig;
260 CpuMpData->InitFlag = ApInitDone;
266 CpuMpData->CpuCount = CpuMpData->FinishedCount + 1;
267 ASSERT (CpuMpData->CpuCount <=
PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
272 while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
281 DEBUG ((DEBUG_INFO,
"MpInitLib: Find %d processors in system.\n", CpuMpData->CpuCount));
283 return CpuMpData->CpuCount;
305 CpuInfoInHob[ProcessorNumber].ApicId =
GetApicId ();
306 CpuInfoInHob[ProcessorNumber].Health = BistData;
308 CpuMpData->CpuData[ProcessorNumber].Waiting =
FALSE;
309 CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ?
TRUE :
FALSE;
312 SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);
332 UINTN ProcessorNumber;
333 volatile UINT32 *ApStartupSignalBuffer;
337 CpuMpData = ExchangeInfo->CpuMpData;
340 if (CpuMpData->InitFlag == ApInitConfig) {
341 ProcessorNumber = ApIndex;
346 ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
356 ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
358 (UINT32 *)ApStartupSignalBuffer,
366 if (
GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateReady) {
367 Procedure = (
EFI_AP_PROCEDURE)CpuMpData->CpuData[ProcessorNumber].ApFunction;
368 Parameter = (VOID *)CpuMpData->CpuData[ProcessorNumber].ApFunctionArgument;
369 if (Procedure !=
NULL) {
370 SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateBusy);
371 Procedure (Parameter);
374 SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateFinished);
387 IoCsrWrite64 (LOONGARCH_IOCSR_MBUF0, 0x0);
388 IoCsrWrite64 (LOONGARCH_IOCSR_MBUF1, 0x0);
389 IoCsrWrite64 (LOONGARCH_IOCSR_MBUF2, 0x0);
390 IoCsrWrite64 (LOONGARCH_IOCSR_MBUF3, 0x0);
395 EnableLocalInterrupts (BIT12);
396 IoCsrWrite32 (LOONGARCH_IOCSR_IPI_EN, 0xFFFFFFFFU);
412 if (CpuMpData != ExchangeInfo->CpuMpData) {
413 CpuMpData = ExchangeInfo->CpuMpData;
415 ApStartupSignalBuffer = CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
421 if (*ApStartupSignalBuffer == WAKEUP_AP_SIGNAL) {
445 IN UINTN TimeoutInMicroseconds,
446 OUT UINT64 *CurrentTime
449 UINT64 TimeoutInSeconds;
450 UINT64 TimestampCounterFreq;
461 if (TimeoutInMicroseconds == 0) {
478 TimeoutInSeconds =
DivU64x32 (TimeoutInMicroseconds, 1000000);
483 return MultU64x64 (TimestampCounterFreq, TimeoutInSeconds);
491 TimestampCounterFreq,
492 TimeoutInMicroseconds
521 IN OUT UINT64 *PreviousTime,
522 IN UINT64 *TotalTime,
544 Delta = (INT64)(CurrentTime - *PreviousTime);
554 *PreviousTime = CurrentTime;
555 if (*TotalTime > Timeout) {
573 IN UINT32 FinishedApLimit,
581 if (TimeLimit == 0) {
585 CpuMpData->TotalTime = 0;
588 &CpuMpData->CurrentTime
590 while (CpuMpData->FinishedCount < FinishedApLimit &&
592 &CpuMpData->CurrentTime,
593 &CpuMpData->TotalTime,
594 CpuMpData->ExpectedTime
600 if (CpuMpData->FinishedCount >= FinishedApLimit) {
603 "%a: reached FinishedApLimit=%u in %Lu microseconds\n",
622 IN volatile UINT32 *ApStartupSignalBuffer
630 (UINT32 *)ApStartupSignalBuffer,
652 if (!CpuMpData->MpCpuExchangeInfo) {
656 ExchangeInfo = CpuMpData->MpCpuExchangeInfo;
657 ExchangeInfo->CpuMpData = CpuMpData;
674 IN BOOLEAN Broadcast,
677 IN VOID *ProcedureArgument OPTIONAL,
678 IN BOOLEAN WakeUpDisabledAps
686 CpuMpData->FinishedCount = 0;
690 if (CpuMpData->InitFlag != ApInitDone) {
694 ExchangeInfo = CpuMpData->MpCpuExchangeInfo;
698 if (CpuMpData->InitFlag == ApInitConfig) {
700 if (CpuMpData->ApLoopMode == ApInHltLoop) {
701 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
702 if (Index != CpuMpData->BspNumber) {
704 LOONGARCH_IOCSR_MBUF_SEND,
705 (IOCSR_MBUF_SEND_BLOCKING |
706 (IOCSR_MBUF_SEND_BOX_HI (0x3) << IOCSR_MBUF_SEND_BOX_SHIFT) |
707 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
708 ((
UINTN)(ExchangeInfo) & IOCSR_MBUF_SEND_H32_MASK))
711 LOONGARCH_IOCSR_MBUF_SEND,
712 (IOCSR_MBUF_SEND_BLOCKING |
713 (IOCSR_MBUF_SEND_BOX_LO (0x3) << IOCSR_MBUF_SEND_BOX_SHIFT) |
714 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
715 ((
UINTN)ExchangeInfo) << IOCSR_MBUF_SEND_BUF_SHIFT)
719 LOONGARCH_IOCSR_MBUF_SEND,
720 (IOCSR_MBUF_SEND_BLOCKING |
721 (IOCSR_MBUF_SEND_BOX_HI (0x0) << IOCSR_MBUF_SEND_BOX_SHIFT) |
722 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
726 LOONGARCH_IOCSR_MBUF_SEND,
727 (IOCSR_MBUF_SEND_BLOCKING |
728 (IOCSR_MBUF_SEND_BOX_LO (0x0) << IOCSR_MBUF_SEND_BOX_SHIFT) |
729 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
737 LOONGARCH_IOCSR_IPI_SEND,
738 (IOCSR_MBUF_SEND_BLOCKING |
739 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
746 IoCsrWrite64 (LOONGARCH_IOCSR_MBUF3, (
UINTN)ExchangeInfo);
752 PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
753 PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
757 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
758 if (Index != CpuMpData->BspNumber) {
759 CpuData = &CpuMpData->CpuData[Index];
760 if ((
GetApState (CpuData) == CpuStateDisabled) && !WakeUpDisabledAps) {
764 CpuData->ApFunction = (
UINTN)Procedure;
765 CpuData->ApFunctionArgument = (
UINTN)ProcedureArgument;
767 *(UINT32 *)CpuData->StartupApSignal = WAKEUP_AP_SIGNAL;
773 LOONGARCH_IOCSR_IPI_SEND,
774 (IOCSR_MBUF_SEND_BLOCKING |
775 (CpuInfoInHob[Index].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
785 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
786 CpuData = &CpuMpData->CpuData[Index];
787 if (Index != CpuMpData->BspNumber) {
792 CpuData = &CpuMpData->CpuData[ProcessorNumber];
793 CpuData->ApFunction = (
UINTN)Procedure;
794 CpuData->ApFunctionArgument = (
UINTN)ProcedureArgument;
799 *(UINT32 *)CpuData->StartupApSignal = WAKEUP_AP_SIGNAL;
805 LOONGARCH_IOCSR_IPI_SEND,
806 (IOCSR_MBUF_SEND_BLOCKING |
807 (CpuInfoInHob[ProcessorNumber].ApicId << IOCSR_MBUF_SEND_CPU_SHIFT) |
836 UINTN ProcessorNumber;
841 for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
842 if (CpuMpData->CpuData[ProcessorNumber].Waiting) {
843 *NextProcessorNumber = ProcessorNumber;
848 return EFI_NOT_FOUND;
871 CpuData = &CpuMpData->CpuData[ProcessorNumber];
876 if (
GetApState (CpuData) == CpuStateFinished) {
877 if (CpuData->Finished !=
NULL) {
878 *(CpuData->Finished) =
TRUE;
887 if (
CheckTimeout (&CpuData->CurrentTime, &CpuData->TotalTime, CpuData->ExpectedTime)) {
888 if (CpuData->Finished !=
NULL) {
889 *(CpuData->Finished) =
FALSE;
896 return EFI_NOT_READY;
914 UINTN ProcessorNumber;
915 UINTN NextProcessorNumber;
922 NextProcessorNumber = 0;
927 for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
928 if (!CpuMpData->CpuData[ProcessorNumber].Waiting) {
932 CpuData = &CpuMpData->CpuData[ProcessorNumber];
938 if (
GetApState (CpuData) == CpuStateFinished) {
939 CpuMpData->RunningCount--;
940 CpuMpData->CpuData[ProcessorNumber].Waiting =
FALSE;
946 if (CpuMpData->SingleThread) {
949 if (!EFI_ERROR (Status)) {
953 (UINT32)NextProcessorNumber,
954 CpuMpData->Procedure,
955 CpuMpData->ProcArguments,
966 if (CpuMpData->RunningCount == 0) {
974 &CpuMpData->CurrentTime,
975 &CpuMpData->TotalTime,
976 CpuMpData->ExpectedTime
983 return EFI_NOT_READY;
1021 IN BOOLEAN SingleThread,
1022 IN BOOLEAN ExcludeBsp,
1024 IN UINTN TimeoutInMicroseconds,
1025 IN VOID *ProcedureArgument OPTIONAL,
1031 UINTN ProcessorCount;
1032 UINTN ProcessorNumber;
1035 BOOLEAN HasEnabledAp;
1040 if (FailedCpuList !=
NULL) {
1041 *FailedCpuList =
NULL;
1044 if ((CpuMpData->CpuCount == 1) && ExcludeBsp) {
1045 return EFI_NOT_STARTED;
1048 if (Procedure ==
NULL) {
1049 return EFI_INVALID_PARAMETER;
1056 if (CallerNumber != CpuMpData->BspNumber) {
1057 return EFI_DEVICE_ERROR;
1065 ProcessorCount = CpuMpData->CpuCount;
1066 HasEnabledAp =
FALSE;
1071 for (ProcessorNumber = 0; ProcessorNumber < ProcessorCount; ProcessorNumber++) {
1072 CpuData = &CpuMpData->CpuData[ProcessorNumber];
1073 if (ProcessorNumber != CpuMpData->BspNumber) {
1075 if (ApState != CpuStateDisabled) {
1076 HasEnabledAp =
TRUE;
1077 if (ApState != CpuStateIdle) {
1081 return EFI_NOT_READY;
1087 if (!HasEnabledAp && ExcludeBsp) {
1091 return EFI_NOT_STARTED;
1094 CpuMpData->RunningCount = 0;
1095 for (ProcessorNumber = 0; ProcessorNumber < ProcessorCount; ProcessorNumber++) {
1096 CpuData = &CpuMpData->CpuData[ProcessorNumber];
1097 CpuData->Waiting =
FALSE;
1098 if (ProcessorNumber != CpuMpData->BspNumber) {
1099 if (CpuData->State == CpuStateIdle) {
1103 CpuData->Waiting =
TRUE;
1104 CpuMpData->RunningCount++;
1109 CpuMpData->Procedure = Procedure;
1110 CpuMpData->ProcArguments = ProcedureArgument;
1111 CpuMpData->SingleThread = SingleThread;
1112 CpuMpData->FinishedCount = 0;
1114 TimeoutInMicroseconds,
1115 &CpuMpData->CurrentTime
1117 CpuMpData->TotalTime = 0;
1118 CpuMpData->WaitEvent = WaitEvent;
1120 if (!SingleThread) {
1123 for (ProcessorNumber = 0; ProcessorNumber < ProcessorCount; ProcessorNumber++) {
1124 if (ProcessorNumber == CallerNumber) {
1128 if (CpuMpData->CpuData[ProcessorNumber].Waiting) {
1129 WakeUpAP (CpuMpData,
FALSE, ProcessorNumber, Procedure, ProcedureArgument,
TRUE);
1139 Procedure (ProcedureArgument);
1143 if (WaitEvent ==
NULL) {
1146 }
while (Status == EFI_NOT_READY);
1180 IN UINTN TimeoutInMicroseconds,
1181 IN VOID *ProcedureArgument OPTIONAL,
1182 OUT BOOLEAN *Finished OPTIONAL
1192 if (Finished !=
NULL) {
1200 if (CallerNumber != CpuMpData->BspNumber) {
1201 return EFI_DEVICE_ERROR;
1207 if (ProcessorNumber >= CpuMpData->CpuCount) {
1208 return EFI_NOT_FOUND;
1214 if (ProcessorNumber == CpuMpData->BspNumber) {
1215 return EFI_INVALID_PARAMETER;
1221 if (Procedure ==
NULL) {
1222 return EFI_INVALID_PARAMETER;
1233 if (
GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateDisabled) {
1234 return EFI_INVALID_PARAMETER;
1237 CpuData = &CpuMpData->CpuData[ProcessorNumber];
1238 CpuData->WaitEvent = WaitEvent;
1239 CpuData->Finished = Finished;
1240 CpuData->ExpectedTime =
CalculateTimeout (TimeoutInMicroseconds, &CpuData->CurrentTime);
1241 CpuData->TotalTime = 0;
1250 if (WaitEvent ==
NULL) {
1253 }
while (Status == EFI_NOT_READY);
1289 IN UINTN TimeoutInMicroseconds,
1290 IN VOID *ProcedureArgument OPTIONAL
1298 TimeoutInMicroseconds,
1325 UINT32 MaxLogicalProcessorNumber;
1327 UINTN MonitorBufferSize;
1333 if (OldCpuMpData ==
NULL) {
1334 MaxLogicalProcessorNumber =
PcdGet32 (PcdCpuMaxLogicalProcessorNumber);
1336 MaxLogicalProcessorNumber = OldCpuMpData->CpuCount;
1339 ASSERT (MaxLogicalProcessorNumber != 0);
1341 MonitorBufferSize =
sizeof (WAKEUP_AP_SIGNAL) * MaxLogicalProcessorNumber;
1344 BufferSize += MonitorBufferSize;
1348 ASSERT (MpBuffer !=
NULL);
1349 ZeroMem (MpBuffer, BufferSize);
1353 CpuMpData->CpuCount = 1;
1354 CpuMpData->BspNumber = 0;
1355 CpuMpData->CpuData = (
CPU_AP_DATA *)(CpuMpData + 1);
1356 CpuMpData->CpuInfoInHob = (UINT64)(
UINTN)(CpuMpData->CpuData + MaxLogicalProcessorNumber);
1368 for (Index = 0; Index < MaxLogicalProcessorNumber; Index++) {
1369 CpuMpData->CpuData[Index].StartupApSignal =
1370 (UINT32 *)((MpBuffer + BufferSize - MonitorBufferSize) + (
sizeof (WAKEUP_AP_SIGNAL) * Index));
1371 if ((OldCpuMpData ==
NULL) && (Index != CpuMpData->BspNumber)) {
1372 ((
CPU_INFO_IN_HOB *)CpuMpData->CpuInfoInHob)[Index].ApicId = INVALID_APIC_ID;
1376 if (OldCpuMpData ==
NULL) {
1377 if (MaxLogicalProcessorNumber > 1) {
1388 CpuMpData->CpuCount = OldCpuMpData->CpuCount;
1389 CpuMpData->BspNumber = OldCpuMpData->BspNumber;
1390 CpuMpData->CpuInfoInHob = OldCpuMpData->CpuInfoInHob;
1391 CpuMpData->MpCpuExchangeInfo = OldCpuMpData->MpCpuExchangeInfo;
1394 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
1396 CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 0) ?
TRUE :
FALSE;
1399 if (CpuMpData->CpuCount > 1) {
1405 CpuMpData->InitFlag = ApInitReconfig;
1411 while (CpuMpData->FinishedCount < (CpuMpData->CpuCount - 1)) {
1415 CpuMpData->InitFlag = ApInitDone;
1418 if (MaxLogicalProcessorNumber > 1) {
1419 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
1420 SetApState (&CpuMpData->CpuData[Index], CpuStateIdle);
1469 if (CallerNumber != CpuMpData->BspNumber) {
1470 return EFI_DEVICE_ERROR;
1473 if (ProcessorInfoBuffer ==
NULL) {
1474 return EFI_INVALID_PARAMETER;
1477 if (ProcessorNumber >= CpuMpData->CpuCount) {
1478 return EFI_NOT_FOUND;
1481 ProcessorInfoBuffer->ProcessorId = (UINT64)CpuInfoInHob[ProcessorNumber].ApicId;
1482 ProcessorInfoBuffer->StatusFlag = 0;
1483 if (ProcessorNumber == CpuMpData->BspNumber) {
1487 if (CpuMpData->CpuData[ProcessorNumber].CpuHealthy) {
1491 if (
GetApState (&CpuMpData->CpuData[ProcessorNumber]) == CpuStateDisabled) {
1492 ProcessorInfoBuffer->StatusFlag &= ~PROCESSOR_ENABLED_BIT;
1497 if (HealthData !=
NULL) {
1498 HealthData->Uint32 = CpuInfoInHob[ProcessorNumber].Health;
1528 if (ProcessorNumber ==
NULL) {
1529 return EFI_INVALID_PARAMETER;
1560 OUT UINTN *NumberOfProcessors OPTIONAL,
1561 OUT UINTN *NumberOfEnabledProcessors OPTIONAL
1566 UINTN ProcessorNumber;
1567 UINTN EnabledProcessorNumber;
1572 if ((NumberOfProcessors ==
NULL) && (NumberOfEnabledProcessors ==
NULL)) {
1573 return EFI_INVALID_PARAMETER;
1580 if (CallerNumber != CpuMpData->BspNumber) {
1581 return EFI_DEVICE_ERROR;
1584 ProcessorNumber = CpuMpData->CpuCount;
1585 EnabledProcessorNumber = 0;
1586 for (Index = 0; Index < ProcessorNumber; Index++) {
1587 if (
GetApState (&CpuMpData->CpuData[Index]) != CpuStateDisabled) {
1588 EnabledProcessorNumber++;
1592 if (NumberOfProcessors !=
NULL) {
1593 *NumberOfProcessors = ProcessorNumber;
1596 if (NumberOfEnabledProcessors !=
NULL) {
1597 *NumberOfEnabledProcessors = EnabledProcessorNumber;
1620 if (GuidHob !=
NULL) {
1621 DataInHob = GET_GUID_HOB_DATA (GuidHob);
UINT64 EFIAPI GetPerformanceCounterProperties(OUT UINT64 *StartValue OPTIONAL, OUT UINT64 *EndValue OPTIONAL)
UINT64 EFIAPI GetPerformanceCounter(VOID)
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
UINT64 EFIAPI DivU64x32(IN UINT64 Dividend, IN UINT32 Divisor)
UINT64 EFIAPI MultU64x64(IN UINT64 Multiplicand, IN UINT64 Multiplier)
VOID EFIAPI CpuPause(VOID)
VOID EFIAPI EnableInterrupts(VOID)
VOID EFIAPI DisableInterrupts(VOID)
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
UINT64 EFIAPI DivU64x64Remainder(IN UINT64 Dividend, IN UINT64 Divisor, OUT UINT64 *Remainder OPTIONAL)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID EFIAPI CpuSleep(VOID)
UINTN EFIAPI CsrRead(IN UINT16 Select)
VOID CheckAndUpdateApsStatus(VOID)
CPU_MP_DATA * GetCpuMpData(VOID)
VOID InitMpGlobalData(IN CPU_MP_DATA *CpuMpData)
PROCESSOR_RESOURCE_DATA * GetProcessorResourceDataFromGuidedHob(VOID)
EFI_STATUS StartupThisAPWorker(IN EFI_AP_PROCEDURE Procedure, IN UINTN ProcessorNumber, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT BOOLEAN *Finished OPTIONAL)
CPU_STATE GetApState(IN CPU_AP_DATA *CpuData)
CPU_MP_DATA * GetCpuMpDataFromGuidedHob(VOID)
VOID EFIAPI ApWakeupFunction(IN UINTN ApIndex, IN MP_CPU_EXCHANGE_INFO *ExchangeInfo)
EFI_STATUS EFIAPI MpInitLibWhoAmI(OUT UINTN *ProcessorNumber)
EFI_STATUS EFIAPI MpInitLibGetNumberOfProcessors(OUT UINTN *NumberOfProcessors OPTIONAL, OUT UINTN *NumberOfEnabledProcessors OPTIONAL)
VOID SortApicId(IN CPU_MP_DATA *CpuMpData)
VOID WakeUpAP(IN CPU_MP_DATA *CpuMpData, IN BOOLEAN Broadcast, IN UINTN ProcessorNumber, IN EFI_AP_PROCEDURE Procedure OPTIONAL, IN VOID *ProcedureArgument OPTIONAL, IN BOOLEAN WakeUpDisabledAps)
UINT64 CalculateTimeout(IN UINTN TimeoutInMicroseconds, OUT UINT64 *CurrentTime)
EFI_STATUS EFIAPI MpInitLibStartupAllCPUs(IN EFI_AP_PROCEDURE Procedure, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL)
VOID TimedWaitForApFinish(IN CPU_MP_DATA *CpuMpData, IN UINT32 FinishedApLimit, IN UINT32 TimeLimit)
VOID WaitApWakeup(IN volatile UINT32 *ApStartupSignalBuffer)
EFI_STATUS EFIAPI MpInitLibGetProcessorInfo(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer, OUT EFI_HEALTH_FLAGS *HealthData OPTIONAL)
EFI_STATUS GetProcessorNumber(IN CPU_MP_DATA *CpuMpData, OUT UINTN *ProcessorNumber)
BOOLEAN CheckTimeout(IN OUT UINT64 *PreviousTime, IN UINT64 *TotalTime, IN UINT64 Timeout)
UINTN CollectProcessorCount(IN CPU_MP_DATA *CpuMpData)
VOID FillExchangeInfoData(IN CPU_MP_DATA *CpuMpData)
EFI_STATUS StartupAllCPUsWorker(IN EFI_AP_PROCEDURE Procedure, IN BOOLEAN SingleThread, IN BOOLEAN ExcludeBsp, IN EFI_EVENT WaitEvent OPTIONAL, IN UINTN TimeoutInMicroseconds, IN VOID *ProcedureArgument OPTIONAL, OUT UINTN **FailedCpuList OPTIONAL)
EFI_STATUS CheckThisAP(IN UINTN ProcessorNumber)
VOID InitializeApData(IN OUT CPU_MP_DATA *CpuMpData, IN UINTN ProcessorNumber, IN UINT32 BistData)
VOID SetApState(IN CPU_AP_DATA *CpuData, IN CPU_STATE State)
EFI_STATUS EFIAPI MpInitLibInitialize(VOID)
EFI_STATUS CheckAllAPs(VOID)
EFI_STATUS GetNextWaitingProcessorNumber(OUT UINTN *NextProcessorNumber)
#define DEBUG(Expression)
#define PROCESSOR_HEALTH_STATUS_BIT
#define PROCESSOR_AS_BSP_BIT
#define PROCESSOR_ENABLED_BIT
#define PcdGet32(TokenName)
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
UINT32 EFIAPI InterlockedIncrement(IN volatile UINT32 *Value)
SPIN_LOCK *EFIAPI AcquireSpinLock(IN OUT SPIN_LOCK *SpinLock)
UINT32 EFIAPI InterlockedCompareExchange32(IN OUT volatile UINT32 *Value, IN UINT32 CompareValue, IN UINT32 ExchangeValue)
SPIN_LOCK *EFIAPI InitializeSpinLock(OUT SPIN_LOCK *SpinLock)
SPIN_LOCK *EFIAPI ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock)
#define EFI_SIZE_TO_PAGES(Size)