]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Application/Cpuid/Cpuid.c
UefiCpuPkg/Cpuid.h: Remove duplicated struct definition for leaf 1FH
[mirror_edk2.git] / UefiCpuPkg / Application / Cpuid / Cpuid.c
CommitLineData
25705752
MK
1/** @file\r
2 UEFI Application to display CPUID leaf information.\r
3\r
516e3397 4 Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>\r
25705752
MK
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include <Uefi.h>\r
16#include <Library/BaseLib.h>\r
17#include <Library/UefiLib.h>\r
18#include <Register/Cpuid.h>\r
19\r
20///\r
21/// Macro used to display the value of a bit field in a register returned by CPUID.\r
22///\r
23#define PRINT_BIT_FIELD(Variable, FieldName) \\r
d2ba6f41 24 Print (L"%5a%42a: %x\n", #Variable, #FieldName, Variable.Bits.FieldName);\r
25705752
MK
25\r
26///\r
27/// Macro used to display the value of a register returned by CPUID.\r
28///\r
29#define PRINT_VALUE(Variable, Description) \\r
30 Print (L"%5a%42a: %x\n", #Variable, #Description, Variable);\r
31\r
32///\r
33/// Structure for cache description lookup table\r
34///\r
35typedef struct {\r
36 UINT8 CacheDescriptor;\r
37 CHAR8 *Type;\r
38 CHAR8 *Description;\r
39} CPUID_CACHE_INFO_DESCRIPTION;\r
40\r
41///\r
42/// Cache description lookup table\r
43///\r
44CPUID_CACHE_INFO_DESCRIPTION mCpuidCacheInfoDescription[] = {\r
45 { 0x00 , "General" , "Null descriptor, this byte contains no information" },\r
46 { 0x01 , "TLB" , "Instruction TLB: 4 KByte pages, 4-way set associative, 32 entries" },\r
47 { 0x02 , "TLB" , "Instruction TLB: 4 MByte pages, fully associative, 2 entries" },\r
48 { 0x03 , "TLB" , "Data TLB: 4 KByte pages, 4-way set associative, 64 entries" },\r
49 { 0x04 , "TLB" , "Data TLB: 4 MByte pages, 4-way set associative, 8 entries" },\r
50 { 0x05 , "TLB" , "Data TLB1: 4 MByte pages, 4-way set associative, 32 entries" },\r
51 { 0x06 , "Cache" , "1st-level instruction cache: 8 KBytes, 4-way set associative, 32 byte line size" },\r
52 { 0x08 , "Cache" , "1st-level instruction cache: 16 KBytes, 4-way set associative, 32 byte line size" },\r
53 { 0x09 , "Cache" , "1st-level instruction cache: 32KBytes, 4-way set associative, 64 byte line size" },\r
54 { 0x0A , "Cache" , "1st-level data cache: 8 KBytes, 2-way set associative, 32 byte line size" },\r
55 { 0x0B , "TLB" , "Instruction TLB: 4 MByte pages, 4-way set associative, 4 entries" },\r
56 { 0x0C , "Cache" , "1st-level data cache: 16 KBytes, 4-way set associative, 32 byte line size" },\r
57 { 0x0D , "Cache" , "1st-level data cache: 16 KBytes, 4-way set associative, 64 byte line size" },\r
58 { 0x0E , "Cache" , "1st-level data cache: 24 KBytes, 6-way set associative, 64 byte line size" },\r
59 { 0x1D , "Cache" , "2nd-level cache: 128 KBytes, 2-way set associative, 64 byte line size" },\r
60 { 0x21 , "Cache" , "2nd-level cache: 256 KBytes, 8-way set associative, 64 byte line size" },\r
61 { 0x22 , "Cache" , "3rd-level cache: 512 KBytes, 4-way set associative, 64 byte line size, 2 lines per sector" },\r
62 { 0x23 , "Cache" , "3rd-level cache: 1 MBytes, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
63 { 0x24 , "Cache" , "2nd-level cache: 1 MBytes, 16-way set associative, 64 byte line size" },\r
64 { 0x25 , "Cache" , "3rd-level cache: 2 MBytes, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
65 { 0x29 , "Cache" , "3rd-level cache: 4 MBytes, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
66 { 0x2C , "Cache" , "1st-level data cache: 32 KBytes, 8-way set associative, 64 byte line size" },\r
67 { 0x30 , "Cache" , "1st-level instruction cache: 32 KBytes, 8-way set associative, 64 byte line size" },\r
68 { 0x40 , "Cache" , "No 2nd-level cache or, if processor contains a valid 2nd-level cache, no 3rd-level cache" },\r
69 { 0x41 , "Cache" , "2nd-level cache: 128 KBytes, 4-way set associative, 32 byte line size" },\r
70 { 0x42 , "Cache" , "2nd-level cache: 256 KBytes, 4-way set associative, 32 byte line size" },\r
71 { 0x43 , "Cache" , "2nd-level cache: 512 KBytes, 4-way set associative, 32 byte line size" },\r
72 { 0x44 , "Cache" , "2nd-level cache: 1 MByte, 4-way set associative, 32 byte line size" },\r
73 { 0x45 , "Cache" , "2nd-level cache: 2 MByte, 4-way set associative, 32 byte line size" },\r
74 { 0x46 , "Cache" , "3rd-level cache: 4 MByte, 4-way set associative, 64 byte line size" },\r
75 { 0x47 , "Cache" , "3rd-level cache: 8 MByte, 8-way set associative, 64 byte line size" },\r
76 { 0x48 , "Cache" , "2nd-level cache: 3MByte, 12-way set associative, 64 byte line size" },\r
77 { 0x49 , "Cache" , "3rd-level cache: 4MB, 16-way set associative, 64-byte line size (Intel Xeon processor MP, Family 0FH, Model 06H). 2nd-level cache: 4 MByte, 16-way set associative, 64 byte line size" },\r
78 { 0x4A , "Cache" , "3rd-level cache: 6MByte, 12-way set associative, 64 byte line size" },\r
79 { 0x4B , "Cache" , "3rd-level cache: 8MByte, 16-way set associative, 64 byte line size" },\r
80 { 0x4C , "Cache" , "3rd-level cache: 12MByte, 12-way set associative, 64 byte line size" },\r
81 { 0x4D , "Cache" , "3rd-level cache: 16MByte, 16-way set associative, 64 byte line size" },\r
82 { 0x4E , "Cache" , "2nd-level cache: 6MByte, 24-way set associative, 64 byte line size" },\r
83 { 0x4F , "TLB" , "Instruction TLB: 4 KByte pages, 32 entries" },\r
84 { 0x50 , "TLB" , "Instruction TLB: 4 KByte and 2-MByte or 4-MByte pages, 64 entries" },\r
85 { 0x51 , "TLB" , "Instruction TLB: 4 KByte and 2-MByte or 4-MByte pages, 128 entries" },\r
86 { 0x52 , "TLB" , "Instruction TLB: 4 KByte and 2-MByte or 4-MByte pages, 256 entries" },\r
87 { 0x55 , "TLB" , "Instruction TLB: 2-MByte or 4-MByte pages, fully associative, 7 entries" },\r
88 { 0x56 , "TLB" , "Data TLB0: 4 MByte pages, 4-way set associative, 16 entries" },\r
89 { 0x57 , "TLB" , "Data TLB0: 4 KByte pages, 4-way associative, 16 entries" },\r
90 { 0x59 , "TLB" , "Data TLB0: 4 KByte pages, fully associative, 16 entries" },\r
14806d7b 91 { 0x5A , "TLB" , "Data TLB0: 2 MByte or 4 MByte pages, 4-way set associative, 32 entries" },\r
25705752
MK
92 { 0x5B , "TLB" , "Data TLB: 4 KByte and 4 MByte pages, 64 entries" },\r
93 { 0x5C , "TLB" , "Data TLB: 4 KByte and 4 MByte pages,128 entries" },\r
94 { 0x5D , "TLB" , "Data TLB: 4 KByte and 4 MByte pages,256 entries" },\r
95 { 0x60 , "Cache" , "1st-level data cache: 16 KByte, 8-way set associative, 64 byte line size" },\r
96 { 0x61 , "TLB" , "Instruction TLB: 4 KByte pages, fully associative, 48 entries" },\r
14806d7b
HW
97 { 0x63 , "TLB" , "Data TLB: 2 MByte or 4 MByte pages, 4-way set associative, 32 entries and a separate array with 1 GByte pages, 4-way set associative, 4 entries" },\r
98 { 0x64 , "TLB" , "Data TLB: 4 KByte pages, 4-way set associative, 512 entries" },\r
25705752
MK
99 { 0x66 , "Cache" , "1st-level data cache: 8 KByte, 4-way set associative, 64 byte line size" },\r
100 { 0x67 , "Cache" , "1st-level data cache: 16 KByte, 4-way set associative, 64 byte line size" },\r
101 { 0x68 , "Cache" , "1st-level data cache: 32 KByte, 4-way set associative, 64 byte line size" },\r
102 { 0x6A , "Cache" , "uTLB: 4 KByte pages, 8-way set associative, 64 entries" },\r
103 { 0x6B , "Cache" , "DTLB: 4 KByte pages, 8-way set associative, 256 entries" },\r
104 { 0x6C , "Cache" , "DTLB: 2M/4M pages, 8-way set associative, 128 entries" },\r
105 { 0x6D , "Cache" , "DTLB: 1 GByte pages, fully associative, 16 entries" },\r
106 { 0x70 , "Cache" , "Trace cache: 12 K-uop, 8-way set associative" },\r
107 { 0x71 , "Cache" , "Trace cache: 16 K-uop, 8-way set associative" },\r
108 { 0x72 , "Cache" , "Trace cache: 32 K-uop, 8-way set associative" },\r
109 { 0x76 , "TLB" , "Instruction TLB: 2M/4M pages, fully associative, 8 entries" },\r
110 { 0x78 , "Cache" , "2nd-level cache: 1 MByte, 4-way set associative, 64byte line size" },\r
111 { 0x79 , "Cache" , "2nd-level cache: 128 KByte, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
112 { 0x7A , "Cache" , "2nd-level cache: 256 KByte, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
113 { 0x7B , "Cache" , "2nd-level cache: 512 KByte, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
114 { 0x7C , "Cache" , "2nd-level cache: 1 MByte, 8-way set associative, 64 byte line size, 2 lines per sector" },\r
115 { 0x7D , "Cache" , "2nd-level cache: 2 MByte, 8-way set associative, 64byte line size" },\r
116 { 0x7F , "Cache" , "2nd-level cache: 512 KByte, 2-way set associative, 64-byte line size" },\r
117 { 0x80 , "Cache" , "2nd-level cache: 512 KByte, 8-way set associative, 64-byte line size" },\r
118 { 0x82 , "Cache" , "2nd-level cache: 256 KByte, 8-way set associative, 32 byte line size" },\r
119 { 0x83 , "Cache" , "2nd-level cache: 512 KByte, 8-way set associative, 32 byte line size" },\r
120 { 0x84 , "Cache" , "2nd-level cache: 1 MByte, 8-way set associative, 32 byte line size" },\r
121 { 0x85 , "Cache" , "2nd-level cache: 2 MByte, 8-way set associative, 32 byte line size" },\r
122 { 0x86 , "Cache" , "2nd-level cache: 512 KByte, 4-way set associative, 64 byte line size" },\r
123 { 0x87 , "Cache" , "2nd-level cache: 1 MByte, 8-way set associative, 64 byte line size" },\r
124 { 0xA0 , "DTLB" , "DTLB: 4k pages, fully associative, 32 entries" },\r
125 { 0xB0 , "TLB" , "Instruction TLB: 4 KByte pages, 4-way set associative, 128 entries" },\r
126 { 0xB1 , "TLB" , "Instruction TLB: 2M pages, 4-way, 8 entries or 4M pages, 4-way, 4 entries" },\r
127 { 0xB2 , "TLB" , "Instruction TLB: 4KByte pages, 4-way set associative, 64 entries" },\r
128 { 0xB3 , "TLB" , "Data TLB: 4 KByte pages, 4-way set associative, 128 entries" },\r
129 { 0xB4 , "TLB" , "Data TLB1: 4 KByte pages, 4-way associative, 256 entries" },\r
130 { 0xB5 , "TLB" , "Instruction TLB: 4KByte pages, 8-way set associative, 64 entries" },\r
131 { 0xB6 , "TLB" , "Instruction TLB: 4KByte pages, 8-way set associative, 128 entries" },\r
132 { 0xBA , "TLB" , "Data TLB1: 4 KByte pages, 4-way associative, 64 entries" },\r
133 { 0xC0 , "TLB" , "Data TLB: 4 KByte and 4 MByte pages, 4-way associative, 8 entries" },\r
134 { 0xC1 , "STLB" , "Shared 2nd-Level TLB: 4 KByte/2MByte pages, 8-way associative, 1024 entries" },\r
135 { 0xC2 , "DTLB" , "DTLB: 4 KByte/2 MByte pages, 4-way associative, 16 entries" },\r
136 { 0xC3 , "STLB" , "Shared 2nd-Level TLB: 4 KByte /2 MByte pages, 6-way associative, 1536 entries. Also 1GBbyte pages, 4-way, 16 entries." },\r
14806d7b 137 { 0xC4 , "DTLB" , "DTLB: 2M/4M Byte pages, 4-way associative, 32 entries" },\r
25705752
MK
138 { 0xCA , "STLB" , "Shared 2nd-Level TLB: 4 KByte pages, 4-way associative, 512 entries" },\r
139 { 0xD0 , "Cache" , "3rd-level cache: 512 KByte, 4-way set associative, 64 byte line size" },\r
140 { 0xD1 , "Cache" , "3rd-level cache: 1 MByte, 4-way set associative, 64 byte line size" },\r
141 { 0xD2 , "Cache" , "3rd-level cache: 2 MByte, 4-way set associative, 64 byte line size" },\r
142 { 0xD6 , "Cache" , "3rd-level cache: 1 MByte, 8-way set associative, 64 byte line size" },\r
143 { 0xD7 , "Cache" , "3rd-level cache: 2 MByte, 8-way set associative, 64 byte line size" },\r
144 { 0xD8 , "Cache" , "3rd-level cache: 4 MByte, 8-way set associative, 64 byte line size" },\r
145 { 0xDC , "Cache" , "3rd-level cache: 1.5 MByte, 12-way set associative, 64 byte line size" },\r
146 { 0xDD , "Cache" , "3rd-level cache: 3 MByte, 12-way set associative, 64 byte line size" },\r
147 { 0xDE , "Cache" , "3rd-level cache: 6 MByte, 12-way set associative, 64 byte line size" },\r
148 { 0xE2 , "Cache" , "3rd-level cache: 2 MByte, 16-way set associative, 64 byte line size" },\r
149 { 0xE3 , "Cache" , "3rd-level cache: 4 MByte, 16-way set associative, 64 byte line size" },\r
150 { 0xE4 , "Cache" , "3rd-level cache: 8 MByte, 16-way set associative, 64 byte line size" },\r
151 { 0xEA , "Cache" , "3rd-level cache: 12MByte, 24-way set associative, 64 byte line size" },\r
152 { 0xEB , "Cache" , "3rd-level cache: 18MByte, 24-way set associative, 64 byte line size" },\r
153 { 0xEC , "Cache" , "3rd-level cache: 24MByte, 24-way set associative, 64 byte line size" },\r
154 { 0xF0 , "Prefetch" , "64-Byte prefetching" },\r
155 { 0xF1 , "Prefetch" , "128-Byte prefetching" },\r
56fbaecb 156 { 0xFE , "General" , "CPUID leaf 2 does not report TLB descriptor information; use CPUID leaf 18H to query TLB and other address translation parameters." },\r
25705752
MK
157 { 0xFF , "General" , "CPUID leaf 2 does not report cache descriptor information, use CPUID leaf 4 to query cache parameters" }\r
158};\r
159\r
160///\r
161/// The maximum supported CPUID leaf index starting from leaf 0x00000000.\r
162///\r
163UINT32 gMaximumBasicFunction = CPUID_SIGNATURE;\r
164\r
165///\r
166/// The maximum supported CPUID leaf index starting from leaf 0x80000000.\r
167///\r
168UINT32 gMaximumExtendedFunction = CPUID_EXTENDED_FUNCTION;\r
169\r
170/**\r
171 Display CPUID_SIGNATURE leaf.\r
172\r
173**/\r
174VOID\r
175CpuidSignature (\r
176 VOID\r
177 )\r
178{\r
179 UINT32 Eax;\r
180 UINT32 Ebx;\r
181 UINT32 Ecx;\r
182 UINT32 Edx;\r
183 CHAR8 Signature[13];\r
184\r
25705752
MK
185 AsmCpuid (CPUID_SIGNATURE, &Eax, &Ebx, &Ecx, &Edx);\r
186\r
187 Print (L"CPUID_SIGNATURE (Leaf %08x)\n", CPUID_SIGNATURE);\r
188 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx, Edx);\r
189 PRINT_VALUE (Eax, MaximumLeaf);\r
190 *(UINT32 *)(Signature + 0) = Ebx;\r
191 *(UINT32 *)(Signature + 4) = Edx;\r
192 *(UINT32 *)(Signature + 8) = Ecx;\r
193 Signature [12] = 0;\r
194 Print (L" Signature = %a\n", Signature);\r
195\r
196 gMaximumBasicFunction = Eax;\r
197}\r
198\r
199/**\r
200 Display CPUID_VERSION_INFO leaf.\r
201\r
202**/\r
203VOID\r
204CpuidVersionInfo (\r
205 VOID\r
206 )\r
207{\r
208 CPUID_VERSION_INFO_EAX Eax;\r
209 CPUID_VERSION_INFO_EBX Ebx;\r
210 CPUID_VERSION_INFO_ECX Ecx;\r
211 CPUID_VERSION_INFO_EDX Edx;\r
5a676df9
JF
212 UINT32 DisplayFamily;\r
213 UINT32 DisplayModel;\r
25705752 214\r
321ef72c
JF
215 if (CPUID_VERSION_INFO > gMaximumBasicFunction) {\r
216 return;\r
217 }\r
218\r
25705752
MK
219 AsmCpuid (CPUID_VERSION_INFO, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
220\r
221 Print (L"CPUID_VERSION_INFO (Leaf %08x)\n", CPUID_VERSION_INFO);\r
222 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
223\r
224 DisplayFamily = Eax.Bits.FamilyId;\r
225 if (Eax.Bits.FamilyId == 0x0F) {\r
226 DisplayFamily |= (Eax.Bits.ExtendedFamilyId << 4);\r
227 }\r
228\r
229 DisplayModel = Eax.Bits.Model;\r
230 if (Eax.Bits.FamilyId == 0x06 || Eax.Bits.FamilyId == 0x0f) {\r
231 DisplayModel |= (Eax.Bits.ExtendedModelId << 4);\r
232 }\r
233\r
234 Print (L" Family = %x Model = %x Stepping = %x\n", DisplayFamily, DisplayModel, Eax.Bits.SteppingId);\r
235\r
236 PRINT_BIT_FIELD (Eax, SteppingId);\r
237 PRINT_BIT_FIELD (Eax, Model);\r
238 PRINT_BIT_FIELD (Eax, FamilyId);\r
239 PRINT_BIT_FIELD (Eax, ProcessorType);\r
240 PRINT_BIT_FIELD (Eax, ExtendedModelId);\r
241 PRINT_BIT_FIELD (Eax, ExtendedFamilyId);\r
242 PRINT_BIT_FIELD (Ebx, BrandIndex);\r
243 PRINT_BIT_FIELD (Ebx, CacheLineSize);\r
244 PRINT_BIT_FIELD (Ebx, MaximumAddressableIdsForLogicalProcessors);\r
245 PRINT_BIT_FIELD (Ebx, InitialLocalApicId);\r
246 PRINT_BIT_FIELD (Ecx, SSE3);\r
247 PRINT_BIT_FIELD (Ecx, PCLMULQDQ);\r
248 PRINT_BIT_FIELD (Ecx, DTES64);\r
249 PRINT_BIT_FIELD (Ecx, MONITOR);\r
250 PRINT_BIT_FIELD (Ecx, DS_CPL);\r
251 PRINT_BIT_FIELD (Ecx, VMX);\r
252 PRINT_BIT_FIELD (Ecx, SMX);\r
253 PRINT_BIT_FIELD (Ecx, TM2);\r
254 PRINT_BIT_FIELD (Ecx, SSSE3);\r
255 PRINT_BIT_FIELD (Ecx, CNXT_ID);\r
256 PRINT_BIT_FIELD (Ecx, SDBG);\r
257 PRINT_BIT_FIELD (Ecx, FMA);\r
258 PRINT_BIT_FIELD (Ecx, CMPXCHG16B);\r
259 PRINT_BIT_FIELD (Ecx, xTPR_Update_Control);\r
260 PRINT_BIT_FIELD (Ecx, PDCM);\r
261 PRINT_BIT_FIELD (Ecx, PCID);\r
262 PRINT_BIT_FIELD (Ecx, DCA);\r
263 PRINT_BIT_FIELD (Ecx, SSE4_1);\r
264 PRINT_BIT_FIELD (Ecx, SSE4_2);\r
265 PRINT_BIT_FIELD (Ecx, x2APIC);\r
266 PRINT_BIT_FIELD (Ecx, MOVBE);\r
267 PRINT_BIT_FIELD (Ecx, POPCNT);\r
268 PRINT_BIT_FIELD (Ecx, TSC_Deadline);\r
269 PRINT_BIT_FIELD (Ecx, AESNI);\r
270 PRINT_BIT_FIELD (Ecx, XSAVE);\r
271 PRINT_BIT_FIELD (Ecx, OSXSAVE);\r
272 PRINT_BIT_FIELD (Ecx, AVX);\r
273 PRINT_BIT_FIELD (Ecx, F16C);\r
274 PRINT_BIT_FIELD (Ecx, RDRAND);\r
275 PRINT_BIT_FIELD (Edx, FPU);\r
276 PRINT_BIT_FIELD (Edx, VME);\r
277 PRINT_BIT_FIELD (Edx, DE);\r
278 PRINT_BIT_FIELD (Edx, PSE);\r
279 PRINT_BIT_FIELD (Edx, TSC);\r
280 PRINT_BIT_FIELD (Edx, MSR);\r
281 PRINT_BIT_FIELD (Edx, PAE);\r
282 PRINT_BIT_FIELD (Edx, MCE);\r
283 PRINT_BIT_FIELD (Edx, CX8);\r
284 PRINT_BIT_FIELD (Edx, APIC);\r
285 PRINT_BIT_FIELD (Edx, SEP);\r
286 PRINT_BIT_FIELD (Edx, MTRR);\r
287 PRINT_BIT_FIELD (Edx, PGE);\r
288 PRINT_BIT_FIELD (Edx, MCA);\r
289 PRINT_BIT_FIELD (Edx, CMOV);\r
290 PRINT_BIT_FIELD (Edx, PAT);\r
291 PRINT_BIT_FIELD (Edx, PSE_36);\r
292 PRINT_BIT_FIELD (Edx, PSN);\r
293 PRINT_BIT_FIELD (Edx, CLFSH);\r
294 PRINT_BIT_FIELD (Edx, DS);\r
295 PRINT_BIT_FIELD (Edx, ACPI);\r
296 PRINT_BIT_FIELD (Edx, MMX);\r
297 PRINT_BIT_FIELD (Edx, FXSR);\r
298 PRINT_BIT_FIELD (Edx, SSE);\r
299 PRINT_BIT_FIELD (Edx, SSE2);\r
300 PRINT_BIT_FIELD (Edx, SS);\r
301 PRINT_BIT_FIELD (Edx, HTT);\r
302 PRINT_BIT_FIELD (Edx, TM);\r
303 PRINT_BIT_FIELD (Edx, PBE);\r
304}\r
305\r
306/**\r
307 Lookup a cache description string from the mCpuidCacheInfoDescription table.\r
308\r
309 @param[in] CacheDescriptor Cache descriptor value from CPUID_CACHE_INFO.\r
310\r
311**/\r
312CPUID_CACHE_INFO_DESCRIPTION *\r
313LookupCacheDescription (\r
314 UINT8 CacheDescriptor\r
315 )\r
316{\r
317 UINTN NumDescriptors;\r
318 UINTN Descriptor;\r
319\r
320 if (CacheDescriptor == 0x00) {\r
321 return NULL;\r
322 }\r
323 NumDescriptors = sizeof (mCpuidCacheInfoDescription)/sizeof (mCpuidCacheInfoDescription[0]);\r
324 for (Descriptor = 0; Descriptor < NumDescriptors; Descriptor++) {\r
325 if (CacheDescriptor == mCpuidCacheInfoDescription[Descriptor].CacheDescriptor) {\r
326 return &mCpuidCacheInfoDescription[Descriptor];\r
327 }\r
328 }\r
329 return NULL;\r
330}\r
331\r
332/**\r
333 Display CPUID_CACHE_INFO leaf for each supported cache descriptor.\r
334\r
335**/\r
336VOID\r
337CpuidCacheInfo (\r
338 VOID\r
339 )\r
340{\r
341 CPUID_CACHE_INFO_CACHE_TLB Eax;\r
342 CPUID_CACHE_INFO_CACHE_TLB Ebx;\r
343 CPUID_CACHE_INFO_CACHE_TLB Ecx;\r
344 CPUID_CACHE_INFO_CACHE_TLB Edx;\r
345 UINTN Index;\r
346 CPUID_CACHE_INFO_DESCRIPTION *CacheDescription;\r
347\r
348 if (CPUID_CACHE_INFO > gMaximumBasicFunction) {\r
349 return;\r
350 }\r
351\r
352 AsmCpuid (CPUID_CACHE_INFO, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
353\r
354 Print (L"CPUID_CACHE_INFO (Leaf %08x)\n", CPUID_CACHE_INFO);\r
355 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
356 if (Eax.Bits.NotValid == 0) {\r
357 //\r
358 // Process Eax.CacheDescriptor[1..3]. Ignore Eax.CacheDescriptor[0]\r
359 //\r
360 for (Index = 1; Index < 4; Index++) {\r
361 CacheDescription = LookupCacheDescription (Eax.CacheDescriptor[Index]);\r
362 if (CacheDescription != NULL) {\r
363 Print (L" %-8a %a\n",\r
364 CacheDescription->Type,\r
365 CacheDescription->Description\r
366 );\r
367 }\r
368 }\r
369 }\r
370 if (Ebx.Bits.NotValid == 0) {\r
371 //\r
372 // Process Ebx.CacheDescriptor[0..3]\r
373 //\r
374 for (Index = 0; Index < 4; Index++) {\r
375 CacheDescription = LookupCacheDescription (Ebx.CacheDescriptor[Index]);\r
376 if (CacheDescription != NULL) {\r
377 Print (L" %-8a %a\n",\r
378 CacheDescription->Type,\r
379 CacheDescription->Description\r
380 );\r
381 }\r
382 }\r
383 }\r
384 if (Ecx.Bits.NotValid == 0) {\r
385 //\r
386 // Process Ecx.CacheDescriptor[0..3]\r
387 //\r
388 for (Index = 0; Index < 4; Index++) {\r
389 CacheDescription = LookupCacheDescription (Ecx.CacheDescriptor[Index]);\r
390 if (CacheDescription != NULL) {\r
391 Print (L" %-8a %a\n",\r
392 CacheDescription->Type,\r
393 CacheDescription->Description\r
394 );\r
395 }\r
396 }\r
397 }\r
398 if (Edx.Bits.NotValid == 0) {\r
399 //\r
400 // Process Edx.CacheDescriptor[0..3]\r
401 //\r
402 for (Index = 0; Index < 4; Index++) {\r
403 CacheDescription = LookupCacheDescription (Edx.CacheDescriptor[Index]);\r
404 if (CacheDescription != NULL) {\r
405 Print (L" %-8a %a\n",\r
406 CacheDescription->Type,\r
407 CacheDescription->Description\r
408 );\r
409 }\r
410 }\r
411 }\r
412}\r
413\r
414/**\r
415 Display CPUID_SERIAL_NUMBER leaf if it is supported.\r
416\r
417**/\r
418VOID\r
419CpuidSerialNumber (\r
420 VOID\r
421 )\r
422{\r
423 CPUID_VERSION_INFO_EDX VersionInfoEdx;\r
424 UINT32 Ecx;\r
425 UINT32 Edx;\r
426\r
427 Print (L"CPUID_SERIAL_NUMBER (Leaf %08x)\n", CPUID_SERIAL_NUMBER);\r
428\r
429 if (CPUID_SERIAL_NUMBER > gMaximumBasicFunction) {\r
430 return;\r
431 }\r
432\r
433 AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL, &VersionInfoEdx.Uint32);\r
434 if (VersionInfoEdx.Bits.PSN == 0) {\r
435 Print (L" Not Supported\n");\r
436 return;\r
437 }\r
438\r
439 AsmCpuid (CPUID_SERIAL_NUMBER, NULL, NULL, &Ecx, &Edx);\r
440 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, 0, Ecx, Edx);\r
441 Print (L" Processor Serial Number = %08x%08x%08x\n", 0, Edx, Ecx);\r
442}\r
443\r
444/**\r
445 Display CPUID_CACHE_PARAMS for all supported sub-leafs.\r
446\r
447**/\r
448VOID\r
449CpuidCacheParams (\r
450 VOID\r
451 )\r
452{\r
453 UINT32 CacheLevel;\r
454 CPUID_CACHE_PARAMS_EAX Eax;\r
455 CPUID_CACHE_PARAMS_EBX Ebx;\r
456 UINT32 Ecx;\r
457 CPUID_CACHE_PARAMS_EDX Edx;\r
458\r
459 if (CPUID_CACHE_PARAMS > gMaximumBasicFunction) {\r
460 return;\r
461 }\r
462\r
463 CacheLevel = 0;\r
464 do {\r
465 AsmCpuidEx (\r
466 CPUID_CACHE_PARAMS, CacheLevel,\r
467 &Eax.Uint32, &Ebx.Uint32, &Ecx, &Edx.Uint32\r
468 );\r
469 if (Eax.Bits.CacheType != CPUID_CACHE_PARAMS_CACHE_TYPE_NULL) {\r
470 Print (L"CPUID_CACHE_PARAMS (Leaf %08x, Sub-Leaf %08x)\n", CPUID_CACHE_PARAMS, CacheLevel);\r
471 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx, Edx.Uint32);\r
472 PRINT_BIT_FIELD (Eax, CacheType);\r
473 PRINT_BIT_FIELD (Eax, CacheLevel);\r
474 PRINT_BIT_FIELD (Eax, SelfInitializingCache);\r
475 PRINT_BIT_FIELD (Eax, FullyAssociativeCache);\r
476 PRINT_BIT_FIELD (Eax, MaximumAddressableIdsForLogicalProcessors);\r
477 PRINT_BIT_FIELD (Eax, MaximumAddressableIdsForProcessorCores);\r
478 PRINT_BIT_FIELD (Ebx, LineSize);\r
479 PRINT_BIT_FIELD (Ebx, LinePartitions);\r
480 PRINT_BIT_FIELD (Ebx, Ways);\r
481 PRINT_VALUE (Ecx, NumberOfSets);\r
482 PRINT_BIT_FIELD (Edx, Invalidate);\r
483 PRINT_BIT_FIELD (Edx, CacheInclusiveness);\r
484 PRINT_BIT_FIELD (Edx, ComplexCacheIndexing);\r
485 }\r
486 CacheLevel++;\r
487 } while (Eax.Bits.CacheType != CPUID_CACHE_PARAMS_CACHE_TYPE_NULL);\r
488}\r
489\r
490/**\r
491 Display CPUID_MONITOR_MWAIT leaf.\r
492\r
493**/\r
494VOID\r
495CpuidMonitorMwait (\r
496 VOID\r
497 )\r
498{\r
499 CPUID_MONITOR_MWAIT_EAX Eax;\r
500 CPUID_MONITOR_MWAIT_EBX Ebx;\r
501 CPUID_MONITOR_MWAIT_ECX Ecx;\r
502 CPUID_MONITOR_MWAIT_EDX Edx;\r
503\r
504 if (CPUID_MONITOR_MWAIT > gMaximumBasicFunction) {\r
505 return;\r
506 }\r
507\r
508 AsmCpuid (CPUID_MONITOR_MWAIT, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
509\r
510 Print (L"CPUID_MONITOR_MWAIT (Leaf %08x)\n", CPUID_MONITOR_MWAIT);\r
511 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
512\r
513 PRINT_BIT_FIELD (Eax, SmallestMonitorLineSize);\r
514 PRINT_BIT_FIELD (Ebx, LargestMonitorLineSize);\r
515 PRINT_BIT_FIELD (Ecx, ExtensionsSupported);\r
516 PRINT_BIT_FIELD (Ecx, InterruptAsBreak);\r
517 PRINT_BIT_FIELD (Edx, C0States);\r
518 PRINT_BIT_FIELD (Edx, C1States);\r
519 PRINT_BIT_FIELD (Edx, C2States);\r
520 PRINT_BIT_FIELD (Edx, C3States);\r
521 PRINT_BIT_FIELD (Edx, C4States);\r
522 PRINT_BIT_FIELD (Edx, C5States);\r
523 PRINT_BIT_FIELD (Edx, C6States);\r
524 PRINT_BIT_FIELD (Edx, C7States);\r
525}\r
526\r
527/**\r
528 Display CPUID_THERMAL_POWER_MANAGEMENT leaf.\r
529\r
530**/\r
531VOID\r
532CpuidThermalPowerManagement (\r
533 VOID\r
534 )\r
535{\r
536 CPUID_THERMAL_POWER_MANAGEMENT_EAX Eax;\r
537 CPUID_THERMAL_POWER_MANAGEMENT_EBX Ebx;\r
538 CPUID_THERMAL_POWER_MANAGEMENT_ECX Ecx;\r
539\r
540 if (CPUID_THERMAL_POWER_MANAGEMENT > gMaximumBasicFunction) {\r
541 return;\r
542 }\r
543\r
544 AsmCpuid (CPUID_THERMAL_POWER_MANAGEMENT, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, NULL);\r
545\r
546 Print (L"CPUID_THERMAL_POWER_MANAGEMENT (Leaf %08x)\n", CPUID_THERMAL_POWER_MANAGEMENT);\r
547 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, 0);\r
548\r
549 PRINT_BIT_FIELD (Eax, DigitalTemperatureSensor);\r
550 PRINT_BIT_FIELD (Eax, TurboBoostTechnology);\r
551 PRINT_BIT_FIELD (Eax, ARAT);\r
552 PRINT_BIT_FIELD (Eax, PLN);\r
553 PRINT_BIT_FIELD (Eax, ECMD);\r
554 PRINT_BIT_FIELD (Eax, PTM);\r
555 PRINT_BIT_FIELD (Eax, HWP);\r
556 PRINT_BIT_FIELD (Eax, HWP_Notification);\r
557 PRINT_BIT_FIELD (Eax, HWP_Activity_Window);\r
558 PRINT_BIT_FIELD (Eax, HWP_Energy_Performance_Preference);\r
559 PRINT_BIT_FIELD (Eax, HWP_Package_Level_Request);\r
560 PRINT_BIT_FIELD (Eax, HDC);\r
56fbaecb
ED
561 PRINT_BIT_FIELD (Eax, TurboBoostMaxTechnology30);\r
562 PRINT_BIT_FIELD (Eax, HWPCapabilities);\r
563 PRINT_BIT_FIELD (Eax, HWPPECIOverride);\r
564 PRINT_BIT_FIELD (Eax, FlexibleHWP);\r
565 PRINT_BIT_FIELD (Eax, FastAccessMode);\r
566 PRINT_BIT_FIELD (Eax, IgnoringIdleLogicalProcessorHWPRequest);\r
25705752
MK
567 PRINT_BIT_FIELD (Ebx, InterruptThresholds);\r
568 PRINT_BIT_FIELD (Ecx, HardwareCoordinationFeedback);\r
569 PRINT_BIT_FIELD (Ecx, PerformanceEnergyBias);\r
570}\r
571\r
572/**\r
573 Display CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS for all supported sub-leafs.\r
574\r
575**/\r
576VOID\r
577CpuidStructuredExtendedFeatureFlags (\r
578 VOID\r
579 )\r
580{\r
581 UINT32 Eax;\r
582 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX Ebx;\r
583 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_ECX Ecx;\r
56fbaecb 584 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EDX Edx;\r
25705752
MK
585 UINT32 SubLeaf;\r
586\r
587 if (CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS > gMaximumBasicFunction) {\r
588 return;\r
589 }\r
590\r
591 AsmCpuidEx (\r
592 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,\r
593 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO,\r
594 &Eax, NULL, NULL, NULL\r
595 );\r
596 for (SubLeaf = 0; SubLeaf <= Eax; SubLeaf++) {\r
597 AsmCpuidEx (\r
598 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,\r
599 SubLeaf,\r
56fbaecb 600 NULL, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
25705752 601 );\r
56fbaecb 602 if (Ebx.Uint32 != 0 || Ecx.Uint32 != 0 || Edx.Uint32 != 0) {\r
25705752 603 Print (L"CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS (Leaf %08x, Sub-Leaf %08x)\n", CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS, SubLeaf);\r
56fbaecb 604 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
25705752
MK
605 PRINT_BIT_FIELD (Ebx, FSGSBASE);\r
606 PRINT_BIT_FIELD (Ebx, IA32_TSC_ADJUST);\r
f5a2d6f0 607 PRINT_BIT_FIELD (Ebx, SGX);\r
25705752
MK
608 PRINT_BIT_FIELD (Ebx, BMI1);\r
609 PRINT_BIT_FIELD (Ebx, HLE);\r
610 PRINT_BIT_FIELD (Ebx, AVX2);\r
611 PRINT_BIT_FIELD (Ebx, FDP_EXCPTN_ONLY);\r
612 PRINT_BIT_FIELD (Ebx, SMEP);\r
613 PRINT_BIT_FIELD (Ebx, BMI2);\r
614 PRINT_BIT_FIELD (Ebx, EnhancedRepMovsbStosb);\r
615 PRINT_BIT_FIELD (Ebx, INVPCID);\r
616 PRINT_BIT_FIELD (Ebx, RTM);\r
14806d7b 617 PRINT_BIT_FIELD (Ebx, RDT_M);\r
25705752
MK
618 PRINT_BIT_FIELD (Ebx, DeprecateFpuCsDs);\r
619 PRINT_BIT_FIELD (Ebx, MPX);\r
14806d7b 620 PRINT_BIT_FIELD (Ebx, RDT_A);\r
56fbaecb
ED
621 PRINT_BIT_FIELD (Ebx, AVX512F);\r
622 PRINT_BIT_FIELD (Ebx, AVX512DQ);\r
25705752
MK
623 PRINT_BIT_FIELD (Ebx, RDSEED);\r
624 PRINT_BIT_FIELD (Ebx, ADX);\r
625 PRINT_BIT_FIELD (Ebx, SMAP);\r
56fbaecb 626 PRINT_BIT_FIELD (Ebx, AVX512_IFMA);\r
25705752 627 PRINT_BIT_FIELD (Ebx, CLFLUSHOPT);\r
14806d7b 628 PRINT_BIT_FIELD (Ebx, CLWB);\r
25705752 629 PRINT_BIT_FIELD (Ebx, IntelProcessorTrace);\r
56fbaecb
ED
630 PRINT_BIT_FIELD (Ebx, AVX512PF);\r
631 PRINT_BIT_FIELD (Ebx, AVX512ER);\r
632 PRINT_BIT_FIELD (Ebx, AVX512CD);\r
14806d7b 633 PRINT_BIT_FIELD (Ebx, SHA);\r
56fbaecb
ED
634 PRINT_BIT_FIELD (Ebx, AVX512BW);\r
635 PRINT_BIT_FIELD (Ebx, AVX512VL);\r
636\r
25705752 637 PRINT_BIT_FIELD (Ecx, PREFETCHWT1);\r
56fbaecb 638 PRINT_BIT_FIELD (Ecx, AVX512_VBMI);\r
14806d7b 639 PRINT_BIT_FIELD (Ecx, UMIP);\r
25705752
MK
640 PRINT_BIT_FIELD (Ecx, PKU);\r
641 PRINT_BIT_FIELD (Ecx, OSPKE);\r
56fbaecb 642 PRINT_BIT_FIELD (Ecx, AVX512_VPOPCNTDQ);\r
14806d7b
HW
643 PRINT_BIT_FIELD (Ecx, MAWAU);\r
644 PRINT_BIT_FIELD (Ecx, RDPID);\r
645 PRINT_BIT_FIELD (Ecx, SGX_LC);\r
56fbaecb
ED
646\r
647 PRINT_BIT_FIELD (Edx, AVX512_4VNNIW);\r
648 PRINT_BIT_FIELD (Edx, AVX512_4FMAPS);\r
649 PRINT_BIT_FIELD (Edx, EnumeratesSupportForIBRSAndIBPB);\r
650 PRINT_BIT_FIELD (Edx, EnumeratesSupportForSTIBP);\r
651 PRINT_BIT_FIELD (Edx, EnumeratesSupportForL1D_FLUSH);\r
652 PRINT_BIT_FIELD (Edx, EnumeratesSupportForCapability);\r
653 PRINT_BIT_FIELD (Edx, EnumeratesSupportForSSBD);\r
25705752 654 }\r
d93a10c0 655 }\r
25705752
MK
656}\r
657\r
658/**\r
659 Display CPUID_DIRECT_CACHE_ACCESS_INFO leaf.\r
660\r
661**/\r
662VOID\r
663CpuidDirectCacheAccessInfo (\r
664 VOID\r
665 )\r
666{\r
667 UINT32 Eax;\r
668\r
669 if (CPUID_DIRECT_CACHE_ACCESS_INFO > gMaximumBasicFunction) {\r
670 return;\r
671 }\r
672\r
673 AsmCpuid (CPUID_DIRECT_CACHE_ACCESS_INFO, &Eax, NULL, NULL, NULL);\r
674 Print (L"CPUID_DIRECT_CACHE_ACCESS_INFO (Leaf %08x)\n", CPUID_DIRECT_CACHE_ACCESS_INFO);\r
675 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, 0, 0, 0);\r
676}\r
677\r
678/**\r
679 Display CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING leaf.\r
680\r
681**/\r
682VOID\r
683CpuidArchitecturalPerformanceMonitoring (\r
684 VOID\r
685 )\r
686{\r
687 CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EAX Eax;\r
688 CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EBX Ebx;\r
689 CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING_EDX Edx;\r
690\r
691 if (CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING > gMaximumBasicFunction) {\r
692 return;\r
693 }\r
694\r
695 AsmCpuid (CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING, &Eax.Uint32, &Ebx.Uint32, NULL, &Edx.Uint32);\r
696 Print (L"CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING (Leaf %08x)\n", CPUID_ARCHITECTURAL_PERFORMANCE_MONITORING);\r
697 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, 0, Edx.Uint32);\r
698 PRINT_BIT_FIELD (Eax, ArchPerfMonVerID);\r
699 PRINT_BIT_FIELD (Eax, PerformanceMonitorCounters);\r
700 PRINT_BIT_FIELD (Eax, PerformanceMonitorCounterWidth);\r
701 PRINT_BIT_FIELD (Eax, EbxBitVectorLength);\r
702 PRINT_BIT_FIELD (Ebx, UnhaltedCoreCycles);\r
703 PRINT_BIT_FIELD (Ebx, InstructionsRetired);\r
704 PRINT_BIT_FIELD (Ebx, UnhaltedReferenceCycles);\r
705 PRINT_BIT_FIELD (Ebx, LastLevelCacheReferences);\r
706 PRINT_BIT_FIELD (Ebx, LastLevelCacheMisses);\r
707 PRINT_BIT_FIELD (Ebx, BranchInstructionsRetired);\r
708 PRINT_BIT_FIELD (Ebx, AllBranchMispredictRetired);\r
709 PRINT_BIT_FIELD (Edx, FixedFunctionPerformanceCounters);\r
710 PRINT_BIT_FIELD (Edx, FixedFunctionPerformanceCounterWidth);\r
56fbaecb 711 PRINT_BIT_FIELD (Edx, AnyThreadDeprecation);\r
25705752
MK
712}\r
713\r
714/**\r
715 Display CPUID_EXTENDED_TOPOLOGY leafs for all supported levels.\r
716\r
717**/\r
718VOID\r
719CpuidExtendedTopology (\r
720 VOID\r
721 )\r
722{\r
723 CPUID_EXTENDED_TOPOLOGY_EAX Eax;\r
724 CPUID_EXTENDED_TOPOLOGY_EBX Ebx;\r
725 CPUID_EXTENDED_TOPOLOGY_ECX Ecx;\r
726 UINT32 Edx;\r
727 UINT32 LevelNumber;\r
728\r
729 if (CPUID_EXTENDED_TOPOLOGY > gMaximumBasicFunction) {\r
730 return;\r
731 }\r
732\r
733 LevelNumber = 0;\r
734 do {\r
735 AsmCpuidEx (\r
736 CPUID_EXTENDED_TOPOLOGY, LevelNumber,\r
737 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx\r
738 );\r
739 if (Eax.Bits.ApicIdShift != 0) {\r
740 Print (L"CPUID_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_TOPOLOGY, LevelNumber);\r
741 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
742 PRINT_BIT_FIELD (Eax, ApicIdShift);\r
743 PRINT_BIT_FIELD (Ebx, LogicalProcessors);\r
744 PRINT_BIT_FIELD (Ecx, LevelNumber);\r
745 PRINT_BIT_FIELD (Ecx, LevelType);\r
746 PRINT_VALUE (Edx, x2APIC_ID);\r
747 }\r
748 LevelNumber++;\r
749 } while (Eax.Bits.ApicIdShift != 0);\r
750}\r
751\r
752/**\r
753 Display CPUID_EXTENDED_STATE sub-leaf.\r
754\r
755**/\r
756VOID\r
757CpuidExtendedStateSubLeaf (\r
758 VOID\r
759 )\r
760{\r
761 CPUID_EXTENDED_STATE_SUB_LEAF_EAX Eax;\r
762 UINT32 Ebx;\r
763 CPUID_EXTENDED_STATE_SUB_LEAF_ECX Ecx;\r
764 UINT32 Edx;\r
765\r
766 AsmCpuidEx (\r
767 CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF,\r
768 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx\r
769 );\r
770 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF);\r
771 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx);\r
772 PRINT_BIT_FIELD (Eax, XSAVEOPT);\r
773 PRINT_BIT_FIELD (Eax, XSAVEC);\r
774 PRINT_BIT_FIELD (Eax, XGETBV);\r
775 PRINT_BIT_FIELD (Eax, XSAVES);\r
776 PRINT_VALUE (Ebx, EnabledSaveStateSize_XCR0_IA32_XSS);\r
777 PRINT_BIT_FIELD (Ecx, XCR0);\r
56fbaecb 778 PRINT_BIT_FIELD (Ecx, HWPState);\r
25705752
MK
779 PRINT_BIT_FIELD (Ecx, PT);\r
780 PRINT_BIT_FIELD (Ecx, XCR0_1);\r
781 PRINT_VALUE (Edx, IA32_XSS_Supported_32_63);\r
782}\r
783\r
784/**\r
785 Display CPUID_EXTENDED_STATE size and offset information sub-leaf.\r
786\r
787**/\r
788VOID\r
789CpuidExtendedStateSizeOffset (\r
790 VOID\r
791 )\r
792{\r
793 UINT32 Eax;\r
794 UINT32 Ebx;\r
795 CPUID_EXTENDED_STATE_SIZE_OFFSET_ECX Ecx;\r
796 UINT32 Edx;\r
797 UINT32 SubLeaf;\r
798\r
799 for (SubLeaf = CPUID_EXTENDED_STATE_SIZE_OFFSET; SubLeaf < 32; SubLeaf++) {\r
800 AsmCpuidEx (\r
801 CPUID_EXTENDED_STATE, SubLeaf,\r
802 &Eax, &Ebx, &Ecx.Uint32, &Edx\r
803 );\r
804 if (Edx != 0) {\r
805 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, SubLeaf);\r
806 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx.Uint32, Edx);\r
807 PRINT_VALUE (Eax, FeatureSaveStateSize);\r
808 PRINT_VALUE (Ebx, FeatureSaveStateOffset);\r
809 PRINT_BIT_FIELD (Ecx, XSS);\r
810 PRINT_BIT_FIELD (Ecx, Compacted);\r
811 }\r
812 }\r
813}\r
814\r
815/**\r
816 Display CPUID_EXTENDED_STATE main leaf and sub-leafs.\r
817\r
818**/\r
819VOID\r
820CpuidExtendedStateMainLeaf (\r
821 VOID\r
822 )\r
823{\r
824 CPUID_EXTENDED_STATE_MAIN_LEAF_EAX Eax;\r
825 UINT32 Ebx;\r
826 UINT32 Ecx;\r
827 UINT32 Edx;\r
828\r
829 if (CPUID_EXTENDED_STATE > gMaximumBasicFunction) {\r
830 return;\r
831 }\r
832\r
833 AsmCpuidEx (\r
834 CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_MAIN_LEAF,\r
835 &Eax.Uint32, &Ebx, &Ecx, &Edx\r
836 );\r
837 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_MAIN_LEAF);\r
838 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx, Edx);\r
839 PRINT_BIT_FIELD (Eax, x87);\r
840 PRINT_BIT_FIELD (Eax, SSE);\r
841 PRINT_BIT_FIELD (Eax, AVX);\r
842 PRINT_BIT_FIELD (Eax, MPX);\r
843 PRINT_BIT_FIELD (Eax, AVX_512);\r
844 PRINT_BIT_FIELD (Eax, IA32_XSS);\r
845 PRINT_BIT_FIELD (Eax, PKRU);\r
56fbaecb 846 PRINT_BIT_FIELD (Eax, IA32_XSS_2);\r
25705752
MK
847 PRINT_VALUE (Ebx, EnabledSaveStateSize);\r
848 PRINT_VALUE (Ecx, SupportedSaveStateSize);\r
849 PRINT_VALUE (Edx, XCR0_Supported_32_63);\r
850\r
851 CpuidExtendedStateSubLeaf ();\r
852 CpuidExtendedStateSizeOffset ();\r
853}\r
854\r
855/**\r
14806d7b 856 Display CPUID_INTEL_RDT_MONITORING enumeration sub-leaf.\r
25705752
MK
857\r
858**/\r
859VOID\r
14806d7b 860CpuidIntelRdtMonitoringEnumerationSubLeaf (\r
25705752
MK
861 VOID\r
862 )\r
863{\r
864 UINT32 Ebx;\r
14806d7b 865 CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF_EDX Edx;\r
25705752 866\r
14806d7b 867 if (CPUID_INTEL_RDT_MONITORING > gMaximumBasicFunction) {\r
25705752
MK
868 return;\r
869 }\r
870\r
871 AsmCpuidEx (\r
14806d7b 872 CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF,\r
25705752
MK
873 NULL, &Ebx, NULL, &Edx.Uint32\r
874 );\r
14806d7b 875 Print (L"CPUID_INTEL_RDT_MONITORING (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF);\r
25705752
MK
876 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx, 0, Edx.Uint32);\r
877 PRINT_VALUE (Ebx, Maximum_RMID_Range);\r
14806d7b 878 PRINT_BIT_FIELD (Edx, L3CacheRDT_M);\r
25705752
MK
879}\r
880\r
881/**\r
14806d7b 882 Display CPUID_INTEL_RDT_MONITORING L3 cache capability sub-leaf.\r
25705752
MK
883\r
884**/\r
885VOID\r
14806d7b 886CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf (\r
25705752
MK
887 VOID\r
888 )\r
889{\r
890 UINT32 Ebx;\r
891 UINT32 Ecx;\r
14806d7b 892 CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF_EDX Edx;\r
25705752 893\r
14806d7b 894 if (CPUID_INTEL_RDT_MONITORING > gMaximumBasicFunction) {\r
25705752
MK
895 return;\r
896 }\r
897\r
898 AsmCpuidEx (\r
14806d7b 899 CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF,\r
25705752
MK
900 NULL, &Ebx, &Ecx, &Edx.Uint32\r
901 );\r
14806d7b 902 Print (L"CPUID_INTEL_RDT_MONITORING (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF);\r
25705752
MK
903 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx, Ecx, Edx.Uint32);\r
904 PRINT_VALUE (Ebx, OccupancyConversionFactor);\r
905 PRINT_VALUE (Ecx, Maximum_RMID_Range);\r
906 PRINT_BIT_FIELD (Edx, L3CacheOccupancyMonitoring);\r
14806d7b
HW
907 PRINT_BIT_FIELD (Edx, L3CacheTotalBandwidthMonitoring);\r
908 PRINT_BIT_FIELD (Edx, L3CacheLocalBandwidthMonitoring);\r
25705752
MK
909}\r
910\r
56fbaecb
ED
911/**\r
912 Display CPUID_INTEL_RDT_ALLOCATION memory bandwidth allocation technology enumeration\r
913 sub-leaf.\r
914\r
915**/\r
916VOID\r
917CpuidIntelRdtAllocationMemoryBandwidthSubLeaf (\r
918 VOID\r
919 )\r
920{\r
921 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX Eax;\r
922 UINT32 Ebx;\r
923 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX Ecx;\r
924 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX Edx;\r
925\r
926 AsmCpuidEx (\r
927 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF,\r
928 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx.Uint32\r
929 );\r
930 Print (L"CPUID_INTEL_RDT_ALLOCATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF);\r
931 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);\r
932 PRINT_BIT_FIELD (Eax, MaximumMBAThrottling);\r
933 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
934 PRINT_BIT_FIELD (Ecx, Liner);\r
935 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
936}\r
937\r
25705752 938/**\r
14806d7b
HW
939 Display CPUID_INTEL_RDT_ALLOCATION L3 cache allocation technology enumeration\r
940 sub-leaf.\r
25705752
MK
941\r
942**/\r
943VOID\r
14806d7b 944CpuidIntelRdtAllocationL3CacheSubLeaf (\r
25705752
MK
945 VOID\r
946 )\r
947{\r
14806d7b 948 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_EAX Eax;\r
25705752 949 UINT32 Ebx;\r
14806d7b
HW
950 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX Ecx;\r
951 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_EDX Edx;\r
25705752
MK
952\r
953 AsmCpuidEx (\r
14806d7b 954 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF,\r
25705752
MK
955 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx.Uint32\r
956 );\r
14806d7b 957 Print (L"CPUID_INTEL_RDT_ALLOCATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF);\r
25705752
MK
958 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);\r
959 PRINT_BIT_FIELD (Eax, CapacityLength);\r
960 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
25705752
MK
961 PRINT_BIT_FIELD (Ecx, CodeDataPrioritization);\r
962 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
963}\r
964\r
965/**\r
14806d7b
HW
966 Display CPUID_INTEL_RDT_ALLOCATION L2 cache allocation technology enumeration\r
967 sub-leaf.\r
25705752
MK
968\r
969**/\r
970VOID\r
14806d7b 971CpuidIntelRdtAllocationL2CacheSubLeaf (\r
25705752
MK
972 VOID\r
973 )\r
974{\r
14806d7b
HW
975 CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF_EAX Eax;\r
976 UINT32 Ebx;\r
977 CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF_EDX Edx;\r
978\r
979 AsmCpuidEx (\r
980 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF,\r
981 &Eax.Uint32, &Ebx, NULL, &Edx.Uint32\r
982 );\r
983 Print (L"CPUID_INTEL_RDT_ALLOCATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF);\r
984 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, 0, Edx.Uint32);\r
985 PRINT_BIT_FIELD (Eax, CapacityLength);\r
986 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
987 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
988}\r
989\r
990/**\r
991 Display CPUID_INTEL_RDT_ALLOCATION main leaf and sub-leaves.\r
992\r
993**/\r
994VOID\r
995CpuidIntelRdtAllocationMainLeaf (\r
996 VOID\r
997 )\r
998{\r
999 CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX Ebx;\r
25705752 1000\r
14806d7b 1001 if (CPUID_INTEL_RDT_ALLOCATION > gMaximumBasicFunction) {\r
25705752
MK
1002 return;\r
1003 }\r
1004\r
1005 AsmCpuidEx (\r
14806d7b 1006 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF,\r
25705752
MK
1007 NULL, &Ebx.Uint32, NULL, NULL\r
1008 );\r
14806d7b 1009 Print (L"CPUID_INTEL_RDT_ALLOCATION (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF);\r
25705752 1010 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx.Uint32, 0, 0);\r
14806d7b
HW
1011 PRINT_BIT_FIELD (Ebx, L3CacheAllocation);\r
1012 PRINT_BIT_FIELD (Ebx, L2CacheAllocation);\r
56fbaecb
ED
1013 PRINT_BIT_FIELD (Ebx, MemoryBandwidth);\r
1014 CpuidIntelRdtAllocationMemoryBandwidthSubLeaf ();\r
14806d7b
HW
1015 CpuidIntelRdtAllocationL3CacheSubLeaf ();\r
1016 CpuidIntelRdtAllocationL2CacheSubLeaf ();\r
25705752
MK
1017}\r
1018\r
f5a2d6f0
JF
1019/**\r
1020 Display Sub-Leaf 0 Enumeration of Intel SGX Capabilities.\r
1021\r
1022**/\r
1023VOID\r
1024CpuidEnumerationOfIntelSgxCapabilities0SubLeaf (\r
1025 VOID\r
1026 )\r
1027{\r
1028 CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX Eax;\r
1029 UINT32 Ebx;\r
1030 CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EDX Edx;\r
1031\r
1032 AsmCpuidEx (\r
1033 CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF,\r
1034 &Eax.Uint32, &Ebx, NULL, &Edx.Uint32\r
1035 );\r
1036 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF);\r
1037 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, 0, Edx.Uint32);\r
1038 PRINT_BIT_FIELD (Eax, SGX1);\r
1039 PRINT_BIT_FIELD (Eax, SGX2);\r
56fbaecb
ED
1040 PRINT_BIT_FIELD (Eax, ENCLV);\r
1041 PRINT_BIT_FIELD (Eax, ENCLS);\r
f5a2d6f0
JF
1042 PRINT_BIT_FIELD (Edx, MaxEnclaveSize_Not64);\r
1043 PRINT_BIT_FIELD (Edx, MaxEnclaveSize_64);\r
1044}\r
1045\r
1046/**\r
1047 Display Sub-Leaf 1 Enumeration of Intel SGX Capabilities.\r
1048\r
1049**/\r
1050VOID\r
1051CpuidEnumerationOfIntelSgxCapabilities1SubLeaf (\r
1052 VOID\r
1053 )\r
1054{\r
1055 UINT32 Eax;\r
1056 UINT32 Ebx;\r
1057 UINT32 Ecx;\r
1058 UINT32 Edx;\r
1059\r
1060 AsmCpuidEx (\r
1061 CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF,\r
1062 &Eax, &Ebx, &Ecx, &Edx\r
1063 );\r
1064 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF);\r
1065 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx, Edx);\r
1066}\r
1067\r
1068/**\r
1069 Display Sub-Leaf Index 2 or Higher Enumeration of Intel SGX Resources.\r
1070\r
1071**/\r
1072VOID\r
1073CpuidEnumerationOfIntelSgxResourcesSubLeaf (\r
1074 VOID\r
1075 )\r
1076{\r
1077 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EAX Eax;\r
1078 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EBX Ebx;\r
1079 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_ECX Ecx;\r
1080 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EDX Edx;\r
1081 UINT32 SubLeaf;\r
7367cc6c 1082\r
f5a2d6f0
JF
1083 SubLeaf = CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF;\r
1084 do {\r
1085 AsmCpuidEx (\r
1086 CPUID_INTEL_SGX, SubLeaf,\r
1087 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1088 );\r
1089 if (Eax.Bits.SubLeafType == 0x1) {\r
1090 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, SubLeaf);\r
1091 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1092 PRINT_BIT_FIELD (Eax, SubLeafType);\r
1093 PRINT_BIT_FIELD (Eax, LowAddressOfEpcSection);\r
1094 PRINT_BIT_FIELD (Ebx, HighAddressOfEpcSection);\r
1095 PRINT_BIT_FIELD (Ecx, EpcSection);\r
1096 PRINT_BIT_FIELD (Ecx, LowSizeOfEpcSection);\r
1097 PRINT_BIT_FIELD (Edx, HighSizeOfEpcSection);\r
1098 }\r
1099 SubLeaf++;\r
1100 } while (Eax.Bits.SubLeafType == 0x1);\r
1101}\r
1102\r
1103/**\r
1104 Display Intel SGX Resource Enumeration.\r
1105\r
1106**/\r
1107VOID\r
1108CpuidEnumerationOfIntelSgx (\r
1109 VOID\r
1110 )\r
1111{\r
1112 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX Ebx;\r
1113\r
1114 if (CPUID_INTEL_SGX > gMaximumBasicFunction) {\r
1115 return;\r
1116 }\r
1117\r
1118 AsmCpuidEx (\r
1119 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,\r
1120 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO,\r
1121 NULL, &Ebx.Uint32, NULL, NULL\r
1122 );\r
1123 if (Ebx.Bits.SGX != 1) {\r
1124 //\r
1125 // Only if CPUID.(EAX=07H, ECX=0H):EBX.SGX = 1, the processor has support\r
1126 // for Intel SGX.\r
1127 //\r
1128 return;\r
1129 }\r
7367cc6c 1130\r
f5a2d6f0
JF
1131 CpuidEnumerationOfIntelSgxCapabilities0SubLeaf ();\r
1132 CpuidEnumerationOfIntelSgxCapabilities1SubLeaf ();\r
1133 CpuidEnumerationOfIntelSgxResourcesSubLeaf ();\r
1134}\r
1135\r
25705752
MK
1136/**\r
1137 Display CPUID_INTEL_PROCESSOR_TRACE sub-leafs.\r
1138\r
1139 @param[in] MaximumSubLeaf Maximum sub-leaf index for CPUID_INTEL_PROCESSOR_TRACE.\r
1140\r
1141**/\r
1142VOID\r
1143CpuidIntelProcessorTraceSubLeaf (\r
1144 UINT32 MaximumSubLeaf\r
1145 )\r
1146{\r
1147 UINT32 SubLeaf;\r
1148 CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF_EAX Eax;\r
1149 CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF_EBX Ebx;\r
1150\r
1151 for (SubLeaf = CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF; SubLeaf <= MaximumSubLeaf; SubLeaf++) {\r
1152 AsmCpuidEx (\r
1153 CPUID_INTEL_PROCESSOR_TRACE, SubLeaf,\r
1154 &Eax.Uint32, &Ebx.Uint32, NULL, NULL\r
1155 );\r
1156 Print (L"CPUID_INTEL_PROCESSOR_TRACE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_PROCESSOR_TRACE, SubLeaf);\r
1157 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, 0, 0);\r
1158 PRINT_BIT_FIELD (Eax, ConfigurableAddressRanges);\r
1159 PRINT_BIT_FIELD (Eax, MtcPeriodEncodings);\r
1160 PRINT_BIT_FIELD (Ebx, CycleThresholdEncodings);\r
1161 PRINT_BIT_FIELD (Ebx, PsbFrequencyEncodings);\r
1162 }\r
1163}\r
1164\r
1165/**\r
1166 Display CPUID_INTEL_PROCESSOR_TRACE main leaf and sub-leafs.\r
1167\r
1168**/\r
1169VOID\r
1170CpuidIntelProcessorTraceMainLeaf (\r
1171 VOID\r
1172 )\r
1173{\r
1174 UINT32 Eax;\r
1175 CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF_EBX Ebx;\r
1176 CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF_ECX Ecx;\r
1177\r
1178 if (CPUID_INTEL_PROCESSOR_TRACE > gMaximumBasicFunction) {\r
1179 return;\r
1180 }\r
1181\r
1182 AsmCpuidEx (\r
1183 CPUID_INTEL_PROCESSOR_TRACE, CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF,\r
1184 &Eax, &Ebx.Uint32, &Ecx.Uint32, NULL\r
1185 );\r
1186 Print (L"CPUID_INTEL_PROCESSOR_TRACE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_PROCESSOR_TRACE, CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF);\r
1187 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx.Uint32, 0);\r
1188 PRINT_VALUE (Eax, MaximumSubLeaf);\r
1189 PRINT_BIT_FIELD (Ebx, Cr3Filter);\r
1190 PRINT_BIT_FIELD (Ebx, ConfigurablePsb);\r
1191 PRINT_BIT_FIELD (Ebx, IpTraceStopFiltering);\r
1192 PRINT_BIT_FIELD (Ebx, Mtc);\r
14806d7b
HW
1193 PRINT_BIT_FIELD (Ebx, PTWrite);\r
1194 PRINT_BIT_FIELD (Ebx, PowerEventTrace);\r
25705752
MK
1195 PRINT_BIT_FIELD (Ecx, RTIT);\r
1196 PRINT_BIT_FIELD (Ecx, ToPA);\r
1197 PRINT_BIT_FIELD (Ecx, SingleRangeOutput);\r
1198 PRINT_BIT_FIELD (Ecx, TraceTransportSubsystem);\r
1199 PRINT_BIT_FIELD (Ecx, LIP);\r
1200\r
1201 CpuidIntelProcessorTraceSubLeaf (Eax);\r
1202}\r
1203\r
1204/**\r
1205 Display CPUID_TIME_STAMP_COUNTER leaf.\r
1206\r
1207**/\r
1208VOID\r
1209CpuidTimeStampCounter (\r
1210 VOID\r
1211 )\r
1212{\r
1213 UINT32 Eax;\r
1214 UINT32 Ebx;\r
14806d7b 1215 UINT32 Ecx;\r
25705752
MK
1216\r
1217 if (CPUID_TIME_STAMP_COUNTER > gMaximumBasicFunction) {\r
1218 return;\r
1219 }\r
1220\r
14806d7b 1221 AsmCpuid (CPUID_TIME_STAMP_COUNTER, &Eax, &Ebx, &Ecx, NULL);\r
25705752 1222 Print (L"CPUID_TIME_STAMP_COUNTER (Leaf %08x)\n", CPUID_TIME_STAMP_COUNTER);\r
14806d7b 1223 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx, 0);\r
25705752
MK
1224}\r
1225\r
1226/**\r
1227 Display CPUID_PROCESSOR_FREQUENCY leaf.\r
1228\r
1229**/\r
1230VOID\r
1231CpuidProcessorFrequency (\r
1232 VOID\r
1233 )\r
1234{\r
1235 CPUID_PROCESSOR_FREQUENCY_EAX Eax;\r
1236 CPUID_PROCESSOR_FREQUENCY_EBX Ebx;\r
1237 CPUID_PROCESSOR_FREQUENCY_ECX Ecx;\r
1238\r
1239 if (CPUID_PROCESSOR_FREQUENCY > gMaximumBasicFunction) {\r
1240 return;\r
1241 }\r
1242\r
1243 AsmCpuid (CPUID_PROCESSOR_FREQUENCY, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, NULL);\r
1244 Print (L"CPUID_PROCESSOR_FREQUENCY (Leaf %08x)\n", CPUID_PROCESSOR_FREQUENCY);\r
1245 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, 0);\r
1246 PRINT_BIT_FIELD (Eax, ProcessorBaseFrequency);\r
1247 PRINT_BIT_FIELD (Ebx, MaximumFrequency);\r
1248 PRINT_BIT_FIELD (Ecx, BusFrequency);\r
1249}\r
1250\r
1251/**\r
1252 Display CPUID_SOC_VENDOR sub-leafs that contain the SoC Vendor Brand String.\r
1253 Also display these sub-leafs as a single SoC Vendor Brand String.\r
1254\r
1255**/\r
1256VOID\r
1257CpuidSocVendorBrandString (\r
1258 VOID\r
1259 )\r
1260{\r
1261 CPUID_SOC_VENDOR_BRAND_STRING_DATA Eax;\r
1262 CPUID_SOC_VENDOR_BRAND_STRING_DATA Ebx;\r
1263 CPUID_SOC_VENDOR_BRAND_STRING_DATA Ecx;\r
1264 CPUID_SOC_VENDOR_BRAND_STRING_DATA Edx;\r
1265 //\r
1266 // Array to store brand string from 3 brand string leafs with\r
1267 // 4 32-bit brand string values per leaf and an extra value to\r
1268 // null terminate the string.\r
1269 //\r
1270 UINT32 BrandString[3 * 4 + 1];\r
1271\r
1272 AsmCpuidEx (\r
1273 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING1,\r
1274 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1275 );\r
1276 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING1);\r
1277 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1278 BrandString[0] = Eax.Uint32;\r
1279 BrandString[1] = Ebx.Uint32;\r
1280 BrandString[2] = Ecx.Uint32;\r
1281 BrandString[3] = Edx.Uint32;\r
1282\r
1283 AsmCpuidEx (\r
1284 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING2,\r
1285 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1286 );\r
1287 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING2);\r
1288 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1289 BrandString[4] = Eax.Uint32;\r
1290 BrandString[5] = Ebx.Uint32;\r
1291 BrandString[6] = Ecx.Uint32;\r
1292 BrandString[7] = Edx.Uint32;\r
1293\r
1294 AsmCpuidEx (\r
1295 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING3,\r
1296 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1297 );\r
1298 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING3);\r
1299 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1300 BrandString[8] = Eax.Uint32;\r
1301 BrandString[9] = Ebx.Uint32;\r
1302 BrandString[10] = Ecx.Uint32;\r
1303 BrandString[11] = Edx.Uint32;\r
1304\r
1305 BrandString[12] = 0;\r
1306\r
1307 Print (L"Vendor Brand String = %a\n", (CHAR8 *)BrandString);\r
1308}\r
1309\r
1310/**\r
1311 Display CPUID_SOC_VENDOR main leaf and sub-leafs.\r
1312\r
1313**/\r
1314VOID\r
1315CpuidSocVendor (\r
1316 VOID\r
1317 )\r
1318{\r
1319 UINT32 Eax;\r
1320 CPUID_SOC_VENDOR_MAIN_LEAF_EBX Ebx;\r
1321 UINT32 Ecx;\r
1322 UINT32 Edx;\r
1323\r
1324 if (CPUID_SOC_VENDOR > gMaximumBasicFunction) {\r
1325 return;\r
1326 }\r
1327\r
1328 AsmCpuidEx (\r
1329 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_MAIN_LEAF,\r
1330 &Eax, &Ebx.Uint32, &Ecx, &Edx\r
1331 );\r
1332 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_MAIN_LEAF);\r
1333 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx, Edx);\r
1334 if (Eax < 3) {\r
1335 Print (L" Not Supported\n");\r
1336 return;\r
1337 }\r
1338 PRINT_VALUE (Eax, MaxSOCID_Index);\r
1339 PRINT_BIT_FIELD (Ebx, SocVendorId);\r
1340 PRINT_BIT_FIELD (Ebx, IsVendorScheme);\r
1341 PRINT_VALUE (Ecx, ProjectID);\r
1342 PRINT_VALUE (Edx, SteppingID);\r
1343 CpuidSocVendorBrandString ();\r
1344}\r
1345\r
56fbaecb
ED
1346/**\r
1347 Display CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS main leaf and sub-leafs.\r
1348\r
1349**/\r
1350VOID\r
1351CpuidDeterministicAddressTranslationParameters (\r
1352 VOID\r
1353 )\r
1354{\r
1355 UINT32 Eax;\r
1356 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX Ebx;\r
1357 UINT32 Ecx;\r
1358 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX Edx;\r
1359\r
1360 if (CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS > gMaximumBasicFunction) {\r
1361 return;\r
1362 }\r
1363\r
1364 AsmCpuidEx (\r
1365 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS,\r
1366 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF,\r
1367 &Eax, &Ebx.Uint32, &Ecx, &Edx.Uint32\r
1368 );\r
1369 Print (L"CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS (Leaf %08x, Sub-Leaf %08x)\n", CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS, CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF);\r
1370 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx, Edx.Uint32);\r
1371\r
1372 PRINT_VALUE (Eax, MaxID_Index);\r
1373 PRINT_BIT_FIELD (Ebx, Page4K);\r
1374 PRINT_BIT_FIELD (Ebx, Page2M);\r
1375 PRINT_BIT_FIELD (Ebx, Page4M);\r
1376 PRINT_BIT_FIELD (Ebx, Page1G);\r
1377 PRINT_BIT_FIELD (Ebx, Partitioning);\r
1378 PRINT_BIT_FIELD (Ebx, Way);\r
1379\r
1380 PRINT_VALUE (Ecx, NumberOfSets);\r
1381\r
1382 PRINT_BIT_FIELD (Edx, TranslationCacheType);\r
1383 PRINT_BIT_FIELD (Edx, TranslationCacheLevel);\r
1384 PRINT_BIT_FIELD (Edx, FullyAssociative);\r
1385 PRINT_BIT_FIELD (Edx, MaximumNum);\r
1386}\r
1387\r
1388/**\r
1389 Display CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION main leaf and sub-leafs.\r
1390\r
1391**/\r
1392VOID\r
1393CpuidV2ExtendedTopologyEnumeration (\r
1394 VOID\r
1395 )\r
1396{\r
516e3397
RN
1397 CPUID_EXTENDED_TOPOLOGY_EAX Eax;\r
1398 CPUID_EXTENDED_TOPOLOGY_EBX Ebx;\r
1399 CPUID_EXTENDED_TOPOLOGY_ECX Ecx;\r
1400 UINT32 Edx;\r
56fbaecb 1401\r
516e3397 1402 if (CPUID_V2_EXTENDED_TOPOLOGY > gMaximumBasicFunction) {\r
56fbaecb
ED
1403 return;\r
1404 }\r
1405\r
1406 AsmCpuidEx (\r
516e3397
RN
1407 CPUID_V2_EXTENDED_TOPOLOGY,\r
1408 0,\r
56fbaecb
ED
1409 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx\r
1410 );\r
516e3397 1411 Print (L"CPUID_V2_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", CPUID_V2_EXTENDED_TOPOLOGY, 0);\r
56fbaecb
ED
1412 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
1413\r
516e3397
RN
1414 PRINT_BIT_FIELD (Eax, ApicIdShift);\r
1415 PRINT_BIT_FIELD (Ebx, LogicalProcessors);\r
1416 PRINT_BIT_FIELD (Ecx, LevelNumber);\r
56fbaecb
ED
1417 PRINT_BIT_FIELD (Ecx, LevelType);\r
1418 PRINT_VALUE (Edx, x2APICID);\r
1419}\r
1420\r
25705752
MK
1421/**\r
1422 Display CPUID_EXTENDED_FUNCTION leaf.\r
1423\r
1424**/\r
1425VOID\r
1426CpuidExtendedFunction (\r
1427 VOID\r
1428 )\r
1429{\r
1430 UINT32 Eax;\r
1431\r
1432 AsmCpuid (CPUID_EXTENDED_FUNCTION, &Eax, NULL, NULL, NULL);\r
1433 Print (L"CPUID_EXTENDED_FUNCTION (Leaf %08x)\n", CPUID_EXTENDED_FUNCTION);\r
1434 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, 0, 0, 0);\r
1435 PRINT_VALUE (Eax, MaximumExtendedFunction);\r
1436\r
1437 gMaximumExtendedFunction = Eax;\r
1438}\r
1439\r
1440/**\r
1441 Display CPUID_EXTENDED_CPU_SIG leaf.\r
1442\r
1443**/\r
1444VOID\r
1445CpuidExtendedCpuSig (\r
1446 VOID\r
1447 )\r
1448{\r
1449 UINT32 Eax;\r
1450 CPUID_EXTENDED_CPU_SIG_ECX Ecx;\r
1451 CPUID_EXTENDED_CPU_SIG_EDX Edx;\r
1452\r
1453 if (CPUID_EXTENDED_CPU_SIG > gMaximumExtendedFunction) {\r
1454 return;\r
1455 }\r
1456\r
1457 AsmCpuid (CPUID_EXTENDED_CPU_SIG, &Eax, NULL, &Ecx.Uint32, &Edx.Uint32);\r
1458 Print (L"CPUID_EXTENDED_CPU_SIG (Leaf %08x)\n", CPUID_EXTENDED_CPU_SIG);\r
1459 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, 0, Ecx.Uint32, Edx.Uint32);\r
1460 PRINT_BIT_FIELD (Ecx, LAHF_SAHF);\r
1461 PRINT_BIT_FIELD (Ecx, LZCNT);\r
1462 PRINT_BIT_FIELD (Ecx, PREFETCHW);\r
1463 PRINT_BIT_FIELD (Edx, SYSCALL_SYSRET);\r
1464 PRINT_BIT_FIELD (Edx, NX);\r
1465 PRINT_BIT_FIELD (Edx, Page1GB);\r
1466 PRINT_BIT_FIELD (Edx, RDTSCP);\r
1467 PRINT_BIT_FIELD (Edx, LM);\r
1468}\r
1469\r
1470/**\r
1471 Display CPUID_BRAND_STRING1, CPUID_BRAND_STRING2 and CPUID_BRAND_STRING3\r
1472 leafs. Also display these three leafs as a single brand string.\r
1473\r
1474**/\r
1475VOID\r
1476CpuidProcessorBrandString (\r
1477 VOID\r
1478 )\r
1479{\r
1480 CPUID_BRAND_STRING_DATA Eax;\r
1481 CPUID_BRAND_STRING_DATA Ebx;\r
1482 CPUID_BRAND_STRING_DATA Ecx;\r
1483 CPUID_BRAND_STRING_DATA Edx;\r
1484 //\r
1485 // Array to store brand string from 3 brand string leafs with\r
1486 // 4 32-bit brand string values per leaf and an extra value to\r
1487 // null terminate the string.\r
1488 //\r
1489 UINT32 BrandString[3 * 4 + 1];\r
1490\r
1491 if (CPUID_BRAND_STRING1 <= gMaximumExtendedFunction) {\r
1492 AsmCpuid (CPUID_BRAND_STRING1, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1493 Print (L"CPUID_BRAND_STRING1 (Leaf %08x)\n", CPUID_BRAND_STRING1);\r
1494 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1495 BrandString[0] = Eax.Uint32;\r
1496 BrandString[1] = Ebx.Uint32;\r
1497 BrandString[2] = Ecx.Uint32;\r
1498 BrandString[3] = Edx.Uint32;\r
1499 }\r
1500\r
1501 if (CPUID_BRAND_STRING2 <= gMaximumExtendedFunction) {\r
1502 AsmCpuid (CPUID_BRAND_STRING2, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1503 Print (L"CPUID_BRAND_STRING2 (Leaf %08x)\n", CPUID_BRAND_STRING2);\r
1504 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1505 BrandString[4] = Eax.Uint32;\r
1506 BrandString[5] = Ebx.Uint32;\r
1507 BrandString[6] = Ecx.Uint32;\r
1508 BrandString[7] = Edx.Uint32;\r
1509 }\r
1510\r
1511 if (CPUID_BRAND_STRING3 <= gMaximumExtendedFunction) {\r
1512 AsmCpuid (CPUID_BRAND_STRING3, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1513 Print (L"CPUID_BRAND_STRING3 (Leaf %08x)\n", CPUID_BRAND_STRING3);\r
1514 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1515 BrandString[8] = Eax.Uint32;\r
1516 BrandString[9] = Ebx.Uint32;\r
1517 BrandString[10] = Ecx.Uint32;\r
1518 BrandString[11] = Edx.Uint32;\r
1519 }\r
1520\r
1521 BrandString[12] = 0;\r
1522\r
1523 Print (L"Brand String = %a\n", (CHAR8 *)BrandString);\r
1524}\r
1525\r
1526/**\r
1527 Display CPUID_EXTENDED_CACHE_INFO leaf.\r
1528\r
1529**/\r
1530VOID\r
1531CpuidExtendedCacheInfo (\r
1532 VOID\r
1533 )\r
1534{\r
1535 CPUID_EXTENDED_CACHE_INFO_ECX Ecx;\r
1536\r
1537 if (CPUID_EXTENDED_CACHE_INFO > gMaximumExtendedFunction) {\r
1538 return;\r
1539 }\r
1540\r
1541 AsmCpuid (CPUID_EXTENDED_CACHE_INFO, NULL, NULL, &Ecx.Uint32, NULL);\r
1542 Print (L"CPUID_EXTENDED_CACHE_INFO (Leaf %08x)\n", CPUID_EXTENDED_CACHE_INFO);\r
1543 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, 0, Ecx.Uint32, 0);\r
1544 PRINT_BIT_FIELD (Ecx, CacheLineSize);\r
1545 PRINT_BIT_FIELD (Ecx, L2Associativity);\r
1546 PRINT_BIT_FIELD (Ecx, CacheSize);\r
1547}\r
1548\r
1549/**\r
1550 Display CPUID_EXTENDED_TIME_STAMP_COUNTER leaf.\r
1551\r
1552**/\r
1553VOID\r
1554CpuidExtendedTimeStampCounter (\r
1555 VOID\r
1556 )\r
1557{\r
1558 CPUID_EXTENDED_TIME_STAMP_COUNTER_EDX Edx;\r
1559\r
1560 if (CPUID_EXTENDED_TIME_STAMP_COUNTER > gMaximumExtendedFunction) {\r
1561 return;\r
1562 }\r
1563\r
1564 AsmCpuid (CPUID_EXTENDED_TIME_STAMP_COUNTER, NULL, NULL, NULL, &Edx.Uint32);\r
1565 Print (L"CPUID_EXTENDED_TIME_STAMP_COUNTER (Leaf %08x)\n", CPUID_EXTENDED_TIME_STAMP_COUNTER);\r
1566 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, 0, 0, Edx.Uint32);\r
1567 PRINT_BIT_FIELD (Edx, InvariantTsc);\r
1568}\r
1569\r
1570/**\r
1571 Display CPUID_VIR_PHY_ADDRESS_SIZE leaf.\r
1572\r
1573**/\r
1574VOID\r
1575CpuidVirPhyAddressSize (\r
1576 VOID\r
1577 )\r
1578{\r
1579 CPUID_VIR_PHY_ADDRESS_SIZE_EAX Eax;\r
1580\r
1581 if (CPUID_VIR_PHY_ADDRESS_SIZE > gMaximumExtendedFunction) {\r
1582 return;\r
1583 }\r
1584\r
1585 AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &Eax.Uint32, NULL, NULL, NULL);\r
1586 Print (L"CPUID_VIR_PHY_ADDRESS_SIZE (Leaf %08x)\n", CPUID_VIR_PHY_ADDRESS_SIZE);\r
1587 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, 0, 0, 0);\r
1588 PRINT_BIT_FIELD (Eax, PhysicalAddressBits);\r
1589 PRINT_BIT_FIELD (Eax, LinearAddressBits);\r
1590}\r
1591\r
1592/**\r
1593 The user Entry Point for Application. The user code starts with this function\r
1594 as the real entry point for the application.\r
1595\r
1596 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
1597 @param[in] SystemTable A pointer to the EFI System Table.\r
1598\r
1599 @retval EFI_SUCCESS The entry point is executed successfully.\r
1600 @retval other Some error occurs when executing this entry point.\r
1601\r
1602**/\r
1603EFI_STATUS\r
1604EFIAPI\r
1605UefiMain (\r
1606 IN EFI_HANDLE ImageHandle,\r
1607 IN EFI_SYSTEM_TABLE *SystemTable\r
1608 )\r
1609{\r
1610 Print (L"UEFI CPUID Version 0.5\n");\r
1611\r
1612 CpuidSignature ();\r
1613 CpuidVersionInfo ();\r
1614 CpuidCacheInfo ();\r
1615 CpuidSerialNumber ();\r
1616 CpuidCacheParams();\r
1617 CpuidMonitorMwait ();\r
1618 CpuidThermalPowerManagement ();\r
1619 CpuidStructuredExtendedFeatureFlags ();\r
1620 CpuidDirectCacheAccessInfo();\r
1621 CpuidArchitecturalPerformanceMonitoring ();\r
1622 CpuidExtendedTopology ();\r
1623 CpuidExtendedStateMainLeaf ();\r
14806d7b
HW
1624 CpuidIntelRdtMonitoringEnumerationSubLeaf ();\r
1625 CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf ();\r
1626 CpuidIntelRdtAllocationMainLeaf ();\r
f5a2d6f0 1627 CpuidEnumerationOfIntelSgx ();\r
25705752
MK
1628 CpuidIntelProcessorTraceMainLeaf ();\r
1629 CpuidTimeStampCounter ();\r
1630 CpuidProcessorFrequency ();\r
1631 CpuidSocVendor ();\r
56fbaecb
ED
1632 CpuidDeterministicAddressTranslationParameters ();\r
1633 CpuidV2ExtendedTopologyEnumeration ();\r
25705752
MK
1634 CpuidExtendedFunction ();\r
1635 CpuidExtendedCpuSig ();\r
1636 CpuidProcessorBrandString ();\r
1637 CpuidExtendedCacheInfo ();\r
1638 CpuidExtendedTimeStampCounter ();\r
1639 CpuidVirPhyAddressSize ();\r
1640\r
1641 return EFI_SUCCESS;\r
1642}\r