[PATCH] K6-2 Write allocate bug.

Dave Jones (davej@suse.de)
Mon, 19 Nov 2001 14:17:48 +0100 (CET)


Linus,
Patch below reformats some ugly compound ifs, and in the process
fixes up a bug where we end up poking the WHCR in old-style and new-style
on some K6-2's (Due to a missing (c->x86_mask>7) (See 2nd hunk of patch).

regards,

Dave.

diff -urN --exclude-from=/home/davej/.exclude linux-2.4.15-pre5/arch/i386/kernel/setup.c linux-2.4.15-pre5-dj/arch/i386/kernel/setup.c
--- linux-2.4.15-pre5/arch/i386/kernel/setup.c Mon Nov 19 12:08:00 2001
+++ linux-2.4.15-pre5-dj/arch/i386/kernel/setup.c Mon Nov 19 12:22:26 2001
@@ -1233,13 +1233,12 @@
}

/* K6 with old style WHCR */
- if( c->x86_model < 8 ||
- (c->x86_model== 8 && c->x86_mask < 8))
- {
+ if (c->x86_model < 8 ||
+ (c->x86_model== 8 && c->x86_mask < 8)) {
/* We can only write allocate on the low 508Mb */
if(mbytes>508)
mbytes=508;
-
+
rdmsr(MSR_K6_WHCR, l, h);
if ((l&0x0000FFFF)==0) {
unsigned long flags;
@@ -1250,14 +1249,14 @@
local_irq_restore(flags);
printk(KERN_INFO "Enabling old style K6 write allocation for %d Mb\n",
mbytes);
-
}
break;
}
- if (c->x86_model == 8 || c->x86_model == 9 || c->x86_model == 13)
- {
+
+ if ((c->x86_model == 8 && c->x86_mask >7) ||
+ c->x86_model == 9 || c->x86_model == 13) {
/* The more serious chips .. */
-
+
if(mbytes>4092)
mbytes=4092;

@@ -1274,10 +1273,8 @@
}

/* Set MTRR capability flag if appropriate */
- if ( (c->x86_model == 13) ||
- (c->x86_model == 9) ||
- ((c->x86_model == 8) &&
- (c->x86_mask >= 8)) )
+ if (c->x86_model == 13 || c->x86_model == 9 ||
+ (c->x86_model == 8 && c->x86_mask >= 8))
set_bit(X86_FEATURE_K6_MTRR, &c->x86_capability);
break;
}

-- 
| Dave Jones.        http://www.codemonkey.org.uk
| SuSE Labs

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/