Subject: Re: port-i386/19290: Bad CPU identify
To: None <jordivvz@terra.es>
From: Bang Jun-Young <junyoung@netbsd.org>
List: netbsd-bugs
Date: 12/06/2002 15:06:16
On Thu, Dec 05, 2002 at 04:28:18AM -0800, jordivvz@terra.es wrote:
> cpu0: Intel Celeron (Mendocino) (686-class), 333.36 MHz
> cpu0: I-cache 16 KB 32b/line 4-way, D-cache 16 KB 32b/line 2-way
> cpu0: L2 cache 256 KB 32b/line 4-way

Hopefully the following patch will address the problem:

Index: machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/i386/i386/machdep.c,v
retrieving revision 1.502
diff -u -r1.502 machdep.c
--- machdep.c	2002/12/06 05:03:02	1.502
+++ machdep.c	2002/12/06 06:01:33
@@ -344,6 +344,8 @@
 static void via_cpu_probe __P((struct cpu_info *));
 static void amd_family6_probe __P((struct cpu_info *));
 
+static char *intel_family6_name __P((struct cpu_info *));
+
 static void transmeta_cpu_info __P((struct cpu_info *));
 static void amd_cpu_cacheinfo __P((struct cpu_info *));
 
@@ -1122,6 +1124,58 @@
 	}
 }
 
+char *
+intel_family6_name(struct cpu_info *ci)
+{
+	int model = CPUID2MODEL(ci->ci_signature);
+	char *ret = NULL;
+	u_int l2cache = ci->ci_cinfo[CAI_L2CACHE].cai_totalsize;
+
+	switch (model) {
+	case 5:
+		switch (l2cache) {
+		case 0:
+		case 128 * 1024:
+			ret = "Celeron (Covington)";
+			break;
+		case 256 * 1024:
+			ret = "Mobile Pentium II (Dixon)";
+			break;
+		case 512 * 1024:
+			ret = "Pentium II";
+			break;
+		case 1 * 1024 * 1024:
+		case 2 * 1024 * 1024:
+			ret = "Pentium II Xeon";
+			break;
+		}
+		break;
+	case 6:
+		switch (l2cache) {
+		case 256 * 1024:
+			ret = "Mobile Pentium II w/256 KB L2 cache";
+			break;
+		case 512 * 1024:
+			ret = "Mobile Pentium II w/512 KB L2 cache";
+			break;
+		}
+		break;
+	case 7:
+		switch (l2cache) {
+		case 512 * 1024:
+			ret = "Pentium III";
+			break;
+		case 1 * 1024 * 1024:
+		case 2 * 1024 * 1024:
+			ret = "Pentium III Xeon";
+			break;
+		}
+		break;
+	}
+
+	return (ret);
+}
+
 static void
 cpu_probe_base_features(struct cpu_info *ci)
 {
@@ -1780,6 +1834,12 @@
 			    model >= 8 && ci->ci_brand_id &&
 			    ci->ci_brand_id < 8)
 				brand = i386_intel_brand[ci->ci_brand_id];
+			if (vendor == CPUVENDOR_INTEL && family == 6 &&
+			    model >= 5 && model <= 7) {
+				char *family6_name = intel_family6_name(ci);
+				if (family6_name != NULL)
+					name = family6_name;
+			}
 			
 			if (vendor == CPUVENDOR_AMD && family == 6 &&
 			    model >= 6) {

Jun-Young

-- 
Bang Jun-Young <junyoung@netbsd.org>