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.
This commit is contained in:
Brian Feldman 1999-07-06 05:25:41 +00:00
parent cb7a4779cb
commit c92f8276cd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48615
2 changed files with 104 additions and 94 deletions

View File

@ -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!"
);
}

View File

@ -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!"
);
}