Here's a patch which should improve Pentium IV support in test10-pre.

The test10-pre3 patch detects Pentium IV (family code 15) but resets
boot_cpu_data.x86 to 6 in this case.

The advantage of doing this is that the places in the kernel which
construct cpu family names (i386 .. i686) still work: the Pentium IV
will be announced as an i686. (Inaccurate, but who cares? These
names are meaningless anyway. Why should a K7 be i686?)

The BIG disadvantage is that low-level cpu-specific drivers break if
boot_cpu_data.x86 doesn't equal the family code returned by CPUID.

The patch contains the following fixes/changes:
* arch/i386/kernel/microcode.c:
  - make check for Intel P6 family be strict
* arch/i386/kernel/setup.c:
  - (Pentium IV) remove broken "c->x86 = 6;" assignment, so c->x86
    remains == 15
  - (Pentium IV) don't goto name_decoded, return instead; otherwise
    the name grabbed from the extended cpuid levels will be clobbered
  - print cpu family as integer not char in /proc/cpuinfo
* include/asm-i386/bugs.h:
  - the test for K6 B-step chips was missing a test for family==5
  - init of system_utsname.machine maps family codes > 6 to 6;
    if anyone can suggest a better naming scheme for newer cpus
    like P4 and the Itanium's embedded PentiumIII let me know.
* include/asm-i386/elf.h:
  - same fix as in the system_utsname.machine init code

Alan wrote:
> What about the other proc stuff. This will report a 1586, type 15 cpu and

2.2? I looked carefully through 2.4 and fixed all places I found where
"1586" or "?86" ('?' == '0'+15) could have been constructed.
setup.c's print_cpu_info() is safe since x86_model_id was set from the
extended cpuid levels data.


/Mikael


--- linux-2.4.0-test10-pre3/arch/i386/kernel/microcode.c.~1~    Sat Sep  9 12:49:37 
2000
+++ linux-2.4.0-test10-pre3/arch/i386/kernel/microcode.c        Tue Oct 17 20:18:07 
+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-pre3/arch/i386/kernel/setup.c.~1~        Mon Oct 16 17:29:05 
2000
+++ linux-2.4.0-test10-pre3/arch/i386/kernel/setup.c    Wed Oct 18 22:36:26 2000
@@ -1548,9 +1548,8 @@
 
                        /* Pentium IV. */
                        if (c->x86 == 15) {
-                               c->x86 = 6;
                                get_model_name(c);
-                               goto name_decoded;
+                               return;
                        }
 
                        /* Names for the Pentium II/Celeron processors 
@@ -1689,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-pre3/include/asm-i386/bugs.h.~1~ Sat Sep  9 12:49:40 2000
+++ linux-2.4.0-test10-pre3/include/asm-i386/bugs.h     Wed Oct 18 22:22:19 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)
        {
@@ -426,5 +427,5 @@
        check_pentium_f00f();
 #endif
        check_cyrix_coma();
-       system_utsname.machine[1] = '0' + boot_cpu_data.x86;
+       system_utsname.machine[1] = '0' + (boot_cpu_data.x86 > 6 ? 6 : 
+boot_cpu_data.x86);
 }
--- linux-2.4.0-test10-pre3/include/asm-i386/elf.h.~1~  Fri Jul 14 18:22:10 2000
+++ linux-2.4.0-test10-pre3/include/asm-i386/elf.h      Wed Oct 18 22:17:06 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 [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to