patch-2.2.8 linux/arch/i386/kernel/setup.c

Next file: linux/arch/i386/kernel/smp.c
Previous file: linux/arch/i386/kernel/process.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
@@ -5,6 +5,10 @@
  *
  *  Enhanced CPU type detection by Mike Jagdis, Patrick St. Jean
  *  and Martin Mares, November 1997.
+ *
+ *  Force Cyrix 6x86(MX) and M II processors to report MTRR capability
+ *  and fix against Cyrix "coma bug" by
+ *      Zoltan Boszormenyi <zboszor@mol.hu> February 1999.
  */
 
 /*
@@ -39,6 +43,7 @@
 #include <asm/io.h>
 #include <asm/smp.h>
 #include <asm/cobalt.h>
+#include <asm/msr.h>
 
 /*
  * Machine setup..
@@ -57,6 +62,7 @@
 unsigned int machine_id = 0;
 unsigned int machine_submodel_id = 0;
 unsigned int BIOS_revision = 0;
+unsigned int mca_pentium_flag = 0;
 
 /*
  * Setup options
@@ -244,11 +250,6 @@
 	unsigned long memory_start, memory_end;
 	char c = ' ', *to = command_line, *from = COMMAND_LINE;
 	int len = 0;
-	static unsigned char smptrap=0;
-
-	if (smptrap)
-		return;
-	smptrap=1;
 
 #ifdef CONFIG_VISWS
 	visws_get_board_type_and_rev();
@@ -381,16 +382,6 @@
 
 }
 
-#define rdmsr(msr,val1,val2) \
-       __asm__ __volatile__("rdmsr" \
-			    : "=a" (val1), "=d" (val2) \
-			    : "c" (msr))
-
-#define wrmsr(msr,val1,val2) \
-     __asm__ __volatile__("wrmsr" \
-			  : /* no outputs */ \
-			  : "c" (msr), "a" (val1), "d" (val2))
-
 __initfunc(static int get_model_name(struct cpuinfo_x86 *c))
 {
 	unsigned int n, dummy, *v;
@@ -408,6 +399,14 @@
 	cpuid(0x80000003, &v[4], &v[5], &v[6], &v[7]);
 	cpuid(0x80000004, &v[8], &v[9], &v[10], &v[11]);
 	c->x86_model_id[48] = 0;
+	/*  Set MTRR capability flag if appropriate  */
+	if(boot_cpu_data.x86 !=5)
+		return 1;
+	if((boot_cpu_data.x86_model == 9) ||
+	   ((boot_cpu_data.x86_model == 8) && 
+	    (boot_cpu_data.x86_mask >= 8)))
+		c->x86_capability |= X86_FEATURE_MTRR;
+
 	return 1;
 }
 
@@ -587,6 +586,10 @@
 			(c->x86_model)++;
 		} else             /* 686 */
 			p = Cx86_cb+1;
+		/* Emulate MTRRs using Cyrix's ARRs. */
+		c->x86_capability |= X86_FEATURE_MTRR;
+		/* 6x86's contain this bug */
+		c->coma_bug = 1;
 		break;
 
 	case 4: /* MediaGX/GXm */
@@ -611,11 +614,14 @@
 
         case 5: /* 6x86MX/M II */
 		if (dir1 > 7) dir0_msn++;  /* M II */
+		else c->coma_bug = 1;      /* 6x86MX, it has the bug. */
 		tmp = (!(dir0_lsn & 7) || dir0_lsn & 1) ? 2 : 0;
 		Cx86_cb[tmp] = cyrix_model_mult2[dir0_lsn & 7];
 		p = Cx86_cb+tmp;
         	if (((dir1 & 0x0f) > 4) || ((dir1 & 0xf0) == 0x20))
 			(c->x86_model)++;
+		/* Emulate MTRRs using Cyrix's ARRs. */
+		c->x86_capability |= X86_FEATURE_MTRR;
 		break;
 
 	case 0xf:  /* Cyrix 486 without DEVID registers */
@@ -869,7 +875,7 @@
 	int sep_bug;
 	static char *x86_cap_flags[] = {
 	        "fpu", "vme", "de", "pse", "tsc", "msr", "6", "mce",
-	        "cx8", "9", "10", "sep", "12", "pge", "14", "cmov",
+	        "cx8", "9", "10", "sep", "mtrr", "pge", "14", "cmov",
 	        "16", "17", "psn", "19", "20", "21", "22", "mmx",
 	        "24", "kni", "26", "27", "28", "29", "30", "31"
 	};
@@ -917,7 +923,6 @@
 		} else if (c->x86_vendor == X86_VENDOR_INTEL) {
 			x86_cap_flags[6] = "pae";
 			x86_cap_flags[9] = "apic";
-			x86_cap_flags[12] = "mtrr";
 			x86_cap_flags[14] = "mca";
 			x86_cap_flags[16] = "pat";
 			x86_cap_flags[17] = "pse36";
@@ -936,6 +941,7 @@
 			        "hlt_bug\t\t: %s\n"
 			        "sep_bug\t\t: %s\n"
 			        "f00f_bug\t: %s\n"
+			        "coma_bug\t: %s\n"
 			        "fpu\t\t: %s\n"
 			        "fpu_exception\t: %s\n"
 			        "cpuid level\t: %d\n"
@@ -945,6 +951,7 @@
 			     c->hlt_works_ok ? "no" : "yes",
 			     sep_bug ? "yes" : "no",
 			     c->f00f_bug ? "yes" : "no",
+			     c->coma_bug ? "yes" : "no",
 			     c->hard_math ? "yes" : "no",
 			     (c->hard_math && ignore_irq13) ? "yes" : "no",
 			     c->cpuid_level,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)