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