From owner-freebsd-bugs Wed Nov 18 16:20:01 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA09197 for freebsd-bugs-outgoing; Wed, 18 Nov 1998 16:20:01 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA09183 for ; Wed, 18 Nov 1998 16:19:57 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.8/8.8.5) id QAA22290; Wed, 18 Nov 1998 16:20:01 -0800 (PST) Received: from ns.issei.org (ns.issei.org [210.169.187.130]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA07467 for ; Wed, 18 Nov 1998 16:11:28 -0800 (PST) (envelope-from issei@issei.org) Received: from sandra.issei.org (sandra.issei.org [210.169.187.134]) by ns.issei.org (8.9.1a/3.7W-hub) with ESMTP id JAA03400 for ; Thu, 19 Nov 1998 09:10:58 +0900 (JST) Received: by sandra.issei.org (8.8.8/3.7W-null) id JAA23205; Thu, 19 Nov 1998 09:10:58 +0900 (JST) Message-Id: <199811190010.JAA23205@sandra.issei.org> Date: Thu, 19 Nov 1998 09:10:58 +0900 (JST) From: issei@jp.FreeBSD.ORG To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/8751: Cannot display new CPU name correctly. Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 8751 >Category: kern >Synopsis: Cannot display new CPU name correctly. >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Nov 18 16:20:00 PST 1998 >Last-Modified: >Originator: Issei Suzuki >Organization: Personal >Release: FreeBSD 2.2.7-STABLE i386 >Environment: >Description: FreeBSD cannot display Intel's new CPU name correctly on boot time. >How-To-Repeat: This is the boot time message when I use Celeron CPU. CPU: Unknown 80686 (300.68-MHz 686-class CPU) Origin = "GenuineIntel" Id = 0x660 Stepping=0 Features=0x183f9ff,,MMX,> FreeBSD displays CPU name as 'Unknown 80686' instead of 'Celeron' >Fix: Apply the following patch to /sys/i386/i386/identcpu.c See also Intel's Application note AP-485 "Intel Processor Identification and the CPUID Instruction" http://developer.intel.com/design/pro/applnots/241618.HTM --- 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; } >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message