lkml.org 
[lkml]   [1998]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPrePATCH 02: AMD K6/K6-2 CPU recognition
This patch adds the extended functions available in the K6/K6-2 procs.
Detects 3DNow! and more. Only tested on a K6-2 300. Use at your own
risk ;)
There are some weird things that I have emailed AMD on, such as CPUID 1
reports
the cpu as a 586, but CPUID 80000002 reports the cpu as a 686.
This is diffed against 2.0.34 with the previous patch installed.
http://www.nb.net/~rob

I will be upgrading to 2.0.35 soon and also begin developement on 2.1.x.
This will be the last patch for 2.0.34 ;)

/proc/cpuinfo:
processor : 0
cpu : 586
model : K6-2 (model 8)
vendor_id : AuthenticAMD
stepping : unknown
fdiv_bug : no
hlt_bug : no
f00f_bug : no
fpu : yes
fpu_exception : yes
cpuid : yes
wp : yes
flags : fpu vme de pse tsc msr mce cx8 mmx
bogomips : 599.65
cpu: : 686
model : K5 (model 0)
processor name : AMD-own
stepping : 0
fpu vme de pse tsc msr mce cx8 SYSCALL+SYSRET mmx 3DNow!



--- setup.c Sat Jul 11 03:41:27 1998
+++ /usr/src/linux/arch/i386/kernel/setup.c Thu Jul 16 00:25:44 1998
@@ -40,12 +40,18 @@
char x86 = 0; /* set by kernel/head.S to 3..6 */
char x86_model = 0; /* set by kernel/head.S */
char x86_mask = 0; /* set by kernel/head.S */
+char efunc_family = 0;
+char efunc_model = 0;
+char efunc_mask = 0;
+int efunc_cap = 0;
+int ifamd = 0;
int x86_capability = 0; /* set by kernel/head.S */
int fdiv_bug = 0; /* set if Pentium(TM) with FP bug */
int pentium_f00f_bug = 0; /* set if Pentium(TM) with F00F bug */
int have_cpuid = 0; /* set if CPUID instruction works */

char x86_vendor_id[13] = "unknown";
+char efunc_proc_name[48]="unknown";

unsigned char Cx86_step = 0;
static const char *Cx86_type[] = {
@@ -239,8 +245,10 @@
"unknown (model 4)", "unknown (model 5)",
"K6 (model 6)", "K6 (model 7)", "K6-2 (model 8)", "K6-2
(model 9)"
};
- if (nr < sizeof(model)/sizeof(char *))
+ if (nr < sizeof(model)/sizeof(char *)) {
+ ifamd = 1;
return model[nr];
+ }
return NULL;

}
@@ -336,6 +344,13 @@
"16", "17", "18", "19", "20", "21", "22", "mmx",
"24", "25", "26", "27", "28", "29", "30", "31"
};
+
+ static const char *efunc_cap_flags[]= {
+ "fpu", "vme", "de", "pse", "tsc", "msr", "6", "mce",
+ "cx8", "9", "10", "SYSCALL+SYSRET", "12", "gpe", "14",
+ "cmov", "fpcmov", "17", "18", "19", "20", "21", "22",
"mmx",
+ "24", "25", "26", "27", "28", "29", "30", "3DNow!"
+ };

#ifdef __SMP__
int n;
@@ -409,6 +424,26 @@
"\nbogomips\t: %lu.%02lu\n",
CD(loops_per_sec+2500)/500000,
(CD(loops_per_sec+2500)/5000) %
100);
+
+ if (ifamd) {
+ len += sprintf(buffer+len,
+ "cpu:\t\t: %c86\n"
+ "model\t\t: %s\n"
+ "processor name\t: %s\n"
+ "stepping\t: %d\n",
+ CD(efunc_family)+'0',
+ getmodel(CD(efunc_family),
CD(efunc_model)),
+ CD(efunc_proc_name),
+ CD(efunc_mask));
+
+ for ( i = 0 ; i < 32 ; i++ ) {
+ if ( CD(efunc_cap) & (1 << i) ) {
+ len += sprintf(buffer+len, "
%s",
+
efunc_cap_flags[i]);
+ }
+ }
+ }
+
#ifdef __SMP__
}
}
--- head.S Wed Jun 3 17:17:46 1998
+++ /usr/src/linux/arch/i386/kernel/head.S Thu Jul 16 00:14:38 1998
@@ -164,6 +164,30 @@
movl %edx,SYMBOL_NAME(x86_vendor_id)+4 # next 4 chars
movl %ecx,SYMBOL_NAME(x86_vendor_id)+8 # last 4 chars

+ movl $0x80000000h, %eax
+ cpuid
+ movl $0x80000001h, %eax
+ cpuid
+ movb %al, %cl
+ andb $0x0f,%ah
+ movb %ah,SYMBOL_NAME(efunc_family)
+ andb $0x0f, %al
+ shrb $4, %al
+ movb %al,SYMBOL_NAME(efunc_model)
+ andb $0x0f,%cl
+ movb %cl,SYMBOL_NAME(efunc_mask)
+ movl %edx,SYMBOL_NAME(efunc_cap)
+
+ movl $0x80000002,%eax
+ cpuid
+ movl %eax,SYMBOL_NAME(efunc_proc_name)
+ movl %ebx,SYMBOL_NAME(efunc_proc_name)+12
+ movl %ecx,SYMBOL_NAME(efunc_proc_name)+24
+ movl %edx,SYMBOL_NAME(efunc_proc_name)+36
+
+ movl $1, %eax
+ cpuid
+
movl %cr0,%eax # 486+
andl $0x80000011,%eax # Save PG,PE,ET
orl $0x50022,%eax # set AM, WP, NE and MP
--
Robert Dale

"arrest this man he talks in maths"
RADIOHEAD OK COMPUTER

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

\
 
 \ /
  Last update: 2005-03-22 13:43    [from the cache]
©2003-2011 Jasper Spaans