diff options
author | green <green@FreeBSD.org> | 1999-07-06 05:25:41 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 1999-07-06 05:25:41 +0000 |
commit | f8207e4623d39c57e39e9aa256272af6b5da7ddf (patch) | |
tree | 71d7baa8f57b924d94ead93cfe33e223a7f33147 /sys | |
parent | ca1b97c691756d726e676f30689ce2f0938c2df3 (diff) | |
download | FreeBSD-src-f8207e4623d39c57e39e9aa256272af6b5da7ddf.zip FreeBSD-src-f8207e4623d39c57e39e9aa256272af6b5da7ddf.tar.gz |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/identcpu.c | 99 | ||||
-rw-r--r-- | sys/i386/i386/identcpu.c | 99 |
2 files changed, 104 insertions, 94 deletions
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<b31>" ); } + 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<b6>" - "\010MCE" - "\011CX8" - "\012<b9>" - "\013<b10>" - "\014SYSCALL" - "\015<b12>" - "\016PGE" - "\017<b14>" - "\020ICMOV" - "\021FCMOV" - "\022<b17>" - "\023<b18>" - "\024<b19>" - "\025<b20>" - "\026<b21>" - "\027<b22>" - "\030MMX" - "\031<b24>" - "\032<b25>" - "\033<b26>" - "\034<b27>" - "\035<b28>" - "\036<b29>" - "\037<b30>" - "\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<b6>" + "\010MCE" + "\011CX8" + "\012<b9>" + "\013<b10>" + "\014SYSCALL" + "\015<b12>" + "\016PGE" + "\017<b14>" + "\020ICMOV" + "\021FCMOV" + "\022<b17>" + "\023<b18>" + "\024<b19>" + "\025<b20>" + "\026<b21>" + "\027<b22>" + "\030MMX" + "\031<b24>" + "\032<b25>" + "\033<b26>" + "\034<b27>" + "\035<b28>" + "\036<b29>" + "\037<b30>" + "\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<b31>" ); } + 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<b6>" - "\010MCE" - "\011CX8" - "\012<b9>" - "\013<b10>" - "\014SYSCALL" - "\015<b12>" - "\016PGE" - "\017<b14>" - "\020ICMOV" - "\021FCMOV" - "\022<b17>" - "\023<b18>" - "\024<b19>" - "\025<b20>" - "\026<b21>" - "\027<b22>" - "\030MMX" - "\031<b24>" - "\032<b25>" - "\033<b26>" - "\034<b27>" - "\035<b28>" - "\036<b29>" - "\037<b30>" - "\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<b6>" + "\010MCE" + "\011CX8" + "\012<b9>" + "\013<b10>" + "\014SYSCALL" + "\015<b12>" + "\016PGE" + "\017<b14>" + "\020ICMOV" + "\021FCMOV" + "\022<b17>" + "\023<b18>" + "\024<b19>" + "\025<b20>" + "\026<b21>" + "\027<b22>" + "\030MMX" + "\031<b24>" + "\032<b25>" + "\033<b26>" + "\034<b27>" + "\035<b28>" + "\036<b29>" + "\037<b30>" + "\0403DNow!" + ); +} |