Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Enable second noise source on newer VIA CPUs



details:   https://anonhg.NetBSD.org/src/rev/792fa617e4b5
branches:  trunk
changeset: 812759:792fa617e4b5
user:      tls <tls%NetBSD.org@localhost>
date:      Fri Jan 01 19:46:48 2016 +0000

description:
Enable second noise source on newer VIA CPUs

diffstat:

 sys/arch/x86/x86/identcpu.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r c5acaec1e40d -r 792fa617e4b5 sys/arch/x86/x86/identcpu.c
--- a/sys/arch/x86/x86/identcpu.c       Fri Jan 01 19:14:45 2016 +0000
+++ b/sys/arch/x86/x86/identcpu.c       Fri Jan 01 19:46:48 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: identcpu.c,v 1.49 2015/12/13 15:02:19 maxv Exp $       */
+/*     $NetBSD: identcpu.c,v 1.50 2016/01/01 19:46:48 tls Exp $        */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.49 2015/12/13 15:02:19 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.50 2016/01/01 19:46:48 tls Exp $");
 
 #include "opt_xen.h"
 
@@ -554,8 +554,14 @@
                    /* Actually do the enables. */
                    if (rng_enable) {
                        msr = rdmsr(MSR_VIA_RNG);
-                       wrmsr(MSR_VIA_RNG, msr | MSR_VIA_RNG_ENABLE);
+                       msr |= MSR_VIA_RNG_ENABLE;
+                       /* C7 stepping 8 and subsequent CPUs have dual RNG */
+                       if (model > 0xA || (model == 0xA && stepping > 0x7)) {
+                               msr |= MSR_VIA_RNG_2NOISE;
+                       }
+                       wrmsr(MSR_VIA_RNG, msr);
                    }
+
                    if (ace_enable) {
                        msr = rdmsr(MSR_VIA_ACE);
                        wrmsr(MSR_VIA_ACE, msr | MSR_VIA_ACE_ENABLE);



Home | Main Index | Thread Index | Old Index