From hula@hula.se  Fri Oct  3 10:19:09 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 61E4C16A4DA
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 10:19:09 -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 C548C43FF3
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 10:19:05 -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 1DF0930703
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  3 Oct 2003 19:19:04 +0200 (CEST)
Message-Id: <AF5C3D25-F5C5-11D7-B07F-000A959CEBC0@hula.se>
Date: Fri, 3 Oct 2003 19:19:03 +0200
From: Mikael Kullberg <hula@hula.se>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Adding VIA C3 capability printout in i386/identcpu.c

>Number:         57546
>Category:       i386
>Synopsis:       [patch] Adding VIA C3 capability printout in i386/identcpu.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 03 10:20:11 PDT 2003
>Closed-Date:    Mon Mar 28 13:00:40 GMT 2005
>Last-Modified:  Mon Mar 28 13:00:40 GMT 2005
>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:
Responsible-Changed-From-To: gnats-admin->freebsd-bugs 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Sat Oct 4 09:12:26 PDT 2003 
Responsible-Changed-Why:  
Reassign misfiled PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57546 
Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: bms 
Responsible-Changed-When: Tue Jun 22 15:01:15 GMT 2004 
Responsible-Changed-Why:  
MarkM is working on C3 RNG support 

http://www.freebsd.org/cgi/query-pr.cgi?pr=57546 
State-Changed-From-To: open->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 28 12:59:40 GMT 2005 
State-Changed-Why:  
Similar update committed. 

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