]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Application/Cpuid/Cpuid.c
UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly
[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
079141eb 720 UINT32 LeafFunction\r
25705752
MK
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
079141eb
RN
729 if (LeafFunction > gMaximumBasicFunction) {\r
730 return;\r
731 }\r
732 if ((LeafFunction != CPUID_EXTENDED_TOPOLOGY) && (LeafFunction != CPUID_V2_EXTENDED_TOPOLOGY)) {\r
25705752
MK
733 return;\r
734 }\r
735\r
736 LevelNumber = 0;\r
079141eb 737 for (LevelNumber = 0; ; LevelNumber++) {\r
25705752 738 AsmCpuidEx (\r
079141eb 739 LeafFunction, LevelNumber,\r
25705752
MK
740 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx\r
741 );\r
079141eb
RN
742 if (Ecx.Bits.LevelType == CPUID_EXTENDED_TOPOLOGY_LEVEL_TYPE_INVALID) {\r
743 break;\r
25705752 744 }\r
079141eb
RN
745 Print (\r
746 L"%a (Leaf %08x, Sub-Leaf %08x)\n",\r
747 LeafFunction == CPUID_EXTENDED_TOPOLOGY ? "CPUID_EXTENDED_TOPOLOGY" : "CPUID_V2_EXTENDED_TOPOLOGY",\r
748 LeafFunction, LevelNumber\r
749 );\r
750 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx);\r
751 PRINT_BIT_FIELD (Eax, ApicIdShift);\r
752 PRINT_BIT_FIELD (Ebx, LogicalProcessors);\r
753 PRINT_BIT_FIELD (Ecx, LevelNumber);\r
754 PRINT_BIT_FIELD (Ecx, LevelType);\r
755 PRINT_VALUE (Edx, x2APIC_ID);\r
756 }\r
25705752
MK
757}\r
758\r
759/**\r
760 Display CPUID_EXTENDED_STATE sub-leaf.\r
761\r
762**/\r
763VOID\r
764CpuidExtendedStateSubLeaf (\r
765 VOID\r
766 )\r
767{\r
768 CPUID_EXTENDED_STATE_SUB_LEAF_EAX Eax;\r
769 UINT32 Ebx;\r
770 CPUID_EXTENDED_STATE_SUB_LEAF_ECX Ecx;\r
771 UINT32 Edx;\r
772\r
773 AsmCpuidEx (\r
774 CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF,\r
775 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx\r
776 );\r
777 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_SUB_LEAF);\r
778 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx);\r
779 PRINT_BIT_FIELD (Eax, XSAVEOPT);\r
780 PRINT_BIT_FIELD (Eax, XSAVEC);\r
781 PRINT_BIT_FIELD (Eax, XGETBV);\r
782 PRINT_BIT_FIELD (Eax, XSAVES);\r
783 PRINT_VALUE (Ebx, EnabledSaveStateSize_XCR0_IA32_XSS);\r
784 PRINT_BIT_FIELD (Ecx, XCR0);\r
56fbaecb 785 PRINT_BIT_FIELD (Ecx, HWPState);\r
25705752
MK
786 PRINT_BIT_FIELD (Ecx, PT);\r
787 PRINT_BIT_FIELD (Ecx, XCR0_1);\r
788 PRINT_VALUE (Edx, IA32_XSS_Supported_32_63);\r
789}\r
790\r
791/**\r
792 Display CPUID_EXTENDED_STATE size and offset information sub-leaf.\r
793\r
794**/\r
795VOID\r
796CpuidExtendedStateSizeOffset (\r
797 VOID\r
798 )\r
799{\r
800 UINT32 Eax;\r
801 UINT32 Ebx;\r
802 CPUID_EXTENDED_STATE_SIZE_OFFSET_ECX Ecx;\r
803 UINT32 Edx;\r
804 UINT32 SubLeaf;\r
805\r
806 for (SubLeaf = CPUID_EXTENDED_STATE_SIZE_OFFSET; SubLeaf < 32; SubLeaf++) {\r
807 AsmCpuidEx (\r
808 CPUID_EXTENDED_STATE, SubLeaf,\r
809 &Eax, &Ebx, &Ecx.Uint32, &Edx\r
810 );\r
811 if (Edx != 0) {\r
812 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, SubLeaf);\r
813 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx.Uint32, Edx);\r
814 PRINT_VALUE (Eax, FeatureSaveStateSize);\r
815 PRINT_VALUE (Ebx, FeatureSaveStateOffset);\r
816 PRINT_BIT_FIELD (Ecx, XSS);\r
817 PRINT_BIT_FIELD (Ecx, Compacted);\r
818 }\r
819 }\r
820}\r
821\r
822/**\r
823 Display CPUID_EXTENDED_STATE main leaf and sub-leafs.\r
824\r
825**/\r
826VOID\r
827CpuidExtendedStateMainLeaf (\r
828 VOID\r
829 )\r
830{\r
831 CPUID_EXTENDED_STATE_MAIN_LEAF_EAX Eax;\r
832 UINT32 Ebx;\r
833 UINT32 Ecx;\r
834 UINT32 Edx;\r
835\r
836 if (CPUID_EXTENDED_STATE > gMaximumBasicFunction) {\r
837 return;\r
838 }\r
839\r
840 AsmCpuidEx (\r
841 CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_MAIN_LEAF,\r
842 &Eax.Uint32, &Ebx, &Ecx, &Edx\r
843 );\r
844 Print (L"CPUID_EXTENDED_STATE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_EXTENDED_STATE, CPUID_EXTENDED_STATE_MAIN_LEAF);\r
845 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx, Edx);\r
846 PRINT_BIT_FIELD (Eax, x87);\r
847 PRINT_BIT_FIELD (Eax, SSE);\r
848 PRINT_BIT_FIELD (Eax, AVX);\r
849 PRINT_BIT_FIELD (Eax, MPX);\r
850 PRINT_BIT_FIELD (Eax, AVX_512);\r
851 PRINT_BIT_FIELD (Eax, IA32_XSS);\r
852 PRINT_BIT_FIELD (Eax, PKRU);\r
56fbaecb 853 PRINT_BIT_FIELD (Eax, IA32_XSS_2);\r
25705752
MK
854 PRINT_VALUE (Ebx, EnabledSaveStateSize);\r
855 PRINT_VALUE (Ecx, SupportedSaveStateSize);\r
856 PRINT_VALUE (Edx, XCR0_Supported_32_63);\r
857\r
858 CpuidExtendedStateSubLeaf ();\r
859 CpuidExtendedStateSizeOffset ();\r
860}\r
861\r
862/**\r
14806d7b 863 Display CPUID_INTEL_RDT_MONITORING enumeration sub-leaf.\r
25705752
MK
864\r
865**/\r
866VOID\r
14806d7b 867CpuidIntelRdtMonitoringEnumerationSubLeaf (\r
25705752
MK
868 VOID\r
869 )\r
870{\r
871 UINT32 Ebx;\r
14806d7b 872 CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF_EDX Edx;\r
25705752 873\r
14806d7b 874 if (CPUID_INTEL_RDT_MONITORING > gMaximumBasicFunction) {\r
25705752
MK
875 return;\r
876 }\r
877\r
878 AsmCpuidEx (\r
14806d7b 879 CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF,\r
25705752
MK
880 NULL, &Ebx, NULL, &Edx.Uint32\r
881 );\r
14806d7b 882 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
883 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx, 0, Edx.Uint32);\r
884 PRINT_VALUE (Ebx, Maximum_RMID_Range);\r
14806d7b 885 PRINT_BIT_FIELD (Edx, L3CacheRDT_M);\r
25705752
MK
886}\r
887\r
888/**\r
14806d7b 889 Display CPUID_INTEL_RDT_MONITORING L3 cache capability sub-leaf.\r
25705752
MK
890\r
891**/\r
892VOID\r
14806d7b 893CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf (\r
25705752
MK
894 VOID\r
895 )\r
896{\r
897 UINT32 Ebx;\r
898 UINT32 Ecx;\r
14806d7b 899 CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF_EDX Edx;\r
25705752 900\r
14806d7b 901 if (CPUID_INTEL_RDT_MONITORING > gMaximumBasicFunction) {\r
25705752
MK
902 return;\r
903 }\r
904\r
905 AsmCpuidEx (\r
14806d7b 906 CPUID_INTEL_RDT_MONITORING, CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF,\r
25705752
MK
907 NULL, &Ebx, &Ecx, &Edx.Uint32\r
908 );\r
14806d7b 909 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
910 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx, Ecx, Edx.Uint32);\r
911 PRINT_VALUE (Ebx, OccupancyConversionFactor);\r
912 PRINT_VALUE (Ecx, Maximum_RMID_Range);\r
913 PRINT_BIT_FIELD (Edx, L3CacheOccupancyMonitoring);\r
14806d7b
HW
914 PRINT_BIT_FIELD (Edx, L3CacheTotalBandwidthMonitoring);\r
915 PRINT_BIT_FIELD (Edx, L3CacheLocalBandwidthMonitoring);\r
25705752
MK
916}\r
917\r
56fbaecb
ED
918/**\r
919 Display CPUID_INTEL_RDT_ALLOCATION memory bandwidth allocation technology enumeration\r
920 sub-leaf.\r
921\r
922**/\r
923VOID\r
924CpuidIntelRdtAllocationMemoryBandwidthSubLeaf (\r
925 VOID\r
926 )\r
927{\r
928 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EAX Eax;\r
929 UINT32 Ebx;\r
930 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_ECX Ecx;\r
931 CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF_EDX Edx;\r
932\r
933 AsmCpuidEx (\r
934 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_MEMORY_BANDWIDTH_SUB_LEAF,\r
935 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx.Uint32\r
936 );\r
937 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
938 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);\r
939 PRINT_BIT_FIELD (Eax, MaximumMBAThrottling);\r
940 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
941 PRINT_BIT_FIELD (Ecx, Liner);\r
942 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
943}\r
944\r
25705752 945/**\r
14806d7b
HW
946 Display CPUID_INTEL_RDT_ALLOCATION L3 cache allocation technology enumeration\r
947 sub-leaf.\r
25705752
MK
948\r
949**/\r
950VOID\r
14806d7b 951CpuidIntelRdtAllocationL3CacheSubLeaf (\r
25705752
MK
952 VOID\r
953 )\r
954{\r
14806d7b 955 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_EAX Eax;\r
25705752 956 UINT32 Ebx;\r
14806d7b
HW
957 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_ECX Ecx;\r
958 CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF_EDX Edx;\r
25705752
MK
959\r
960 AsmCpuidEx (\r
14806d7b 961 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF,\r
25705752
MK
962 &Eax.Uint32, &Ebx, &Ecx.Uint32, &Edx.Uint32\r
963 );\r
14806d7b 964 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
965 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, Ecx.Uint32, Edx.Uint32);\r
966 PRINT_BIT_FIELD (Eax, CapacityLength);\r
967 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
25705752
MK
968 PRINT_BIT_FIELD (Ecx, CodeDataPrioritization);\r
969 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
970}\r
971\r
972/**\r
14806d7b
HW
973 Display CPUID_INTEL_RDT_ALLOCATION L2 cache allocation technology enumeration\r
974 sub-leaf.\r
25705752
MK
975\r
976**/\r
977VOID\r
14806d7b 978CpuidIntelRdtAllocationL2CacheSubLeaf (\r
25705752
MK
979 VOID\r
980 )\r
981{\r
14806d7b
HW
982 CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF_EAX Eax;\r
983 UINT32 Ebx;\r
984 CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF_EDX Edx;\r
985\r
986 AsmCpuidEx (\r
987 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_L2_CACHE_SUB_LEAF,\r
988 &Eax.Uint32, &Ebx, NULL, &Edx.Uint32\r
989 );\r
990 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
991 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, 0, Edx.Uint32);\r
992 PRINT_BIT_FIELD (Eax, CapacityLength);\r
993 PRINT_VALUE (Ebx, AllocationUnitBitMap);\r
994 PRINT_BIT_FIELD (Edx, HighestCosNumber);\r
995}\r
996\r
997/**\r
998 Display CPUID_INTEL_RDT_ALLOCATION main leaf and sub-leaves.\r
999\r
1000**/\r
1001VOID\r
1002CpuidIntelRdtAllocationMainLeaf (\r
1003 VOID\r
1004 )\r
1005{\r
1006 CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF_EBX Ebx;\r
25705752 1007\r
14806d7b 1008 if (CPUID_INTEL_RDT_ALLOCATION > gMaximumBasicFunction) {\r
25705752
MK
1009 return;\r
1010 }\r
1011\r
1012 AsmCpuidEx (\r
14806d7b 1013 CPUID_INTEL_RDT_ALLOCATION, CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF,\r
25705752
MK
1014 NULL, &Ebx.Uint32, NULL, NULL\r
1015 );\r
14806d7b 1016 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 1017 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, Ebx.Uint32, 0, 0);\r
14806d7b
HW
1018 PRINT_BIT_FIELD (Ebx, L3CacheAllocation);\r
1019 PRINT_BIT_FIELD (Ebx, L2CacheAllocation);\r
56fbaecb
ED
1020 PRINT_BIT_FIELD (Ebx, MemoryBandwidth);\r
1021 CpuidIntelRdtAllocationMemoryBandwidthSubLeaf ();\r
14806d7b
HW
1022 CpuidIntelRdtAllocationL3CacheSubLeaf ();\r
1023 CpuidIntelRdtAllocationL2CacheSubLeaf ();\r
25705752
MK
1024}\r
1025\r
f5a2d6f0
JF
1026/**\r
1027 Display Sub-Leaf 0 Enumeration of Intel SGX Capabilities.\r
1028\r
1029**/\r
1030VOID\r
1031CpuidEnumerationOfIntelSgxCapabilities0SubLeaf (\r
1032 VOID\r
1033 )\r
1034{\r
1035 CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EAX Eax;\r
1036 UINT32 Ebx;\r
1037 CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF_EDX Edx;\r
1038\r
1039 AsmCpuidEx (\r
1040 CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF,\r
1041 &Eax.Uint32, &Ebx, NULL, &Edx.Uint32\r
1042 );\r
1043 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_0_SUB_LEAF);\r
1044 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx, 0, Edx.Uint32);\r
1045 PRINT_BIT_FIELD (Eax, SGX1);\r
1046 PRINT_BIT_FIELD (Eax, SGX2);\r
56fbaecb
ED
1047 PRINT_BIT_FIELD (Eax, ENCLV);\r
1048 PRINT_BIT_FIELD (Eax, ENCLS);\r
f5a2d6f0
JF
1049 PRINT_BIT_FIELD (Edx, MaxEnclaveSize_Not64);\r
1050 PRINT_BIT_FIELD (Edx, MaxEnclaveSize_64);\r
1051}\r
1052\r
1053/**\r
1054 Display Sub-Leaf 1 Enumeration of Intel SGX Capabilities.\r
1055\r
1056**/\r
1057VOID\r
1058CpuidEnumerationOfIntelSgxCapabilities1SubLeaf (\r
1059 VOID\r
1060 )\r
1061{\r
1062 UINT32 Eax;\r
1063 UINT32 Ebx;\r
1064 UINT32 Ecx;\r
1065 UINT32 Edx;\r
1066\r
1067 AsmCpuidEx (\r
1068 CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF,\r
1069 &Eax, &Ebx, &Ecx, &Edx\r
1070 );\r
1071 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, CPUID_INTEL_SGX_CAPABILITIES_1_SUB_LEAF);\r
1072 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx, Edx);\r
1073}\r
1074\r
1075/**\r
1076 Display Sub-Leaf Index 2 or Higher Enumeration of Intel SGX Resources.\r
1077\r
1078**/\r
1079VOID\r
1080CpuidEnumerationOfIntelSgxResourcesSubLeaf (\r
1081 VOID\r
1082 )\r
1083{\r
1084 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EAX Eax;\r
1085 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EBX Ebx;\r
1086 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_ECX Ecx;\r
1087 CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF_EDX Edx;\r
1088 UINT32 SubLeaf;\r
7367cc6c 1089\r
f5a2d6f0
JF
1090 SubLeaf = CPUID_INTEL_SGX_CAPABILITIES_RESOURCES_SUB_LEAF;\r
1091 do {\r
1092 AsmCpuidEx (\r
1093 CPUID_INTEL_SGX, SubLeaf,\r
1094 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1095 );\r
1096 if (Eax.Bits.SubLeafType == 0x1) {\r
1097 Print (L"CPUID_INTEL_SGX (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_SGX, SubLeaf);\r
1098 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1099 PRINT_BIT_FIELD (Eax, SubLeafType);\r
1100 PRINT_BIT_FIELD (Eax, LowAddressOfEpcSection);\r
1101 PRINT_BIT_FIELD (Ebx, HighAddressOfEpcSection);\r
1102 PRINT_BIT_FIELD (Ecx, EpcSection);\r
1103 PRINT_BIT_FIELD (Ecx, LowSizeOfEpcSection);\r
1104 PRINT_BIT_FIELD (Edx, HighSizeOfEpcSection);\r
1105 }\r
1106 SubLeaf++;\r
1107 } while (Eax.Bits.SubLeafType == 0x1);\r
1108}\r
1109\r
1110/**\r
1111 Display Intel SGX Resource Enumeration.\r
1112\r
1113**/\r
1114VOID\r
1115CpuidEnumerationOfIntelSgx (\r
1116 VOID\r
1117 )\r
1118{\r
1119 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX Ebx;\r
1120\r
1121 if (CPUID_INTEL_SGX > gMaximumBasicFunction) {\r
1122 return;\r
1123 }\r
1124\r
1125 AsmCpuidEx (\r
1126 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS,\r
1127 CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_SUB_LEAF_INFO,\r
1128 NULL, &Ebx.Uint32, NULL, NULL\r
1129 );\r
1130 if (Ebx.Bits.SGX != 1) {\r
1131 //\r
1132 // Only if CPUID.(EAX=07H, ECX=0H):EBX.SGX = 1, the processor has support\r
1133 // for Intel SGX.\r
1134 //\r
1135 return;\r
1136 }\r
7367cc6c 1137\r
f5a2d6f0
JF
1138 CpuidEnumerationOfIntelSgxCapabilities0SubLeaf ();\r
1139 CpuidEnumerationOfIntelSgxCapabilities1SubLeaf ();\r
1140 CpuidEnumerationOfIntelSgxResourcesSubLeaf ();\r
1141}\r
1142\r
25705752
MK
1143/**\r
1144 Display CPUID_INTEL_PROCESSOR_TRACE sub-leafs.\r
1145\r
1146 @param[in] MaximumSubLeaf Maximum sub-leaf index for CPUID_INTEL_PROCESSOR_TRACE.\r
1147\r
1148**/\r
1149VOID\r
1150CpuidIntelProcessorTraceSubLeaf (\r
1151 UINT32 MaximumSubLeaf\r
1152 )\r
1153{\r
1154 UINT32 SubLeaf;\r
1155 CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF_EAX Eax;\r
1156 CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF_EBX Ebx;\r
1157\r
1158 for (SubLeaf = CPUID_INTEL_PROCESSOR_TRACE_SUB_LEAF; SubLeaf <= MaximumSubLeaf; SubLeaf++) {\r
1159 AsmCpuidEx (\r
1160 CPUID_INTEL_PROCESSOR_TRACE, SubLeaf,\r
1161 &Eax.Uint32, &Ebx.Uint32, NULL, NULL\r
1162 );\r
1163 Print (L"CPUID_INTEL_PROCESSOR_TRACE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_PROCESSOR_TRACE, SubLeaf);\r
1164 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, 0, 0);\r
1165 PRINT_BIT_FIELD (Eax, ConfigurableAddressRanges);\r
1166 PRINT_BIT_FIELD (Eax, MtcPeriodEncodings);\r
1167 PRINT_BIT_FIELD (Ebx, CycleThresholdEncodings);\r
1168 PRINT_BIT_FIELD (Ebx, PsbFrequencyEncodings);\r
1169 }\r
1170}\r
1171\r
1172/**\r
1173 Display CPUID_INTEL_PROCESSOR_TRACE main leaf and sub-leafs.\r
1174\r
1175**/\r
1176VOID\r
1177CpuidIntelProcessorTraceMainLeaf (\r
1178 VOID\r
1179 )\r
1180{\r
1181 UINT32 Eax;\r
1182 CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF_EBX Ebx;\r
1183 CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF_ECX Ecx;\r
1184\r
1185 if (CPUID_INTEL_PROCESSOR_TRACE > gMaximumBasicFunction) {\r
1186 return;\r
1187 }\r
1188\r
1189 AsmCpuidEx (\r
1190 CPUID_INTEL_PROCESSOR_TRACE, CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF,\r
1191 &Eax, &Ebx.Uint32, &Ecx.Uint32, NULL\r
1192 );\r
1193 Print (L"CPUID_INTEL_PROCESSOR_TRACE (Leaf %08x, Sub-Leaf %08x)\n", CPUID_INTEL_PROCESSOR_TRACE, CPUID_INTEL_PROCESSOR_TRACE_MAIN_LEAF);\r
1194 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx.Uint32, 0);\r
1195 PRINT_VALUE (Eax, MaximumSubLeaf);\r
1196 PRINT_BIT_FIELD (Ebx, Cr3Filter);\r
1197 PRINT_BIT_FIELD (Ebx, ConfigurablePsb);\r
1198 PRINT_BIT_FIELD (Ebx, IpTraceStopFiltering);\r
1199 PRINT_BIT_FIELD (Ebx, Mtc);\r
14806d7b
HW
1200 PRINT_BIT_FIELD (Ebx, PTWrite);\r
1201 PRINT_BIT_FIELD (Ebx, PowerEventTrace);\r
25705752
MK
1202 PRINT_BIT_FIELD (Ecx, RTIT);\r
1203 PRINT_BIT_FIELD (Ecx, ToPA);\r
1204 PRINT_BIT_FIELD (Ecx, SingleRangeOutput);\r
1205 PRINT_BIT_FIELD (Ecx, TraceTransportSubsystem);\r
1206 PRINT_BIT_FIELD (Ecx, LIP);\r
1207\r
1208 CpuidIntelProcessorTraceSubLeaf (Eax);\r
1209}\r
1210\r
1211/**\r
1212 Display CPUID_TIME_STAMP_COUNTER leaf.\r
1213\r
1214**/\r
1215VOID\r
1216CpuidTimeStampCounter (\r
1217 VOID\r
1218 )\r
1219{\r
1220 UINT32 Eax;\r
1221 UINT32 Ebx;\r
14806d7b 1222 UINT32 Ecx;\r
25705752
MK
1223\r
1224 if (CPUID_TIME_STAMP_COUNTER > gMaximumBasicFunction) {\r
1225 return;\r
1226 }\r
1227\r
14806d7b 1228 AsmCpuid (CPUID_TIME_STAMP_COUNTER, &Eax, &Ebx, &Ecx, NULL);\r
25705752 1229 Print (L"CPUID_TIME_STAMP_COUNTER (Leaf %08x)\n", CPUID_TIME_STAMP_COUNTER);\r
14806d7b 1230 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx, Ecx, 0);\r
25705752
MK
1231}\r
1232\r
1233/**\r
1234 Display CPUID_PROCESSOR_FREQUENCY leaf.\r
1235\r
1236**/\r
1237VOID\r
1238CpuidProcessorFrequency (\r
1239 VOID\r
1240 )\r
1241{\r
1242 CPUID_PROCESSOR_FREQUENCY_EAX Eax;\r
1243 CPUID_PROCESSOR_FREQUENCY_EBX Ebx;\r
1244 CPUID_PROCESSOR_FREQUENCY_ECX Ecx;\r
1245\r
1246 if (CPUID_PROCESSOR_FREQUENCY > gMaximumBasicFunction) {\r
1247 return;\r
1248 }\r
1249\r
1250 AsmCpuid (CPUID_PROCESSOR_FREQUENCY, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, NULL);\r
1251 Print (L"CPUID_PROCESSOR_FREQUENCY (Leaf %08x)\n", CPUID_PROCESSOR_FREQUENCY);\r
1252 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, 0);\r
1253 PRINT_BIT_FIELD (Eax, ProcessorBaseFrequency);\r
1254 PRINT_BIT_FIELD (Ebx, MaximumFrequency);\r
1255 PRINT_BIT_FIELD (Ecx, BusFrequency);\r
1256}\r
1257\r
1258/**\r
1259 Display CPUID_SOC_VENDOR sub-leafs that contain the SoC Vendor Brand String.\r
1260 Also display these sub-leafs as a single SoC Vendor Brand String.\r
1261\r
1262**/\r
1263VOID\r
1264CpuidSocVendorBrandString (\r
1265 VOID\r
1266 )\r
1267{\r
1268 CPUID_SOC_VENDOR_BRAND_STRING_DATA Eax;\r
1269 CPUID_SOC_VENDOR_BRAND_STRING_DATA Ebx;\r
1270 CPUID_SOC_VENDOR_BRAND_STRING_DATA Ecx;\r
1271 CPUID_SOC_VENDOR_BRAND_STRING_DATA Edx;\r
1272 //\r
1273 // Array to store brand string from 3 brand string leafs with\r
1274 // 4 32-bit brand string values per leaf and an extra value to\r
1275 // null terminate the string.\r
1276 //\r
1277 UINT32 BrandString[3 * 4 + 1];\r
1278\r
1279 AsmCpuidEx (\r
1280 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING1,\r
1281 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1282 );\r
1283 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING1);\r
1284 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1285 BrandString[0] = Eax.Uint32;\r
1286 BrandString[1] = Ebx.Uint32;\r
1287 BrandString[2] = Ecx.Uint32;\r
1288 BrandString[3] = Edx.Uint32;\r
1289\r
1290 AsmCpuidEx (\r
1291 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING2,\r
1292 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1293 );\r
1294 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING2);\r
1295 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1296 BrandString[4] = Eax.Uint32;\r
1297 BrandString[5] = Ebx.Uint32;\r
1298 BrandString[6] = Ecx.Uint32;\r
1299 BrandString[7] = Edx.Uint32;\r
1300\r
1301 AsmCpuidEx (\r
1302 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING3,\r
1303 &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32\r
1304 );\r
1305 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_BRAND_STRING3);\r
1306 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1307 BrandString[8] = Eax.Uint32;\r
1308 BrandString[9] = Ebx.Uint32;\r
1309 BrandString[10] = Ecx.Uint32;\r
1310 BrandString[11] = Edx.Uint32;\r
1311\r
1312 BrandString[12] = 0;\r
1313\r
1314 Print (L"Vendor Brand String = %a\n", (CHAR8 *)BrandString);\r
1315}\r
1316\r
1317/**\r
1318 Display CPUID_SOC_VENDOR main leaf and sub-leafs.\r
1319\r
1320**/\r
1321VOID\r
1322CpuidSocVendor (\r
1323 VOID\r
1324 )\r
1325{\r
1326 UINT32 Eax;\r
1327 CPUID_SOC_VENDOR_MAIN_LEAF_EBX Ebx;\r
1328 UINT32 Ecx;\r
1329 UINT32 Edx;\r
1330\r
1331 if (CPUID_SOC_VENDOR > gMaximumBasicFunction) {\r
1332 return;\r
1333 }\r
1334\r
1335 AsmCpuidEx (\r
1336 CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_MAIN_LEAF,\r
1337 &Eax, &Ebx.Uint32, &Ecx, &Edx\r
1338 );\r
1339 Print (L"CPUID_SOC_VENDOR (Leaf %08x, Sub-Leaf %08x)\n", CPUID_SOC_VENDOR, CPUID_SOC_VENDOR_MAIN_LEAF);\r
1340 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx, Edx);\r
1341 if (Eax < 3) {\r
1342 Print (L" Not Supported\n");\r
1343 return;\r
1344 }\r
1345 PRINT_VALUE (Eax, MaxSOCID_Index);\r
1346 PRINT_BIT_FIELD (Ebx, SocVendorId);\r
1347 PRINT_BIT_FIELD (Ebx, IsVendorScheme);\r
1348 PRINT_VALUE (Ecx, ProjectID);\r
1349 PRINT_VALUE (Edx, SteppingID);\r
1350 CpuidSocVendorBrandString ();\r
1351}\r
1352\r
56fbaecb
ED
1353/**\r
1354 Display CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS main leaf and sub-leafs.\r
1355\r
1356**/\r
1357VOID\r
1358CpuidDeterministicAddressTranslationParameters (\r
1359 VOID\r
1360 )\r
1361{\r
1362 UINT32 Eax;\r
1363 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EBX Ebx;\r
1364 UINT32 Ecx;\r
1365 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_EDX Edx;\r
1366\r
1367 if (CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS > gMaximumBasicFunction) {\r
1368 return;\r
1369 }\r
1370\r
1371 AsmCpuidEx (\r
1372 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS,\r
1373 CPUID_DETERMINISTIC_ADDRESS_TRANSLATION_PARAMETERS_MAIN_LEAF,\r
1374 &Eax, &Ebx.Uint32, &Ecx, &Edx.Uint32\r
1375 );\r
1376 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
1377 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, Ebx.Uint32, Ecx, Edx.Uint32);\r
1378\r
1379 PRINT_VALUE (Eax, MaxID_Index);\r
1380 PRINT_BIT_FIELD (Ebx, Page4K);\r
1381 PRINT_BIT_FIELD (Ebx, Page2M);\r
1382 PRINT_BIT_FIELD (Ebx, Page4M);\r
1383 PRINT_BIT_FIELD (Ebx, Page1G);\r
1384 PRINT_BIT_FIELD (Ebx, Partitioning);\r
1385 PRINT_BIT_FIELD (Ebx, Way);\r
1386\r
1387 PRINT_VALUE (Ecx, NumberOfSets);\r
1388\r
1389 PRINT_BIT_FIELD (Edx, TranslationCacheType);\r
1390 PRINT_BIT_FIELD (Edx, TranslationCacheLevel);\r
1391 PRINT_BIT_FIELD (Edx, FullyAssociative);\r
1392 PRINT_BIT_FIELD (Edx, MaximumNum);\r
1393}\r
1394\r
25705752
MK
1395/**\r
1396 Display CPUID_EXTENDED_FUNCTION leaf.\r
1397\r
1398**/\r
1399VOID\r
1400CpuidExtendedFunction (\r
1401 VOID\r
1402 )\r
1403{\r
1404 UINT32 Eax;\r
1405\r
1406 AsmCpuid (CPUID_EXTENDED_FUNCTION, &Eax, NULL, NULL, NULL);\r
1407 Print (L"CPUID_EXTENDED_FUNCTION (Leaf %08x)\n", CPUID_EXTENDED_FUNCTION);\r
1408 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, 0, 0, 0);\r
1409 PRINT_VALUE (Eax, MaximumExtendedFunction);\r
1410\r
1411 gMaximumExtendedFunction = Eax;\r
1412}\r
1413\r
1414/**\r
1415 Display CPUID_EXTENDED_CPU_SIG leaf.\r
1416\r
1417**/\r
1418VOID\r
1419CpuidExtendedCpuSig (\r
1420 VOID\r
1421 )\r
1422{\r
1423 UINT32 Eax;\r
1424 CPUID_EXTENDED_CPU_SIG_ECX Ecx;\r
1425 CPUID_EXTENDED_CPU_SIG_EDX Edx;\r
1426\r
1427 if (CPUID_EXTENDED_CPU_SIG > gMaximumExtendedFunction) {\r
1428 return;\r
1429 }\r
1430\r
1431 AsmCpuid (CPUID_EXTENDED_CPU_SIG, &Eax, NULL, &Ecx.Uint32, &Edx.Uint32);\r
1432 Print (L"CPUID_EXTENDED_CPU_SIG (Leaf %08x)\n", CPUID_EXTENDED_CPU_SIG);\r
1433 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax, 0, Ecx.Uint32, Edx.Uint32);\r
1434 PRINT_BIT_FIELD (Ecx, LAHF_SAHF);\r
1435 PRINT_BIT_FIELD (Ecx, LZCNT);\r
1436 PRINT_BIT_FIELD (Ecx, PREFETCHW);\r
1437 PRINT_BIT_FIELD (Edx, SYSCALL_SYSRET);\r
1438 PRINT_BIT_FIELD (Edx, NX);\r
1439 PRINT_BIT_FIELD (Edx, Page1GB);\r
1440 PRINT_BIT_FIELD (Edx, RDTSCP);\r
1441 PRINT_BIT_FIELD (Edx, LM);\r
1442}\r
1443\r
1444/**\r
1445 Display CPUID_BRAND_STRING1, CPUID_BRAND_STRING2 and CPUID_BRAND_STRING3\r
1446 leafs. Also display these three leafs as a single brand string.\r
1447\r
1448**/\r
1449VOID\r
1450CpuidProcessorBrandString (\r
1451 VOID\r
1452 )\r
1453{\r
1454 CPUID_BRAND_STRING_DATA Eax;\r
1455 CPUID_BRAND_STRING_DATA Ebx;\r
1456 CPUID_BRAND_STRING_DATA Ecx;\r
1457 CPUID_BRAND_STRING_DATA Edx;\r
1458 //\r
1459 // Array to store brand string from 3 brand string leafs with\r
1460 // 4 32-bit brand string values per leaf and an extra value to\r
1461 // null terminate the string.\r
1462 //\r
1463 UINT32 BrandString[3 * 4 + 1];\r
1464\r
1465 if (CPUID_BRAND_STRING1 <= gMaximumExtendedFunction) {\r
1466 AsmCpuid (CPUID_BRAND_STRING1, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1467 Print (L"CPUID_BRAND_STRING1 (Leaf %08x)\n", CPUID_BRAND_STRING1);\r
1468 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1469 BrandString[0] = Eax.Uint32;\r
1470 BrandString[1] = Ebx.Uint32;\r
1471 BrandString[2] = Ecx.Uint32;\r
1472 BrandString[3] = Edx.Uint32;\r
1473 }\r
1474\r
1475 if (CPUID_BRAND_STRING2 <= gMaximumExtendedFunction) {\r
1476 AsmCpuid (CPUID_BRAND_STRING2, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1477 Print (L"CPUID_BRAND_STRING2 (Leaf %08x)\n", CPUID_BRAND_STRING2);\r
1478 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1479 BrandString[4] = Eax.Uint32;\r
1480 BrandString[5] = Ebx.Uint32;\r
1481 BrandString[6] = Ecx.Uint32;\r
1482 BrandString[7] = Edx.Uint32;\r
1483 }\r
1484\r
1485 if (CPUID_BRAND_STRING3 <= gMaximumExtendedFunction) {\r
1486 AsmCpuid (CPUID_BRAND_STRING3, &Eax.Uint32, &Ebx.Uint32, &Ecx.Uint32, &Edx.Uint32);\r
1487 Print (L"CPUID_BRAND_STRING3 (Leaf %08x)\n", CPUID_BRAND_STRING3);\r
1488 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, Ebx.Uint32, Ecx.Uint32, Edx.Uint32);\r
1489 BrandString[8] = Eax.Uint32;\r
1490 BrandString[9] = Ebx.Uint32;\r
1491 BrandString[10] = Ecx.Uint32;\r
1492 BrandString[11] = Edx.Uint32;\r
1493 }\r
1494\r
1495 BrandString[12] = 0;\r
1496\r
1497 Print (L"Brand String = %a\n", (CHAR8 *)BrandString);\r
1498}\r
1499\r
1500/**\r
1501 Display CPUID_EXTENDED_CACHE_INFO leaf.\r
1502\r
1503**/\r
1504VOID\r
1505CpuidExtendedCacheInfo (\r
1506 VOID\r
1507 )\r
1508{\r
1509 CPUID_EXTENDED_CACHE_INFO_ECX Ecx;\r
1510\r
1511 if (CPUID_EXTENDED_CACHE_INFO > gMaximumExtendedFunction) {\r
1512 return;\r
1513 }\r
1514\r
1515 AsmCpuid (CPUID_EXTENDED_CACHE_INFO, NULL, NULL, &Ecx.Uint32, NULL);\r
1516 Print (L"CPUID_EXTENDED_CACHE_INFO (Leaf %08x)\n", CPUID_EXTENDED_CACHE_INFO);\r
1517 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, 0, Ecx.Uint32, 0);\r
1518 PRINT_BIT_FIELD (Ecx, CacheLineSize);\r
1519 PRINT_BIT_FIELD (Ecx, L2Associativity);\r
1520 PRINT_BIT_FIELD (Ecx, CacheSize);\r
1521}\r
1522\r
1523/**\r
1524 Display CPUID_EXTENDED_TIME_STAMP_COUNTER leaf.\r
1525\r
1526**/\r
1527VOID\r
1528CpuidExtendedTimeStampCounter (\r
1529 VOID\r
1530 )\r
1531{\r
1532 CPUID_EXTENDED_TIME_STAMP_COUNTER_EDX Edx;\r
1533\r
1534 if (CPUID_EXTENDED_TIME_STAMP_COUNTER > gMaximumExtendedFunction) {\r
1535 return;\r
1536 }\r
1537\r
1538 AsmCpuid (CPUID_EXTENDED_TIME_STAMP_COUNTER, NULL, NULL, NULL, &Edx.Uint32);\r
1539 Print (L"CPUID_EXTENDED_TIME_STAMP_COUNTER (Leaf %08x)\n", CPUID_EXTENDED_TIME_STAMP_COUNTER);\r
1540 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", 0, 0, 0, Edx.Uint32);\r
1541 PRINT_BIT_FIELD (Edx, InvariantTsc);\r
1542}\r
1543\r
1544/**\r
1545 Display CPUID_VIR_PHY_ADDRESS_SIZE leaf.\r
1546\r
1547**/\r
1548VOID\r
1549CpuidVirPhyAddressSize (\r
1550 VOID\r
1551 )\r
1552{\r
1553 CPUID_VIR_PHY_ADDRESS_SIZE_EAX Eax;\r
1554\r
1555 if (CPUID_VIR_PHY_ADDRESS_SIZE > gMaximumExtendedFunction) {\r
1556 return;\r
1557 }\r
1558\r
1559 AsmCpuid (CPUID_VIR_PHY_ADDRESS_SIZE, &Eax.Uint32, NULL, NULL, NULL);\r
1560 Print (L"CPUID_VIR_PHY_ADDRESS_SIZE (Leaf %08x)\n", CPUID_VIR_PHY_ADDRESS_SIZE);\r
1561 Print (L" EAX:%08x EBX:%08x ECX:%08x EDX:%08x\n", Eax.Uint32, 0, 0, 0);\r
1562 PRINT_BIT_FIELD (Eax, PhysicalAddressBits);\r
1563 PRINT_BIT_FIELD (Eax, LinearAddressBits);\r
1564}\r
1565\r
1566/**\r
1567 The user Entry Point for Application. The user code starts with this function\r
1568 as the real entry point for the application.\r
1569\r
1570 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
1571 @param[in] SystemTable A pointer to the EFI System Table.\r
1572\r
1573 @retval EFI_SUCCESS The entry point is executed successfully.\r
1574 @retval other Some error occurs when executing this entry point.\r
1575\r
1576**/\r
1577EFI_STATUS\r
1578EFIAPI\r
1579UefiMain (\r
1580 IN EFI_HANDLE ImageHandle,\r
1581 IN EFI_SYSTEM_TABLE *SystemTable\r
1582 )\r
1583{\r
1584 Print (L"UEFI CPUID Version 0.5\n");\r
1585\r
1586 CpuidSignature ();\r
1587 CpuidVersionInfo ();\r
1588 CpuidCacheInfo ();\r
1589 CpuidSerialNumber ();\r
1590 CpuidCacheParams();\r
1591 CpuidMonitorMwait ();\r
1592 CpuidThermalPowerManagement ();\r
1593 CpuidStructuredExtendedFeatureFlags ();\r
1594 CpuidDirectCacheAccessInfo();\r
1595 CpuidArchitecturalPerformanceMonitoring ();\r
079141eb 1596 CpuidExtendedTopology (CPUID_EXTENDED_TOPOLOGY);\r
25705752 1597 CpuidExtendedStateMainLeaf ();\r
14806d7b
HW
1598 CpuidIntelRdtMonitoringEnumerationSubLeaf ();\r
1599 CpuidIntelRdtMonitoringL3CacheCapabilitySubLeaf ();\r
1600 CpuidIntelRdtAllocationMainLeaf ();\r
f5a2d6f0 1601 CpuidEnumerationOfIntelSgx ();\r
25705752
MK
1602 CpuidIntelProcessorTraceMainLeaf ();\r
1603 CpuidTimeStampCounter ();\r
1604 CpuidProcessorFrequency ();\r
1605 CpuidSocVendor ();\r
56fbaecb 1606 CpuidDeterministicAddressTranslationParameters ();\r
079141eb 1607 CpuidExtendedTopology (CPUID_V2_EXTENDED_TOPOLOGY);\r
25705752
MK
1608 CpuidExtendedFunction ();\r
1609 CpuidExtendedCpuSig ();\r
1610 CpuidProcessorBrandString ();\r
1611 CpuidExtendedCacheInfo ();\r
1612 CpuidExtendedTimeStampCounter ();\r
1613 CpuidVirPhyAddressSize ();\r
1614\r
1615 return EFI_SUCCESS;\r
1616}\r