11CHAR16 *mDependTypeStr[] = { L
"None", L
"Thread", L
"Core", L
"Package", L
"Invalid" };
22 IN UINT8 *SupportedFeatureMask,
28 Status =
PcdSetPtrS (PcdCpuFeaturesCapability, &BitMaskSize, SupportedFeatureMask);
40 IN UINT8 *SupportedFeatureMask,
46 Status =
PcdSetPtrS (PcdCpuFeaturesSetting, &BitMaskSize, SupportedFeatureMask);
63 UINT32 DisplayedFamily;
64 UINT32 DisplayedModel;
68 DisplayedFamily = Eax.Bits.FamilyId;
69 if (Eax.Bits.FamilyId == 0x0F) {
70 DisplayedFamily += Eax.Bits.ExtendedFamilyId;
73 DisplayedModel = Eax.Bits.Model;
74 if ((Eax.Bits.FamilyId == 0x06) || (Eax.Bits.FamilyId == 0x0f)) {
75 DisplayedModel += (Eax.Bits.ExtendedModelId << 4);
78 CpuInfo->DisplayFamily = DisplayedFamily;
79 CpuInfo->DisplayModel = DisplayedModel;
80 CpuInfo->SteppingId = Eax.Bits.SteppingId;
81 CpuInfo->ProcessorType = Eax.Bits.ProcessorType;
82 CpuInfo->CpuIdVersionInfoEcx.Uint32 = Ecx.Uint32;
83 CpuInfo->CpuIdVersionInfoEdx.Uint32 = Edx.Uint32;
96 UINTN ProcessorNumber;
115 UINT32 *ThreadCountPerPackage;
116 UINT8 *ThreadCountPerCore;
118 UINTN NumberOfEnabledProcessors;
124 CpuFeaturesData =
NULL;
129 ThreadCountPerCore =
NULL;
130 ThreadCountPerPackage =
NULL;
133 if (CpuFeaturesData ==
NULL) {
134 ASSERT (CpuFeaturesData !=
NULL);
146 if (CpuFeaturesData->InitOrder ==
NULL) {
147 ASSERT (CpuFeaturesData->InitOrder !=
NULL);
157 while (!
IsNull (&CpuFeaturesData->FeatureList, Entry)) {
158 CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
159 ASSERT (CpuFeature->InitializeFunc !=
NULL);
160 if (CpuFeature->GetConfigDataFunc !=
NULL) {
161 CpuFeature->ConfigData = CpuFeature->GetConfigDataFunc (NumberOfCpus);
164 Entry = Entry->ForwardLink;
167 CpuFeaturesData->NumberOfCpus = (UINT32)NumberOfCpus;
170 if (AcpiCpuData ==
NULL) {
171 ASSERT (AcpiCpuData !=
NULL);
175 CpuFeaturesData->AcpiCpuData = AcpiCpuData;
177 CpuStatus = &AcpiCpuData->CpuFeatureInitData.CpuStatus;
178 CopyMem (&CpuStatusBackupBuffer, CpuStatus,
sizeof (CpuStatusBackupBuffer));
180 if (Location ==
NULL) {
181 ASSERT (Location !=
NULL);
188 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
189 InitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
190 InitOrder->FeaturesSupportedMask =
AllocateZeroPool (CpuFeaturesData->BitMaskSize);
191 if (InitOrder->FeaturesSupportedMask ==
NULL) {
192 ASSERT (InitOrder->FeaturesSupportedMask !=
NULL);
201 &ProcessorInfoBuffer,
205 &Location[ProcessorNumber],
232 CpuStatus->PackageCount = Package + 1;
233 CpuStatus->MaxCoreCount = Core + 1;
234 CpuStatus->MaxThreadCount = Thread + 1;
237 "Processor Info: Package: %d, MaxCore : %d, MaxThread: %d\n",
238 CpuStatus->PackageCount,
239 CpuStatus->MaxCoreCount,
240 CpuStatus->MaxThreadCount
247 if (ThreadCountPerPackage ==
NULL) {
248 ASSERT (ThreadCountPerPackage !=
NULL);
252 ZeroMem (ThreadCountPerPackage,
sizeof (UINT32) * CpuStatus->PackageCount);
256 if (ThreadCountPerCore ==
NULL) {
257 ASSERT (ThreadCountPerCore !=
NULL);
261 ZeroMem (ThreadCountPerCore,
sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount);
264 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
266 ThreadCountPerPackage[Location->
Package]++;
267 ThreadCountPerCore[Location->
Package * CpuStatus->MaxCoreCount + Location->
Core]++;
270 for (PackageIndex = 0; PackageIndex < CpuStatus->PackageCount; PackageIndex++) {
271 if (ThreadCountPerPackage[PackageIndex] != 0) {
272 DEBUG ((DEBUG_INFO,
"P%02d: Thread Count = %d\n", PackageIndex, ThreadCountPerPackage[PackageIndex]));
273 for (CoreIndex = 0; CoreIndex < CpuStatus->MaxCoreCount; CoreIndex++) {
274 if (ThreadCountPerCore[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex] != 0) {
277 " P%02d C%04d, Thread Count = %d\n",
280 ThreadCountPerCore[PackageIndex * CpuStatus->MaxCoreCount + CoreIndex]
287 CpuFeaturesData->CpuFlags.CoreSemaphoreCount =
AllocateZeroPool (
sizeof (UINT32) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount);
288 if (CpuFeaturesData->CpuFlags.CoreSemaphoreCount ==
NULL) {
289 ASSERT (CpuFeaturesData->CpuFlags.CoreSemaphoreCount !=
NULL);
293 CpuFeaturesData->CpuFlags.PackageSemaphoreCount =
AllocateZeroPool (
sizeof (UINT32) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount);
294 if (CpuFeaturesData->CpuFlags.PackageSemaphoreCount ==
NULL) {
295 ASSERT (CpuFeaturesData->CpuFlags.PackageSemaphoreCount !=
NULL);
303 Pages =
EFI_SIZE_TO_PAGES (CpuStatus->PackageCount * sizeof (UINT32) + CpuStatus->PackageCount * CpuStatus->MaxCoreCount * sizeof (UINT32));
305 if (FirstCore ==
NULL) {
306 ASSERT (FirstCore !=
NULL);
310 FirstThread = FirstCore + CpuStatus->PackageCount;
315 FirstPackage = MAX_UINT32;
316 SetMem32 (FirstCore, CpuStatus->PackageCount * sizeof (UINT32), MAX_UINT32);
317 SetMem32 (FirstThread, CpuStatus->PackageCount * CpuStatus->MaxCoreCount * sizeof (UINT32), MAX_UINT32);
319 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
325 FirstPackage =
MIN (Location->
Package, FirstPackage);
335 FirstThread[Location->
Package * CpuStatus->MaxCoreCount + Location->
Core] =
MIN (
337 FirstThread[Location->
Package * CpuStatus->MaxCoreCount + Location->
Core]
344 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
347 if (Location->
Package == FirstPackage) {
348 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Package = 1;
355 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Die = 1;
356 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Tile = 1;
357 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Module = 1;
359 if (Location->
Core == FirstCore[Location->
Package]) {
360 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Core = 1;
363 if (Location->
Thread == FirstThread[Location->
Package * CpuStatus->MaxCoreCount + Location->
Core]) {
364 CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo.
First.Thread = 1;
373 if (FirstCore !=
NULL) {
377 if ((CpuFeaturesData !=
NULL) && (CpuFeaturesData->CpuFlags.PackageSemaphoreCount !=
NULL)) {
378 FreePool ((VOID *)CpuFeaturesData->CpuFlags.PackageSemaphoreCount);
379 CpuFeaturesData->CpuFlags.PackageSemaphoreCount =
NULL;
382 if ((CpuFeaturesData !=
NULL) && (CpuFeaturesData->CpuFlags.CoreSemaphoreCount !=
NULL)) {
383 FreePool ((VOID *)CpuFeaturesData->CpuFlags.CoreSemaphoreCount);
384 CpuFeaturesData->CpuFlags.CoreSemaphoreCount =
NULL;
387 if ((ThreadCountPerCore !=
NULL) && (CpuStatus !=
NULL)) {
390 EFI_SIZE_TO_PAGES (
sizeof (UINT8) * CpuStatus->PackageCount * CpuStatus->MaxCoreCount)
394 if ((ThreadCountPerPackage !=
NULL) && (CpuStatus !=
NULL)) {
396 ThreadCountPerPackage,
401 if (InitOrder !=
NULL) {
402 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
403 InitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
404 if (InitOrder->FeaturesSupportedMask !=
NULL) {
405 FreePool (InitOrder->FeaturesSupportedMask);
406 InitOrder->FeaturesSupportedMask =
NULL;
411 if (Location !=
NULL) {
415 if (CpuFeaturesData->InitOrder !=
NULL) {
417 CpuFeaturesData->InitOrder =
NULL;
420 if (CpuStatus !=
NULL) {
421 CopyMem (CpuStatus, &CpuStatusBackupBuffer,
sizeof (*CpuStatus));
435 IN UINT8 *SupportedFeatureMask,
436 IN UINT8 *OrFeatureBitMask,
437 IN UINT32 BitMaskSize
444 Data1 = SupportedFeatureMask;
445 Data2 = OrFeatureBitMask;
446 for (Index = 0; Index < BitMaskSize; Index++) {
447 *(Data1++) |= *(Data2++);
461 IN UINT8 *SupportedFeatureMask,
462 IN CONST UINT8 *AndFeatureBitMask,
463 IN UINT32 BitMaskSize
470 Data1 = SupportedFeatureMask;
471 Data2 = AndFeatureBitMask;
472 for (Index = 0; Index < BitMaskSize; Index++) {
473 *(Data1++) &= *(Data2++);
486 IN UINT8 *SupportedFeatureMask,
487 IN UINT8 *AndFeatureBitMask,
488 IN UINT32 BitMaskSize
495 Data1 = SupportedFeatureMask;
496 Data2 = AndFeatureBitMask;
497 for (Index = 0; Index < BitMaskSize; Index++) {
498 *(Data1++) &= ~(*(Data2++));
517 IN UINT8 *SupportedFeatureMask,
518 IN UINT8 *ComparedFeatureBitMask,
519 IN UINT32 BitMaskSize
526 Data1 = SupportedFeatureMask;
527 Data2 = ComparedFeatureBitMask;
528 for (Index = 0; Index < BitMaskSize; Index++) {
529 if (((*(Data1++)) & (*(Data2++))) != 0) {
548 UINTN ProcessorNumber;
556 CpuInfo = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo;
562 while (!
IsNull (&CpuFeaturesData->FeatureList, Entry)) {
563 CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
564 if (CpuFeature->SupportFunc ==
NULL) {
569 CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
570 CpuFeature->FeatureMask,
571 CpuFeaturesData->BitMaskSize
573 }
else if (CpuFeature->SupportFunc (ProcessorNumber, CpuInfo, CpuFeature->ConfigData)) {
575 CpuFeaturesData->InitOrder[ProcessorNumber].FeaturesSupportedMask,
576 CpuFeature->FeatureMask,
577 CpuFeaturesData->BitMaskSize
581 Entry = Entry->ForwardLink;
602 UINT32 DebugPrintErrorLevel;
604 DebugPrintErrorLevel = (ProcessorNumber == 0) ? DEBUG_INFO : DEBUG_VERBOSE;
609 RegisterTable = &CpuFeaturesData->RegisterTable[ProcessorNumber];
610 DEBUG ((DebugPrintErrorLevel,
"RegisterTable->TableLength = %d\n", RegisterTable->TableLength));
614 for (FeatureIndex = 0; FeatureIndex < RegisterTable->TableLength; FeatureIndex++) {
615 RegisterTableEntry = &RegisterTableEntryHead[FeatureIndex];
616 switch (RegisterTableEntry->RegisterType) {
619 DebugPrintErrorLevel,
620 "Processor: %04d: Index %04d, MSR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
621 (UINT32)ProcessorNumber,
622 (UINT32)FeatureIndex,
623 RegisterTableEntry->Index,
624 RegisterTableEntry->ValidBitStart,
625 RegisterTableEntry->ValidBitLength,
626 RegisterTableEntry->Value
629 case ControlRegister:
631 DebugPrintErrorLevel,
632 "Processor: %04d: Index %04d, CR : %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
633 (UINT32)ProcessorNumber,
634 (UINT32)FeatureIndex,
635 RegisterTableEntry->Index,
636 RegisterTableEntry->ValidBitStart,
637 RegisterTableEntry->ValidBitLength,
638 RegisterTableEntry->Value
643 DebugPrintErrorLevel,
644 "Processor: %04d: Index %04d, MMIO : %016lx, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
645 (UINT32)ProcessorNumber,
646 (UINT32)FeatureIndex,
647 RegisterTableEntry->Index |
LShiftU64 (RegisterTableEntry->HighIndex, 32),
648 RegisterTableEntry->ValidBitStart,
649 RegisterTableEntry->ValidBitLength,
650 RegisterTableEntry->Value
655 DebugPrintErrorLevel,
656 "Processor: %04d: Index %04d, CACHE: %08x, Bit Start: %02d, Bit Length: %02d, Value: %016lx\r\n",
657 (UINT32)ProcessorNumber,
658 (UINT32)FeatureIndex,
659 RegisterTableEntry->Index,
660 RegisterTableEntry->ValidBitStart,
661 RegisterTableEntry->ValidBitLength,
662 RegisterTableEntry->Value
667 DebugPrintErrorLevel,
668 "Processor: %04d: Index %04d, SEMAP: %s\r\n",
669 (UINT32)ProcessorNumber,
670 (UINT32)FeatureIndex,
671 mDependTypeStr[
MIN ((UINT32)RegisterTableEntry->Value, InvalidDepType)]
692CPU_FEATURE_DEPENDENCE_TYPE
694 IN CPU_FEATURE_DEPENDENCE_TYPE BeforeDep,
695 IN CPU_FEATURE_DEPENDENCE_TYPE AfterDep,
696 IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep,
697 IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep
700 CPU_FEATURE_DEPENDENCE_TYPE Bigger;
702 Bigger =
MAX (BeforeDep, AfterDep);
703 Bigger =
MAX (Bigger, NoneNeibBeforeDep);
704 return MAX (Bigger, NoneNeibAfterDep);
719 UINTN ProcessorNumber;
729 CPU_FEATURE_DEPENDENCE_TYPE BeforeDep;
730 CPU_FEATURE_DEPENDENCE_TYPE AfterDep;
731 CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep;
732 CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep;
735 CpuFeaturesData->CapabilityPcd =
AllocatePool (CpuFeaturesData->BitMaskSize);
736 ASSERT (CpuFeaturesData->CapabilityPcd !=
NULL);
737 SetMem (CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize, 0xFF);
738 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
739 CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
743 SupportedMaskAnd (CpuFeaturesData->CapabilityPcd, CpuInitOrder->FeaturesSupportedMask, CpuFeaturesData->BitMaskSize);
749 CpuFeaturesData->SettingPcd =
AllocateCopyPool (CpuFeaturesData->BitMaskSize, CpuFeaturesData->CapabilityPcd);
750 ASSERT (CpuFeaturesData->SettingPcd !=
NULL);
757 DEBUG ((DEBUG_INFO,
"Last CPU features list...\n"));
759 while (!
IsNull (&CpuFeaturesData->FeatureList, Entry)) {
760 CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
761 if (
IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize)) {
762 if (
IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->SettingPcd, CpuFeaturesData->BitMaskSize)) {
763 DEBUG ((DEBUG_INFO,
"[Enable ] "));
765 DEBUG ((DEBUG_INFO,
"[Disable ] "));
768 DEBUG ((DEBUG_INFO,
"[Unsupport] "));
772 Entry = Entry->ForwardLink;
775 DEBUG ((DEBUG_INFO,
"PcdCpuFeaturesCapability:\n"));
777 DEBUG ((DEBUG_INFO,
"Origin PcdCpuFeaturesSetting:\n"));
779 DEBUG ((DEBUG_INFO,
"Final PcdCpuFeaturesSetting:\n"));
786 SetCapabilityPcd (CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize);
787 SetSettingPcd (CpuFeaturesData->SettingPcd, CpuFeaturesData->BitMaskSize);
789 for (ProcessorNumber = 0; ProcessorNumber < NumberOfCpus; ProcessorNumber++) {
790 CpuInitOrder = &CpuFeaturesData->InitOrder[ProcessorNumber];
792 while (!
IsNull (&CpuFeaturesData->FeatureList, Entry)) {
796 CpuFeature = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
797 if (
IsBitMaskMatch (CpuFeature->FeatureMask, CpuFeaturesData->CapabilityPcd, CpuFeaturesData->BitMaskSize)) {
799 ASSERT (CpuFeatureInOrder !=
NULL);
800 InsertTailList (&CpuInitOrder->OrderList, &CpuFeatureInOrder->Link);
803 Entry = Entry->ForwardLink;
809 CpuInfo = &CpuFeaturesData->InitOrder[ProcessorNumber].CpuInfo;
811 while (!
IsNull (&CpuInitOrder->OrderList, Entry)) {
812 CpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (Entry);
815 if (
IsBitMaskMatch (CpuFeatureInOrder->FeatureMask, CpuFeaturesData->SettingPcd, CpuFeaturesData->BitMaskSize)) {
816 Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData,
TRUE);
817 if (EFI_ERROR (Status)) {
821 SupportedMaskCleanBit (CpuFeaturesData->SettingPcd, CpuFeatureInOrder->FeatureMask, CpuFeaturesData->BitMaskSize);
822 if (CpuFeatureInOrder->FeatureName !=
NULL) {
823 DEBUG ((DEBUG_WARN,
"Warning :: Failed to enable Feature: Name = %a.\n", CpuFeatureInOrder->FeatureName));
825 DEBUG ((DEBUG_WARN,
"Warning :: Failed to enable Feature: Mask = "));
832 Status = CpuFeatureInOrder->InitializeFunc (ProcessorNumber, CpuInfo, CpuFeatureInOrder->ConfigData,
FALSE);
833 if (EFI_ERROR (Status)) {
834 if (CpuFeatureInOrder->FeatureName !=
NULL) {
835 DEBUG ((DEBUG_WARN,
"Warning :: Failed to disable Feature: Name = %a.\n", CpuFeatureInOrder->FeatureName));
837 DEBUG ((DEBUG_WARN,
"Warning :: Failed to disable Feature: Mask = "));
846 NextEntry = Entry->ForwardLink;
847 if (!
IsNull (&CpuInitOrder->OrderList, NextEntry)) {
848 NextCpuFeatureInOrder = CPU_FEATURE_ENTRY_FROM_LINK (NextEntry);
862 BeforeDep = NoneDepType;
863 AfterDep = NoneDepType;
864 NoneNeibAfterDep = NoneDepType;
877 BeforeDep =
BiggestDep (BeforeDep, AfterDep, NoneNeibBeforeDep, NoneNeibAfterDep);
878 if (BeforeDep > ThreadDepType) {
883 Entry = Entry->ForwardLink;
890 DEBUG ((DEBUG_INFO,
"Dump final value for PcdCpuFeaturesSetting:\n"));
908 IN OUT volatile UINT32 *Sem
926 IN OUT volatile UINT32 *Sem
933 }
while (Value == 0 ||
991 return EFI_UNSUPPORTED;
1019 volatile UINT32 *SemaphorePtr;
1021 UINT32 CurrentThread;
1023 UINTN ProcessorIndex;
1024 UINT32 *ThreadCountPerPackage;
1025 UINT8 *ThreadCountPerCore;
1027 UINT64 CurrentValue;
1034 for (Index = 0; Index < RegisterTable->TableLength; Index++) {
1035 RegisterTableEntry = &RegisterTableEntryHead[Index];
1040 switch (RegisterTableEntry->RegisterType) {
1044 case ControlRegister:
1046 if (EFI_ERROR (Status)) {
1050 if (RegisterTableEntry->TestThenWrite) {
1053 RegisterTableEntry->ValidBitStart,
1054 RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1
1056 if (CurrentValue == RegisterTableEntry->Value) {
1063 RegisterTableEntry->ValidBitStart,
1064 RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1,
1065 RegisterTableEntry->Value
1074 if (RegisterTableEntry->TestThenWrite) {
1076 if (RegisterTableEntry->ValidBitLength >= 64) {
1077 if (Value == RegisterTableEntry->Value) {
1083 RegisterTableEntry->ValidBitStart,
1084 RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1
1086 if (CurrentValue == RegisterTableEntry->Value) {
1092 if (RegisterTableEntry->ValidBitLength >= 64) {
1097 RegisterTableEntry->Index,
1098 RegisterTableEntry->Value
1105 RegisterTableEntry->Index,
1106 RegisterTableEntry->ValidBitStart,
1107 RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1,
1108 RegisterTableEntry->Value
1119 (
UINTN)(RegisterTableEntry->Index |
LShiftU64 (RegisterTableEntry->HighIndex, 32)),
1120 RegisterTableEntry->ValidBitStart,
1121 RegisterTableEntry->ValidBitStart + RegisterTableEntry->ValidBitLength - 1,
1122 (UINT32)RegisterTableEntry->Value
1133 if (RegisterTableEntry->Value == 0) {
1156 switch (RegisterTableEntry->Value) {
1158 SemaphorePtr = CpuFlags->CoreSemaphoreCount;
1159 ThreadCountPerCore = (UINT8 *)(
UINTN)CpuStatus->ThreadCountPerCore;
1161 CurrentCore = ApLocation->Package * CpuStatus->MaxCoreCount + ApLocation->Core;
1165 FirstThread = CurrentCore * CpuStatus->MaxThreadCount;
1166 CurrentThread = FirstThread + ApLocation->Thread;
1183 for (ProcessorIndex = 0; ProcessorIndex < CpuStatus->MaxThreadCount; ProcessorIndex++) {
1190 for (ProcessorIndex = 0; ProcessorIndex < ThreadCountPerCore[CurrentCore]; ProcessorIndex++) {
1196 case PackageDepType:
1197 SemaphorePtr = CpuFlags->PackageSemaphoreCount;
1198 ThreadCountPerPackage = (UINT32 *)(
UINTN)CpuStatus->ThreadCountPerPackage;
1202 FirstThread = ApLocation->Package * CpuStatus->MaxCoreCount * CpuStatus->MaxThreadCount;
1206 CurrentThread = FirstThread + CpuStatus->MaxThreadCount * ApLocation->Core + ApLocation->Thread;
1223 for (ProcessorIndex = 0; ProcessorIndex < CpuStatus->MaxThreadCount * CpuStatus->MaxCoreCount; ProcessorIndex++) {
1230 for (ProcessorIndex = 0; ProcessorIndex < ThreadCountPerPackage[ApLocation->Package]; ProcessorIndex++) {
1269 AcpiCpuData = CpuFeaturesData->AcpiCpuData;
1274 RegisterTable =
NULL;
1275 ProcIndex = (
UINTN)-1;
1276 for (Index = 0; Index < AcpiCpuData->NumberOfCpus; Index++) {
1277 if (RegisterTables[Index].InitialApicId == InitApicId) {
1278 RegisterTable = &RegisterTables[Index];
1284 ASSERT (RegisterTable !=
NULL);
1289 &AcpiCpuData->CpuFeatureInitData.CpuStatus,
1290 &CpuFeaturesData->CpuFlags
1314 if (CpuFeaturesData->NumberOfCpus > 1) {
BOOLEAN EFIAPI IsNull(IN CONST LIST_ENTRY *List, IN CONST LIST_ENTRY *Node)
LIST_ENTRY *EFIAPI GetFirstNode(IN CONST LIST_ENTRY *List)
UINT64 EFIAPI BitFieldWrite64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
UINT64 EFIAPI BitFieldRead64(IN UINT64 Operand, IN UINTN StartBit, IN UINTN EndBit)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
VOID *EFIAPI SetMem32(OUT VOID *Buffer, IN UINTN Length, IN UINT32 Value)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID SetSettingPcd(IN UINT8 *SupportedFeatureMask, IN UINTN BitMaskSize)
VOID SetCapabilityPcd(IN UINT8 *SupportedFeatureMask, IN UINTN BitMaskSize)
VOID FillProcessorInfo(IN OUT REGISTER_CPU_FEATURE_INFORMATION *CpuInfo)
VOID ProgramProcessorRegister(IN CPU_REGISTER_TABLE *RegisterTable, IN EFI_CPU_PHYSICAL_LOCATION *ApLocation, IN CPU_STATUS_INFORMATION *CpuStatus, IN PROGRAM_CPU_REGISTER_FLAGS *CpuFlags)
VOID DumpRegisterTableOnProcessor(IN UINTN ProcessorNumber)
UINTN ReadWriteCr(IN UINT32 CrIndex, IN BOOLEAN Read, IN OUT UINTN *CrValue)
VOID LibWaitForSemaphore(IN OUT volatile UINT32 *Sem)
BOOLEAN IsBitMaskMatch(IN UINT8 *SupportedFeatureMask, IN UINT8 *ComparedFeatureBitMask, IN UINT32 BitMaskSize)
VOID SupportedMaskAnd(IN UINT8 *SupportedFeatureMask, IN CONST UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
VOID EFIAPI CpuFeaturesDetect(VOID)
VOID SupportedMaskOr(IN UINT8 *SupportedFeatureMask, IN UINT8 *OrFeatureBitMask, IN UINT32 BitMaskSize)
CPU_FEATURE_DEPENDENCE_TYPE BiggestDep(IN CPU_FEATURE_DEPENDENCE_TYPE BeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE AfterDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep)
VOID AnalysisProcessorFeatures(IN UINTN NumberOfCpus)
VOID SupportedMaskCleanBit(IN UINT8 *SupportedFeatureMask, IN UINT8 *AndFeatureBitMask, IN UINT32 BitMaskSize)
VOID EFIAPI SetProcessorRegister(IN OUT VOID *Buffer)
VOID EFIAPI CollectProcessorData(IN OUT VOID *Buffer)
VOID CpuInitDataInitialize(VOID)
VOID LibReleaseSemaphore(IN OUT volatile UINT32 *Sem)
UINT32 GetProcessorIndex(VOID)
VOID EFIAPI AsmDisableCache(VOID)
CPU_FEATURES_DATA * GetCpuFeaturesData(VOID)
VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors)
EFI_STATUS GetProcessorInformation(IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
MP_SERVICES GetMpService(VOID)
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
VOID EFIAPI AsmEnableCache(VOID)
UINTN EFIAPI AsmReadCr3(VOID)
UINTN EFIAPI AsmWriteCr2(UINTN Cr2)
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
UINTN EFIAPI AsmWriteCr3(UINTN Cr3)
UINTN EFIAPI AsmWriteCr4(UINTN Cr4)
UINTN EFIAPI AsmReadCr0(VOID)
UINTN EFIAPI AsmWriteCr0(UINTN Cr0)
UINTN EFIAPI AsmReadCr2(VOID)
UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
UINTN EFIAPI AsmReadCr4(VOID)
UINT32 EFIAPI MmioBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
UINT32 EFIAPI GetInitialApicId(VOID)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG_CODE_BEGIN()
#define DEBUG(Expression)
#define CPUID_VERSION_INFO
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
#define PcdSetPtrS(TokenName, SizeOfBuffer, Buffer)
#define PcdGetPtr(TokenName)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
VOID *EFIAPI AllocatePages(IN UINTN Pages)
VOID DumpCpuFeature(IN CPU_FEATURES_ENTRY *CpuFeature, IN UINT32 BitMaskSize)
VOID DumpCpuFeatureMask(IN UINT8 *FeatureMask, IN UINT32 BitMaskSize)
CPU_FEATURE_DEPENDENCE_TYPE DetectNoneNeighborhoodFeatureScope(IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN LIST_ENTRY *FeatureList)
ACPI_CPU_DATA * GetAcpiCpuData(VOID)
CPU_FEATURE_DEPENDENCE_TYPE DetectFeatureScope(IN CPU_FEATURES_ENTRY *CpuFeature, IN BOOLEAN Before, IN UINT8 *NextCpuFeatureMask)
#define CPU_REGISTER_TABLE_WRITE32(ProcessorNumber, RegisterType, Index, Value)
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 ReleaseSpinLock(IN OUT SPIN_LOCK *SpinLock)
UINT64 EFI_PHYSICAL_ADDRESS
#define EFI_SIZE_TO_PAGES(Size)
UINT64 EFIAPI AsmMsrBitFieldWrite64(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
EFI_CPU_PHYSICAL_LOCATION Location
EFI_PROCESSOR_INFORMATION ProcessorInfo
REGISTER_CPU_FEATURE_FIRST_PROCESSOR First