aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/random/probe.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2012-09-26 09:22:28 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2012-09-26 09:22:28 +0000
commit2633f0aa456b0e1aea1186801bcade79300ab23f (patch)
tree3864364f19b1b9fbce50e71bad33856cdb7331a1 /sys/dev/random/probe.c
parent8a4c133ac8d292a98f53ff616cecc39bb92bae6a (diff)
Notes
Diffstat (limited to 'sys/dev/random/probe.c')
-rw-r--r--sys/dev/random/probe.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/sys/dev/random/probe.c b/sys/dev/random/probe.c
index 0bbfd95c68d8..4558db71e626 100644
--- a/sys/dev/random/probe.c
+++ b/sys/dev/random/probe.c
@@ -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_systat *systat)
/* 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
}