1 /* SPDX-License-Identifier: GPL-2.0-only */
5 int via_c7_probe(const struct targetdef
*target
, const struct cpuid_t
*id
) {
6 return ((VENDOR_CENTAUR
== id
->vendor
) &&
7 (0x6 == id
->family
) && (
8 (0xa == id
->model
) || /* C7 A */
9 (0xd == id
->model
) || /* C7 D */
10 (0xf == id
->model
) /* Nano */
14 const struct msrdef via_c7_msrs
[] = {
15 {0x10, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_TIME_STAMP_COUNTER", "", {
18 {0x2a, MSRTYPE_RDWR
, MSR2(0, 0), "EBL_CR_POWERON", "", {
21 {0xc1, MSRTYPE_RDWR
, MSR2(0, 0), "PERFCTR0", "", {
24 {0xc2, MSRTYPE_RDWR
, MSR2(0, 0), "PERFCTR1", "", {
27 {0x11e, MSRTYPE_RDWR
, MSR2(0, 0), "BBL_CR_CTL3", "", {
30 /* if CPUID.0AH: EAX[15:8] > 0 */
31 {0x186, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_PERFEVTSEL0",
32 "Performance Event Select Register 0", {
34 { 31, 8, "CMASK", "R/W", PRESENT_HEX
, {
35 /* When CMASK is not zero, the corresponding performance
36 * counter 0 increments each cycle if the event count
37 * is greater than or equal to the CMASK.
41 { 23, 1, "INV", "R/W", PRESENT_BIN
, {
42 { MSR1(0), "CMASK using as is" },
43 { MSR1(1), "CMASK inerting" },
46 { 22, 1, "EN", "R/W", PRESENT_BIN
, {
47 { MSR1(0), "No commence counting" },
48 { MSR1(1), "Commence counting" },
51 { 21, 1, "AnyThread", "R/W", PRESENT_BIN
, {
54 { 20, 1, "INT", "R/W", PRESENT_BIN
, {
55 { MSR1(0), "Interrupt on counter overflow is disabled" },
56 { MSR1(1), "Interrupt on counter overflow is enabled" },
59 { 19, 1, "PC", "R/W", PRESENT_BIN
, {
60 { MSR1(0), "Disabled pin control" },
61 { MSR1(1), "Enabled pin control" },
64 { 18, 1, "Edge", "R/W", PRESENT_BIN
, {
65 { MSR1(0), "Disabled edge detection" },
66 { MSR1(1), "Enabled edge detection" },
69 { 17, 1, "OS", "R/W", PRESENT_BIN
, {
70 { MSR1(0), "Nothing" },
71 { MSR1(1), "Counts while in privilege level is ring 0" },
74 { 16, 1, "USR", "R/W", PRESENT_BIN
, {
75 { MSR1(0), "Nothing" },
76 { MSR1(1), "Counts while in privilege level is not ring 0" },
79 { 15, 8, "UMask", "R/W", PRESENT_HEX
, {
80 /* Qualifies the microarchitectural condition
81 * to detect on the selected event logic. */
84 { 7, 8, "Event Select", "R/W", PRESENT_HEX
, {
85 /* Selects a performance event logic unit. */
90 /* if CPUID.0AH: EAX[15:8] > 0 */
91 {0x187, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_PERFEVTSEL1",
92 "Performance Event Select Register 1", {
94 { 31, 8, "CMASK", "R/W", PRESENT_HEX
, {
95 /* When CMASK is not zero, the corresponding performance
96 * counter 1 increments each cycle if the event count
97 * is greater than or equal to the CMASK.
101 { 23, 1, "INV", "R/W", PRESENT_BIN
, {
102 { MSR1(0), "CMASK using as is" },
103 { MSR1(1), "CMASK inerting" },
106 { 22, 1, "EN", "R/W", PRESENT_BIN
, {
107 { MSR1(0), "No commence counting" },
108 { MSR1(1), "Commence counting" },
111 { 21, 1, "AnyThread", "R/W", PRESENT_BIN
, {
114 { 20, 1, "INT", "R/W", PRESENT_BIN
, {
115 { MSR1(0), "Interrupt on counter overflow is disabled" },
116 { MSR1(1), "Interrupt on counter overflow is enabled" },
119 { 19, 1, "PC", "R/W", PRESENT_BIN
, {
120 { MSR1(0), "Disabled pin control" },
121 { MSR1(1), "Enabled pin control" },
124 { 18, 1, "Edge", "R/W", PRESENT_BIN
, {
125 { MSR1(0), "Disabled edge detection" },
126 { MSR1(1), "Enabled edge detection" },
129 { 17, 1, "OS", "R/W", PRESENT_BIN
, {
130 { MSR1(0), "Nothing" },
131 { MSR1(1), "Counts while in privilege level is ring 0" },
134 { 16, 1, "USR", "R/W", PRESENT_BIN
, {
135 { MSR1(0), "Nothing" },
136 { MSR1(1), "Counts while in privilege level is not ring 0" },
139 { 15, 8, "UMask", "R/W", PRESENT_HEX
, {
140 /* Qualifies the microarchitectural condition
141 * to detect on the selected event logic. */
144 { 7, 8, "Event Select", "R/W", PRESENT_HEX
, {
145 /* Selects a performance event logic unit. */
150 {0x198, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_PERF_STATUS", "", {
151 { 63, 8, "Lowest Supported Clock Ratio", "R/O", PRESENT_HEX
, {
154 { 55, 8, "Lowest Supported Voltage", "R/O", PRESENT_HEX
, {
157 { 47, 8, "Highest Supported Clock Ratio", "R/O", PRESENT_HEX
, {
160 { 39, 8, "Highest Supported Voltage", "R/O", PRESENT_HEX
, {
163 { 31, 8, "Lowest Clock Ratio", "R/O", PRESENT_HEX
, {
167 { 21, 2, "Performance Control MSR Transition", "R/O", PRESENT_HEX
, {
170 { 19, 1, "Thermal Monitor 2 transition", "R/O", PRESENT_BIN
, {
173 { 18, 1, "Thermal Monitor 2 transition", "R/O", PRESENT_BIN
, {
176 { 17, 1, "Voltage Transition in progress", "R/O", PRESENT_BIN
, {
179 { 16, 1, "Clock Ratio Transition in progress", "R/O", PRESENT_BIN
, {
182 { 15, 8, "Current Clock Ratio", "R/W", PRESENT_HEX
, {
185 { 7, 8, "16*x + 700 = Current voltage in mV", "R/W", PRESENT_HEX
, {
190 {0x199, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_PERF_CTL", "", {
191 { 63, 48, RESERVED
},
192 { 15, 8, "Desired Clock Ratio", "R/W", PRESENT_HEX
, {
195 { 7, 8, "16*x + 700 = Desired voltage in mV", "R/W", PRESENT_HEX
, {
200 {0x19a, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_CLOCK_MODULATION", "", {
201 { 63, 59, RESERVED
},
202 { 15, 8, "allows selection of the on-demand clock modulation duty cycle", "R/W", PRESENT_BIN
, {
203 { MSR1(0), "Reserved" },
204 { MSR1(1), "12.5%" },
205 { MSR1(2), "25.0%" },
206 { MSR1(3), "37.5%" },
207 { MSR1(4), "50.0%" },
208 { MSR1(5), "62.5%" },
209 { MSR1(6), "75.0%" },
210 { MSR1(7), "87.5%" },
216 {0x19b, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_THERM_INTERRUPT", "", {
217 { 63, 62, RESERVED
},
218 { 1, 1, "Enables APIC LVT interrupt on a low-to-high temp transition", "R/W", PRESENT_BIN
, {
221 { 0, 1, "Enables APIC LVT interrupt on a high-to-low temp transition", "R/W", PRESENT_BIN
, {
226 {0x19c, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_THERM_STATUS", "", {
227 { 63, 62, RESERVED
},
228 { 1, 1, "TCC assert detect", "R/O", PRESENT_BIN
, {
229 { MSR1(0), "TCC not asserted" },
230 { MSR1(1), "TCC asserted" },
233 { 0, 1, "TCC trigger detect (Sticky bit, only cleared upon reset)", "R/O", PRESENT_BIN
, {
234 { MSR1(0), "TCC not triggered" },
235 { MSR1(1), "TCC triggered" },
240 {0x19d, MSRTYPE_RDWR
, MSR2(0, 0), "MSR_THERM2_CTL", "", {
241 { 63, 47, RESERVED
},
242 { 16, 1, "Thermal Monitor enable", "R/W", PRESENT_HEX
, {
243 { MSR1(0), "Thermal Monitor 1 enabled" },
244 { MSR1(1), "Thermal Monitor 2 enabled" },
247 { 15, 8, "Thermal Monitor 2 performance state clock ratio", "R/W", PRESENT_HEX
, {
250 { 7, 8, "Thermal Monitor 2 performance state volatege", "R/W", PRESENT_HEX
, {
255 {0x1a0, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MISC_ENABLES", "", {
256 { 63, 43, RESERVED
},
257 { 20, 1, "PowerSaver lock", "R/W", PRESENT_BIN
, {
258 { MSR1(0), "Bit 16 can be set and cleared." },
259 { MSR1(1), "Bit 16 can only be cleared upon reset." },
263 { 16, 1, "Enhanced PowerSaver enable", "R/W", PRESENT_BIN
, {
264 { MSR1(0), "Performance state changes disabled" },
265 { MSR1(1), "Performance state changes enabled" },
269 { 10, 1, "PBE enable", "R/W", PRESENT_BIN
, {
270 { MSR1(0), "FERR# legacy mode" },
271 { MSR1(1), "Enables break events for APIC via FERR#" },
275 { 3, 1, "Thermal Monitor 2 enable", "R/W", PRESENT_BIN
, {
276 { MSR1(0), "On-die clock throttling enabled" },
277 { MSR1(1), "Thermal Monitor 1 or 2 enabled" },
283 {0x200, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE0", "", {
286 {0x201, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK0", "", {
289 {0x202, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE1", "", {
292 {0x203, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK1", "", {
295 {0x204, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE2", "", {
298 {0x205, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK2", "", {
301 {0x206, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE3", "", {
304 {0x207, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK3", "", {
307 {0x208, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE4", "", {
310 {0x209, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK4", "", {
313 {0x20a, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE5", "", {
316 {0x20b, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK5", "", {
319 {0x20c, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE6", "", {
322 {0x20d, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK6", "", {
325 {0x20e, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSBASE7", "", {
328 {0x20f, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_PHYSMASK7", "", {
331 {0x250, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX64K_00000", "", {
334 {0x258, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX16K_80000", "", {
337 {0x259, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX16K_A0000", "", {
340 {0x268, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_C0000", "", {
343 {0x269, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_C8000", "", {
346 {0x26a, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_D0000", "", {
349 {0x26b, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_D8000", "", {
352 {0x26c, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_E0000", "", {
355 {0x26d, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_E8000", "", {
358 {0x26e, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_F0000", "", {
361 {0x26f, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_FIX4K_F8000", "", {
364 {0x2ff, MSRTYPE_RDWR
, MSR2(0, 0), "IA32_MTRR_DEF_TYPE", "", {
367 {0x1107, MSRTYPE_RDWR
, MSR2(0, 0), "FCR",
368 "Feature Control Register", {
369 { 63, 55, RESERVED
},
370 { 8, 1, "Disables L2 Cache", "R/W", PRESENT_BIN
, {
371 { MSR1(0), "L2 Cache enabled" },
372 { MSR1(1), "L2 Cache disabled" },
376 { 1, 1, "Enables CPUID reporting CMPXCHG8B", "R/W", PRESENT_BIN
, {
377 { MSR1(0), "Disabled CPUID reporting CMPXCHG8B" },
378 { MSR1(1), "Enabled CPUID reporting CMPXCHG8B" },
384 {0x1108, MSRTYPE_RDWR
, MSR2(0, 0), "FCR2",
385 "Feature Control Register 2", {
386 { 63, 32, "Last 4 characters of Alternate Vendor ID string", "R/W", PRESENT_STR
, {
389 { 31, 17, RESERVED
},
390 { 14, 1, "Use the Alternate Vendor ID string", "R/W", PRESENT_BIN
, {
391 { MSR1(0), "The CPUID instruction vendor ID is CentaurHauls" },
392 { MSR1(1), "The CPUID instruction returns the alternate Vendor ID" },
396 { 11, 4, "Family ID", "R/W", PRESENT_HEX
, {
399 { 7, 4, "Model ID", "R/W", PRESENT_HEX
, {
405 {0x1109, MSRTYPE_WRONLY
, MSR2(0, 0), "FCR3",
406 "Feature Control Register 3", {
407 { 63, 32, "First 4 characters of Alternate Vendor ID string", "W/O", PRESENT_STR
, {
410 { 31, 32, "Middle 4 characters of Alternate Vendor ID string", "W/O", PRESENT_STR
, {
415 {0x1152, MSRTYPE_RDONLY
, MSR2(0, 0), "FUSES", "Fuses", {
418 {0x1153, MSRTYPE_RDONLY
, MSR2(0, 0), "BRAND",
419 "BRAND_1 XOR BRAND_2, (00b = C7-M, 01b = C7, 10b = Eden, 11b = Reserved)", {
420 { 63, 42, RESERVED
},
421 { 21, 2, "BRAND_1", "R/O", PRESENT_BIN
, {
424 { 19, 2, "BRAND_2", "R/O", PRESENT_BIN
, {
427 { 17, 18, RESERVED
},
430 {0x1160, MSRTYPE_RDWR
, MSR2(0, 0), "UNK0", "", {
433 {0x1161, MSRTYPE_RDWR
, MSR2(0, 0), "UNK1", "", {
436 {0x1164, MSRTYPE_RDWR
, MSR2(0, 0), "THERM_THRESH_LOW", "(FUSES[6:4] * 5 + 65)", {
439 {0x1165, MSRTYPE_RDWR
, MSR2(0, 0), "THERM_THRESH_HI", "(FUSES[6:4] * 5 + 65) + 5", {
442 {0x1166, MSRTYPE_RDWR
, MSR2(0, 0), "THERM_THRESH_OVERSTRESS", "", {
445 {0x1167, MSRTYPE_RDWR
, MSR2(0, 0), "THERM_THRESH_USER_TRIP", "", {
448 {0x1168, MSRTYPE_RDWR
, MSR2(0, 0), "UNK2", "", {
451 {0x116a, MSRTYPE_RDWR
, MSR2(0, 0), "UNK3", "", {
454 {0x116b, MSRTYPE_RDWR
, MSR2(0, 0), "UNK4", "", {