Lines Matching refs:PeiCpuMpData

57   IN PEI_CPU_MP_DATA   *PeiCpuMpData  in SortApicId()  argument
67 ApCount = PeiCpuMpData->CpuCount - 1; in SortApicId()
75 ApicId = PeiCpuMpData->CpuData[Index1].ApicId; in SortApicId()
77 if (ApicId > PeiCpuMpData->CpuData[Index2].ApicId) { in SortApicId()
79 ApicId = PeiCpuMpData->CpuData[Index2].ApicId; in SortApicId()
83 CopyMem (&CpuData, &PeiCpuMpData->CpuData[Index3], sizeof (PEI_CPU_DATA)); in SortApicId()
85 &PeiCpuMpData->CpuData[Index3], in SortApicId()
86 &PeiCpuMpData->CpuData[Index1], in SortApicId()
89 CopyMem (&PeiCpuMpData->CpuData[Index1], &CpuData, sizeof (PEI_CPU_DATA)); in SortApicId()
97 for (Index1 = 0; Index1 < PeiCpuMpData->CpuCount; Index1++) { in SortApicId()
98 if (PeiCpuMpData->CpuData[Index1].ApicId == ApicId) { in SortApicId()
99 PeiCpuMpData->BspNumber = (UINT32) Index1; in SortApicId()
272 PEI_CPU_MP_DATA *PeiCpuMpData; in ApCFunction() local
278 PeiCpuMpData = ExchangeInfo->PeiCpuMpData; in ApCFunction()
280 if (PeiCpuMpData->InitFlag) { in ApCFunction()
285 RestoreVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters, FALSE); in ApCFunction()
289 …BistData = *(UINTN *) (PeiCpuMpData->Buffer + ProcessorNumber * PeiCpuMpData->CpuApStackSize - siz… in ApCFunction()
290 PeiCpuMpData->CpuData[ProcessorNumber].Health.Uint32 = (UINT32) BistData; in ApCFunction()
291 PeiCpuMpData->CpuData[ProcessorNumber].ApicId = GetInitialApicId (); in ApCFunction()
292 if (PeiCpuMpData->CpuData[ProcessorNumber].ApicId >= 0xFF) { in ApCFunction()
297 AcquireSpinLock(&PeiCpuMpData->MpLock); in ApCFunction()
298 PeiCpuMpData->X2ApicEnable = TRUE; in ApCFunction()
299 ReleaseSpinLock(&PeiCpuMpData->MpLock); in ApCFunction()
304 MtrrSetAllMtrrs (&PeiCpuMpData->MtrrTable); in ApCFunction()
306 PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle; in ApCFunction()
311 GetProcessorNumber (PeiCpuMpData, &ProcessorNumber); in ApCFunction()
312 if (PeiCpuMpData->ApLoopMode == ApInHltLoop) { in ApCFunction()
316 RestoreVolatileRegisters (&PeiCpuMpData->CpuData[ProcessorNumber].VolatileRegisters, TRUE); in ApCFunction()
319 if ((PeiCpuMpData->CpuData[ProcessorNumber].State != CpuStateDisabled) && in ApCFunction()
320 (PeiCpuMpData->ApFunction != 0)) { in ApCFunction()
321 PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateBusy; in ApCFunction()
322 Procedure = (EFI_AP_PROCEDURE)(UINTN)PeiCpuMpData->ApFunction; in ApCFunction()
326 Procedure ((VOID *)(UINTN)PeiCpuMpData->ApFunctionArgument); in ApCFunction()
330 GetProcessorNumber (PeiCpuMpData, &ProcessorNumber); in ApCFunction()
331 PeiCpuMpData->CpuData[ProcessorNumber].State = CpuStateIdle; in ApCFunction()
338 InterlockedIncrement ((UINT32 *)&PeiCpuMpData->FinishedCount); in ApCFunction()
343 if (PeiCpuMpData->ApLoopMode == ApInHltLoop) { in ApCFunction()
347 SaveVolatileRegisters (&PeiCpuMpData->CpuData[ProcessorNumber].VolatileRegisters); in ApCFunction()
357 ApStartupSignalBuffer = PeiCpuMpData->CpuData[ProcessorNumber].StartupApSignal; in ApCFunction()
364 if (PeiCpuMpData->ApLoopMode == ApInMwaitLoop) { in ApCFunction()
374 AsmMwait (PeiCpuMpData->ApTargetCState << 4, 0); in ApCFunction()
376 } else if (PeiCpuMpData->ApLoopMode == ApInRunLoop) { in ApCFunction()
408 IN PEI_CPU_MP_DATA *PeiCpuMpData, in WakeUpAP() argument
418 PeiCpuMpData->ApFunction = (UINTN) Procedure; in WakeUpAP()
419 PeiCpuMpData->ApFunctionArgument = (UINTN) ProcedureArgument; in WakeUpAP()
420 PeiCpuMpData->FinishedCount = 0; in WakeUpAP()
422 ExchangeInfo = PeiCpuMpData->MpCpuExchangeInfo; in WakeUpAP()
424 ExchangeInfo->StackStart = PeiCpuMpData->Buffer; in WakeUpAP()
425 ExchangeInfo->StackSize = PeiCpuMpData->CpuApStackSize; in WakeUpAP()
426 ExchangeInfo->BufferStart = PeiCpuMpData->WakeupBuffer; in WakeUpAP()
427 ExchangeInfo->PmodeOffset = PeiCpuMpData->AddressMap.PModeEntryOffset; in WakeUpAP()
428 ExchangeInfo->LmodeOffset = PeiCpuMpData->AddressMap.LModeEntryOffset; in WakeUpAP()
432 ExchangeInfo->PeiCpuMpData = PeiCpuMpData; in WakeUpAP()
440 if (PeiCpuMpData->ApLoopMode == ApInMwaitLoop) { in WakeUpAP()
445 PeiCpuMpData->ApTargetCState = PcdGet8 (PcdCpuApTargetCstate); in WakeUpAP()
451 if (PeiCpuMpData->ApLoopMode == ApInHltLoop || PeiCpuMpData->InitFlag) { in WakeUpAP()
456 PeiCpuMpData->CpuData[ProcessorNumber].ApicId, in WakeUpAP()
460 } else if ((PeiCpuMpData->ApLoopMode == ApInMwaitLoop) || in WakeUpAP()
461 (PeiCpuMpData->ApLoopMode == ApInRunLoop)) { in WakeUpAP()
463 for (Index = 0; Index < PeiCpuMpData->CpuCount; Index++) { in WakeUpAP()
464 if (Index != PeiCpuMpData->BspNumber) { in WakeUpAP()
465 *(PeiCpuMpData->CpuData[Index].StartupApSignal) = WAKEUP_AP_SIGNAL; in WakeUpAP()
469 *(PeiCpuMpData->CpuData[ProcessorNumber].StartupApSignal) = WAKEUP_AP_SIGNAL; in WakeUpAP()
556 IN PEI_CPU_MP_DATA *PeiCpuMpData in BackupAndPrepareWakeupBuffer() argument
560 (VOID *) PeiCpuMpData->BackupBuffer, in BackupAndPrepareWakeupBuffer()
561 (VOID *) PeiCpuMpData->WakeupBuffer, in BackupAndPrepareWakeupBuffer()
562 PeiCpuMpData->BackupBufferSize in BackupAndPrepareWakeupBuffer()
565 (VOID *) PeiCpuMpData->WakeupBuffer, in BackupAndPrepareWakeupBuffer()
566 (VOID *) PeiCpuMpData->AddressMap.RendezvousFunnelAddress, in BackupAndPrepareWakeupBuffer()
567 PeiCpuMpData->AddressMap.RendezvousFunnelSize in BackupAndPrepareWakeupBuffer()
578 IN PEI_CPU_MP_DATA *PeiCpuMpData in RestoreWakeupBuffer() argument
581 …CopyMem ((VOID *) PeiCpuMpData->WakeupBuffer, (VOID *) PeiCpuMpData->BackupBuffer, PeiCpuMpData->B… in RestoreWakeupBuffer()
593 IN PEI_CPU_MP_DATA *PeiCpuMpData in CountProcessorNumber() argument
603 MtrrGetAllMtrrs (&PeiCpuMpData->MtrrTable); in CountProcessorNumber()
612 PeiCpuMpData->InitFlag = TRUE; in CountProcessorNumber()
613 PeiCpuMpData->X2ApicEnable = FALSE; in CountProcessorNumber()
614 WakeUpAP (PeiCpuMpData, TRUE, 0, NULL, NULL); in CountProcessorNumber()
619 PeiCpuMpData->InitFlag = FALSE; in CountProcessorNumber()
620 PeiCpuMpData->CpuCount += (UINT32)PeiCpuMpData->MpCpuExchangeInfo->NumApsExecuting; in CountProcessorNumber()
621 ASSERT (PeiCpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber)); in CountProcessorNumber()
625 while (PeiCpuMpData->FinishedCount < (PeiCpuMpData->CpuCount - 1)) { in CountProcessorNumber()
629 if (PeiCpuMpData->X2ApicEnable) { in CountProcessorNumber()
634 WakeUpAP (PeiCpuMpData, TRUE, 0, ApFuncEnableX2Apic, NULL); in CountProcessorNumber()
638 while (PeiCpuMpData->FinishedCount < (PeiCpuMpData->CpuCount - 1)) { in CountProcessorNumber()
650 SortApicId (PeiCpuMpData); in CountProcessorNumber()
653 DEBUG ((EFI_D_INFO, "CpuMpPei: Find %d processors in system.\n", PeiCpuMpData->CpuCount)); in CountProcessorNumber()
654 return PeiCpuMpData->CpuCount; in CountProcessorNumber()
671 PEI_CPU_MP_DATA *PeiCpuMpData; in PrepareAPStartupVector() local
704 PeiCpuMpData = (PEI_CPU_MP_DATA *) (UINTN) (Buffer + PcdGet32 (PcdCpuApStackSize) * MaxCpuCount); in PrepareAPStartupVector()
705 PeiCpuMpData->Buffer = (UINTN) Buffer; in PrepareAPStartupVector()
706 PeiCpuMpData->CpuApStackSize = PcdGet32 (PcdCpuApStackSize); in PrepareAPStartupVector()
707 PeiCpuMpData->WakeupBuffer = WakeupBuffer; in PrepareAPStartupVector()
708 PeiCpuMpData->BackupBuffer = (UINTN)PeiCpuMpData + sizeof (PEI_CPU_MP_DATA); in PrepareAPStartupVector()
709 PeiCpuMpData->BackupBufferSize = WakeupBufferSize; in PrepareAPStartupVector()
710PeiCpuMpData->MpCpuExchangeInfo = (MP_CPU_EXCHANGE_INFO *) (UINTN) (WakeupBuffer + AddressMap.Rend… in PrepareAPStartupVector()
712 PeiCpuMpData->CpuCount = 1; in PrepareAPStartupVector()
713 PeiCpuMpData->BspNumber = 0; in PrepareAPStartupVector()
714 PeiCpuMpData->CpuData = (PEI_CPU_DATA *) (PeiCpuMpData->BackupBuffer + in PrepareAPStartupVector()
715 PeiCpuMpData->BackupBufferSize); in PrepareAPStartupVector()
716 PeiCpuMpData->CpuData[0].ApicId = GetInitialApicId (); in PrepareAPStartupVector()
717 PeiCpuMpData->CpuData[0].Health.Uint32 = 0; in PrepareAPStartupVector()
718 PeiCpuMpData->EndOfPeiFlag = FALSE; in PrepareAPStartupVector()
719 InitializeSpinLock(&PeiCpuMpData->MpLock); in PrepareAPStartupVector()
720 SaveVolatileRegisters (&PeiCpuMpData->CpuData[0].VolatileRegisters); in PrepareAPStartupVector()
721 CopyMem (&PeiCpuMpData->AddressMap, &AddressMap, sizeof (MP_ASSEMBLY_ADDRESS_MAP)); in PrepareAPStartupVector()
725 PeiCpuMpData->ApLoopMode = ApLoopMode; in PrepareAPStartupVector()
726 DEBUG ((EFI_D_INFO, "AP Loop Mode is %d\n", PeiCpuMpData->ApLoopMode)); in PrepareAPStartupVector()
727 MonitorBuffer = (UINT8 *)(PeiCpuMpData->CpuData + MaxCpuCount); in PrepareAPStartupVector()
728 if (PeiCpuMpData->ApLoopMode != ApInHltLoop) { in PrepareAPStartupVector()
733 PeiCpuMpData->CpuData[Index].StartupApSignal = in PrepareAPStartupVector()
740 BackupAndPrepareWakeupBuffer(PeiCpuMpData); in PrepareAPStartupVector()
742 return PeiCpuMpData; in PrepareAPStartupVector()
768 PEI_CPU_MP_DATA *PeiCpuMpData; in CpuMpEndOfPeiCallback() local
777 PeiCpuMpData = GetMpHobData (); in CpuMpEndOfPeiCallback()
778 ASSERT (PeiCpuMpData != NULL); in CpuMpEndOfPeiCallback()
791 if(MemoryHob->AllocDescriptor.MemoryBaseAddress == PeiCpuMpData->WakeupBuffer) { in CpuMpEndOfPeiCallback()
802 RestoreWakeupBuffer (PeiCpuMpData); in CpuMpEndOfPeiCallback()
803 PeiCpuMpData->EndOfPeiFlag = TRUE; in CpuMpEndOfPeiCallback()
828 PEI_CPU_MP_DATA *PeiCpuMpData; in CpuMpPeimInit() local
838 PeiCpuMpData = PrepareAPStartupVector (); in CpuMpPeimInit()
842 ProcessorCount = CountProcessorNumber (PeiCpuMpData); in CpuMpPeimInit()
848 (VOID *)&PeiCpuMpData, in CpuMpPeimInit()
854 CollectBistDataFromPpi (PeiServices, PeiCpuMpData); in CpuMpPeimInit()