svn commit: r240950 - in stable/9/sys: amd64/conf conf dev/random
i386/conf modules/random
Konstantin Belousov
kib at FreeBSD.org
Wed Sep 26 09:22:29 UTC 2012
Author: kib
Date: Wed Sep 26 09:22:28 2012
New Revision: 240950
URL: http://svn.freebsd.org/changeset/base/240950
Log:
MFC r240135:
Add support for new Intel on-CPU Bull Mountain random number generator.
MFC r240455:
Rename the IVY_RNG option to RDRAND_RNG.
Added:
stable/9/sys/dev/random/ivy.c
- copied, changed from r240135, head/sys/dev/random/ivy.c
Deleted:
stable/9/sys/dev/random/nehemiah.h
Modified:
stable/9/sys/amd64/conf/GENERIC
stable/9/sys/conf/files.amd64
stable/9/sys/conf/files.i386
stable/9/sys/conf/options.amd64
stable/9/sys/conf/options.i386
stable/9/sys/dev/random/nehemiah.c
stable/9/sys/dev/random/probe.c
stable/9/sys/i386/conf/GENERIC
stable/9/sys/modules/random/Makefile
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/conf/ (props changed)
stable/9/sys/dev/ (props changed)
stable/9/sys/modules/ (props changed)
Modified: stable/9/sys/amd64/conf/GENERIC
==============================================================================
--- stable/9/sys/amd64/conf/GENERIC Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/amd64/conf/GENERIC Wed Sep 26 09:22:28 2012 (r240950)
@@ -272,6 +272,8 @@ device wpi # Intel 3945ABG wireless NI
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
+options PADLOCK_RNG # VIA Padlock RNG
+options RDRAND_RNG # Intel Bull Mountain RNG
device ether # Ethernet support
device vlan # 802.1Q VLAN support
device tun # Packet tunnel.
Modified: stable/9/sys/conf/files.amd64
==============================================================================
--- stable/9/sys/conf/files.amd64 Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/conf/files.amd64 Wed Sep 26 09:22:28 2012 (r240950)
@@ -216,7 +216,8 @@ dev/lindev/lindev.c optional lindev
dev/nfe/if_nfe.c optional nfe pci
dev/nve/if_nve.c optional nve pci
dev/nvram/nvram.c optional nvram isa
-dev/random/nehemiah.c optional random
+dev/random/ivy.c optional random rdrand_rng
+dev/random/nehemiah.c optional random padlock_rng
dev/qlxgb/qla_dbg.c optional qlxgb pci
dev/qlxgb/qla_hw.c optional qlxgb pci
dev/qlxgb/qla_ioctl.c optional qlxgb pci
Modified: stable/9/sys/conf/files.i386
==============================================================================
--- stable/9/sys/conf/files.i386 Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/conf/files.i386 Wed Sep 26 09:22:28 2012 (r240950)
@@ -226,7 +226,8 @@ dev/nfe/if_nfe.c optional nfe pci
dev/nve/if_nve.c optional nve pci
dev/nvram/nvram.c optional nvram isa
dev/pcf/pcf_isa.c optional pcf
-dev/random/nehemiah.c optional random
+dev/random/ivy.c optional random rdrand_rng
+dev/random/nehemiah.c optional random padlock_rng
dev/sbni/if_sbni.c optional sbni
dev/sbni/if_sbni_isa.c optional sbni isa
dev/sbni/if_sbni_pci.c optional sbni pci
Modified: stable/9/sys/conf/options.amd64
==============================================================================
--- stable/9/sys/conf/options.amd64 Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/conf/options.amd64 Wed Sep 26 09:22:28 2012 (r240950)
@@ -68,3 +68,7 @@ XENHVM opt_global.h
# options for the Intel C600 SAS driver (isci)
ISCI_LOGGING opt_isci.h
+
+# hw random number generators for random(4)
+PADLOCK_RNG opt_cpu.h
+RDRAND_RNG opt_cpu.h
Modified: stable/9/sys/conf/options.i386
==============================================================================
--- stable/9/sys/conf/options.i386 Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/conf/options.i386 Wed Sep 26 09:22:28 2012 (r240950)
@@ -123,3 +123,7 @@ XENHVM opt_global.h
# options for the Intel C600 SAS driver (isci)
ISCI_LOGGING opt_isci.h
+
+# hw random number generators for random(4)
+PADLOCK_RNG opt_cpu.h
+RDRAND_RNG opt_cpu.h
Copied and modified: stable/9/sys/dev/random/ivy.c (from r240135, head/sys/dev/random/ivy.c)
==============================================================================
--- head/sys/dev/random/ivy.c Wed Sep 5 13:18:51 2012 (r240135, copy source)
+++ stable/9/sys/dev/random/ivy.c Wed Sep 26 09:22:28 2012 (r240950)
@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
#include "opt_cpu.h"
-#ifdef IVY_RNG
+#ifdef RDRAND_RNG
#include <sys/param.h>
#include <sys/time.h>
Modified: stable/9/sys/dev/random/nehemiah.c
==============================================================================
--- stable/9/sys/dev/random/nehemiah.c Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/dev/random/nehemiah.c Wed Sep 26 09:22:28 2012 (r240950)
@@ -28,6 +28,10 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_cpu.h"
+
+#ifdef PADLOCK_RNG
+
#include <sys/param.h>
#include <sys/time.h>
#include <sys/lock.h>
@@ -203,3 +207,5 @@ random_nehemiah_read(void *buf, int c)
mtx_unlock(&random_nehemiah_mtx);
return (c);
}
+
+#endif
Modified: stable/9/sys/dev/random/probe.c
==============================================================================
--- stable/9/sys/dev/random/probe.c Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/dev/random/probe.c Wed Sep 26 09:22:28 2012 (r240950)
@@ -28,12 +28,17 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
+#include "opt_cpu.h"
+#endif
+
#include <sys/types.h>
#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/random.h>
#include <sys/selinfo.h>
-#include <sys/stdint.h>
#include <sys/sysctl.h>
#if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
@@ -45,7 +50,15 @@ __FBSDID("$FreeBSD$");
#include <dev/random/randomdev.h>
#include <dev/random/randomdev_soft.h>
-#include <dev/random/nehemiah.h>
+
+#if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
+#ifdef PADLOCK_RNG
+extern struct random_systat random_nehemiah;
+#endif
+#ifdef RDRAND_RNG
+extern struct random_systat random_ivy;
+#endif
+#endif
void
random_ident_hardware(struct random_systat *systat)
@@ -56,8 +69,25 @@ random_ident_hardware(struct random_syst
/* Then go looking for hardware */
#if defined(__amd64__) || (defined(__i386__) && !defined(PC98))
+#ifdef PADLOCK_RNG
if (via_feature_rng & VIA_HAS_RNG) {
- *systat = random_nehemiah;
+ int enable;
+
+ enable = 1;
+ TUNABLE_INT_FETCH("hw.nehemiah_rng_enable", &enable);
+ if (enable)
+ *systat = random_nehemiah;
}
#endif
+#ifdef RDRAND_RNG
+ if (cpu_feature2 & CPUID2_RDRAND) {
+ int enable;
+
+ enable = 1;
+ TUNABLE_INT_FETCH("hw.ivy_rng_enable", &enable);
+ if (enable)
+ *systat = random_ivy;
+ }
+#endif
+#endif
}
Modified: stable/9/sys/i386/conf/GENERIC
==============================================================================
--- stable/9/sys/i386/conf/GENERIC Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/i386/conf/GENERIC Wed Sep 26 09:22:28 2012 (r240950)
@@ -285,6 +285,8 @@ device wpi # Intel 3945ABG wireless NI
# Pseudo devices.
device loop # Network loopback
device random # Entropy device
+options PADLOCK_RNG # VIA Padlock RNG
+options RDRAND_RNG # Intel Bull Mountain RNG
device ether # Ethernet support
device vlan # 802.1Q VLAN support
device tun # Packet tunnel.
Modified: stable/9/sys/modules/random/Makefile
==============================================================================
--- stable/9/sys/modules/random/Makefile Wed Sep 26 08:57:12 2012 (r240949)
+++ stable/9/sys/modules/random/Makefile Wed Sep 26 09:22:28 2012 (r240950)
@@ -8,10 +8,11 @@ KMOD= random
SRCS= randomdev.c probe.c
.if ${MACHINE} == "amd64" || ${MACHINE} == "i386"
SRCS+= nehemiah.c
+SRCS+= ivy.c
.endif
SRCS+= randomdev_soft.c yarrow.c hash.c
SRCS+= rijndael-alg-fst.c rijndael-api-fst.c sha2.c
-SRCS+= bus_if.h device_if.h vnode_if.h
+SRCS+= bus_if.h device_if.h vnode_if.h opt_cpu.h
CFLAGS+= -I${.CURDIR}/../..
More information about the svn-src-stable-9
mailing list