From owner-FreeBSD-users-jp@jp.freebsd.org  Sat Sep 12 13:00:31 1998
Received: (from daemon@localhost)
	by jaz.jp.freebsd.org (8.9.1+3.0W/8.7.3) id NAA22929;
	Sat, 12 Sep 1998 13:00:31 +0900 (JST)
	(envelope-from owner-FreeBSD-users-jp@jp.FreeBSD.org)
Received: from ns.mikage.t-cnet.or.jp (ns.mikage.t-cnet.or.jp [210.169.187.130])
	by jaz.jp.freebsd.org (8.9.1+3.0W/8.7.3) with ESMTP id NAA22916
	for <FreeBSD-users-jp@jp.freebsd.org>; Sat, 12 Sep 1998 13:00:28 +0900 (JST)
	(envelope-from issei@mikage.t-cnet.or.jp)
Received: from localhost ([210.169.187.134])
	by ns.mikage.t-cnet.or.jp (8.9.1a+IPv6/3.7W) with ESMTP/IPv4 id NAA23811
	for <FreeBSD-users-jp@jp.freebsd.org>; Sat, 12 Sep 1998 13:00:27 +0900 (JST)
To: FreeBSD-users-jp@jp.freebsd.org
X-PGP-Fingerprint: 29 5E 86 48 44 CC 38 9C  72 82 D5 83 B6 FD 03 B1
Mime-Version: 1.0
X-Mailer: Mew version 1.93 on XEmacs 20.4 (Emerald)
Content-Type: Multipart/Mixed;
	boundary="--Next_Part(Sat_Sep_12_13:00:11_1998_41)--"
Content-Transfer-Encoding: 7bit
Message-Id: <19980912130027C.issei@mikage.t-cnet.or.jp>
Date: Sat, 12 Sep 1998 13:00:27 +0900
From: Issei Suzuki <issei@mikage.t-cnet.or.jp>
X-Dispatcher: imput version 980905(IM100)
Lines: 124
Reply-To: FreeBSD-users-jp@jp.freebsd.org
Precedence: bulk
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+980820
X-Sequence: FreeBSD-users-jp 32824
Subject: [FreeBSD-users-jp 32824] Celeron identification
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

----Next_Part(Sat_Sep_12_13:00:11_1998_41)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$BNkLZ0l@8!w>p9)(B.$BEl9)Bg(B $B$G$9!#(B

  FreeBSD-stable $B$G(B kernel $B$,(B Celeron $B$rG'<1$G$-$k(B ($B5/F0;~$K(B CPU: $B$H$7$F(B
Unknown 80686 $B$G$O$J$/(B Celeron $B$HI=<($9$k(B) $B$h$&$K$7$F$_$^$7$?!#<j85$K$"(B
$B$k(B Celeron 300A $B$G$7$+;n$7$F$^$;$s$,!"(B

> CPU: Celeron (L2 128KB) (451.02-MHz 686-class CPU)
>   Origin = "GenuineIntel"  Id = 0x660  Stepping=0

$B$HI=<($G$-$F$^$9!#$$$A$*$&%G!<%?%7!<%H8+$J$,$i(B

  Celeron
  Celeron L2 $B%-%c%C%7%eIU$-(B
  Pentium II / Pentium II Xeon L2 $B%-%c%C%7%e(B 512KB
  Pentium II Xeon L2 $B%-%c%C%7%e(B 1MB
  Pentium II Xeon L2 $B%-%c%C%7%e(B 2MB

$B$r<1JL$G$-$k$h$&$K:n$C$?$D$b$j!#(B


  FreeBSD-stable $B$N(B /sys/i386/i386/identcpu.c $B$X$N:9J,$K$J$C$F$^$9$N$G!"(B
$BE:IU$N%U%!%$%k$r(B identcpu.c.diff $B$H$$$&%U%!%$%kL>$GJ]B8$7$F(B

# patch -d /sys < identcpu.c.diff

$B$H$7$F%Q%C%A$rEv$F$?8e$K%+!<%M%k$r:F9=C[$7$F$/$@$5$$!#(B

-- 
Issei Suzuki <issei@mikage.t-cnet.or.jp>

----Next_Part(Sat_Sep_12_13:00:11_1998_41)--
Content-Type: Text/Plain; charset=us-ascii
Content-Description: identcpu.c.diff
Content-Disposition: attachment; filename=identcpu.c.diff
Content-Transfer-Encoding: 7bit

--- i386/i386/identcpu.c.old	Sat Sep 12 09:54:28 1998
+++ i386/i386/identcpu.c	Sat Sep 12 12:22:20 1998
@@ -71,6 +71,7 @@
 static void print_AMD_info(void);
 static void print_AMD_assoc(int i);
 static void do_cpuid(u_long ax, u_long *p);
+static int get_L2cache(void);
 
 u_long	cyrix_did;		/* Device ID of Cyrix CPU */
 int cpu_class = CPUCLASS_386;	/* least common denominator */
@@ -196,8 +197,33 @@
 					cpu = CPU_PII;
 					break;
 				case 0x50:
-				        strcat(cpu_model, "Pentium II (quarter-micron)");
-					cpu = CPU_PII;
+				case 0x60:
+					/* Ident Celeron and Pentium II */
+					switch (get_L2cache()) {
+					case 0:
+						strcat(cpu_model, "Celeron");
+						break;
+					case 128:
+						strcat(cpu_model, "Celeron (L2 128KB)");
+						break;
+					case 512:
+						strcat(cpu_model, "Pentium II (quarter-micron) / Pentium II Xeon (L2 512KB)");
+						cpu = CPU_PII;
+						break;
+					case 1024:
+						strcat(cpu_model, "Pentium II Xeon (L2 1MB)");
+						cpu = CPU_PII;
+						break;
+					case 2048:
+						strcat(cpu_model, "Pentium II Xeon (L2 2MB)");
+						cpu = CPU_PII;
+						break;
+
+					case -1:
+					default:
+				        	strcat(cpu_model, "Unknown 80686");
+						break;
+					}
 					break;
 				default:
 				        strcat(cpu_model, "Unknown 80686");
@@ -829,4 +855,35 @@
 		printf(", %d lines/tag", (regs[3] >> 8) & 0xff);
 		print_AMD_assoc((regs[3] >> 16) & 0xff);
 	}
+}
+
+/* check the amount of L2 cache */
+static int
+get_L2cache(void)
+{
+	int i, j;
+	u_long regs[4];
+	do_cpuid(2, regs);
+
+	for (i=0; i<4; i++)
+		for (j=0; j<4; j++)
+			switch ((regs[i] >> j*8) & 0xff) {
+			case 0x40:
+				return 0;
+			case 0x41:
+				return 128;
+			case 0x42:
+				return 256;
+			case 0x43:
+				return 512;
+			case 0x44:
+				return 1024;
+			case 0x45:
+				return 2048;
+			default:
+			        /* nothing */
+				break;
+			}
+
+	return -1;
 }

----Next_Part(Sat_Sep_12_13:00:11_1998_41)----
