summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AMD/identify.c5
-rw-r--r--ChangeLog1
-rw-r--r--Cyrix/identify.c4
-rw-r--r--IDT/identify.c12
-rw-r--r--Intel/identify.c4
-rw-r--r--RiSE/identify.c13
-rw-r--r--TODO3
-rw-r--r--features.c116
-rw-r--r--x86info.h3
9 files changed, 78 insertions, 83 deletions
diff --git a/AMD/identify.c b/AMD/identify.c
index 4dfc6d6..9d6d6cd 100644
--- a/AMD/identify.c
+++ b/AMD/identify.c
@@ -1,5 +1,5 @@
/*
- * $Id: identify.c,v 1.12 2001/12/10 21:12:12 davej Exp $
+ * $Id: identify.c,v 1.13 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info.
* (C) 2001 Dave Jones.
*
@@ -239,8 +239,7 @@ void display_AMD_info(unsigned int maxei, struct cpudata *cpu)
if (maxei >= 0x80000001) {
cpuid (cpu->number, 0x00000001, &eax, &ebx, &ecx, &tmp);
cpuid (cpu->number, 0x80000001, &eax, &ebx, &ecx, &edx);
- edx |= tmp;
- decode_feature_flags (cpu, edx);
+ decode_feature_flags (cpu, tmp, edx);
}
get_model_name (maxei, cpu);
diff --git a/ChangeLog b/ChangeLog
index 200ed7e..07f5a20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,6 +18,7 @@
* Intel/identify.c: Only read eblcr when asked to.
Distinguish between Celerons & Pentiums.
Make cache descriptions match in style to the AMD descriptions.
+ * features.c: Rewritten.
2001-12-9 Hans-Frieder Vogt <hfvogt@nexgo.de>
diff --git a/Cyrix/identify.c b/Cyrix/identify.c
index aadab2d..06f88c7 100644
--- a/Cyrix/identify.c
+++ b/Cyrix/identify.c
@@ -1,5 +1,5 @@
/*
- * $Id: identify.c,v 1.5 2001/12/10 21:12:12 davej Exp $
+ * $Id: identify.c,v 1.6 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info.
* (C) 2001 Dave Jones.
*
@@ -104,7 +104,7 @@ void display_Cyrix_info(unsigned int maxi, unsigned int maxei, struct cpudata *c
}
}
- decode_feature_flags (cpu, edx);
+ decode_feature_flags (cpu, edx, 0);
printf ("TLB & L1 Cache info\n");
if (maxi >= 2 && show_cacheinfo) {
diff --git a/IDT/identify.c b/IDT/identify.c
index 4065b5e..2433da7 100644
--- a/IDT/identify.c
+++ b/IDT/identify.c
@@ -1,5 +1,5 @@
/*
- * $Id: identify.c,v 1.14 2001/12/10 21:12:12 davej Exp $
+ * $Id: identify.c,v 1.15 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info.
* (C) 2001 Dave Jones.
*
@@ -113,7 +113,7 @@ void decode_IDT_cacheinfo(unsigned int maxei, struct cpudata *cpu)
void display_IDT_info(unsigned int maxei, struct cpudata *cpu)
{
unsigned int i;
- unsigned long eax, ebx, ecx, edx;
+ unsigned long eax, ebx, ecx, edx, tmp=0;
get_model_name (maxei, cpu);
@@ -130,10 +130,10 @@ void display_IDT_info(unsigned int maxei, struct cpudata *cpu)
if (maxei == 0)
return;
- if (maxei >= 0x80000001) {
- cpuid (cpu->number, 0x80000001, &eax, &ebx, &ecx, &edx);
- decode_feature_flags (cpu, edx);
- }
+ cpuid (cpu->number, 0x00000001, &eax, &ebx, &ecx, &tmp);
+ if (maxei >= 0x80000001)
+ cpuid (cpu->number, 0x80000001, &eax, &ebx, &ecx, &tmp);
+ decode_feature_flags (cpu, edx, tmp);
if (show_cacheinfo)
decode_IDT_cacheinfo(maxei, cpu);
diff --git a/Intel/identify.c b/Intel/identify.c
index 3c9cb88..a039190 100644
--- a/Intel/identify.c
+++ b/Intel/identify.c
@@ -1,5 +1,5 @@
/*
- * $Id: identify.c,v 1.11 2001/12/10 22:20:11 davej Exp $
+ * $Id: identify.c,v 1.12 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info.
* (C) 2001 Dave Jones.
*
@@ -384,7 +384,7 @@ void display_Intel_info (unsigned int maxi, struct cpudata *cpu)
get_model_name (eax, cpu);
cpuid (cpu->number, 0x00000001, &eax, &ebx, &ecx, &edx);
- decode_feature_flags (cpu, edx);
+ decode_feature_flags (cpu, edx, 0);
if (maxi >= 2 && show_cacheinfo) {
/* Decode TLB and cache info */
diff --git a/RiSE/identify.c b/RiSE/identify.c
index 6a5dce0..b9adb06 100644
--- a/RiSE/identify.c
+++ b/RiSE/identify.c
@@ -1,5 +1,5 @@
/*
- * $Id: identify.c,v 1.4 2001/12/10 21:12:12 davej Exp $
+ * $Id: identify.c,v 1.5 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info.
* (C) 2001 Dave Jones.
*
@@ -44,7 +44,7 @@ void Identify_RiSE (unsigned int maxi, struct cpudata *cpu)
void display_RiSE_info(unsigned int maxi, unsigned int maxei, struct cpudata *cpu)
{
unsigned int i;
- unsigned long eax, ebx, ecx, edx;
+ unsigned long eax, ebx, ecx, edx, tmp=0;
get_model_name (maxei, cpu);
@@ -67,10 +67,7 @@ void display_RiSE_info(unsigned int maxi, unsigned int maxei, struct cpudata *cp
}
cpuid (cpu->number, 0x00000001, &eax, &ebx, &ecx, &edx);
- decode_feature_flags (cpu, edx);
-
- if (maxei >= 0x80000001) {
- cpuid (cpu->number, 0x80000001, &eax, &ebx, &ecx, &edx);
- decode_feature_flags (cpu, edx);
- }
+ if (maxei >= 0x80000001)
+ cpuid (cpu->number, 0x80000001, &eax, &ebx, &ecx, &tmp);
+ decode_feature_flags (cpu, edx, tmp);
}
diff --git a/TODO b/TODO
index 5bcedec..969632c 100644
--- a/TODO
+++ b/TODO
@@ -13,9 +13,6 @@
"Stepping D0 Duron detected with Cache size bug.
You should upgrade your kernel to work around this bug"
-- Flags code needs an update. It was taken from the
- kernel before hpa cleaned it up.
-
- --gcc option to output best optimisation parameters
for that CPU.
diff --git a/features.c b/features.c
index 59a5f64..2c84cd6 100644
--- a/features.c
+++ b/features.c
@@ -1,88 +1,88 @@
/*
- * $Id: features.c,v 1.8 2001/12/10 17:52:15 davej Exp $
+ * $Id: features.c,v 1.9 2001/12/10 22:53:32 davej Exp $
* This file is part of x86info
* (C) 2001 Dave Jones.
*
* Licensed under the terms of the GNU GPL License version 2.
*
- * Feature flag decoding.
- * Modified from a routine in Linux kernel 2.4.0test3 by Jauder Ho <jauderho@carumba.com>
- * FIXME: Update to latest code from 2.4 kernel.
+ * Feature flag decoding.
*/
#include <stdio.h>
#include "x86info.h"
-void decode_feature_flags (struct cpudata *cpu, int flags)
+void decode_feature_flags (struct cpudata *cpu, int flags, int eflags)
{
- /*
- * Flags should be entered into the array ONLY if there is no overlap.
- * Else a number should be used and then overridden in the case
- * statement below. --Jauder <jauderho@carumba.com>
- *
- * NOTE: bits 10, 19-22, 26-31 are reserved.
- *
- * Data courtesy of http://www.sandpile.org/arch/cpuid.htm
- * Thanks to the Greasel!
- */
- static char *cap_flags[] = {
+ const char *generic_cap_flags[] = {
"fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
"cx8", "apic", "10", "sep", "mtrr", "pge", "mca", "cmov",
- "16", "pse36", "psn", "19", "20", "21", "22", "mmx",
- "24", "xmm", "26", "27", "28", "29", "30", "31"
+ "pat", "pse36", "psn", "clflsh", "20", "dtes", "acpi", "mmx",
+ "fxsr", "xmm", "xmm2", "selfsnoop", "ht", "acc", "ia64", "31"
};
+ const char *amd_cap_flags[] = {
+ "0", "1", "2", "3", "4", "5", "6", "7",
+ "8", "9", "10", "syscall", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20", "21", "mmxext", "23",
+ "24", "25", "26", "27", "28", "lm", "3dnow!ext", "3dnow!"
+ };
+ const char *centaur_cap_flags[] = {
+ "0", "1", "2", "3", "4", "5", "6", "7",
+ "8", "9", "10", "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20", "21", "22", "23",
+ "24", "25", "26", "27", "28", "lm", "3dnow!ext", "3dnow!"
+ };
+ const char *transmeta_cap_flags[] = {
+ "recovery", "longrun", "2", "lrti", "4", "5", "6", "7",
+ "8", "9", "10", "11", "12", "13", "14", "15",
+ "16", "17", "18", "19", "20", "21", "22", "23",
+ "24", "25", "26", "27", "28", "29", "30", "31"
+ };
+
int i;
if (show_flags == 0)
return;
printf ("Feature flags:\n");
- /* Modify the capabilities according to chip type */
- switch (cpu->vendor) {
+ for (i = 0; i < 32; i++)
+ if (flags & (1 << i))
+ printf (" %s", generic_cap_flags[i]);
- case VENDOR_CYRIX:
- cap_flags[24] = "cxmmx";
- break;
+ printf ("\n");
- case VENDOR_AMD:
- if (cpu->family == 5 && cpu->model == 6)
- cap_flags[10] = "sep";
- if (cpu->family < 6)
- cap_flags[16] = "fcmov";
- cap_flags[16] = "pat";
- cap_flags[22] = "mmxext";
- cap_flags[24] = "fxsr";
- if (cpu->family >=6 && cpu->model >= 6)
- cap_flags[25] = "sse";
- cap_flags[30] = "3dnowext";
- cap_flags[31] = "3dnow";
- break;
+ /* Vendor specific extensions. */
+ switch (cpu->vendor) {
- case VENDOR_INTEL:
- cap_flags[16] = "pat";
- cap_flags[18] = "pn";
- cap_flags[24] = "fxsr";
- cap_flags[25] = "sse";
- cap_flags[26] = "sse2";
- cap_flags[27] = "ss";
- cap_flags[29] = "tm";
- cap_flags[30] = "ia64";
- break;
+ case VENDOR_AMD:
+ printf ("Extended feature flags:\n");
+ for (i = 0; i < 32; i++) {
+ if (eflags & (1 << i))
+ printf (" %s", amd_cap_flags[i]);
+ }
+ break;
- case VENDOR_CENTAUR:
- if ((cpu->family==5 && cpu->model >= 8) || /* Only Winchip2 and above */
- (cpu->family==6)) /* VIA Cyrix III family */
- cap_flags[31] = "3dnow";
- break;
+ case VENDOR_CENTAUR:
+ printf ("Extended feature flags:\n");
+ for (i = 0; i < 32; i++) {
+ if (eflags & (1 << i))
+ printf (" %s", centaur_cap_flags[i]);
+ }
+ break;
- default:
- /* Unknown CPU manufacturer or no special handling needed */
- break;
- }
+ case VENDOR_TRANSMETA:
+ printf ("Extended feature flags:\n");
+ for (i = 0; i < 32; i++) {
+ if (eflags & (1 << i))
+ printf (" %s", transmeta_cap_flags[i]);
+ }
+ break;
- for (i = 0; i < 32; i++)
- if (flags & (1 << i))
- printf (" %s", cap_flags[i]);
+ case VENDOR_CYRIX:
+ case VENDOR_INTEL:
+ default:
+ /* Unknown CPU manufacturer or no special handling needed */
+ break;
+ }
printf ("\n\n");
}
diff --git a/x86info.h b/x86info.h
index 8fba4b1..3b783cb 100644
--- a/x86info.h
+++ b/x86info.h
@@ -19,6 +19,7 @@ typedef __u32 u32;
#define VENDOR_CYRIX 3
#define VENDOR_INTEL 4
#define VENDOR_RISE 5
+#define VENDOR_TRANSMETA 6
struct cpudata {
unsigned int number;
@@ -50,7 +51,7 @@ void display_IDT_info(unsigned int maxei, struct cpudata *cpu);
void display_Intel_info(unsigned int maxi, struct cpudata *cpu);
void display_RiSE_info(unsigned int maxi, unsigned int maxei, struct cpudata *cpu);
-void decode_feature_flags (struct cpudata *cpu, int flags);
+void decode_feature_flags (struct cpudata *cpu, int flags, int eflags);
void identify (struct cpudata *cpu);
void dumpregs (int cpunum);