From f8207e4623d39c57e39e9aa256272af6b5da7ddf Mon Sep 17 00:00:00 2001 From: green Date: Tue, 6 Jul 1999 05:25:41 +0000 Subject: I made some cleanups, rearranged things a bit, and made AMD Features default printing on CPUs that have it. If there are no objections, I'll MFC all recent changes (harmless, really) to 3.2 and PAO. --- sys/amd64/amd64/identcpu.c | 99 ++++++++++++++++++++++++---------------------- sys/i386/i386/identcpu.c | 99 ++++++++++++++++++++++++---------------------- 2 files changed, 104 insertions(+), 94 deletions(-) (limited to 'sys') diff --git a/sys/amd64/amd64/identcpu.c b/sys/amd64/amd64/identcpu.c index 323b39c..f9e03c7 100644 --- a/sys/amd64/amd64/identcpu.c +++ b/sys/amd64/amd64/identcpu.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.66 1999/07/05 02:27:32 green Exp $ + * $Id: identcpu.c,v 1.65 1999/06/24 20:08:56 jlemon Exp $ */ #include "opt_cpu.h" @@ -71,7 +71,8 @@ void enable_K6_2_wt_alloc(void); void panicifcpuunsupported(void); static void identifycyrix(void); -static void print_AMD_info(void); +static void print_AMD_features(u_int *regs); +static void print_AMD_info(u_int amd_maxregs); static void print_AMD_assoc(int i); static void do_cpuid(u_int ax, u_int *p); @@ -525,7 +526,7 @@ printcpuinfo(void) strcmp(cpu_vendor, "RiseRiseRise") == 0 || ((strcmp(cpu_vendor, "CyrixInstead") == 0) && ((cpu_id & 0xf00) > 0x500))) { - printf(" Stepping=%u", cpu_id & 0xf); + printf(" Stepping = %u", cpu_id & 0xf); if (strcmp(cpu_vendor, "CyrixInstead") == 0) printf(" DIR=0x%04x", cyrix_did); if (cpu_high > 0) { @@ -573,6 +574,9 @@ printcpuinfo(void) "\040" ); } + if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + nreg >= 0x80000001) + print_AMD_features(regs); } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { printf(" DIR=0x%04x", cyrix_did); printf(" Stepping=%u", (cyrix_did & 0xf000) >> 12); @@ -591,7 +595,7 @@ printcpuinfo(void) return; if (strcmp(cpu_vendor, "AuthenticAMD") == 0) - print_AMD_info(); + print_AMD_info(nreg); #ifdef I686_CPU /* * XXX - Do PPro CPUID level=2 stuff here? @@ -867,53 +871,13 @@ print_AMD_assoc(int i) } static void -print_AMD_info(void) +print_AMD_info(u_int amd_maxregs) { - u_int regs[4], amd_maxregs; quad_t amd_whcr; - do_cpuid(0x80000000, regs); - amd_maxregs = regs[0]; - - if (amd_maxregs >= 0x80000001) { - do_cpuid(0x80000001, regs); - printf(" AMD Features=0x%b\n", regs[3], - "\020" /* in hex */ - "\001FPU" - "\002VME" - "\003DE" - "\004PSE" - "\005TSC" - "\006MSR" - "\007" - "\010MCE" - "\011CX8" - "\012" - "\013" - "\014SYSCALL" - "\015" - "\016PGE" - "\017" - "\020ICMOV" - "\021FCMOV" - "\022" - "\023" - "\024" - "\025" - "\026" - "\027" - "\030MMX" - "\031" - "\032" - "\033" - "\034" - "\035" - "\036" - "\037" - "\0403DNow!" - ); - } if (amd_maxregs >= 0x80000005) { + u_int regs[4]; + do_cpuid(0x80000005, regs); printf("Data TLB: %d entries", (regs[1] >> 16) & 0xff); print_AMD_assoc(regs[1] >> 24); @@ -965,3 +929,44 @@ print_AMD_info(void) } } } + +static void +print_AMD_features(u_int *regs) +{ + do_cpuid(0x80000001, regs); + printf("\n AMD Features=0x%b", regs[3] &~ cpu_feature, + "\020" /* in hex */ + "\001FPU" + "\002VME" + "\003DE" + "\004PSE" + "\005TSC" + "\006MSR" + "\007" + "\010MCE" + "\011CX8" + "\012" + "\013" + "\014SYSCALL" + "\015" + "\016PGE" + "\017" + "\020ICMOV" + "\021FCMOV" + "\022" + "\023" + "\024" + "\025" + "\026" + "\027" + "\030MMX" + "\031" + "\032" + "\033" + "\034" + "\035" + "\036" + "\037" + "\0403DNow!" + ); +} diff --git a/sys/i386/i386/identcpu.c b/sys/i386/i386/identcpu.c index 323b39c..f9e03c7 100644 --- a/sys/i386/i386/identcpu.c +++ b/sys/i386/i386/identcpu.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: Id: machdep.c,v 1.193 1996/06/18 01:22:04 bde Exp - * $Id: identcpu.c,v 1.66 1999/07/05 02:27:32 green Exp $ + * $Id: identcpu.c,v 1.65 1999/06/24 20:08:56 jlemon Exp $ */ #include "opt_cpu.h" @@ -71,7 +71,8 @@ void enable_K6_2_wt_alloc(void); void panicifcpuunsupported(void); static void identifycyrix(void); -static void print_AMD_info(void); +static void print_AMD_features(u_int *regs); +static void print_AMD_info(u_int amd_maxregs); static void print_AMD_assoc(int i); static void do_cpuid(u_int ax, u_int *p); @@ -525,7 +526,7 @@ printcpuinfo(void) strcmp(cpu_vendor, "RiseRiseRise") == 0 || ((strcmp(cpu_vendor, "CyrixInstead") == 0) && ((cpu_id & 0xf00) > 0x500))) { - printf(" Stepping=%u", cpu_id & 0xf); + printf(" Stepping = %u", cpu_id & 0xf); if (strcmp(cpu_vendor, "CyrixInstead") == 0) printf(" DIR=0x%04x", cyrix_did); if (cpu_high > 0) { @@ -573,6 +574,9 @@ printcpuinfo(void) "\040" ); } + if (strcmp(cpu_vendor, "AuthenticAMD") == 0 && + nreg >= 0x80000001) + print_AMD_features(regs); } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) { printf(" DIR=0x%04x", cyrix_did); printf(" Stepping=%u", (cyrix_did & 0xf000) >> 12); @@ -591,7 +595,7 @@ printcpuinfo(void) return; if (strcmp(cpu_vendor, "AuthenticAMD") == 0) - print_AMD_info(); + print_AMD_info(nreg); #ifdef I686_CPU /* * XXX - Do PPro CPUID level=2 stuff here? @@ -867,53 +871,13 @@ print_AMD_assoc(int i) } static void -print_AMD_info(void) +print_AMD_info(u_int amd_maxregs) { - u_int regs[4], amd_maxregs; quad_t amd_whcr; - do_cpuid(0x80000000, regs); - amd_maxregs = regs[0]; - - if (amd_maxregs >= 0x80000001) { - do_cpuid(0x80000001, regs); - printf(" AMD Features=0x%b\n", regs[3], - "\020" /* in hex */ - "\001FPU" - "\002VME" - "\003DE" - "\004PSE" - "\005TSC" - "\006MSR" - "\007" - "\010MCE" - "\011CX8" - "\012" - "\013" - "\014SYSCALL" - "\015" - "\016PGE" - "\017" - "\020ICMOV" - "\021FCMOV" - "\022" - "\023" - "\024" - "\025" - "\026" - "\027" - "\030MMX" - "\031" - "\032" - "\033" - "\034" - "\035" - "\036" - "\037" - "\0403DNow!" - ); - } if (amd_maxregs >= 0x80000005) { + u_int regs[4]; + do_cpuid(0x80000005, regs); printf("Data TLB: %d entries", (regs[1] >> 16) & 0xff); print_AMD_assoc(regs[1] >> 24); @@ -965,3 +929,44 @@ print_AMD_info(void) } } } + +static void +print_AMD_features(u_int *regs) +{ + do_cpuid(0x80000001, regs); + printf("\n AMD Features=0x%b", regs[3] &~ cpu_feature, + "\020" /* in hex */ + "\001FPU" + "\002VME" + "\003DE" + "\004PSE" + "\005TSC" + "\006MSR" + "\007" + "\010MCE" + "\011CX8" + "\012" + "\013" + "\014SYSCALL" + "\015" + "\016PGE" + "\017" + "\020ICMOV" + "\021FCMOV" + "\022" + "\023" + "\024" + "\025" + "\026" + "\027" + "\030MMX" + "\031" + "\032" + "\033" + "\034" + "\035" + "\036" + "\037" + "\0403DNow!" + ); +} -- cgit v1.1