2 * Copyright (c) 1992 Terrence R. Lambert.
3 * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
4 * Copyright (c) 1997 KATO Takenori.
7 * This code is derived from software contributed to Berkeley by
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the University of
21 * California, Berkeley and its contributors.
22 * 4. Neither the name of the University nor the names of its contributors
23 * may be used to endorse or promote products derived from this software
24 * without specific prior written permission.
26 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp
39 * $FreeBSD: src/sys/i386/i386/identcpu.c,v 1.206 2009/11/12 10:59:00 nyan
43 #include <sys/param.h>
44 #include <sys/systm.h>
45 #include <sys/kernel.h>
46 #include <sys/sysctl.h>
49 #include <machine/asmacros.h>
50 #include <machine/clock.h>
51 #include <machine/cputypes.h>
52 #include <machine/segments.h>
53 #include <machine/specialreg.h>
54 #include <machine/md_var.h>
55 #include <machine/intr_machdep.h>
57 #define IDENTBLUE_CYRIX486 0
58 #define IDENTBLUE_IBMCPU 1
59 #define IDENTBLUE_CYRIXM2 2
61 /* XXX - should be in header file: */
62 void printcpuinfo(void);
63 void finishidentcpu(void);
64 void earlysetcpuclass(void);
65 #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
66 void enable_K5_wt_alloc(void);
67 void enable_K6_wt_alloc(void);
68 void enable_K6_2_wt_alloc(void);
70 void panicifcpuunsupported(void);
72 static void identifycyrix(void);
73 static void init_exthigh(void);
74 static u_int find_cpu_vendor_id(void);
75 static void print_AMD_info(void);
76 static void print_INTEL_info(void);
77 static void print_INTEL_TLB(u_int data);
78 static void print_AMD_assoc(int i);
79 static void print_transmeta_info(void);
80 static void print_via_padlock_info(void);
83 u_int cpu_exthigh; /* Highest arg to extended CPUID */
84 u_int cyrix_did; /* Device ID of Cyrix CPU */
85 char machine[] = MACHINE;
86 SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD,
87 machine, 0, "Machine class");
89 static char cpu_model[128];
90 SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD,
91 cpu_model, 0, "Machine model");
93 static int hw_clockrate;
94 SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD,
95 &hw_clockrate, 0, "CPU instruction clock rate");
97 static char cpu_brand[48];
99 #define MAX_ADDITIONAL_INFO 16
101 static const char *additional_cpu_info_ary[MAX_ADDITIONAL_INFO];
102 static u_int additional_cpu_info_count;
104 #define MAX_BRAND_INDEX 8
106 static const char *cpu_brandtable[MAX_BRAND_INDEX + 1] = {
110 "Intel Pentium III Xeon",
122 { "Intel 80286", CPUCLASS_286 }, /* CPU_286 */
123 { "i386SX", CPUCLASS_386 }, /* CPU_386SX */
124 { "i386DX", CPUCLASS_386 }, /* CPU_386 */
125 { "i486SX", CPUCLASS_486 }, /* CPU_486SX */
126 { "i486DX", CPUCLASS_486 }, /* CPU_486 */
127 { "Pentium", CPUCLASS_586 }, /* CPU_586 */
128 { "Cyrix 486", CPUCLASS_486 }, /* CPU_486DLC */
129 { "Pentium Pro", CPUCLASS_686 }, /* CPU_686 */
130 { "Cyrix 5x86", CPUCLASS_486 }, /* CPU_M1SC */
131 { "Cyrix 6x86", CPUCLASS_486 }, /* CPU_M1 */
132 { "Blue Lightning", CPUCLASS_486 }, /* CPU_BLUE */
133 { "Cyrix 6x86MX", CPUCLASS_686 }, /* CPU_M2 */
134 { "NexGen 586", CPUCLASS_386 }, /* CPU_NX586 (XXX) */
135 { "Cyrix 486S/DX", CPUCLASS_486 }, /* CPU_CY486DX */
136 { "Pentium II", CPUCLASS_686 }, /* CPU_PII */
137 { "Pentium III", CPUCLASS_686 }, /* CPU_PIII */
138 { "Pentium 4", CPUCLASS_686 }, /* CPU_P4 */
145 { INTEL_VENDOR_ID, CPU_VENDOR_INTEL }, /* GenuineIntel */
146 { AMD_VENDOR_ID, CPU_VENDOR_AMD }, /* AuthenticAMD */
147 { CENTAUR_VENDOR_ID, CPU_VENDOR_CENTAUR }, /* CentaurHauls */
148 { NSC_VENDOR_ID, CPU_VENDOR_NSC }, /* Geode by NSC */
149 { CYRIX_VENDOR_ID, CPU_VENDOR_CYRIX }, /* CyrixInstead */
150 { TRANSMETA_VENDOR_ID, CPU_VENDOR_TRANSMETA }, /* GenuineTMx86 */
151 { SIS_VENDOR_ID, CPU_VENDOR_SIS }, /* SiS SiS SiS */
152 { UMC_VENDOR_ID, CPU_VENDOR_UMC }, /* UMC UMC UMC */
153 { NEXGEN_VENDOR_ID, CPU_VENDOR_NEXGEN }, /* NexGenDriven */
154 { RISE_VENDOR_ID, CPU_VENDOR_RISE }, /* RiseRiseRise */
156 /* XXX CPUID 8000_0000h and 8086_0000h, not 0000_0000h */
157 { "TransmetaCPU", CPU_VENDOR_TRANSMETA },
162 static int cpu_cores;
163 static int cpu_logical;
166 #if defined(I586_CPU) && !defined(NO_F00F_HACK)
167 int has_f00f_bug = 0; /* Initialized so that it can be patched. */
178 (cpu_vendor_id == CPU_VENDOR_INTEL ||
179 cpu_vendor_id == CPU_VENDOR_AMD ||
180 cpu_vendor_id == CPU_VENDOR_TRANSMETA ||
181 cpu_vendor_id == CPU_VENDOR_CENTAUR ||
182 cpu_vendor_id == CPU_VENDOR_NSC)) {
183 do_cpuid(0x80000000, regs);
184 if (regs[0] >= 0x80000000)
185 cpu_exthigh = regs[0];
198 cpu_class = i386_cpus[cpu].cpu_class;
200 strncpy(cpu_model, i386_cpus[cpu].cpu_name, sizeof (cpu_model));
202 /* Check for extended CPUID information and a processor name. */
204 if (cpu_exthigh >= 0x80000004) {
206 for (i = 0x80000002; i < 0x80000005; i++) {
208 memcpy(brand, regs, sizeof(regs));
209 brand += sizeof(regs);
213 if (cpu_vendor_id == CPU_VENDOR_INTEL) {
214 if ((cpu_id & 0xf00) > 0x300) {
219 switch (cpu_id & 0x3000) {
221 strcpy(cpu_model, "Overdrive ");
224 strcpy(cpu_model, "Dual ");
228 switch (cpu_id & 0xf00) {
230 strcat(cpu_model, "i486 ");
231 /* Check the particular flavor of 486 */
232 switch (cpu_id & 0xf0) {
235 strcat(cpu_model, "DX");
238 strcat(cpu_model, "SX");
241 strcat(cpu_model, "DX2");
244 strcat(cpu_model, "SL");
247 strcat(cpu_model, "SX2");
251 "DX2 Write-Back Enhanced");
254 strcat(cpu_model, "DX4");
259 /* Check the particular flavor of 586 */
260 strcat(cpu_model, "Pentium");
261 switch (cpu_id & 0xf0) {
263 strcat(cpu_model, " A-step");
266 strcat(cpu_model, "/P5");
269 strcat(cpu_model, "/P54C");
272 strcat(cpu_model, "/P24T");
275 strcat(cpu_model, "/P55C");
278 strcat(cpu_model, "/P54C");
281 strcat(cpu_model, "/P55C (quarter-micron)");
287 #if defined(I586_CPU) && !defined(NO_F00F_HACK)
289 * XXX - If/when Intel fixes the bug, this
290 * should also check the version of the
291 * CPU, not just that it's a Pentium.
297 /* Check the particular flavor of 686 */
298 switch (cpu_id & 0xf0) {
300 strcat(cpu_model, "Pentium Pro A-step");
303 strcat(cpu_model, "Pentium Pro");
309 "Pentium II/Pentium II Xeon/Celeron");
317 "Pentium III/Pentium III Xeon/Celeron");
321 strcat(cpu_model, "Unknown 80686");
326 strcat(cpu_model, "Pentium 4");
330 strcat(cpu_model, "unknown");
335 * If we didn't get a brand name from the extended
336 * CPUID, try to look it up in the brand table.
338 if (cpu_high > 0 && *cpu_brand == '\0') {
339 brand_index = cpu_procinfo & CPUID_BRAND_INDEX;
340 if (brand_index <= MAX_BRAND_INDEX &&
341 cpu_brandtable[brand_index] != NULL)
343 cpu_brandtable[brand_index]);
346 } else if (cpu_vendor_id == CPU_VENDOR_AMD) {
348 * Values taken from AMD Processor Recognition
349 * http://www.amd.com/K6/k6docs/pdf/20734g.pdf
350 * (also describes ``Features'' encodings.
352 strcpy(cpu_model, "AMD ");
353 switch (cpu_id & 0xFF0) {
355 strcat(cpu_model, "Standard Am486DX");
358 strcat(cpu_model, "Enhanced Am486DX2 Write-Through");
361 strcat(cpu_model, "Enhanced Am486DX2 Write-Back");
364 strcat(cpu_model, "Enhanced Am486DX4/Am5x86 Write-Through");
367 strcat(cpu_model, "Enhanced Am486DX4/Am5x86 Write-Back");
370 strcat(cpu_model, "Am5x86 Write-Through");
373 strcat(cpu_model, "Am5x86 Write-Back");
376 strcat(cpu_model, "K5 model 0");
380 strcat(cpu_model, "K5 model 1");
383 strcat(cpu_model, "K5 PR166 (model 2)");
386 strcat(cpu_model, "K5 PR200 (model 3)");
389 strcat(cpu_model, "K6");
392 strcat(cpu_model, "K6 266 (model 1)");
395 strcat(cpu_model, "K6-2");
398 strcat(cpu_model, "K6-III");
401 strcat(cpu_model, "Geode LX");
403 * Make sure the TSC runs through suspension,
404 * otherwise we can't use it as timecounter
406 wrmsr(0x1900, rdmsr(0x1900) | 0x20ULL);
409 strcat(cpu_model, "Unknown");
412 #if defined(I586_CPU) && defined(CPU_WT_ALLOC)
413 if ((cpu_id & 0xf00) == 0x500) {
414 if (((cpu_id & 0x0f0) > 0)
415 && ((cpu_id & 0x0f0) < 0x60)
416 && ((cpu_id & 0x00f) > 3))
417 enable_K5_wt_alloc();
418 else if (((cpu_id & 0x0f0) > 0x80)
419 || (((cpu_id & 0x0f0) == 0x80)
420 && (cpu_id & 0x00f) > 0x07))
421 enable_K6_2_wt_alloc();
422 else if ((cpu_id & 0x0f0) > 0x50)
423 enable_K6_wt_alloc();
426 } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) {
427 strcpy(cpu_model, "Cyrix ");
428 switch (cpu_id & 0xff0) {
430 strcat(cpu_model, "MediaGX");
433 strcat(cpu_model, "6x86");
436 cpu_class = CPUCLASS_586;
437 strcat(cpu_model, "GXm");
440 strcat(cpu_model, "6x86MX");
444 * Even though CPU supports the cpuid
445 * instruction, it can be disabled.
446 * Therefore, this routine supports all Cyrix
449 switch (cyrix_did & 0xf0) {
451 switch (cyrix_did & 0x0f) {
453 strcat(cpu_model, "486SLC");
456 strcat(cpu_model, "486DLC");
459 strcat(cpu_model, "486SLC2");
462 strcat(cpu_model, "486DLC2");
465 strcat(cpu_model, "486SRx");
468 strcat(cpu_model, "486DRx");
471 strcat(cpu_model, "486SRx2");
474 strcat(cpu_model, "486DRx2");
477 strcat(cpu_model, "486SRu");
480 strcat(cpu_model, "486DRu");
483 strcat(cpu_model, "486SRu2");
486 strcat(cpu_model, "486DRu2");
489 strcat(cpu_model, "Unknown");
494 switch (cyrix_did & 0x0f) {
496 strcat(cpu_model, "486S");
499 strcat(cpu_model, "486S2");
502 strcat(cpu_model, "486Se");
505 strcat(cpu_model, "486S2e");
508 strcat(cpu_model, "486DX");
511 strcat(cpu_model, "486DX2");
514 strcat(cpu_model, "486DX4");
517 strcat(cpu_model, "Unknown");
522 if ((cyrix_did & 0x0f) < 8)
523 strcat(cpu_model, "6x86"); /* Where did you get it? */
525 strcat(cpu_model, "5x86");
528 strcat(cpu_model, "6x86");
531 if ((cyrix_did & 0xf000) == 0x3000) {
532 cpu_class = CPUCLASS_586;
533 strcat(cpu_model, "GXm");
535 strcat(cpu_model, "MediaGX");
538 strcat(cpu_model, "6x86MX");
541 switch (cyrix_did & 0x0f) {
543 strcat(cpu_model, "Overdrive CPU");
546 strcpy(cpu_model, "Texas Instruments 486SXL");
549 strcat(cpu_model, "486SLC/DLC");
552 strcat(cpu_model, "Unknown");
557 strcat(cpu_model, "Unknown");
562 } else if (cpu_vendor_id == CPU_VENDOR_RISE) {
563 strcpy(cpu_model, "Rise ");
564 switch (cpu_id & 0xff0) {
566 strcat(cpu_model, "mP6");
569 strcat(cpu_model, "Unknown");
571 } else if (cpu_vendor_id == CPU_VENDOR_CENTAUR) {
572 switch (cpu_id & 0xff0) {
574 strcpy(cpu_model, "IDT WinChip C6");
578 strcpy(cpu_model, "IDT WinChip 2");
581 strcpy(cpu_model, "VIA C3 Samuel");
585 strcpy(cpu_model, "VIA C3 Ezra");
587 strcpy(cpu_model, "VIA C3 Samuel 2");
590 strcpy(cpu_model, "VIA C3 Ezra-T");
593 strcpy(cpu_model, "VIA C3 Nehemiah");
597 strcpy(cpu_model, "VIA C7 Esther");
600 strcpy(cpu_model, "VIA Nano");
603 strcpy(cpu_model, "VIA/IDT Unknown");
605 } else if (cpu_vendor_id == CPU_VENDOR_IBM) {
606 strcpy(cpu_model, "Blue Lightning CPU");
607 } else if (cpu_vendor_id == CPU_VENDOR_NSC) {
608 switch (cpu_id & 0xfff) {
610 strcpy(cpu_model, "Geode SC1100");
615 strcpy(cpu_model, "Geode/NSC unknown");
621 * Replace cpu_model with cpu_brand minus leading spaces if
625 while (*brand == ' ')
628 strcpy(cpu_model, brand);
630 kprintf("%s (", cpu_model);
638 #if defined(I486_CPU)
643 #if defined(I586_CPU)
645 hw_clockrate = (tsc_frequency + 5000) / 1000000;
646 kprintf("%jd.%02d-MHz ",
647 (intmax_t)(tsc_frequency + 4999) / 1000000,
648 (u_int)((tsc_frequency + 4999) / 10000) % 100);
652 #if defined(I686_CPU)
654 hw_clockrate = (tsc_frequency + 5000) / 1000000;
655 kprintf("%jd.%02d-MHz ",
656 (intmax_t)(tsc_frequency + 4999) / 1000000,
657 (u_int)((tsc_frequency + 4999) / 10000) % 100);
662 kprintf("Unknown"); /* will panic below... */
664 kprintf("-class CPU)\n");
666 kprintf(" Origin = \"%s\"",cpu_vendor);
668 kprintf(" Id = 0x%x", cpu_id);
670 if (cpu_vendor_id == CPU_VENDOR_INTEL ||
671 cpu_vendor_id == CPU_VENDOR_AMD ||
672 cpu_vendor_id == CPU_VENDOR_TRANSMETA ||
673 cpu_vendor_id == CPU_VENDOR_RISE ||
674 cpu_vendor_id == CPU_VENDOR_CENTAUR ||
675 cpu_vendor_id == CPU_VENDOR_NSC ||
676 (cpu_vendor_id == CPU_VENDOR_CYRIX &&
677 ((cpu_id & 0xf00) > 0x500))) {
678 kprintf(" Stepping = %u", cpu_id & 0xf);
679 if (cpu_vendor_id == CPU_VENDOR_CYRIX)
680 kprintf(" DIR=0x%04x", cyrix_did);
682 u_int cmp = 1, htt = 1;
685 * Here we should probably set up flags indicating
686 * whether or not various features are available.
687 * The interesting ones are probably VME, PSE, PAE,
688 * and PGE. The code already assumes without bothering
689 * to check that all CPUs >= Pentium have a TSC and
692 kprintf("\n Features=0x%b", cpu_feature,
694 "\001FPU" /* Integral FPU */
695 "\002VME" /* Extended VM86 mode support */
696 "\003DE" /* Debugging Extensions (CR4.DE) */
697 "\004PSE" /* 4MByte page tables */
698 "\005TSC" /* Timestamp counter */
699 "\006MSR" /* Machine specific registers */
700 "\007PAE" /* Physical address extension */
701 "\010MCE" /* Machine Check support */
702 "\011CX8" /* CMPEXCH8 instruction */
703 "\012APIC" /* SMP local APIC */
704 "\013oldMTRR" /* Previous implementation of MTRR */
705 "\014SEP" /* Fast System Call */
706 "\015MTRR" /* Memory Type Range Registers */
707 "\016PGE" /* PG_G (global bit) support */
708 "\017MCA" /* Machine Check Architecture */
709 "\020CMOV" /* CMOV instruction */
710 "\021PAT" /* Page attributes table */
711 "\022PSE36" /* 36 bit address space support */
712 "\023PN" /* Processor Serial number */
713 "\024CLFLUSH" /* Has the CLFLUSH instruction */
715 "\026DTS" /* Debug Trace Store */
716 "\027ACPI" /* ACPI support */
717 "\030MMX" /* MMX instructions */
718 "\031FXSR" /* FXSAVE/FXRSTOR */
719 "\032SSE" /* Streaming SIMD Extensions */
720 "\033SSE2" /* Streaming SIMD Extensions #2 */
721 "\034SS" /* Self snoop */
722 "\035HTT" /* Hyperthreading (see EBX bit 16-23) */
723 "\036TM" /* Thermal Monitor clock slowdown */
724 "\037IA64" /* CPU can execute IA64 instructions */
725 "\040PBE" /* Pending Break Enable */
728 if (cpu_feature2 != 0) {
729 kprintf("\n Features2=0x%b", cpu_feature2,
731 "\001SSE3" /* SSE3 */
732 "\002PCLMULQDQ" /* Carry-Less Mul Quadword */
733 "\003DTES64" /* 64-bit Debug Trace */
734 "\004MON" /* MONITOR/MWAIT Instructions */
735 "\005DS_CPL" /* CPL Qualified Debug Store */
736 "\006VMX" /* Virtual Machine Extensions */
737 "\007SMX" /* Safer Mode Extensions */
738 "\010EST" /* Enhanced SpeedStep */
739 "\011TM2" /* Thermal Monitor 2 */
740 "\012SSSE3" /* SSSE3 */
741 "\013CNXT-ID" /* L1 context ID available */
743 "\015FMA" /* Fused Multiply Add */
744 "\016CX16" /* CMPXCHG16B Instruction */
745 "\017xTPR" /* Send Task Priority Messages */
746 "\020PDCM" /* Perf/Debug Capability MSR */
748 "\022PCID" /* Process-context Identifiers */
749 "\023DCA" /* Direct Cache Access */
750 "\024SSE4.1" /* SSE 4.1 */
751 "\025SSE4.2" /* SSE 4.2 */
752 "\026x2APIC" /* xAPIC Extensions */
753 "\027MOVBE" /* MOVBE Instruction */
754 "\030POPCNT" /* POPCNT Instruction */
755 "\031TSCDLT" /* TSC-Deadline Timer */
756 "\032AESNI" /* AES Crypto */
757 "\033XSAVE" /* XSAVE/XRSTOR States */
758 "\034OSXSAVE" /* OS-Enabled State Management */
759 "\035AVX" /* Advanced Vector Extensions */
760 "\036F16C" /* Half-precision conversions */
761 "\037RDRND" /* RDRAND RNG function */
762 "\040VMM" /* Running on a hypervisor */
767 * AMD64 Architecture Programmer's Manual Volume 3:
768 * General-Purpose and System Instructions
769 * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/24594.pdf
771 * IA-32 Intel Architecture Software Developer's Manual,
772 * Volume 2A: Instruction Set Reference, A-M
773 * ftp://download.intel.com/design/Pentium4/manuals/25366617.pdf
775 if (amd_feature != 0) {
776 kprintf("\n AMD Features=0x%b", amd_feature,
778 "\001<s0>" /* Same */
779 "\002<s1>" /* Same */
780 "\003<s2>" /* Same */
781 "\004<s3>" /* Same */
782 "\005<s4>" /* Same */
783 "\006<s5>" /* Same */
784 "\007<s6>" /* Same */
785 "\010<s7>" /* Same */
786 "\011<s8>" /* Same */
787 "\012<s9>" /* Same */
788 "\013<b10>" /* Undefined */
789 "\014SYSCALL" /* Have SYSCALL/SYSRET */
790 "\015<s12>" /* Same */
791 "\016<s13>" /* Same */
792 "\017<s14>" /* Same */
793 "\020<s15>" /* Same */
794 "\021<s16>" /* Same */
795 "\022<s17>" /* Same */
796 "\023<b18>" /* Reserved, unknown */
797 "\024MP" /* Multiprocessor Capable */
798 "\025NX" /* Has EFER.NXE, NX */
799 "\026<b21>" /* Undefined */
800 "\027MMX+" /* AMD MMX Extensions */
801 "\030<s23>" /* Same */
802 "\031<s24>" /* Same */
803 "\032FFXSR" /* Fast FXSAVE/FXRSTOR */
804 "\033Page1GB" /* 1-GB large page support */
805 "\034RDTSCP" /* RDTSCP */
806 "\035<b28>" /* Undefined */
807 "\036LM" /* 64 bit long mode */
808 "\0373DNow!+" /* AMD 3DNow! Extensions */
809 "\0403DNow!" /* AMD 3DNow! */
813 if (amd_feature2 != 0) {
814 kprintf("\n AMD Features2=0x%b", amd_feature2,
816 "\001LAHF" /* LAHF/SAHF in long mode */
817 "\002CMP" /* CMP legacy */
818 "\003SVM" /* Secure Virtual Mode */
819 "\004ExtAPIC" /* Extended APIC register */
820 "\005CR8" /* CR8 in legacy mode */
821 "\006ABM" /* LZCNT instruction */
822 "\007SSE4A" /* SSE4A */
823 "\010MAS" /* Misaligned SSE mode */
824 "\011Prefetch" /* 3DNow! Prefetch/PrefetchW */
825 "\012OSVW" /* OS visible workaround */
826 "\013IBS" /* Instruction based sampling */
827 "\014XOP" /* XOP extended instructions */
828 "\015SKINIT" /* SKINIT/STGI */
829 "\016WDT" /* Watchdog timer */
831 "\020LWP" /* Lightweight Profiling */
832 "\021FMA4" /* 4-operand FMA instructions */
833 "\022TCE" /* Translation Cache Extension */
835 "\024NodeId" /* NodeId MSR support */
837 "\026TBM" /* Trailing Bit Manipulation */
838 "\027Topology" /* Topology Extensions */
839 "\030PCX_CORE" /* Core Performance Counter */
840 "\031PCX_NB" /* NB Performance Counter */
851 if (cpu_vendor_id == CPU_VENDOR_CENTAUR)
852 print_via_padlock_info();
854 if ((cpu_feature & CPUID_HTT) &&
855 cpu_vendor_id == CPU_VENDOR_AMD)
856 cpu_feature &= ~CPUID_HTT;
859 * If this CPU supports HTT or CMP then mention the
860 * number of physical/logical cores it contains.
862 if (cpu_feature & CPUID_HTT)
863 htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
864 if (cpu_vendor_id == CPU_VENDOR_AMD &&
865 (amd_feature2 & AMDID2_CMP))
866 cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
867 else if (cpu_vendor_id == CPU_VENDOR_INTEL &&
869 cpuid_count(4, 0, regs);
870 if ((regs[0] & 0x1f) != 0)
871 cmp = ((regs[0] >> 26) & 0x3f) + 1;
876 * XXX For Intel CPUs, this is max number of cores per
877 * package, not the actual cores per package.
880 cpu_logical = htt / cmp;
883 kprintf("\n Cores per package: %d", cpu_cores);
884 if (cpu_logical > 1) {
885 kprintf("\n Logical CPUs per core: %d",
892 * If this CPU supports P-state invariant TSC then
893 * mention the capability.
895 switch (cpu_vendor_id) {
897 if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
898 CPUID_TO_FAMILY(cpu_id) >= 0x10 ||
900 tsc_is_invariant = 1;
902 case CPU_VENDOR_INTEL:
903 if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
904 (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
905 CPUID_TO_MODEL(cpu_id) >= 0xe) ||
906 (CPUID_TO_FAMILY(cpu_id) == 0xf &&
907 CPUID_TO_MODEL(cpu_id) >= 0x3))
908 tsc_is_invariant = 1;
910 case CPU_VENDOR_CENTAUR:
911 if (CPUID_TO_FAMILY(cpu_id) == 0x6 &&
912 CPUID_TO_MODEL(cpu_id) >= 0xf &&
913 (rdmsr(0x1203) & 0x100000000ULL) == 0)
914 tsc_is_invariant = 1;
917 if (tsc_is_invariant)
918 kprintf("\n TSC: P-state invariant");
922 } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) {
923 kprintf(" DIR=0x%04x", cyrix_did);
924 kprintf(" Stepping=%u", (cyrix_did & 0xf000) >> 12);
925 kprintf(" Revision=%u", (cyrix_did & 0x0f00) >> 8);
926 #ifndef CYRIX_CACHE_REALLY_WORKS
927 if (cpu == CPU_M1 && (cyrix_did & 0xff00) < 0x1700)
928 kprintf("\n CPU cache: write-through mode");
932 /* Avoid ugly blank lines: only print newline when we have to. */
933 if (*cpu_vendor || cpu_id)
936 for (i = 0; i < additional_cpu_info_count; ++i) {
937 kprintf(" %s\n", additional_cpu_info_ary[i]);
943 if (cpu_vendor_id == CPU_VENDOR_AMD)
945 else if (cpu_vendor_id == CPU_VENDOR_INTEL)
947 else if (cpu_vendor_id == CPU_VENDOR_TRANSMETA)
948 print_transmeta_info();
951 kprintf("Use SSE2 (lfence, mfence)\n");
956 panicifcpuunsupported(void)
960 #if !defined(I486_CPU) && !defined(I586_CPU) && !defined(I686_CPU)
961 #error This kernel is not configured for one of the supported CPUs
966 * Now that we have told the user what they have,
967 * let them know if that machine type isn't configured.
970 case CPUCLASS_286: /* a 286 should not make it this far, anyway */
972 #if !defined(I486_CPU)
975 #if !defined(I586_CPU)
978 #if !defined(I686_CPU)
981 panic("CPU class not configured");
988 static volatile u_int trap_by_rdmsr;
991 * Special exception 6 handler.
992 * The rdmsr instruction generates invalid opcodes fault on 486-class
993 * Cyrix CPU. Stacked eip register points the rdmsr instruction in the
994 * function identblue() when this handler is called. Stacked eip should
1003 .type " __XSTRING(CNAME(bluetrap6)) ",@function \n\
1004 " __XSTRING(CNAME(bluetrap6)) ": \n\
1006 movl $0xa8c1d," __XSTRING(CNAME(trap_by_rdmsr)) " \n\
1007 addl $2, (%esp) /* rdmsr is a 2-byte instruction */ \n\
1012 * Special exception 13 handler.
1013 * Accessing non-existent MSR generates general protection fault.
1015 inthand_t bluetrap13;
1021 .type " __XSTRING(CNAME(bluetrap13)) ",@function \n\
1022 " __XSTRING(CNAME(bluetrap13)) ": \n\
1024 movl $0xa89c4," __XSTRING(CNAME(trap_by_rdmsr)) " \n\
1025 popl %eax /* discard error code */ \n\
1026 addl $2, (%esp) /* rdmsr is a 2-byte instruction */ \n\
1031 * Distinguish IBM Blue Lightning CPU from Cyrix CPUs that does not
1032 * support cpuid instruction. This function should be called after
1033 * loading interrupt descriptor table register.
1035 * I don't like this method that handles fault, but I couldn't get
1036 * information for any other methods. Does blue giant know?
1045 * Cyrix 486-class CPU does not support rdmsr instruction.
1046 * The rdmsr instruction generates invalid opcode fault, and exception
1047 * will be trapped by bluetrap6() on Cyrix 486-class CPU. The
1048 * bluetrap6() set the magic number to trap_by_rdmsr.
1050 setidt(6, bluetrap6, SDT_SYS386TGT, SEL_KPL,
1051 GSEL(GCODE_SEL, SEL_KPL));
1054 * Certain BIOS disables cpuid instruction of Cyrix 6x86MX CPU.
1055 * In this case, rdmsr generates general protection fault, and
1056 * exception will be trapped by bluetrap13().
1058 setidt(13, bluetrap13, SDT_SYS386TGT, SEL_KPL,
1059 GSEL(GCODE_SEL, SEL_KPL));
1061 rdmsr(0x1002); /* Cyrix CPU generates fault. */
1063 if (trap_by_rdmsr == 0xa8c1d)
1064 return IDENTBLUE_CYRIX486;
1065 else if (trap_by_rdmsr == 0xa89c4)
1066 return IDENTBLUE_CYRIXM2;
1067 return IDENTBLUE_IBMCPU;
1072 * identifycyrix() set lower 16 bits of cyrix_did as follows:
1074 * F E D C B A 9 8 7 6 5 4 3 2 1 0
1075 * +-------+-------+---------------+
1076 * | SID | RID | Device ID |
1077 * | (DIR 1) | (DIR 0) |
1078 * +-------+-------+---------------+
1083 int ccr2_test = 0, dir_test = 0;
1088 ccr2 = read_cyrix_reg(CCR2);
1089 write_cyrix_reg(CCR2, ccr2 ^ CCR2_LOCK_NW);
1090 read_cyrix_reg(CCR2);
1091 if (read_cyrix_reg(CCR2) != ccr2)
1093 write_cyrix_reg(CCR2, ccr2);
1095 ccr3 = read_cyrix_reg(CCR3);
1096 write_cyrix_reg(CCR3, ccr3 ^ CCR3_MAPEN3);
1097 read_cyrix_reg(CCR3);
1098 if (read_cyrix_reg(CCR3) != ccr3)
1099 dir_test = 1; /* CPU supports DIRs. */
1100 write_cyrix_reg(CCR3, ccr3);
1103 /* Device ID registers are available. */
1104 cyrix_did = read_cyrix_reg(DIR1) << 8;
1105 cyrix_did += read_cyrix_reg(DIR0);
1106 } else if (ccr2_test)
1107 cyrix_did = 0x0010; /* 486S A-step */
1109 cyrix_did = 0x00ff; /* Old 486SLC/DLC and TI486SXLC/SXL */
1114 /* Update TSC freq with the value indicated by the caller. */
1116 tsc_frequency_changed(void *arg, const struct cf_level *level, int status)
1119 * If there was an error during the transition or
1120 * TSC is P-state invariant, don't do anything.
1122 if (status != 0 || tsc_is_invariant)
1125 /* Total setting for this level gives the new frequency in MHz. */
1126 hw_clockrate = level->total_set.freq;
1131 * Final stage of CPU identification. -- Should I check TI?
1134 finishidentcpu(void)
1140 cpu_vendor_id = find_cpu_vendor_id();
1143 * Clear "Limit CPUID Maxval" bit and get the largest standard CPUID
1144 * function number again if it is set from BIOS. It is necessary
1145 * for probing correct CPU topology later.
1146 * XXX This is only done on the BSP package.
1148 if (cpu_vendor_id == CPU_VENDOR_INTEL && cpu_high > 0 && cpu_high < 4 &&
1149 ((CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x3) ||
1150 (CPUID_TO_FAMILY(cpu_id) == 0x6 && CPUID_TO_MODEL(cpu_id) >= 0xe))) {
1152 msr = rdmsr(MSR_IA32_MISC_ENABLE);
1153 if ((msr & 0x400000ULL) != 0) {
1154 wrmsr(MSR_IA32_MISC_ENABLE, msr & ~0x400000ULL);
1160 /* Detect AMD features (PTE no-execute bit, 3dnow, 64 bit mode etc) */
1161 if (cpu_vendor_id == CPU_VENDOR_INTEL ||
1162 cpu_vendor_id == CPU_VENDOR_AMD) {
1164 if (cpu_exthigh >= 0x80000001) {
1165 do_cpuid(0x80000001, regs);
1166 amd_feature = regs[3] & ~(cpu_feature & 0x0183f3ff);
1167 amd_feature2 = regs[2];
1170 if (cpu_exthigh >= 0x80000007) {
1171 do_cpuid(0x80000007, regs);
1172 amd_pminfo = regs[3];
1175 if (cpu_exthigh >= 0x80000008) {
1176 do_cpuid(0x80000008, regs);
1177 cpu_procinfo2 = regs[2];
1179 } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) {
1180 if (cpu == CPU_486) {
1182 * These conditions are equivalent to:
1183 * - CPU does not support cpuid instruction.
1184 * - Cyrix/IBM CPU is detected.
1186 isblue = identblue();
1187 if (isblue == IDENTBLUE_IBMCPU) {
1188 strcpy(cpu_vendor, "IBM");
1189 cpu_vendor_id = CPU_VENDOR_IBM;
1194 switch (cpu_id & 0xf00) {
1197 * Cyrix's datasheet does not describe DIRs.
1198 * Therefor, I assume it does not have them
1199 * and use the result of the cpuid instruction.
1200 * XXX they seem to have it for now at least. -Peter
1208 * This routine contains a trick.
1209 * Don't check (cpu_id & 0x00f0) == 0x50 to detect M2, now.
1211 switch (cyrix_did & 0x00f0) {
1220 if ((cyrix_did & 0x000f) < 8)
1233 /* M2 and later CPUs are treated as M2. */
1237 * enable cpuid instruction.
1239 ccr3 = read_cyrix_reg(CCR3);
1240 write_cyrix_reg(CCR3, CCR3_MAPEN0);
1241 write_cyrix_reg(CCR4, read_cyrix_reg(CCR4) | CCR4_CPUID);
1242 write_cyrix_reg(CCR3, ccr3);
1245 cpu_high = regs[0]; /* eax */
1247 cpu_id = regs[0]; /* eax */
1248 cpu_feature = regs[3]; /* edx */
1252 } else if (cpu == CPU_486 && *cpu_vendor == '\0') {
1254 * There are BlueLightning CPUs that do not change
1255 * undefined flags by dividing 5 by 2. In this case,
1256 * the CPU identification routine in locore.s leaves
1257 * cpu_vendor null string and puts CPU_486 into the
1260 isblue = identblue();
1261 if (isblue == IDENTBLUE_IBMCPU) {
1262 strcpy(cpu_vendor, "IBM");
1263 cpu_vendor_id = CPU_VENDOR_IBM;
1269 * Set MI flags for MI procedures implemented using machine-specific
1273 if (cpu_feature & CPUID_SSE2)
1274 cpu_mi_feature |= CPU_MI_BZERONT;
1276 if (cpu_feature2 & CPUID2_MON)
1277 cpu_mi_feature |= CPU_MI_MONITOR;
1280 if ((cpu_feature & CPUID_SSE2) == 0)
1281 panic("CPU does not has SSE2, remove options CPU_HAS_SSE2");
1286 find_cpu_vendor_id(void)
1290 for (i = 0; i < NELEM(cpu_vendors); i++)
1291 if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0)
1292 return (cpu_vendors[i].vendor_id);
1297 print_AMD_assoc(int i)
1300 kprintf(", fully associative\n");
1302 kprintf(", %d-way associative\n", i);
1306 * #31116 Rev 3.06 section 3.9
1307 * CPUID Fn8000_0006 L2/L3 Cache and L2 TLB Identifiers
1310 print_AMD_L2L3_assoc(int i)
1312 static const char *assoc_str[] = {
1314 [0x1] = "direct mapped",
1315 [0x2] = "2-way associative",
1316 [0x4] = "4-way associative",
1317 [0x6] = "8-way associative",
1318 [0x8] = "16-way associative",
1319 [0xa] = "32-way associative",
1320 [0xb] = "48-way associative",
1321 [0xc] = "64-way associative",
1322 [0xd] = "96-way associative",
1323 [0xe] = "128-way associative",
1324 [0xf] = "fully associative"
1328 if (assoc_str[i] == NULL)
1329 kprintf(", unknown associative\n");
1331 kprintf(", %s\n", assoc_str[i]);
1335 print_AMD_info(void)
1339 if (cpu_exthigh >= 0x80000005) {
1342 do_cpuid(0x80000005, regs);
1343 kprintf("Data TLB: %d entries", (regs[1] >> 16) & 0xff);
1344 print_AMD_assoc(regs[1] >> 24);
1345 kprintf("Instruction TLB: %d entries", regs[1] & 0xff);
1346 print_AMD_assoc((regs[1] >> 8) & 0xff);
1347 kprintf("L1 data cache: %d kbytes", regs[2] >> 24);
1348 kprintf(", %d bytes/line", regs[2] & 0xff);
1349 kprintf(", %d lines/tag", (regs[2] >> 8) & 0xff);
1350 print_AMD_assoc((regs[2] >> 16) & 0xff);
1351 kprintf("L1 instruction cache: %d kbytes", regs[3] >> 24);
1352 kprintf(", %d bytes/line", regs[3] & 0xff);
1353 kprintf(", %d lines/tag", (regs[3] >> 8) & 0xff);
1354 print_AMD_assoc((regs[3] >> 16) & 0xff);
1355 if (cpu_exthigh >= 0x80000006) { /* K6-III or later */
1356 do_cpuid(0x80000006, regs);
1358 * Report right L2 cache size on Duron rev. A0.
1360 if ((cpu_id & 0xFF0) == 0x630)
1361 kprintf("L2 internal cache: 64 kbytes");
1363 kprintf("L2 internal cache: %d kbytes", regs[2] >> 16);
1365 kprintf(", %d bytes/line", regs[2] & 0xff);
1366 kprintf(", %d lines/tag", (regs[2] >> 8) & 0x0f);
1367 print_AMD_L2L3_assoc((regs[2] >> 12) & 0x0f);
1370 * #31116 Rev 3.06 section 2.16.2:
1371 * ... If EDX[31:16] is not zero then the processor
1372 * includes an L3. ...
1374 if ((regs[3] & 0xffff0000) != 0) {
1375 kprintf("L3 shared cache: %d kbytes",
1376 (regs[3] >> 18) * 512);
1377 kprintf(", %d bytes/line", regs[3] & 0xff);
1378 kprintf(", %d lines/tag", (regs[3] >> 8) & 0x0f);
1379 print_AMD_L2L3_assoc((regs[3] >> 12) & 0x0f);
1383 if (((cpu_id & 0xf00) == 0x500)
1384 && (((cpu_id & 0x0f0) > 0x80)
1385 || (((cpu_id & 0x0f0) == 0x80)
1386 && (cpu_id & 0x00f) > 0x07))) {
1387 /* K6-2(new core [Stepping 8-F]), K6-III or later */
1388 amd_whcr = rdmsr(0xc0000082);
1389 if (!(amd_whcr & (0x3ff << 22))) {
1390 kprintf("Write Allocate Disable\n");
1392 kprintf("Write Allocate Enable Limit: %dM bytes\n",
1393 (u_int32_t)((amd_whcr & (0x3ff << 22)) >> 22) * 4);
1394 kprintf("Write Allocate 15-16M bytes: %s\n",
1395 (amd_whcr & (1 << 16)) ? "Enable" : "Disable");
1397 } else if (((cpu_id & 0xf00) == 0x500)
1398 && ((cpu_id & 0x0f0) > 0x50)) {
1399 /* K6, K6-2(old core) */
1400 amd_whcr = rdmsr(0xc0000082);
1401 if (!(amd_whcr & (0x7f << 1))) {
1402 kprintf("Write Allocate Disable\n");
1404 kprintf("Write Allocate Enable Limit: %dM bytes\n",
1405 (u_int32_t)((amd_whcr & (0x7f << 1)) >> 1) * 4);
1406 kprintf("Write Allocate 15-16M bytes: %s\n",
1407 (amd_whcr & 0x0001) ? "Enable" : "Disable");
1408 kprintf("Hardware Write Allocate Control: %s\n",
1409 (amd_whcr & 0x0100) ? "Enable" : "Disable");
1414 * Opteron Rev E shows a bug as in very rare occasions a read memory
1415 * barrier is not performed as expected if it is followed by a
1416 * non-atomic read-modify-write instruction.
1417 * As long as that bug pops up very rarely (intensive machine usage
1418 * on other operating systems generally generates one unexplainable
1419 * crash any 2 months) and as long as a model specific fix would be
1420 * impratical at this stage, print out a warning string if the broken
1421 * model and family are identified.
1423 if (CPUID_TO_FAMILY(cpu_id) == 0xf && CPUID_TO_MODEL(cpu_id) >= 0x20 &&
1424 CPUID_TO_MODEL(cpu_id) <= 0x3f)
1425 kprintf("WARNING: This architecture revision has known SMP "
1426 "hardware bugs which may cause random instability\n");
1430 print_INTEL_info(void)
1433 u_int rounds, regnum;
1434 u_int nwaycode, nway;
1436 if (cpu_high >= 2) {
1439 do_cpuid(0x2, regs);
1440 if (rounds == 0 && (rounds = (regs[0] & 0xff)) == 0)
1441 break; /* we have a buggy CPU */
1443 for (regnum = 0; regnum <= 3; ++regnum) {
1444 if (regs[regnum] & (1<<31))
1447 print_INTEL_TLB(regs[regnum] & 0xff);
1448 print_INTEL_TLB((regs[regnum] >> 8) & 0xff);
1449 print_INTEL_TLB((regs[regnum] >> 16) & 0xff);
1450 print_INTEL_TLB((regs[regnum] >> 24) & 0xff);
1452 } while (--rounds > 0);
1455 if (cpu_exthigh >= 0x80000006) {
1456 do_cpuid(0x80000006, regs);
1457 nwaycode = (regs[2] >> 12) & 0x0f;
1458 if (nwaycode >= 0x02 && nwaycode <= 0x08)
1459 nway = 1 << (nwaycode / 2);
1462 kprintf("\nL2 cache: %u kbytes, %u-way associative, %u bytes/line",
1463 (regs[2] >> 16) & 0xffff, nway, regs[2] & 0xff);
1470 print_INTEL_TLB(u_int data)
1478 kprintf("\nInstruction TLB: 4 KB pages, 4-way set associative, 32 entries");
1481 kprintf("\nInstruction TLB: 4 MB pages, fully associative, 2 entries");
1484 kprintf("\nData TLB: 4 KB pages, 4-way set associative, 64 entries");
1487 kprintf("\nData TLB: 4 MB Pages, 4-way set associative, 8 entries");
1490 kprintf("\n1st-level instruction cache: 8 KB, 4-way set associative, 32 byte line size");
1493 kprintf("\n1st-level instruction cache: 16 KB, 4-way set associative, 32 byte line size");
1496 kprintf("\n1st-level data cache: 8 KB, 2-way set associative, 32 byte line size");
1499 kprintf("\n1st-level data cache: 16 KB, 4-way set associative, 32 byte line size");
1502 kprintf("\n3rd-level cache: 512 KB, 4-way set associative, sectored cache, 64 byte line size");
1505 kprintf("\n3rd-level cache: 1 MB, 8-way set associative, sectored cache, 64 byte line size");
1508 kprintf("\n3rd-level cache: 2 MB, 8-way set associative, sectored cache, 64 byte line size");
1511 kprintf("\n3rd-level cache: 4 MB, 8-way set associative, sectored cache, 64 byte line size");
1514 kprintf("\n1st-level data cache: 32 KB, 8-way set associative, 64 byte line size");
1517 kprintf("\n1st-level instruction cache: 32 KB, 8-way set associative, 64 byte line size");
1520 kprintf("\n2nd-level cache: 128 KB, 4-way set associative, sectored cache, 64 byte line size");
1523 kprintf("\n2nd-level cache: 128 KB, 2-way set associative, sectored cache, 64 byte line size");
1526 kprintf("\n2nd-level cache: 256 KB, 4-way set associative, sectored cache, 64 byte line size");
1529 kprintf("\n2nd-level cache: 128 KB, 4-way set associative, 32 byte line size");
1532 kprintf("\n2nd-level cache: 256 KB, 4-way set associative, 32 byte line size");
1535 kprintf("\n2nd-level cache: 512 KB, 4-way set associative, 32 byte line size");
1538 kprintf("\n2nd-level cache: 1 MB, 4-way set associative, 32 byte line size");
1541 kprintf("\n2nd-level cache: 2 MB, 4-way set associative, 32 byte line size");
1544 kprintf("\n3rd-level cache: 4 MB, 4-way set associative, 64 byte line size");
1547 kprintf("\n3rd-level cache: 8 MB, 8-way set associative, 64 byte line size");
1550 kprintf("\nInstruction TLB: 4 KB, 2 MB or 4 MB pages, fully associative, 64 entries");
1553 kprintf("\nInstruction TLB: 4 KB, 2 MB or 4 MB pages, fully associative, 128 entries");
1556 kprintf("\nInstruction TLB: 4 KB, 2 MB or 4 MB pages, fully associative, 256 entries");
1559 kprintf("\nData TLB: 4 KB or 4 MB pages, fully associative, 64 entries");
1562 kprintf("\nData TLB: 4 KB or 4 MB pages, fully associative, 128 entries");
1565 kprintf("\nData TLB: 4 KB or 4 MB pages, fully associative, 256 entries");
1568 kprintf("\n1st-level data cache: 16 KB, 8-way set associative, sectored cache, 64 byte line size");
1571 kprintf("\n1st-level data cache: 8 KB, 4-way set associative, sectored cache, 64 byte line size");
1574 kprintf("\n1st-level data cache: 16 KB, 4-way set associative, sectored cache, 64 byte line size");
1577 kprintf("\n1st-level data cache: 32 KB, 4 way set associative, sectored cache, 64 byte line size");
1580 kprintf("\nTrace cache: 12K-uops, 8-way set associative");
1583 kprintf("\nTrace cache: 16K-uops, 8-way set associative");
1586 kprintf("\nTrace cache: 32K-uops, 8-way set associative");
1589 kprintf("\n2nd-level cache: 1 MB, 4-way set associative, 64-byte line size");
1592 kprintf("\n2nd-level cache: 128 KB, 8-way set associative, sectored cache, 64 byte line size");
1595 kprintf("\n2nd-level cache: 256 KB, 8-way set associative, sectored cache, 64 byte line size");
1598 kprintf("\n2nd-level cache: 512 KB, 8-way set associative, sectored cache, 64 byte line size");
1601 kprintf("\n2nd-level cache: 1 MB, 8-way set associative, sectored cache, 64 byte line size");
1604 kprintf("\n2nd-level cache: 2-MB, 8-way set associative, 64-byte line size");
1607 kprintf("\n2nd-level cache: 512-KB, 2-way set associative, 64-byte line size");
1610 kprintf("\n2nd-level cache: 256 KB, 8-way set associative, 32 byte line size");
1613 kprintf("\n2nd-level cache: 512 KB, 8-way set associative, 32 byte line size");
1616 kprintf("\n2nd-level cache: 1 MB, 8-way set associative, 32 byte line size");
1619 kprintf("\n2nd-level cache: 2 MB, 8-way set associative, 32 byte line size");
1622 kprintf("\n2nd-level cache: 512 KB, 4-way set associative, 64 byte line size");
1625 kprintf("\n2nd-level cache: 1 MB, 8-way set associative, 64 byte line size");
1628 kprintf("\nInstruction TLB: 4 KB Pages, 4-way set associative, 128 entries");
1631 kprintf("\nData TLB: 4 KB Pages, 4-way set associative, 128 entries");
1637 print_transmeta_info(void)
1639 u_int regs[4], nreg = 0;
1641 do_cpuid(0x80860000, regs);
1643 if (nreg >= 0x80860001) {
1644 do_cpuid(0x80860001, regs);
1645 kprintf(" Processor revision %u.%u.%u.%u\n",
1646 (regs[1] >> 24) & 0xff,
1647 (regs[1] >> 16) & 0xff,
1648 (regs[1] >> 8) & 0xff,
1651 if (nreg >= 0x80860002) {
1652 do_cpuid(0x80860002, regs);
1653 kprintf(" Code Morphing Software revision %u.%u.%u-%u-%u\n",
1654 (regs[1] >> 24) & 0xff,
1655 (regs[1] >> 16) & 0xff,
1656 (regs[1] >> 8) & 0xff,
1660 if (nreg >= 0x80860006) {
1662 do_cpuid(0x80860003, (u_int*) &info[0]);
1663 do_cpuid(0x80860004, (u_int*) &info[16]);
1664 do_cpuid(0x80860005, (u_int*) &info[32]);
1665 do_cpuid(0x80860006, (u_int*) &info[48]);
1667 kprintf(" %s\n", info);
1672 print_via_padlock_info(void)
1676 /* Check for supported models. */
1677 switch (cpu_id & 0xff0) {
1679 if ((cpu_id & 0xf) < 3)
1689 do_cpuid(0xc0000000, regs);
1690 if (regs[0] >= 0xc0000001)
1691 do_cpuid(0xc0000001, regs);
1695 kprintf("\n VIA Padlock Features=0x%b", regs[3],
1699 "\011AES-CTR" /* ACE2 */
1700 "\013SHA1,SHA256" /* PHE */
1706 additional_cpu_info(const char *line)
1710 if ((i = additional_cpu_info_count) < MAX_ADDITIONAL_INFO) {
1711 additional_cpu_info_ary[i] = line;
1712 ++additional_cpu_info_count;