From hula@hula.se  Fri Oct  3 10:58:37 2003
Return-Path: <hula@hula.se>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 5F4B116A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 10:58:37 -0700 (PDT)
Received: from thalamus.hula.se (as1-1-2.gp.g.bonet.se [194.236.112.6])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 7741443FF5
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 10:58:36 -0700 (PDT)
	(envelope-from hula@hula.se)
Received: from hula.se (as17-1-5.bi.s.bonet.se [217.215.178.50])
	by thalamus.hula.se (Postfix) with ESMTP id 536E030703
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 19:58:35 +0200 (CEST)
Message-Id: <350197AE-F5CB-11D7-B07F-000A959CEBC0@hula.se>
Date: Fri, 3 Oct 2003 19:58:34 +0200
From: Mikael Kullberg <hula@hula.se>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Adding VIA C3 capability printout in i386/identcpu.c

>Number:         57548
>Category:       i386
>Synopsis:       Adding VIA C3 capability printout in i386/identcpu.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    ceri
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 03 11:00:32 PDT 2003
>Closed-Date:    Sat Oct 04 09:15:39 PDT 2003
>Last-Modified:  Sat Oct 04 09:15:39 PDT 2003
>Originator:     Mikael Kullberg
>Release:        FreeBSD 5.1-RELEASE-p8 i386
>Organization:
Questate AB, Sweden
>Environment:
 System: FreeBSD putamen.hula.se 5.1-RELEASE-p8 FreeBSD 5.1-RELEASE-p8 
 #7:
 Thu Oct 2 15:26:22 CEST 2003 
 hula@putamen.hula.se:/usr/obj/usr/src/sys/HULA i386
 
>Description:

 CPU info reports VIA C3 unknown on boot. Also, the VIA specific features
 aren't listed
 
>How-To-Repeat:
 Boot a Nehemiah system
 
>Fix:
 
 Here's a patch that prints the information. It doesn't store it
 anywhere though, so you can't do any checks later to activate the
 VIA specific features. Anyone used to adding new variables to the
 kernel could perhaps give me some pointers on how to do that. I'm
 specifically working on getting the VIA RNG into /dev/random.
 
 *** /usr/src/sys/i386/i386/identcpu.c   Wed Apr 30 14:23:58 2003
 --- identcpu.c  Fri Oct  3 18:19:08 2003
 ***************
 *** 78,83 ****
 --- 78,84 ----
    static void identifycyrix(void);
    #if defined(I486_CPU) || defined(I586_CPU) || defined(I686_CPU)
    static void print_AMD_features(void);
 + static void print_C3_features(void);
    #endif
    static void print_AMD_info(void);
    static void print_AMD_assoc(int i);
 ***************
 *** 535,540 ****
 --- 536,544 ----
                  case 0x670:
                          strcpy(cpu_model, "VIA C3 Samuel 2");
                          break;
 +               case 0x690:
 +                       strcpy(cpu_model, "VIA C3 Nehemiah");
 +                       break;
                  default:
                          strcpy(cpu_model, "VIA/IDT Unknown");
                  }
 ***************
 *** 664,669 ****
 --- 668,676 ----
                  if (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
                      cpu_exthigh >= 0x80000001)
                          print_AMD_features();
 +                 if (strcmp(cpu_vendor, "CentaurHauls") == 0 &&
 +                   (cpu_id & 0xff0) == 0x690)
 +                       print_C3_features();
          } else if (strcmp(cpu_vendor, "CyrixInstead") == 0) {
                  printf("  DIR=0x%04x", cyrix_did);
                  printf("  Stepping=%u", (cyrix_did & 0xf000) >> 12);
 ***************
 *** 1082,1087 ****
 --- 1089,1113 ----
                  "\0403DNow!"
                  );
    }
 +
 + static void
 + print_C3_features(void)
 + {
 +       u_int regs[4];
 +
 +       do_cpuid(0xC0000000, regs);
 +       if (regs[0] >= 0xC0000001) {
 +               do_cpuid(0xC0000001, regs);
 +               printf("\n  Via C3 Features=0x%b", regs[3],
 +                       "\020"
 +                         "\001AIS"     /* Alternate instruction set */
 +                       "\003XSTORE"    /* Random number generator */
 +                       "\004LH"        /* Long haul */
 +                       "\005FEMMS"     /* Via 3dnow! extensions */
 +                       );
 +       }
 + }
 +
    #endif
 
    /*
 
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ceri 
State-Changed-When: Sat Oct 4 09:14:08 PDT 2003 
State-Changed-Why:  
Duplicate of i386/57546. 


Responsible-Changed-From-To: gnats-admin->ceri 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sat Oct 4 09:14:08 PDT 2003 
Responsible-Changed-Why:  

Take from gnats-admin. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57548 
>Unformatted:
