[PATCH] cpu detection fixes for test10-pre4

From: Mikael Pettersson (mikpe@csd.uu.se)
Date: Thu Oct 19 2000 - 13:36:37 EST


This patch should fix the Pentium IV and other CPU detection
glitches which remain in test10-pre4.

The necessary fixes are:
* arch/i386/kernel/setup.c:
  - (Pentium IV) don't goto name_decoded, return instead; otherwise
    x86_model_id which was grabbed from the extended cpuid levels
    will be overwritten by the final sprintf
  - print cpu family as integer not char in /proc/cpuinfo (since
    Pentium IV's family code 15 won't fit in a char)
* include/asm-i386/elf.h:
  - make Pentium IV and other post-P6 processors use the "i686"
    family name (same fix as the system_utsname.machine init fix
    which went into include/asm-i386/bugs.h in test10-pre4)

The following two fixes are desirable but not strictly necessary:
* arch/i386/kernel/microcode.c:
  - accept _only_ Intel P6, not P6-or-later
* include/asm-i386/bugs.h:
  - the check for K6 B-step chips is missing a family==5 test

/Mikael

--- linux-2.4.0-test10-pre4/arch/i386/kernel/microcode.c.~1~ Sat Sep 9 12:49:37 2000
+++ linux-2.4.0-test10-pre4/arch/i386/kernel/microcode.c Thu Oct 19 13:19:31 2000
@@ -177,7 +177,7 @@
 
         req->err = 1; /* assume the worst */
 
- if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6){
+ if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6){
                 printk(KERN_ERR "microcode: CPU%d not an Intel P6\n", cpu_num);
                 return;
         }
--- linux-2.4.0-test10-pre4/arch/i386/kernel/setup.c.~1~ Thu Oct 19 13:06:18 2000
+++ linux-2.4.0-test10-pre4/arch/i386/kernel/setup.c Thu Oct 19 13:21:16 2000
@@ -1549,7 +1549,7 @@
                         /* Pentium IV. */
                         if (c->x86 == 15) {
                                 get_model_name(c);
- goto name_decoded;
+ return;
                         }
 
                         /* Names for the Pentium II/Celeron processors
@@ -1688,12 +1688,12 @@
 #endif
                 p += sprintf(p,"processor\t: %d\n"
                         "vendor_id\t: %s\n"
- "cpu family\t: %c\n"
+ "cpu family\t: %d\n"
                         "model\t\t: %d\n"
                         "model name\t: %s\n",
                         n,
                         c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown",
- c->x86 + '0',
+ c->x86,
                         c->x86_model,
                         c->x86_model_id[0] ? c->x86_model_id : "unknown");
 
--- linux-2.4.0-test10-pre4/include/asm-i386/bugs.h.~1~ Thu Oct 19 13:06:25 2000
+++ linux-2.4.0-test10-pre4/include/asm-i386/bugs.h Thu Oct 19 13:19:31 2000
@@ -166,6 +166,7 @@
 static void __init check_amd_k6(void)
 {
         if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD &&
+ boot_cpu_data.x86 == 5 &&
             boot_cpu_data.x86_model == 6 &&
             boot_cpu_data.x86_mask == 1)
         {
--- linux-2.4.0-test10-pre4/include/asm-i386/elf.h.~1~ Fri Jul 14 18:22:10 2000
+++ linux-2.4.0-test10-pre4/include/asm-i386/elf.h Thu Oct 19 13:19:31 2000
@@ -93,7 +93,7 @@
    For the moment, we have only optimizations for the Intel generations,
    but that could change... */
 
-#define ELF_PLATFORM ("i386\0i486\0i586\0i686"+((boot_cpu_data.x86-3)*5))
+#define ELF_PLATFORM ("i386\0i486\0i586\0i686"+(((boot_cpu_data.x86>6?6:boot_cpu_data.x86)-3)*5))
 
 #ifdef __KERNEL__
 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:15 EST