/** @file\r
UEFI Application to display CPUID leaf information.\r
\r
- Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
**/\r
VOID\r
CpuidExtendedTopology (\r
- VOID\r
+ UINT32 LeafFunction\r
)\r
{\r
CPUID_EXTENDED_TOPOLOGY_EAX Eax;\r
UINT32 Edx;\r
UINT32 LevelNumber;\r
\r
- if (CPUID_EXTENDED_TOPOLOGY > gMaximumBasicFunction) {\r
+ if (LeafFunction > gMaximumBasicFunction) {\r
+ return;\r
+ }\r
+ if ((LeafFunction != CPUID_EXTENDED_TOPOLOGY) && (LeafFunction != CPUID_V2_EXTENDED_TOPOLOGY)) {\r
return;\r
}\r
\r
LevelNumber = 0;\r
- do {\r
+ for (LevelNumber = 0; ; LevelNumber++) {\r
AsmCpuidEx (\r
- CPUID_EXTENDED_TOPOLOGY, LevelNumber,\r
+ LeafFunction, LevelNumber,\r
&Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx\r
);\r
- if (Eax.Bits.ApicIdShift != 0) {\r
- Print (L"CPUID_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_TOPOLOGY, LevelNumber);\r
- Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
- PRINT_BIT_FIELD (Eax, ApicIdShift);\r
- PRINT_BIT_FIELD (Ebx, LogicalProcessors);\r
- PRINT_BIT_FIELD (Ecx, LevelNumber);\r
- PRINT_BIT_FIELD (Ecx, LevelType);\r
- PRINT_VALUE (Edx, x2APIC_ID);\r
+ if (Ecx.Bits.LevelType == CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID) {\r
+ break;\r
}\r
- LevelNumber++;\r
- } while (Eax.Bits.ApicIdShift != 0);\r
+ Print (\r
+ L"%a (Leaf %08x, Sub-Leaf %08x)\n",\r
+ LeafFunction == CPUID_EXTENDED_TOPOLOGY ? "CPUID_EXTENDED_TOPOLOGY" : "CPUID_V2_EXTENDED_TOPOLOGY",\r
+ LeafFunction, LevelNumber\r
+ );\r
+ Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
+ PRINT_BIT_FIELD (Eax, ApicIdShift);\r
+ PRINT_BIT_FIELD (Ebx, LogicalProcessors);\r
+ PRINT_BIT_FIELD (Ecx, LevelNumber);\r
+ PRINT_BIT_FIELD (Ecx, LevelType);\r
+ PRINT_VALUE (Edx, x2APIC_ID);\r
+ }\r
}\r
\r
/**\r
PRINT_BIT_FIELD (Edx, MaximumNum);\r
}\r
\r
-/**\r
- Display CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION main leaf and sub-leafs.\r
-\r
-**/\r
-VOID\r
-CpuidV2ExtendedTopologyEnumeration (\r
- VOID\r
- )\r
-{\r
- CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX Eax;\r
- CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX Ebx;\r
- CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX Ecx;\r
- UINT32 Edx;\r
-\r
- if (CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION > gMaximumBasicFunction) {\r
- return;\r
- }\r
-\r
- AsmCpuidEx (\r
- CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION,\r
- CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF,\r
- &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx\r
- );\r
- Print (L"CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION, CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF);\r
- Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
-\r
- PRINT_BIT_FIELD (Eax, BitsNum);\r
- PRINT_BIT_FIELD (Ebx, ProcessorsNum);\r
- PRINT_BIT_FIELD (Ecx, LevelNum);\r
- PRINT_BIT_FIELD (Ecx, LevelType);\r
- PRINT_VALUE (Edx, x2APICID);\r
-}\r
-\r
/**\r
Display CPUID_EXTENDED_FUNCTION leaf.\r
\r
CpuidStructuredExtendedFeatureFlags ();\r
CpuidDirectCacheAccessInfo();\r
CpuidArchitecturalPerformanceMonitoring ();\r
- CpuidExtendedTopology ();\r
+ CpuidExtendedTopology (CPUID_EXTENDED_TOPOLOGY);\r
CpuidExtendedStateMainLeaf ();\r
CpuidIntelRdtMonitoringEnumerationSubLeaf ();\r
CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf ();\r
CpuidProcessorFrequency ();\r
CpuidSocVendor ();\r
CpuidDeterministicAddressTranslationParameters ();\r
- CpuidV2ExtendedTopologyEnumeration ();\r
+ CpuidExtendedTopology (CPUID_V2_EXTENDED_TOPOLOGY);\r
CpuidExtendedFunction ();\r
CpuidExtendedCpuSig ();\r
CpuidProcessorBrandString ();\r