| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: i386.c,v 1.74.6.13 2021/12/24 13:02:24 martin Exp $ */ | | 1 | /* $NetBSD: i386.c,v 1.74.6.14 2022/01/31 17:52:44 martin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Frank van der Linden, and by Jason R. Thorpe. | | 8 | * by Frank van der Linden, and by Jason R. Thorpe. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -47,27 +47,27 @@ | | | @@ -47,27 +47,27 @@ |
47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 48 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 51 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 52 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 53 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 54 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
55 | * SUCH DAMAGE. | | 55 | * SUCH DAMAGE. |
56 | */ | | 56 | */ |
57 | | | 57 | |
58 | #include <sys/cdefs.h> | | 58 | #include <sys/cdefs.h> |
59 | #ifndef lint | | 59 | #ifndef lint |
60 | __RCSID("$NetBSD: i386.c,v 1.74.6.13 2021/12/24 13:02:24 martin Exp $"); | | 60 | __RCSID("$NetBSD: i386.c,v 1.74.6.14 2022/01/31 17:52:44 martin Exp $"); |
61 | #endif /* not lint */ | | 61 | #endif /* not lint */ |
62 | | | 62 | |
63 | #include <sys/types.h> | | 63 | #include <sys/types.h> |
64 | #include <sys/param.h> | | 64 | #include <sys/param.h> |
65 | #include <sys/bitops.h> | | 65 | #include <sys/bitops.h> |
66 | #include <sys/sysctl.h> | | 66 | #include <sys/sysctl.h> |
67 | #include <sys/ioctl.h> | | 67 | #include <sys/ioctl.h> |
68 | #include <sys/cpuio.h> | | 68 | #include <sys/cpuio.h> |
69 | | | 69 | |
70 | #include <errno.h> | | 70 | #include <errno.h> |
71 | #include <string.h> | | 71 | #include <string.h> |
72 | #include <stdio.h> | | 72 | #include <stdio.h> |
73 | #include <stdlib.h> | | 73 | #include <stdlib.h> |
| @@ -341,31 +341,37 @@ const struct cpu_cpuid_nameclass i386_cp | | | @@ -341,31 +341,37 @@ const struct cpu_cpuid_nameclass i386_cp |
341 | [0x5e] = "6th gen Core, Xeon E3-1[25]00 v5 (Skylake)", | | 341 | [0x5e] = "6th gen Core, Xeon E3-1[25]00 v5 (Skylake)", |
342 | [0x5f] = "Atom (Goldmont, Denverton)", | | 342 | [0x5f] = "Atom (Goldmont, Denverton)", |
343 | [0x66] = "8th gen Core i3 (Cannon Lake)", | | 343 | [0x66] = "8th gen Core i3 (Cannon Lake)", |
344 | [0x6a] = "3rd gen Xeon Scalable (Ice Lake)", | | 344 | [0x6a] = "3rd gen Xeon Scalable (Ice Lake)", |
345 | [0x6c] = "3rd gen Xeon Scalable (Ice Lake)", | | 345 | [0x6c] = "3rd gen Xeon Scalable (Ice Lake)", |
346 | [0x7a] = "Atom (Goldmont Plus)", | | 346 | [0x7a] = "Atom (Goldmont Plus)", |
347 | [0x7d] = "10th gen Core (Ice Lake)", | | 347 | [0x7d] = "10th gen Core (Ice Lake)", |
348 | [0x7e] = "10th gen Core (Ice Lake)", | | 348 | [0x7e] = "10th gen Core (Ice Lake)", |
349 | [0x85] = "Xeon Phi 7215, 7285, 7295 (Knights Mill)", | | 349 | [0x85] = "Xeon Phi 7215, 7285, 7295 (Knights Mill)", |
350 | [0x86] = "Atom (Tremont)", | | 350 | [0x86] = "Atom (Tremont)", |
351 | [0x8c] = "11th gen Core (Tiger Lake)", | | 351 | [0x8c] = "11th gen Core (Tiger Lake)", |
352 | [0x8d] = "11th gen Core (Tiger Lake)", | | 352 | [0x8d] = "11th gen Core (Tiger Lake)", |
353 | [0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)", | | 353 | [0x8e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)", |
| | | 354 | [0x8f] = "future Xeon (Sapphire Rapids)", |
354 | [0x96] = "Atom x6000E (Elkhart Lake)", | | 355 | [0x96] = "Atom x6000E (Elkhart Lake)", |
| | | 356 | [0x97] = "12th gen Core (Alder Lake)", |
| | | 357 | [0x9a] = "12th gen Core (Alder Lake)", |
355 | [0x9c] = "Pentium Silver N6xxx, Celeron N45xx, Celeron N51xx (Jasper Lake)", | | 358 | [0x9c] = "Pentium Silver N6xxx, Celeron N45xx, Celeron N51xx (Jasper Lake)", |
356 | [0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)", | | 359 | [0x9e] = "7th or 8th gen Core (Kaby Lake, Coffee Lake) or Xeon E (Coffee Lake)", |
357 | [0xa5] = "10th gen Core (Comet Lake)", | | 360 | [0xa5] = "10th gen Core (Comet Lake)", |
358 | [0xa6] = "10th gen Core (Comet Lake)", | | 361 | [0xa6] = "10th gen Core (Comet Lake)", |
| | | 362 | [0xa7] = "11th gen Core (Rocket Lake)", |
| | | 363 | [0xa8] = "11th gen Core (Rocket Lake)", |
| | | 364 | [0xbf] = "12th gen Core (Alder Lake)", |
359 | }, | | 365 | }, |
360 | "Pentium Pro, II or III", /* Default */ | | 366 | "Pentium Pro, II or III", /* Default */ |
361 | NULL, | | 367 | NULL, |
362 | intel_family_new_probe, | | 368 | intel_family_new_probe, |
363 | intel_cpu_cacheinfo, | | 369 | intel_cpu_cacheinfo, |
364 | }, | | 370 | }, |
365 | /* Family > 6 */ | | 371 | /* Family > 6 */ |
366 | { | | 372 | { |
367 | CPUCLASS_686, | | 373 | CPUCLASS_686, |
368 | { | | 374 | { |
369 | 0, 0, 0, 0, 0, 0, 0, 0, | | 375 | 0, 0, 0, 0, 0, 0, 0, 0, |
370 | 0, 0, 0, 0, 0, 0, 0, 0, | | 376 | 0, 0, 0, 0, 0, 0, 0, 0, |
371 | }, | | 377 | }, |
| @@ -2154,51 +2160,45 @@ identifycpu(int fd, const char *cpuname) | | | @@ -2154,51 +2160,45 @@ identifycpu(int fd, const char *cpuname) |
2154 | aprint_verbose("%s: SVM Rev. %d\n", cpuname, | | 2160 | aprint_verbose("%s: SVM Rev. %d\n", cpuname, |
2155 | descs[0] & 0xf); | | 2161 | descs[0] & 0xf); |
2156 | aprint_verbose("%s: SVM NASID %d\n", cpuname, | | 2162 | aprint_verbose("%s: SVM NASID %d\n", cpuname, |
2157 | descs[1]); | | 2163 | descs[1]); |
2158 | print_bits(cpuname, "SVM features", | | 2164 | print_bits(cpuname, "SVM features", |
2159 | CPUID_AMD_SVM_FLAGS, descs[3]); | | 2165 | CPUID_AMD_SVM_FLAGS, descs[3]); |
2160 | } | | 2166 | } |
2161 | if (ci->ci_max_ext_cpuid >= 0x8000001f) { | | 2167 | if (ci->ci_max_ext_cpuid >= 0x8000001f) { |
2162 | x86_cpuid(0x8000001f, descs); | | 2168 | x86_cpuid(0x8000001f, descs); |
2163 | print_bits(cpuname, "Encrypted Memory features", | | 2169 | print_bits(cpuname, "Encrypted Memory features", |
2164 | CPUID_AMD_ENCMEM_FLAGS, descs[0]); | | 2170 | CPUID_AMD_ENCMEM_FLAGS, descs[0]); |
2165 | } | | 2171 | } |
2166 | } else if (cpu_vendor == CPUVENDOR_INTEL) { | | 2172 | } else if (cpu_vendor == CPUVENDOR_INTEL) { |
2167 | int32_t bi_index; | | 2173 | if (ci->ci_max_cpuid >= 0x0a) { |
2168 | | | 2174 | x86_cpuid(0x0a, descs); |
2169 | for (bi_index = 1; bi_index <= ci->ci_max_cpuid; bi_index++) { | | 2175 | print_bits(cpuname, "Perfmon-eax", |
2170 | x86_cpuid(bi_index, descs); | | 2176 | CPUID_PERF_FLAGS0, descs[0]); |
2171 | switch (bi_index) { | | 2177 | print_bits(cpuname, "Perfmon-ebx", |
2172 | case 0x0a: | | 2178 | CPUID_PERF_FLAGS1, descs[1]); |
2173 | print_bits(cpuname, "Perfmon-eax", | | 2179 | print_bits(cpuname, "Perfmon-edx", |
2174 | CPUID_PERF_FLAGS0, descs[0]); | | 2180 | CPUID_PERF_FLAGS3, descs[3]); |
2175 | print_bits(cpuname, "Perfmon-ebx", | | 2181 | } |
2176 | CPUID_PERF_FLAGS1, descs[1]); | | 2182 | if (ci->ci_max_cpuid >= 0x1a) { |
2177 | print_bits(cpuname, "Perfmon-edx", | | 2183 | x86_cpuid(0x1a, descs); |
2178 | CPUID_PERF_FLAGS3, descs[3]); | | 2184 | if (descs[0] != 0) { |
2179 | break; | | 2185 | aprint_verbose("%s: Hybrid: Core type %02x, " |
2180 | default: | | 2186 | "Native Model ID %07x\n", |
2181 | #if 0 | | 2187 | cpuname, |
2182 | aprint_verbose("%s: basic %08x-eax %08x\n", | | 2188 | (uint8_t)__SHIFTOUT(descs[0], |
2183 | cpuname, bi_index, descs[0]); | | 2189 | CPUID_HYBRID_CORETYPE), |
2184 | aprint_verbose("%s: basic %08x-ebx %08x\n", | | 2190 | (uint32_t)__SHIFTOUT(descs[0], |
2185 | cpuname, bi_index, descs[1]); | | 2191 | CPUID_HYBRID_NATIVEID)); |
2186 | aprint_verbose("%s: basic %08x-ecx %08x\n", | | | |
2187 | cpuname, bi_index, descs[2]); | | | |
2188 | aprint_verbose("%s: basic %08x-edx %08x\n", | | | |
2189 | cpuname, bi_index, descs[3]); | | | |
2190 | #endif | | | |
2191 | break; | | | |
2192 | } | | 2192 | } |
2193 | } | | 2193 | } |
2194 | } | | 2194 | } |
2195 | | | 2195 | |
2196 | #ifdef INTEL_ONDEMAND_CLOCKMOD | | 2196 | #ifdef INTEL_ONDEMAND_CLOCKMOD |
2197 | clockmod_init(); | | 2197 | clockmod_init(); |
2198 | #endif | | 2198 | #endif |
2199 | | | 2199 | |
2200 | if (cpu_vendor == CPUVENDOR_AMD) | | 2200 | if (cpu_vendor == CPUVENDOR_AMD) |
2201 | ucode.loader_version = CPU_UCODE_LOADER_AMD; | | 2201 | ucode.loader_version = CPU_UCODE_LOADER_AMD; |
2202 | else if (cpu_vendor == CPUVENDOR_INTEL) | | 2202 | else if (cpu_vendor == CPUVENDOR_INTEL) |
2203 | ucode.loader_version = CPU_UCODE_LOADER_INTEL1; | | 2203 | ucode.loader_version = CPU_UCODE_LOADER_INTEL1; |
2204 | else | | 2204 | else |