diff options
| author | tls <tls@NetBSD.org> | 2012-02-02 19:42:57 +0000 |
|---|---|---|
| committer | tls <tls@NetBSD.org> | 2012-02-02 19:42:57 +0000 |
| commit | cc9ee3de3e25ef31d3a97dc35bedc36945e35d2a (patch) | |
| tree | 06a2889eb6b4b02bc8b8bba6b5cc3f9b1938d18b /sys | |
| parent | f622122a62827e27b444c2f95632d61f73357ced (diff) | |
Entropy-pool implementation move and cleanup.
1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.
2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.
3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.
4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.
5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.
ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
Diffstat (limited to 'sys')
201 files changed, 715 insertions, 1424 deletions
diff --git a/sys/arch/acorn26/ioc/arckbd.c b/sys/arch/acorn26/ioc/arckbd.c index 98c5e867964..cec6b33fdbe 100644 --- a/sys/arch/acorn26/ioc/arckbd.c +++ b/sys/arch/acorn26/ioc/arckbd.c @@ -1,4 +1,4 @@ -/* $NetBSD: arckbd.c,v 1.21 2011/11/19 22:51:18 tls Exp $ */ +/* $NetBSD: arckbd.c,v 1.22 2012/02/02 19:42:57 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 Ben Harris * All rights reserved. @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.21 2011/11/19 22:51:18 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.22 2012/02/02 19:42:57 tls Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -70,10 +70,8 @@ __KERNEL_RCSID(0, "$NetBSD: arckbd.c,v 1.21 2011/11/19 22:51:18 tls Exp $"); #include "wskbd.h" #include "wsmouse.h" -#include "rnd.h" -#if NRND > 0 + #include <sys/rnd.h> -#endif /* #define ARCKBD_DEBUG */ @@ -138,9 +136,7 @@ struct arckbd_softc { struct evcnt sc_xev; struct irq_handler *sc_rirq; struct evcnt sc_rev; -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; #define AKF_WANTKBD 0x01 @@ -223,10 +219,8 @@ arckbd_attach(device_t parent, device_t self, void *aux) aprint_normal("\n"); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_TTY, 0); -#endif wskbdargs.console = 1; /* XXX FIXME */ wskbdargs.keymap = &sc->sc_mapdata; @@ -460,13 +454,9 @@ arckbd_rint(void *cookie) static void arckbd_mousemoved(device_t self, int byte1, int byte2) { -#if NRND > 0 || NWSMOUSE > 0 struct arckbd_softc *sc = device_private(self); -#endif -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, byte1); -#endif #if NWSMOUSE > 0 if (sc->sc_wsmousedev != NULL) { int dx, dy; @@ -489,9 +479,7 @@ arckbd_keyupdown(device_t self, int byte1, int byte2) u_int type; int value; -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, byte1); -#endif if ((byte1 & 0x0f) == 7) { /* Mouse button event */ /* diff --git a/sys/arch/acorn32/eb7500atx/if_cs.c b/sys/arch/acorn32/eb7500atx/if_cs.c index c60d68131d0..6ff8067c190 100644 --- a/sys/arch/acorn32/eb7500atx/if_cs.c +++ b/sys/arch/acorn32/eb7500atx/if_cs.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs.c,v 1.7 2011/07/19 15:59:52 dyoung Exp $ */ +/* $NetBSD: if_cs.c,v 1.8 2012/02/02 19:42:57 tls Exp $ */ /* * Copyright (c) 2004 Christopher Gilbert @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs.c,v 1.7 2011/07/19 15:59:52 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs.c,v 1.8 2012/02/02 19:42:57 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -66,10 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_cs.c,v 1.7 2011/07/19 15:59:52 dyoung Exp $"); #include <sys/device.h> #include <sys/bus.h> -#include "rnd.h" -#if NRND > 0 + #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/arch/alpha/sableio/fdc_sableio.c b/sys/arch/alpha/sableio/fdc_sableio.c index 2cd69916d18..7df2f6e7830 100644 --- a/sys/arch/alpha/sableio/fdc_sableio.c +++ b/sys/arch/alpha/sableio/fdc_sableio.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_sableio.c,v 1.11 2011/07/01 19:19:50 dyoung Exp $ */ +/* $NetBSD: fdc_sableio.c,v 1.12 2012/02/02 19:42:57 tls Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -31,16 +31,14 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: fdc_sableio.c,v 1.11 2011/07/01 19:19:50 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc_sableio.c,v 1.12 2012/02/02 19:42:57 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/callout.h> #include <sys/device.h> #include <sys/buf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <machine/intr.h> diff --git a/sys/arch/arm/at91/at91dbgu.c b/sys/arch/arm/at91/at91dbgu.c index fa63c02576d..f05d8c75cae 100644 --- a/sys/arch/arm/at91/at91dbgu.c +++ b/sys/arch/arm/at91/at91dbgu.c @@ -1,5 +1,5 @@ -/* $Id: at91dbgu.c,v 1.7 2011/11/04 17:23:05 aymeric Exp $ */ -/* $NetBSD: at91dbgu.c,v 1.7 2011/11/04 17:23:05 aymeric Exp $ */ +/* $Id: at91dbgu.c,v 1.8 2012/02/02 19:42:57 tls Exp $ */ +/* $NetBSD: at91dbgu.c,v 1.8 2012/02/02 19:42:57 tls Exp $ */ /* * @@ -83,13 +83,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.7 2011/11/04 17:23:05 aymeric Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91dbgu.c,v 1.8 2012/02/02 19:42:57 tls Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -277,7 +277,7 @@ at91dbgu_attach(device_t parent, device_t self, void *aux) sc->sc_si = softint_establish(SOFTINT_SERIAL, at91dbgu_soft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -1138,7 +1138,7 @@ dbgu_intr(void* arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); #if 0 -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, imr ^ sr ^ c); #endif #endif diff --git a/sys/arch/arm/at91/at91dbguvar.h b/sys/arch/arm/at91/at91dbguvar.h index 5e67c6247cc..6d9d2551c0c 100644 --- a/sys/arch/arm/at91/at91dbguvar.h +++ b/sys/arch/arm/at91/at91dbguvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: at91dbguvar.h,v 1.4 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: at91dbguvar.h,v 1.5 2012/02/02 19:42:57 tls Exp $ */ /*- * Copyright (c) 2007 Embedtronics Oy @@ -81,7 +81,7 @@ struct at91dbgu_softc { int (*disable)(struct at91dbgu_softc *); int enabled; -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif }; diff --git a/sys/arch/arm/at91/at91usart.c b/sys/arch/arm/at91/at91usart.c index eac13785b64..f81f621708c 100644 --- a/sys/arch/arm/at91/at91usart.c +++ b/sys/arch/arm/at91/at91usart.c @@ -1,5 +1,5 @@ -/* $Id: at91usart.c,v 1.5 2011/07/01 19:31:17 dyoung Exp $ */ -/* $NetBSD: at91usart.c,v 1.5 2011/07/01 19:31:17 dyoung Exp $ */ +/* $Id: at91usart.c,v 1.6 2012/02/02 19:42:57 tls Exp $ */ +/* $NetBSD: at91usart.c,v 1.6 2012/02/02 19:42:57 tls Exp $ */ /* * Copyright (c) 2007 Embedtronics Oy. All rights reserved. @@ -77,13 +77,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: at91usart.c,v 1.5 2011/07/01 19:31:17 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91usart.c,v 1.6 2012/02/02 19:42:57 tls Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -303,7 +303,7 @@ at91usart_attach_subr(struct at91usart_softc *sc, struct at91bus_attach_args *sa sc->sc_si = softint_establish(SOFTINT_SERIAL, at91usart_soft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif diff --git a/sys/arch/arm/at91/at91usartvar.h b/sys/arch/arm/at91/at91usartvar.h index b6bb20df69b..0347d8313ff 100644 --- a/sys/arch/arm/at91/at91usartvar.h +++ b/sys/arch/arm/at91/at91usartvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: at91usartvar.h,v 1.4 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: at91usartvar.h,v 1.5 2012/02/02 19:42:57 tls Exp $ */ /*- * Copyright (c) 2007 Embedtronics Oy. All rights reserved. @@ -85,7 +85,7 @@ struct at91usart_softc { int (*disable)(struct at91usart_softc *); int enabled; -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif }; diff --git a/sys/arch/arm/ep93xx/epcom.c b/sys/arch/arm/ep93xx/epcom.c index 8809c1248c1..ebc8723e5ba 100644 --- a/sys/arch/arm/ep93xx/epcom.c +++ b/sys/arch/arm/ep93xx/epcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: epcom.c,v 1.21 2011/07/01 19:31:17 dyoung Exp $ */ +/* $NetBSD: epcom.c,v 1.22 2012/02/02 19:42:57 tls Exp $ */ /* * Copyright (c) 1998, 1999, 2001, 2002, 2004 The NetBSD Foundation, Inc. * All rights reserved. @@ -73,14 +73,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.21 2011/07/01 19:31:17 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: epcom.c,v 1.22 2012/02/02 19:42:57 tls Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" #include "epcom.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -237,7 +237,7 @@ epcom_attach_subr(struct epcom_softc *sc) sc->sc_si = softint_establish(SOFTINT_SERIAL, epcomsoft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_TTY, 0); #endif @@ -1132,7 +1132,7 @@ epcomintr(void* arg) softint_schedule(sc->sc_si); #if 0 /* XXX: broken */ -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, intr ^ flagr); #endif #endif diff --git a/sys/arch/arm/ep93xx/epcomvar.h b/sys/arch/arm/ep93xx/epcomvar.h index 5f628ee8161..cbf26a602b6 100644 --- a/sys/arch/arm/ep93xx/epcomvar.h +++ b/sys/arch/arm/ep93xx/epcomvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: epcomvar.h,v 1.5 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: epcomvar.h,v 1.6 2012/02/02 19:42:58 tls Exp $ */ /*- * Copyright (c) 2004 Jesse Off * @@ -82,7 +82,7 @@ struct epcom_softc { int (*disable)(struct epcom_softc *); int enabled; -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif }; diff --git a/sys/arch/arm/imx/imxuart.c b/sys/arch/arm/imx/imxuart.c index 1d4abdd3971..e981eb16f1c 100644 --- a/sys/arch/arm/imx/imxuart.c +++ b/sys/arch/arm/imx/imxuart.c @@ -1,4 +1,4 @@ -/* $NetBSD: imxuart.c,v 1.8 2011/04/24 16:26:54 rmind Exp $ */ +/* $NetBSD: imxuart.c,v 1.9 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 2009, 2010 Genetec Corporation. All rights reserved. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.8 2011/04/24 16:26:54 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.9 2012/02/02 19:42:58 tls Exp $"); #include "opt_imxuart.h" #include "opt_ddb.h" @@ -108,7 +108,7 @@ __KERNEL_RCSID(0, "$NetBSD: imxuart.c,v 1.8 2011/04/24 16:26:54 rmind Exp $"); #include "opt_imx.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -493,7 +493,7 @@ imxuart_attach_common(device_t parent, device_t self, sc->sc_si = softint_establish(SOFTINT_SERIAL, imxusoft, sc); -#if NRND > 0 && defined(RND_IMXUART) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -647,7 +647,7 @@ imxuart_detach(device_t self, int flags) /* Unhook the soft interrupt handler. */ softint_disestablish(sc->sc_si); -#if NRND > 0 && defined(RND_IMXU) +#ifdef RND_COM /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); #endif @@ -1882,7 +1882,7 @@ imxuintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif diff --git a/sys/arch/arm/ixp12x0/ixp12x0_com.c b/sys/arch/arm/ixp12x0/ixp12x0_com.c index b87b2fe2081..0a15a3a07fc 100644 --- a/sys/arch/arm/ixp12x0/ixp12x0_com.c +++ b/sys/arch/arm/ixp12x0/ixp12x0_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp12x0_com.c,v 1.39 2011/07/01 20:27:50 dyoung Exp $ */ +/* $NetBSD: ixp12x0_com.c,v 1.40 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,13 +66,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.39 2011/07/01 20:27:50 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp12x0_com.c,v 1.40 2012/02/02 19:42:58 tls Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -236,7 +236,7 @@ ixpcom_attach_subr(struct ixpcom_softc *sc) sc->sc_si = softint_establish(SOFTINT_SERIAL, ixpcomsoft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_TTY, 0); #endif @@ -1173,7 +1173,7 @@ ixpcomintr(void* arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif return (1); diff --git a/sys/arch/arm/s3c2xx0/sscom.c b/sys/arch/arm/s3c2xx0/sscom.c index 8aed5edb680..cd409b8fce9 100644 --- a/sys/arch/arm/s3c2xx0/sscom.c +++ b/sys/arch/arm/s3c2xx0/sscom.c @@ -1,4 +1,4 @@ -/* $NetBSD: sscom.c,v 1.34 2012/01/30 03:28:33 nisimura Exp $ */ +/* $NetBSD: sscom.c,v 1.35 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 2002, 2003 Fujitsu Component Limited @@ -98,7 +98,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.34 2012/01/30 03:28:33 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.35 2012/02/02 19:42:58 tls Exp $"); #include "opt_sscom.h" #include "opt_ddb.h" @@ -107,7 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: sscom.c,v 1.34 2012/01/30 03:28:33 nisimura Exp $"); #include "opt_lockdebug.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -494,10 +494,8 @@ sscom_attach_subr(struct sscom_softc *sc) sc->sc_si = softint_establish(SOFTINT_SERIAL, sscomsoft, sc); -#if NRND > 0 && defined(RND_COM) - rnd_attach_source(&sc->rnd_source, sc->sc_dev->dv_xname, + rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_TTY, 0); -#endif /* if there are no enable/disable functions, assume the device is always enabled */ @@ -1727,7 +1725,7 @@ sscomrxintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | rsr); #endif @@ -1792,7 +1790,7 @@ sscomtxintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | rsr); #endif diff --git a/sys/arch/arm/s3c2xx0/sscom_var.h b/sys/arch/arm/s3c2xx0/sscom_var.h index dfc360409ed..6668ae9f597 100644 --- a/sys/arch/arm/s3c2xx0/sscom_var.h +++ b/sys/arch/arm/s3c2xx0/sscom_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: sscom_var.h,v 1.10 2012/01/30 03:28:33 nisimura Exp $ */ +/* $NetBSD: sscom_var.h,v 1.11 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 2002, 2003 Fujitsu Component Limited @@ -174,7 +174,7 @@ struct sscom_softc { pps_params_t ppsparam; #endif -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif #if (defined(MULTIPROCESSOR) || defined(LOCKDEBUG)) && defined(SSCOM_MPLOCK) diff --git a/sys/arch/arm/sa11x0/sa1111_kbc.c b/sys/arch/arm/sa11x0/sa1111_kbc.c index c5485d99bef..95a55082138 100644 --- a/sys/arch/arm/sa11x0/sa1111_kbc.c +++ b/sys/arch/arm/sa11x0/sa1111_kbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa1111_kbc.c,v 1.13 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: sa1111_kbc.c,v 1.14 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 2004 Ben Harris. @@ -57,7 +57,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.13 2011/11/19 22:51:19 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.14 2012/02/02 19:42:58 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.13 2011/11/19 22:51:19 tls Exp $"); #include <sys/errno.h> #include <sys/queue.h> #include <sys/bus.h> +#include <sys/rnd.h> #include <arm/sa11x0/sa1111_reg.h> #include <arm/sa11x0/sa1111_var.h> @@ -78,7 +79,6 @@ __KERNEL_RCSID(0, "$NetBSD: sa1111_kbc.c,v 1.13 2011/11/19 22:51:19 tls Exp $"); #include <dev/pckbport/pckbportvar.h> /* for prototypes */ #include "pckbd.h" -#include "rnd.h" #include "locators.h" struct sackbc_softc { @@ -95,9 +95,7 @@ struct sackbc_softc { int poll_stat; /* data read from inr handler if polling */ int poll_data; /* status read from intr handler if polling */ -#if NRND > 0 krndsource_t rnd_source; -#endif pckbport_tag_t pt; }; @@ -171,9 +169,7 @@ sackbc_rxint(void *cookie) if (stat & KBDSTAT_RXF) { code = bus_space_read_4(sc->iot, sc->ioh, SACCKBD_DATA); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, (stat<<8)|data); -#endif if (sc->polling) { sc->poll_data = code; @@ -279,10 +275,8 @@ sackbc_attach(device_t parent, device_t self, void *aux) if (child == NULL) continue; sc->slot = slot; -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(child), RND_TYPE_TTY, 0); -#endif /* only one of KBD_SLOT or AUX_SLOT is used. */ break; } diff --git a/sys/arch/arm/sa11x0/sa11x0_com.c b/sys/arch/arm/sa11x0/sa11x0_com.c index 475a44b9908..eeba00c1ff5 100644 --- a/sys/arch/arm/sa11x0/sa11x0_com.c +++ b/sys/arch/arm/sa11x0/sa11x0_com.c @@ -1,4 +1,4 @@ -/* $NetBSD: sa11x0_com.c,v 1.49 2011/07/01 20:31:39 dyoung Exp $ */ +/* $NetBSD: sa11x0_com.c,v 1.50 2012/02/02 19:42:58 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2001 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.49 2011/07/01 20:31:39 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.50 2012/02/02 19:42:58 tls Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -74,7 +74,7 @@ __KERNEL_RCSID(0, "$NetBSD: sa11x0_com.c,v 1.49 2011/07/01 20:31:39 dyoung Exp $ #include "opt_lockdebug.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -330,7 +330,7 @@ sacom_attach_subr(struct sacom_softc *sc) sc->sc_si = softint_establish(SOFTINT_SERIAL, sacomsoft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -380,7 +380,7 @@ sacom_detach(device_t dev, int flags) /* Unhook the soft interrupt handler. */ softint_disestablish(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); #endif @@ -1393,7 +1393,7 @@ sacomintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif return 1; diff --git a/sys/arch/arm/xscale/ixp425_if_npe.c b/sys/arch/arm/xscale/ixp425_if_npe.c index ca98fe99d66..44708f7c054 100644 --- a/sys/arch/arm/xscale/ixp425_if_npe.c +++ b/sys/arch/arm/xscale/ixp425_if_npe.c @@ -1,4 +1,4 @@ -/* $NetBSD: ixp425_if_npe.c,v 1.21 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: ixp425_if_npe.c,v 1.22 2012/02/02 19:42:58 tls Exp $ */ /*- * Copyright (c) 2006 Sam Leffler. All rights reserved. @@ -28,7 +28,7 @@ #if 0 __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); #endif -__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.21 2011/11/19 22:51:19 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.22 2012/02/02 19:42:58 tls Exp $"); /* * Intel XScale NPE Ethernet driver. @@ -47,8 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.21 2011/11/19 22:51:19 tls Exp $ * XXX NPE-C port doesn't work yet */ -#include "rnd.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -70,9 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.21 2011/11/19 22:51:19 tls Exp $ #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <arm/xscale/ixp425reg.h> #include <arm/xscale/ixp425var.h> @@ -126,9 +122,7 @@ struct npe_softc { bus_dmamap_t sc_stats_map; bus_addr_t sc_stats_phys; /* phys addr of sc_stats */ int sc_if_flags; /* keep last if_flags */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; /* @@ -338,10 +332,8 @@ npe_attach(struct device *parent, struct device *self, void *arg) if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_NET, 0); -#endif /* callback function to reset MAC */ isc->macresetcbfunc = npeinit_resetcb; @@ -838,10 +830,7 @@ npe_txdone(int qid, void *arg) sc = npes[NPE_QM_Q_NPE(entry)]; DPRINTF(sc, "%s: entry 0x%x NPE %u port %u\n", __func__, entry, NPE_QM_Q_NPE(entry), NPE_QM_Q_PORT(entry)); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, entry); -#endif + rnd_add_uint32(&sc->rnd_source, entry); npe = P2V(NPE_QM_Q_ADDR(entry), &sc->txdma); m_freem(npe->ix_m); @@ -931,10 +920,7 @@ npe_rxdone(int qid, void *arg) DPRINTF(sc, "%s: entry 0x%x neaddr 0x%x ne_len 0x%x\n", __func__, entry, npe->ix_neaddr, npe->ix_hw->ix_ne[0].len); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, entry); -#endif + rnd_add_uint32(&sc->rnd_source, entry); /* * Allocate a new mbuf to replenish the rx buffer. * If doing so fails we drop the rx'd frame so we diff --git a/sys/arch/emips/ebus/ace_ebus.c b/sys/arch/emips/ebus/ace_ebus.c index c050ce1f4e4..c9339587fbe 100644 --- a/sys/arch/emips/ebus/ace_ebus.c +++ b/sys/arch/emips/ebus/ace_ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: ace_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: ace_ebus.c,v 1.4 2012/02/02 19:42:58 tls Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,9 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.4 2012/02/02 19:42:58 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: ace_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); #include <sys/lock.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <machine/intr.h> #include <machine/bus.h> @@ -192,9 +188,7 @@ struct ace_softc { int hw_busy; int retries; /* number of xfer retry */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; int ace_ebus_match(device_t, cfdata_t, void *); @@ -1467,7 +1461,7 @@ sysace_send_config(struct ace_softc *sc, uint32_t *Data, unsigned int nBytes) * Rest of code lifted with mods from the dev\ata\wd.c driver */ -/* $NetBSD: ace_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: ace_ebus.c,v 1.4 2012/02/02 19:42:58 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -1644,10 +1638,8 @@ aceattach(struct ace_softc *ace) */ disk_attach(&ace->sc_dk); -#if NRND > 0 rnd_attach_source(&ace->rnd_source, device_xname(ace->sc_dev), RND_TYPE_DISK, 0); -#endif } @@ -1703,10 +1695,8 @@ acedetach(struct device *self, int flags) /* Detach disk. */ disk_detach(&sc->sc_dk); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif #if 0 sc->drvp->drive_flags = 0; /* no drive any more here */ @@ -1901,9 +1891,7 @@ retry: /* Just reset and retry. Can we do more ? */ } disk_unbusy(&ace->sc_dk, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&ace->rnd_source, bp->b_blkno); -#endif biodone(bp); ace->openings++; acestart(ace); diff --git a/sys/arch/emips/ebus/flash_ebus.c b/sys/arch/emips/ebus/flash_ebus.c index a6c12c74108..ddab9dce4e8 100644 --- a/sys/arch/emips/ebus/flash_ebus.c +++ b/sys/arch/emips/ebus/flash_ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: flash_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: flash_ebus.c,v 1.4 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.4 2012/02/02 19:42:59 tls Exp $"); /* Driver for the Intel 28F320/640/128 (J3A150) StrataFlash memory device * Extended to include the Intel JS28F256P30T95. @@ -61,9 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: flash_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); #include <sys/lock.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include "locators.h" #include <prop/proplib.h> @@ -201,9 +199,7 @@ struct eflash_softc { int retries; /* number of xfer retry */ -#if NRND > 0 krndsource_t rnd_source; -#endif /* flash-specific state */ struct _Flash *sc_dp; @@ -1306,7 +1302,7 @@ static int eflash_write_at (struct eflash_softc *sc, /* Rest of code lifted with mods from the dev\ata\wd.c driver */ -/* $NetBSD: flash_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: flash_ebus.c,v 1.4 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -1458,10 +1454,8 @@ eflashattach(struct eflash_softc *sc) */ disk_attach(&sc->sc_dk); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_DISK, 0); -#endif } @@ -1520,10 +1514,8 @@ eflashdetach(struct device *self, int flags) /* Detach disk. */ disk_detach(&sc->sc_dk); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif /*sc->drvp->drive_flags = 0; -- no drive any more here */ @@ -1828,9 +1820,7 @@ retry: /* Just reset and retry. Can we do more ? */ } disk_unbusy(&sc->sc_dk, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, bp->b_blkno); -#endif biodone(bp); sc->openings++; eflashstart(sc); diff --git a/sys/arch/emips/ebus/if_le_ebus.c b/sys/arch/emips/ebus/if_le_ebus.c index 85b5f5c50ca..320e7193d0e 100644 --- a/sys/arch/emips/ebus/if_le_ebus.c +++ b/sys/arch/emips/ebus/if_le_ebus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: if_le_ebus.c,v 1.4 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,11 +31,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.4 2012/02/02 19:42:59 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/systm.h> @@ -60,9 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_ebus.c,v 1.3 2011/11/19 22:51:19 tls Exp $"); #include <net/bpf.h> #include <net/bpfdesc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <emips/ebus/ebusvar.h> #include <emips/emips/machdep.h> @@ -114,9 +112,7 @@ struct enic_softc { uint8_t sc_enaddr[ETHER_ADDR_LEN]; uint8_t sc_pad[2]; -#if NRND > 0 krndsource_t rnd_source; -#endif }; void enic_reset(struct ifnet *); @@ -226,10 +222,8 @@ enic_attach(device_t parent, device_t self, void *aux) if (sc->sc_sh == NULL) panic("enic_attach: cannot establish shutdown hook"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif ebus_intr_establish(parent, (void *)ia->ia_cookie, IPL_NET, enic_intr, sc); @@ -708,9 +702,7 @@ enic_intr(void *cookie, void *f) isr = sc->sc_regs->Control; } -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, isr); -#endif return 1; } diff --git a/sys/arch/evbarm/dev/plcom.c b/sys/arch/evbarm/dev/plcom.c index ad0104bd911..ee8e3181144 100644 --- a/sys/arch/evbarm/dev/plcom.c +++ b/sys/arch/evbarm/dev/plcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: plcom.c,v 1.32 2011/04/24 16:26:55 rmind Exp $ */ +/* $NetBSD: plcom.c,v 1.33 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 2001 ARM Ltd @@ -94,7 +94,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.32 2011/04/24 16:26:55 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.33 2012/02/02 19:42:59 tls Exp $"); #include "opt_plcom.h" #include "opt_ddb.h" @@ -103,7 +103,7 @@ __KERNEL_RCSID(0, "$NetBSD: plcom.c,v 1.32 2011/04/24 16:26:55 rmind Exp $"); #include "opt_multiprocessor.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -436,7 +436,7 @@ plcom_attach_subr(struct plcom_softc *sc) sc->sc_si = softint_establish(SOFTINT_SERIAL, plcomsoft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_TTY, 0); #endif @@ -499,7 +499,7 @@ plcom_detach(struct device *self, int flags) /* Unhook the soft interrupt handler. */ softint_disestablish(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); #endif @@ -1935,7 +1935,7 @@ plcomintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | rsr); #endif diff --git a/sys/arch/evbarm/dev/plcomvar.h b/sys/arch/evbarm/dev/plcomvar.h index 30ca4cd5a16..ed7d44f1604 100644 --- a/sys/arch/evbarm/dev/plcomvar.h +++ b/sys/arch/evbarm/dev/plcomvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: plcomvar.h,v 1.7 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: plcomvar.h,v 1.8 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -36,7 +36,7 @@ #include "opt_plcom.h" #include "opt_kgdb.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -133,7 +133,7 @@ struct plcom_softc { pps_info_t ppsinfo; pps_params_t ppsparam; -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif struct simplelock sc_lock; diff --git a/sys/arch/evbarm/smdk2xx0/if_cs_smdk24x0.c b/sys/arch/evbarm/smdk2xx0/if_cs_smdk24x0.c index 1547a5fb013..7b69cbff859 100644 --- a/sys/arch/evbarm/smdk2xx0/if_cs_smdk24x0.c +++ b/sys/arch/evbarm/smdk2xx0/if_cs_smdk24x0.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_smdk24x0.c,v 1.4 2011/07/01 20:44:21 dyoung Exp $ */ +/* $NetBSD: if_cs_smdk24x0.c,v 1.5 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 2003 Genetec corporation. All rights reserved. @@ -72,17 +72,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_smdk24x0.c,v 1.4 2011/07/01 20:44:21 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_smdk24x0.c,v 1.5 2012/02/02 19:42:59 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> #include <sys/device.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c b/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c index 925d1ae4cb9..c31d6302fdc 100644 --- a/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c +++ b/sys/arch/evbppc/pmppc/dev/if_cs_mainbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_mainbus.c,v 1.6 2011/06/20 05:15:59 matt Exp $ */ +/* $NetBSD: if_cs_mainbus.c,v 1.7 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.6 2011/06/20 05:15:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.7 2012/02/02 19:42:59 tls Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -38,10 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cs_mainbus.c,v 1.6 2011/06/20 05:15:59 matt Exp $ #include <sys/socket.h> #include <sys/bus.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/arch/hp300/dev/rd.c b/sys/arch/hp300/dev/rd.c index 456b7344613..b8891334325 100644 --- a/sys/arch/hp300/dev/rd.c +++ b/sys/arch/hp300/dev/rd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.91 2011/07/28 03:42:20 uebayasi Exp $ */ +/* $NetBSD: rd.c,v 1.92 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -72,10 +72,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.91 2011/07/28 03:42:20 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.92 2012/02/02 19:42:59 tls Exp $"); #include "opt_useleds.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -90,9 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.91 2011/07/28 03:42:20 uebayasi Exp $"); #include <sys/proc.h> #include <sys/stat.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <hp300/dev/hpibvar.h> @@ -358,13 +355,11 @@ rdattach(device_t parent, device_t self, void *aux) if (rddebug & RDB_ERROR) rderrthresh = 0; #endif -#if NRND > 0 /* * attach the device into the random source list */ rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_DISK, 0); -#endif } static int @@ -919,9 +914,7 @@ rdintr(void *arg) } if (rdfinish(sc, bp)) rdustart(sc); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, bp->b_blkno); -#endif } static int diff --git a/sys/arch/hp300/dev/rdvar.h b/sys/arch/hp300/dev/rdvar.h index 25d5802e824..1dceb7ae5df 100644 --- a/sys/arch/hp300/dev/rdvar.h +++ b/sys/arch/hp300/dev/rdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: rdvar.h,v 1.21 2011/11/19 22:51:19 tls Exp $ */ +/* $NetBSD: rdvar.h,v 1.22 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -80,9 +80,7 @@ struct rd_softc { int sc_active; int sc_errcnt; struct rdstats sc_stats; -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* sc_flags values */ diff --git a/sys/arch/hp700/gsc/harmony.c b/sys/arch/hp700/gsc/harmony.c index 01be09b3fd5..7ca26326a3f 100644 --- a/sys/arch/hp700/gsc/harmony.c +++ b/sys/arch/hp700/gsc/harmony.c @@ -1,4 +1,4 @@ -/* $NetBSD: harmony.c,v 1.25 2011/11/24 03:35:56 mrg Exp $ */ +/* $NetBSD: harmony.c,v 1.26 2012/02/02 19:42:59 tls Exp $ */ /* $OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $ */ @@ -61,7 +61,7 @@ * Harmony (CS4215/AD1849 LASI) audio interface. */ -#include "rnd.h" + #include <sys/param.h> #include <sys/kernel.h> @@ -73,9 +73,7 @@ #include <sys/kmem.h> #include <uvm/uvm_extern.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/audioio.h> #include <dev/audio_if.h> @@ -171,7 +169,6 @@ void harmony_try_more(struct harmony_softc *, int, int, static void harmony_empty_input(struct harmony_softc *); static void harmony_empty_output(struct harmony_softc *); -#if NRND > 0 void harmony_acc_tmo(void *); #define ADD_CLKALLICA(sc) do { \ (sc)->sc_acc <<= 1; \ @@ -180,7 +177,6 @@ void harmony_acc_tmo(void *); rnd_add_uint32(&(sc)->sc_rnd_source, \ (sc)->sc_acc_num ^= (sc)->sc_acc); \ } while(0) -#endif int harmony_match(device_t parent, struct cfdata *match, void *aux) @@ -323,14 +319,12 @@ harmony_attach(device_t parent, device_t self, void *aux) audio_attach_mi(&harmony_sa_hw_if, sc, sc->sc_dv); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv), RND_TYPE_UNKNOWN, 0); callout_init(&sc->sc_acc_tmo, 0); callout_setfunc(&sc->sc_acc_tmo, harmony_acc_tmo, sc); sc->sc_acc_num = 0xa5a5a5a5; -#endif } void @@ -350,7 +344,6 @@ harmony_reset_codec(struct harmony_softc *sc) WRITE_REG(sc, HARMONY_RESET, 0); } -#if NRND > 0 void harmony_acc_tmo(void *v) { @@ -360,7 +353,6 @@ harmony_acc_tmo(void *v) ADD_CLKALLICA(sc); callout_schedule(&sc->sc_acc_tmo, 1); } -#endif /* * interrupt handler @@ -374,9 +366,7 @@ harmony_intr(void *vsc) sc = vsc; r = 0; -#if NRND > 0 ADD_CLKALLICA(sc); -#endif mutex_spin_enter(&sc->sc_intr_lock); @@ -1221,9 +1211,7 @@ harmony_start_cp(struct harmony_softc *sc, int start) RCURADD_BUFMASK, &sc->sc_capture); } -#if NRND > 0 callout_schedule(&sc->sc_acc_tmo, 1); -#endif } void diff --git a/sys/arch/hp700/gsc/harmonyvar.h b/sys/arch/hp700/gsc/harmonyvar.h index e1fc3684eff..1d7dd95045b 100644 --- a/sys/arch/hp700/gsc/harmonyvar.h +++ b/sys/arch/hp700/gsc/harmonyvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: harmonyvar.h,v 1.6 2011/11/23 23:07:29 jmcneill Exp $ */ +/* $NetBSD: harmonyvar.h,v 1.7 2012/02/02 19:42:59 tls Exp $ */ /* $OpenBSD: harmonyvar.h,v 1.8 2003/08/15 13:25:53 mickey Exp $ */ @@ -106,11 +106,9 @@ struct harmony_softc { int sc_micpreamp, sc_ov, sc_outputgain; int sc_teleshare; -#if NRND > 0 krndsource_t sc_rnd_source; struct callout sc_acc_tmo; uint32_t sc_acc, sc_acc_num, sc_acc_cnt; -#endif }; #define READ_REG(sc, reg) \ diff --git a/sys/arch/i386/pnpbios/fdc_pnpbios.c b/sys/arch/i386/pnpbios/fdc_pnpbios.c index effad22741e..742ea4f08a1 100644 --- a/sys/arch/i386/pnpbios/fdc_pnpbios.c +++ b/sys/arch/i386/pnpbios/fdc_pnpbios.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_pnpbios.c,v 1.16 2011/07/01 18:14:15 dyoung Exp $ */ +/* $NetBSD: fdc_pnpbios.c,v 1.17 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -34,9 +34,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdc_pnpbios.c,v 1.16 2011/07/01 18:14:15 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc_pnpbios.c,v 1.17 2012/02/02 19:42:59 tls Exp $"); + -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -44,9 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_pnpbios.c,v 1.16 2011/07/01 18:14:15 dyoung Exp #include <sys/device.h> #include <sys/buf.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <machine/intr.h> diff --git a/sys/arch/macppc/dev/if_gm.c b/sys/arch/macppc/dev/if_gm.c index a9914ff19ae..cc6e5706e82 100644 --- a/sys/arch/macppc/dev/if_gm.c +++ b/sys/arch/macppc/dev/if_gm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gm.c,v 1.40 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: if_gm.c,v 1.41 2012/02/02 19:42:59 tls Exp $ */ /*- * Copyright (c) 2000 Tsubai Masanari. All rights reserved. @@ -27,10 +27,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.40 2011/11/19 22:51:20 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.41 2012/02/02 19:42:59 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/device.h> @@ -41,9 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.40 2011/11/19 22:51:20 tls Exp $"); #include <sys/systm.h> #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <uvm/uvm_extern.h> @@ -86,9 +83,7 @@ struct gmac_softc { struct callout sc_tick_ch; char sc_laddr[6]; -#if NRND > 0 krndsource_t sc_rnd_source; /* random source */ -#endif }; #define sc_if sc_ethercom.ec_if @@ -252,9 +247,7 @@ gmac_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, laddr); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, xname, RND_TYPE_NET, 0); -#endif } u_int @@ -337,9 +330,7 @@ gmac_intr(void *v) if (status & GMAC_INT_TXEMPTY) gmac_tint(sc); -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, status); -#endif return 1; } diff --git a/sys/arch/mips/alchemy/dev/if_aumac.c b/sys/arch/mips/alchemy/dev/if_aumac.c index c2e8f0ed685..091ec76451b 100644 --- a/sys/arch/mips/alchemy/dev/if_aumac.c +++ b/sys/arch/mips/alchemy/dev/if_aumac.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_aumac.c,v 1.33 2012/01/03 07:36:02 kiyohara Exp $ */ +/* $NetBSD: if_aumac.c,v 1.34 2012/02/02 19:42:59 tls Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -46,9 +46,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.33 2012/01/03 07:36:02 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.34 2012/02/02 19:42:59 tls Exp $"); + -#include "rnd.h" #include <sys/param.h> #include <sys/bus.h> @@ -71,9 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.33 2012/01/03 07:36:02 kiyohara Exp $ #include <net/if_ether.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/mii/mii.h> #include <dev/mii/miivar.h> @@ -142,9 +140,7 @@ struct aumac_softc { int sc_rxptr; /* next ready Rx descriptor */ -#if NRND > 0 krndsource_t rnd_source; -#endif #ifdef AUMAC_EVENT_COUNTERS struct evcnt sc_ev_txstall; /* Tx stalled */ @@ -341,9 +337,8 @@ aumac_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, enaddr); -#if NRND > 0 - rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif + rnd_attach_source(&sc->rnd_source, device_xname(self), + RND_TYPE_NET, 0); #ifdef AUMAC_EVENT_COUNTERS evcnt_attach_dynamic(&sc->sc_ev_txstall, EVCNT_TYPE_MISC, @@ -532,10 +527,7 @@ aumac_intr(void *arg) status = aumac_rxintr(sc); status += aumac_txintr(sc); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, status); -#endif + rnd_add_uint32(&sc->rnd_source, status); return status; } diff --git a/sys/arch/mips/atheros/dev/aevar.h b/sys/arch/mips/atheros/dev/aevar.h index bf2dd3fb584..1f1efb7d412 100644 --- a/sys/arch/mips/atheros/dev/aevar.h +++ b/sys/arch/mips/atheros/dev/aevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: aevar.h,v 1.4 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: aevar.h,v 1.5 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -33,14 +33,10 @@ #ifndef _MIPS_ATHEROS_DEV_AEVAR_H_ #define _MIPS_ATHEROS_DEV_AEVAR_H_ -#include "rnd.h" - #include <sys/queue.h> #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Misc. definitions for the Digital Semiconductor ``Tulip'' (21x4x) @@ -186,9 +182,7 @@ struct ae_softc { int sc_rxptr; /* next ready RX descriptor/descsoft */ -#if NRND > 0 krndsource_t sc_rnd_source; /* random source */ -#endif }; #endif diff --git a/sys/arch/mips/atheros/dev/if_ae.c b/sys/arch/mips/atheros/dev/if_ae.c index b44f666a441..c51a1083b16 100644 --- a/sys/arch/mips/atheros/dev/if_ae.c +++ b/sys/arch/mips/atheros/dev/if_ae.c @@ -1,4 +1,4 @@ -/* $Id: if_ae.c,v 1.21 2011/07/10 06:24:19 matt Exp $ */ +/* $Id: if_ae.c,v 1.22 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. * Copyright (c) 2006 Garrett D'Amore. @@ -98,7 +98,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.21 2011/07/10 06:24:19 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.22 2012/02/02 19:43:00 tls Exp $"); #include <sys/param.h> @@ -384,10 +384,8 @@ ae_attach(device_t parent, device_t self, void *aux) ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, ae_ifflags_cb); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, sc->sc_dev.dv_xname, RND_TYPE_NET, 0); -#endif /* * Make sure the interface is shutdown during reboot. @@ -487,9 +485,7 @@ ae_detach(device_t self, int flags) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->sc_rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); @@ -999,10 +995,8 @@ ae_intr(void *arg) /* Try to get more packets going. */ ae_start(ifp); -#if NRND > 0 if (handled) rnd_add_uint32(&sc->sc_rnd_source, status); -#endif return (handled); } diff --git a/sys/arch/mips/sibyte/dev/sbjcnvar.h b/sys/arch/mips/sibyte/dev/sbjcnvar.h index 5be981b6e2e..b09077e21ea 100644 --- a/sys/arch/mips/sibyte/dev/sbjcnvar.h +++ b/sys/arch/mips/sibyte/dev/sbjcnvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbjcnvar.h,v 1.3 2011/02/01 03:16:54 matt Exp $ */ +/* $NetBSD: sbjcnvar.h,v 1.4 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright 2000, 2001 @@ -65,7 +65,7 @@ */ #include "rnd.h" -#if NRND > 0 && defined(RND_SBJCN) +#ifdef RND_SBJCN #include <sys/rnd.h> #endif diff --git a/sys/arch/mips/sibyte/dev/sbscn.c b/sys/arch/mips/sibyte/dev/sbscn.c index 8191b7bfed6..d8d9bec6320 100644 --- a/sys/arch/mips/sibyte/dev/sbscn.c +++ b/sys/arch/mips/sibyte/dev/sbscn.c @@ -1,4 +1,4 @@ -/* $NetBSD: sbscn.c,v 1.36 2011/07/10 23:32:03 matt Exp $ */ +/* $NetBSD: sbscn.c,v 1.37 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright 2000, 2001 @@ -109,7 +109,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.36 2011/07/10 23:32:03 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.37 2012/02/02 19:43:00 tls Exp $"); #define SBSCN_DEBUG @@ -117,7 +117,7 @@ __KERNEL_RCSID(0, "$NetBSD: sbscn.c,v 1.36 2011/07/10 23:32:03 matt Exp $"); #include "ioconf.h" #include "rnd.h" -#if NRND > 0 && defined(RND_SBSCN) +#ifdef RND_SBSCN #include <sys/rnd.h> #endif @@ -382,7 +382,7 @@ sbscn_attach_channel(struct sbscn_softc *sc, int chan, int intr) ch->ch_si = softint_establish(SOFTINT_SERIAL, sbscn_soft, ch); -#if NRND > 0 && defined(RND_SBSCN) +#ifdef RND_SBSCN rnd_attach_source(&ch->ch_rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -1661,7 +1661,7 @@ XXX /* Wake up the poller. */ softint_schedule(ch->ch_si); -#if NRND > 0 && defined(RND_SBSCN) +#ifdef RND_SBSCN rnd_add_uint32(&ch->ch_rnd_source, isr | sr); #endif } diff --git a/sys/arch/mips/sibyte/dev/sbscnvar.h b/sys/arch/mips/sibyte/dev/sbscnvar.h index 7d50bb35314..860be00cd45 100644 --- a/sys/arch/mips/sibyte/dev/sbscnvar.h +++ b/sys/arch/mips/sibyte/dev/sbscnvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbscnvar.h,v 1.5 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: sbscnvar.h,v 1.6 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright 2000, 2001 @@ -65,7 +65,7 @@ */ #include "rnd.h" -#if NRND > 0 && defined(RND_SBSCN) +#ifdef RND_SBSCN #include <sys/rnd.h> #endif @@ -156,7 +156,7 @@ struct sbscn_channel { u_char ch_i_dcd_pin, ch_i_cts_pin, ch_i_dsr_pin, ch_i_ri_pin; u_char ch_o_dtr_pin, ch_o_rts_pin; -#if NRND > 0 && defined(RND_SBSCN) +#ifdef RND_SBSCN krndsource_t ch_rnd_source; #endif }; diff --git a/sys/arch/next68k/dev/mb8795.c b/sys/arch/next68k/dev/mb8795.c index 4b04ad179d9..0f4eaaa66e9 100644 --- a/sys/arch/next68k/dev/mb8795.c +++ b/sys/arch/next68k/dev/mb8795.c @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795.c,v 1.49 2010/04/24 19:58:13 dbj Exp $ */ +/* $NetBSD: mb8795.c,v 1.50 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -25,10 +25,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.49 2010/04/24 19:58:13 dbj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.50 2012/02/02 19:43:00 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -39,9 +38,7 @@ __KERNEL_RCSID(0, "$NetBSD: mb8795.c,v 1.49 2010/04/24 19:58:13 dbj Exp $"); #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -140,10 +137,8 @@ mb8795_config(struct mb8795_softc *sc, int *media, int nmedia, int defmedia) if (sc->sc_sh == NULL) panic("mb8795_config: can't establish shutdownhook"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname, RND_TYPE_NET, 0); -#endif DPRINTF(("%s: leaving mb8795_config()\n",sc->sc_dev.dv_xname)); } diff --git a/sys/arch/next68k/dev/mb8795var.h b/sys/arch/next68k/dev/mb8795var.h index c53f79b4fb8..1379d5067c9 100644 --- a/sys/arch/next68k/dev/mb8795var.h +++ b/sys/arch/next68k/dev/mb8795var.h @@ -1,4 +1,4 @@ -/* $NetBSD: mb8795var.h,v 1.12 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: mb8795var.h,v 1.13 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright (c) 1998 Darrin B. Jewell * All rights reserved. @@ -24,10 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" /* is random device-driver configured? */ -#if NRND > 0 #include <sys/rnd.h> -#endif /* NRND */ #define MB8795_NRXBUFS (32) @@ -71,9 +68,7 @@ struct mb8795_softc { struct ifmedia sc_media; -#if NRND > 0 krndsource_t rnd_source; -#endif /* NRND */ }; diff --git a/sys/arch/prep/pnpbus/fdc_pnpbus.c b/sys/arch/prep/pnpbus/fdc_pnpbus.c index 0a418b751ee..a62c3d691e4 100644 --- a/sys/arch/prep/pnpbus/fdc_pnpbus.c +++ b/sys/arch/prep/pnpbus/fdc_pnpbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_pnpbus.c,v 1.3 2011/07/01 16:55:42 dyoung Exp $ */ +/* $NetBSD: fdc_pnpbus.c,v 1.4 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdc_pnpbus.c,v 1.3 2011/07/01 16:55:42 dyoung Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: fdc_pnpbus.c,v 1.4 2012/02/02 19:43:00 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,9 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_pnpbus.c,v 1.3 2011/07/01 16:55:42 dyoung Exp $" #include <sys/device.h> #include <sys/buf.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <machine/intr.h> diff --git a/sys/arch/sgimips/hpc/if_sq.c b/sys/arch/sgimips/hpc/if_sq.c index 9aea1e5845a..f0c22b951a5 100644 --- a/sys/arch/sgimips/hpc/if_sq.c +++ b/sys/arch/sgimips/hpc/if_sq.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sq.c,v 1.42 2011/07/01 18:53:47 dyoung Exp $ */ +/* $NetBSD: if_sq.c,v 1.43 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright (c) 2001 Rafal K. Boni @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.42 2011/07/01 18:53:47 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sq.c,v 1.43 2012/02/02 19:43:00 tls Exp $"); #include <sys/param.h> @@ -927,10 +927,8 @@ sq_intr(void *arg) handled++; } -#if NRND > 0 if (handled) rnd_add_uint32(&sc->rnd_source, stat); -#endif return handled; } diff --git a/sys/arch/sgimips/hpc/sqvar.h b/sys/arch/sgimips/hpc/sqvar.h index cef219c5d86..b5945a5ab70 100644 --- a/sys/arch/sgimips/hpc/sqvar.h +++ b/sys/arch/sgimips/hpc/sqvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sqvar.h,v 1.13 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: sqvar.h,v 1.14 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright (c) 2001 Rafal K. Boni @@ -30,14 +30,10 @@ #ifndef _ARCH_SGIMIPS_HPC_SQVAR_H_ #define _ARCH_SGIMIPS_HPC_SQVAR_H_ -#include "rnd.h" - #include <sys/queue.h> #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sgimips/hpc/hpcvar.h> #include <sgimips/hpc/hpcreg.h> @@ -156,9 +152,7 @@ struct sq_softc { struct evcnt sq_intrcnt; /* count interrupts */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif struct hpc_values *hpc_regs; /* HPC register definitions */ int sq_trace_idx; diff --git a/sys/arch/sgimips/mace/if_mec.c b/sys/arch/sgimips/mace/if_mec.c index 8775365559a..3e5da39588f 100644 --- a/sys/arch/sgimips/mace/if_mec.c +++ b/sys/arch/sgimips/mace/if_mec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_mec.c,v 1.47 2011/11/19 22:51:20 tls Exp $ */ +/* $NetBSD: if_mec.c,v 1.48 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved. @@ -61,10 +61,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.47 2011/11/19 22:51:20 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.48 2012/02/02 19:43:00 tls Exp $"); #include "opt_ddb.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -77,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.47 2011/11/19 22:51:20 tls Exp $"); #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -316,9 +313,7 @@ struct mec_softc { int sc_rxptr; /* next ready RX buffer */ -#if NRND > 0 krndsource_t sc_rnd_source; /* random source */ -#endif #ifdef MEC_EVENT_COUNTERS struct evcnt sc_ev_txpkts; /* TX packets queued total */ struct evcnt sc_ev_txdpad; /* TX packets padded in txdesc buf */ @@ -624,10 +619,8 @@ mec_attach(device_t parent, device_t self, void *aux) /* establish interrupt */ cpu_intr_establish(maa->maa_intr, maa->maa_intrmask, mec_intr, sc); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif #ifdef MEC_EVENT_COUNTERS evcnt_attach_dynamic(&sc->sc_ev_txpkts , EVCNT_TYPE_MISC, @@ -1619,10 +1612,8 @@ mec_intr(void *arg) mec_start(ifp); } -#if NRND > 0 if (handled) rnd_add_uint32(&sc->sc_rnd_source, statreg); -#endif return handled; } diff --git a/sys/arch/sh3/dev/sci.c b/sys/arch/sh3/dev/sci.c index ab142568bd5..0538f52df47 100644 --- a/sys/arch/sh3/dev/sci.c +++ b/sys/arch/sh3/dev/sci.c @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.53 2011/04/24 16:26:57 rmind Exp $ */ +/* $NetBSD: sci.c,v 1.54 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.53 2011/04/24 16:26:57 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.54 2012/02/02 19:43:00 tls Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -1263,7 +1263,7 @@ sciintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_SCI) +#ifdef RND_SCI rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif diff --git a/sys/arch/sh3/dev/scif.c b/sys/arch/sh3/dev/scif.c index 6c32dfb1866..92e2b7a24b2 100644 --- a/sys/arch/sh3/dev/scif.c +++ b/sys/arch/sh3/dev/scif.c @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.60 2011/04/24 16:26:57 rmind Exp $ */ +/* $NetBSD: scif.c,v 1.61 2012/02/02 19:43:00 tls Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.60 2011/04/24 16:26:57 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.61 2012/02/02 19:43:00 tls Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -1401,7 +1401,7 @@ scifintr(void *arg) /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_SCIF) +#ifdef RND_SCIF rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif diff --git a/sys/arch/sun2/dev/if_ec.c b/sys/arch/sun2/dev/if_ec.c index 0237ba2e716..b6aae6dedd9 100644 --- a/sys/arch/sun2/dev/if_ec.c +++ b/sys/arch/sun2/dev/if_ec.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ec.c,v 1.19 2011/11/19 22:51:21 tls Exp $ */ +/* $NetBSD: if_ec.c,v 1.20 2012/02/02 19:43:00 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -34,11 +34,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.19 2011/11/19 22:51:21 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.20 2012/02/02 19:43:00 tls Exp $"); #include "opt_inet.h" #include "opt_ns.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -49,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ec.c,v 1.19 2011/11/19 22:51:21 tls Exp $"); #include <sys/syslog.h> #include <sys/device.h> #include <sys/endian.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -101,9 +98,7 @@ struct ec_softc { u_char sc_colliding; /* nonzero if the net is colliding */ uint32_t sc_backoff_seed; /* seed for the backoff PRNG */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* Macros to read and write the CSR. */ @@ -249,10 +244,8 @@ ec_attach(device_t parent, device_t self, void *aux) bus_intr_establish(mbma->mbma_bustag, mbma->mbma_pri, IPL_NET, 0, ec_intr, sc); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif } /* diff --git a/sys/arch/x68k/dev/fd.c b/sys/arch/x68k/dev/fd.c index 5d41b3141e9..94258e25c9a 100644 --- a/sys/arch/x68k/dev/fd.c +++ b/sys/arch/x68k/dev/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.95 2011/11/19 22:51:21 tls Exp $ */ +/* $NetBSD: fd.c,v 1.96 2012/02/02 19:43:01 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,9 +64,8 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.95 2011/11/19 22:51:21 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.96 2012/02/02 19:43:01 tls Exp $"); -#include "rnd.h" #include "opt_ddb.h" #include "opt_m68k_arch.h" @@ -88,9 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.95 2011/11/19 22:51:21 tls Exp $"); #include <sys/syslog.h> #include <sys/queue.h> #include <sys/fdio.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <uvm/uvm_extern.h> @@ -244,9 +241,7 @@ struct fd_softc { #define SEC_P01 0x01 /* second part */ #define SEC_P11 0x03 /* both part */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* floppy driver configuration */ @@ -605,10 +600,8 @@ fdattach(device_t parent, device_t self, void *aux) */ mountroothook_establish(fd_mountroot_hook, fd->sc_dev); -#if NRND > 0 rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev), RND_TYPE_DISK, 0); -#endif } inline struct fd_type * @@ -737,9 +730,7 @@ fdfinish(struct fd_softc *fd, struct buf *bp) bp->b_resid = fd->sc_bcount; fd->sc_skip = 0; -#if NRND > 0 rnd_add_uint32(&fd->rnd_source, bp->b_blkno); -#endif biodone(bp); /* turn off motor 5s from now */ diff --git a/sys/arch/x86/pci/fwhrng.c b/sys/arch/x86/pci/fwhrng.c index 58169039052..0f646e3fa20 100644 --- a/sys/arch/x86/pci/fwhrng.c +++ b/sys/arch/x86/pci/fwhrng.c @@ -1,4 +1,4 @@ -/* $NetBSD: fwhrng.c,v 1.4 2011/11/19 22:51:21 tls Exp $ */ +/* $NetBSD: fwhrng.c,v 1.5 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -29,13 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.4 2011/11/19 22:51:21 tls Exp $"); - -#include "rnd.h" - -#if NRND == 0 -#error fwhrng requires rnd pseudo-device -#endif +__KERNEL_RCSID(0, "$NetBSD: fwhrng.c,v 1.5 2012/02/02 19:43:01 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/arch/x86/x86/ipmi.c b/sys/arch/x86/x86/ipmi.c index 8ec1073475d..6be5ab0de42 100644 --- a/sys/arch/x86/x86/ipmi.c +++ b/sys/arch/x86/x86/ipmi.c @@ -1,4 +1,4 @@ -/* $NetBSD: ipmi.c,v 1.51 2012/01/10 15:23:11 njoly Exp $ */ +/* $NetBSD: ipmi.c,v 1.52 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -52,7 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.51 2012/01/10 15:23:11 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.52 2012/02/02 19:43:01 tls Exp $"); #include <sys/types.h> #include <sys/param.h> @@ -66,6 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.51 2012/01/10 15:23:11 njoly Exp $"); #include <sys/kthread.h> #include <sys/bus.h> #include <sys/intr.h> +#include <sys/rnd.h> #include <x86/smbiosvar.h> @@ -87,13 +88,15 @@ struct ipmi_sensor { sysmon_envsys_lim_t i_limits, i_deflims; uint32_t i_props, i_defprops; SLIST_ENTRY(ipmi_sensor) i_list; + int32_t i_prevval; /* feed rnd source on change */ + krndsource_t i_rnd; }; int ipmi_nintr; int ipmi_dbg = 0; int ipmi_enabled = 0; -#define SENSOR_REFRESH_RATE (5 * hz) +#define SENSOR_REFRESH_RATE (hz / 2) #define SMBIOS_TYPE_IPMI 0x26 @@ -1499,6 +1502,10 @@ ipmi_convert_sensor(uint8_t *reading, struct ipmi_sensor *psensor) val = 0; break; } + if (val != psensor->i_prevval) { + rnd_add_uint32(&psensor->i_rnd, val); + psensor->i_prevval = val; + } return val; } @@ -1852,6 +1859,22 @@ add_child_sensors(struct ipmi_softc *sc, uint8_t *psdr, int count, ipmi_is_dupname(psensor->i_envdesc)); } + /* + * Add entropy source. + */ + switch (psensor->i_envtype) { + case ENVSYS_STEMP: + case ENVSYS_SFANRPM: + rnd_attach_source(&psensor->i_rnd, + psensor->i_envdesc, + RND_TYPE_ENV, 0); + break; + default: /* XXX intrusion sensors? */ + rnd_attach_source(&psensor->i_rnd, + psensor->i_envdesc, + RND_TYPE_POWER, 0); + } + dbg_printf(5, "add sensor:%.4x %.2x:%d ent:%.2x:%.2x %s\n", s1->sdrhdr.record_id, s1->sensor_type, typ, s1->entity_id, s1->entity_instance, diff --git a/sys/arch/x86/x86/via_padlock.c b/sys/arch/x86/x86/via_padlock.c index 0340c1818f0..aa0d7b96a50 100644 --- a/sys/arch/x86/x86/via_padlock.c +++ b/sys/arch/x86/x86/via_padlock.c @@ -1,5 +1,5 @@ /* $OpenBSD: via.c,v 1.8 2006/11/17 07:47:56 tom Exp $ */ -/* $NetBSD: via_padlock.c,v 1.20 2012/01/17 03:39:33 jakllsch Exp $ */ +/* $NetBSD: via_padlock.c,v 1.21 2012/02/02 19:43:01 tls Exp $ */ /*- * Copyright (c) 2003 Jason Wright @@ -20,14 +20,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.20 2012/01/17 03:39:33 jakllsch Exp $"); - -#ifdef _KERNEL_OPT -# include "rnd.h" -# if NRND == 0 -# error padlock requires rnd pseudo-devices -# endif -#endif +__KERNEL_RCSID(0, "$NetBSD: via_padlock.c,v 1.21 2012/02/02 19:43:01 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/arch/xen/include/xbdvar.h b/sys/arch/xen/include/xbdvar.h index 28fe36e418c..101aff9fc54 100644 --- a/sys/arch/xen/include/xbdvar.h +++ b/sys/arch/xen/include/xbdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: xbdvar.h,v 1.13 2011/11/19 22:51:21 tls Exp $ */ +/* $NetBSD: xbdvar.h,v 1.14 2012/02/02 19:43:01 tls Exp $ */ /* * @@ -39,9 +39,7 @@ struct xbd_softc { struct dk_intf *sc_di; /* pseudo-disk interface */ struct simplelock sc_slock; /* our lock */ int sc_shutdown; /* about to be removed */ -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; struct xbd_attach_args { diff --git a/sys/arch/xen/xen/if_xennet_xenbus.c b/sys/arch/xen/xen/if_xennet_xenbus.c index 4ab6bd1bdc7..2de6bfaa976 100644 --- a/sys/arch/xen/xen/if_xennet_xenbus.c +++ b/sys/arch/xen/xen/if_xennet_xenbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xennet_xenbus.c,v 1.57 2012/01/04 10:48:24 cherry Exp $ */ +/* $NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -85,11 +85,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.57 2012/01/04 10:48:24 cherry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $"); #include "opt_xen.h" #include "opt_nfs_boot.h" -#include "rnd.h" #include <sys/param.h> #include <sys/device.h> @@ -98,9 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.57 2012/01/04 10:48:24 cherry #include <sys/proc.h> #include <sys/systm.h> #include <sys/intr.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -204,9 +201,7 @@ struct xennet_xenbus_softc { unsigned long sc_rx_feature; #define FEATURE_RX_FLIP 0 #define FEATURE_RX_COPY 1 -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; #define SC_NLIVEREQ(sc) ((sc)->sc_rx_ring.req_prod_pvt - \ (sc)->sc_rx_ring.sring->rsp_prod) @@ -397,10 +392,8 @@ xennet_xenbus_attach(device_t parent, device_t self, void *aux) return; } -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif if (!pmf_device_register(self, xennet_xenbus_suspend, xennet_xenbus_resume)) @@ -439,10 +432,8 @@ xennet_xenbus_detach(device_t self, int flags) ether_ifdetach(ifp); if_detach(ifp); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->sc_rnd_source); -#endif while (xengnt_status(sc->sc_tx_ring_gntref)) { tsleep(xennet_xenbus_detach, PRIBIO, "xnet_txref", hz/2); @@ -991,9 +982,7 @@ xennet_handler(void *arg) xennet_tx_complete(sc); -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, sc->sc_tx_ring.req_prod_pvt); -#endif again: DPRINTFN(XEDB_EVENT, ("xennet_handler prod %d cons %d\n", @@ -1166,9 +1155,7 @@ xennet_start(struct ifnet *ifp) DPRINTFN(XEDB_FOLLOW, ("%s: xennet_start()\n", device_xname(sc->sc_dev))); -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, sc->sc_tx_ring.req_prod_pvt); -#endif xennet_tx_complete(sc); diff --git a/sys/arch/xen/xen/pciback.c b/sys/arch/xen/xen/pciback.c index 2894c721a85..3ec6bf61a33 100644 --- a/sys/arch/xen/xen/pciback.c +++ b/sys/arch/xen/xen/pciback.c @@ -1,4 +1,4 @@ -/* $NetBSD: pciback.c,v 1.6 2011/12/07 15:47:43 cegger Exp $ */ +/* $NetBSD: pciback.c,v 1.7 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2009 Manuel Bouyer. @@ -26,10 +26,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.6 2011/12/07 15:47:43 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.7 2012/02/02 19:43:01 tls Exp $"); #include "opt_xen.h" -#include "rnd.h" + #include <sys/types.h> #include <sys/param.h> diff --git a/sys/arch/xen/xen/xbd_xenbus.c b/sys/arch/xen/xen/xbd_xenbus.c index fa8640927de..e48a1bbd625 100644 --- a/sys/arch/xen/xen/xbd_xenbus.c +++ b/sys/arch/xen/xen/xbd_xenbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: xbd_xenbus.c,v 1.51 2012/01/27 19:48:39 para Exp $ */ +/* $NetBSD: xbd_xenbus.c,v 1.52 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -50,10 +50,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.51 2012/01/27 19:48:39 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.52 2012/02/02 19:43:01 tls Exp $"); #include "opt_xen.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/buf.h> @@ -73,9 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.51 2012/01/27 19:48:39 para Exp $") #include <uvm/uvm.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <xen/hypervisor.h> #include <xen/evtchn.h> @@ -154,9 +152,7 @@ struct xbd_xenbus_softc { u_long sc_info; /* VDISK_* */ u_long sc_handle; /* from backend */ int sc_cache_flush; /* backend supports BLKIF_OP_FLUSH_DISKCACHE */ -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; #if 0 @@ -305,10 +301,8 @@ xbd_xenbus_attach(device_t parent, device_t self, void *aux) return; } -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_DISK, RND_FLAG_NO_COLLECT | RND_FLAG_NO_ESTIMATE); -#endif if (!pmf_device_register(self, xbd_xenbus_suspend, xbd_xenbus_resume)) aprint_error_dev(self, "couldn't establish power handler\n"); @@ -370,10 +364,8 @@ xbd_xenbus_detach(device_t dev, int flags) /* detach disk */ disk_detach(&sc->sc_dksc.sc_dkdev); disk_destroy(&sc->sc_dksc.sc_dkdev); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->sc_rnd_source); -#endif } hypervisor_mask_event(sc->sc_evtchn); @@ -720,10 +712,8 @@ next: disk_unbusy(&sc->sc_dksc.sc_dkdev, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, bp->b_blkno); -#endif biodone(bp); SLIST_INSERT_HEAD(&sc->sc_xbdreq_head, xbdreq, req_next); } diff --git a/sys/arch/xen/xen/xpci_xenbus.c b/sys/arch/xen/xen/xpci_xenbus.c index b2647a06377..1ad1ac98bea 100644 --- a/sys/arch/xen/xen/xpci_xenbus.c +++ b/sys/arch/xen/xen/xpci_xenbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: xpci_xenbus.c,v 1.9 2011/12/07 15:47:43 cegger Exp $ */ +/* $NetBSD: xpci_xenbus.c,v 1.10 2012/02/02 19:43:01 tls Exp $ */ /* * Copyright (c) 2009 Manuel Bouyer. @@ -26,10 +26,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.9 2011/12/07 15:47:43 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xpci_xenbus.c,v 1.10 2012/02/02 19:43:01 tls Exp $"); #include "opt_xen.h" -#include "rnd.h" + #include <sys/types.h> #include <sys/param.h> diff --git a/sys/conf/files b/sys/conf/files index 0d7966e125f..d22f1bfe43b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1042 2012/01/31 05:08:14 macallan Exp $ +# $NetBSD: files,v 1.1043 2012/02/02 19:43:01 tls Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20100430 @@ -1449,8 +1449,6 @@ file dev/mm.c file dev/mulaw.c mulaw needs-flag file dev/nullcons_subr.c nullcons needs-flag file dev/radio.c radio needs-flag -file dev/rnd.c -file dev/rndpool.c file dev/rndpseudo.c rnd needs-flag file dev/sequencer.c sequencer needs-flag file dev/video.c video needs-flag @@ -1510,6 +1508,8 @@ file kern/kern_prot.c file kern/kern_ras.c file kern/kern_rate.c file kern/kern_resource.c +file kern/kern_rndpool.c +file kern/kern_rndq.c file kern/kern_runq.c file kern/kern_rwlock.c file kern/kern_rwlock_obj.c diff --git a/sys/dev/acpi/acpi_tz.c b/sys/dev/acpi/acpi_tz.c index ed47296618c..c976e5a4899 100644 --- a/sys/dev/acpi/acpi_tz.c +++ b/sys/dev/acpi/acpi_tz.c @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_tz.c,v 1.84 2011/10/02 22:20:33 jmcneill Exp $ */ +/* $NetBSD: acpi_tz.c,v 1.85 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca> @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.84 2011/10/02 22:20:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.85 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.84 2011/10/02 22:20:33 jmcneill Exp $" #include <sys/module.h> #include <sys/systm.h> #include <sys/kmem.h> +#include <sys/rnd.h> #include <dev/acpi/acpireg.h> #include <dev/acpi/acpivar.h> @@ -95,6 +96,7 @@ struct acpitz_zone { uint32_t fanmin; uint32_t fanmax; uint32_t fancurrent; + uint32_t fanprev; }; struct acpitz_softc { @@ -111,6 +113,8 @@ struct acpitz_softc { bool sc_have_fan; struct cpu_info **sc_psl; size_t sc_psl_size; + krndsource_t sc_tmp_rs; + krndsource_t sc_fan_rs; }; static int acpitz_match(device_t, cfdata_t, void *); @@ -163,6 +167,8 @@ acpitz_attach(device_t parent, device_t self, void *aux) { struct acpitz_softc *sc = device_private(self); struct acpi_attach_args *aa = aux; + char tmpname[sizeof(sc->sc_tmp_rs.name)]; + char fanname[sizeof(sc->sc_fan_rs.name)]; ACPI_INTEGER val; ACPI_STATUS rv; @@ -211,6 +217,20 @@ acpitz_attach(device_t parent, device_t self, void *aux) acpitz_init_envsys(self); + if (sc->sc_have_fan) { + snprintf(fanname, sizeof(fanname), "%s-fan", + device_xname(self)); + snprintf(tmpname, sizeof(tmpname), "%s-tmp", + device_xname(self)); + rnd_attach_source(&sc->sc_fan_rs, + fanname, RND_TYPE_ENV, 0); + rnd_attach_source(&sc->sc_tmp_rs, + tmpname, RND_TYPE_ENV, 0); + } else { + rnd_attach_source(&sc->sc_tmp_rs, + device_xname(self), RND_TYPE_ENV, 0); + } + callout_schedule(&sc->sc_callout, sc->sc_zone.tzp * hz / 10); } @@ -226,6 +246,11 @@ acpitz_detach(device_t self, int flags) callout_halt(&sc->sc_callout, NULL); callout_destroy(&sc->sc_callout); + rnd_detach_source(&sc->sc_tmp_rs); + if (sc->sc_have_fan) { + rnd_detach_source(&sc->sc_fan_rs); + } + pmf_device_deregister(self); acpi_deregister_notify(sc->sc_node); @@ -295,10 +320,19 @@ acpitz_get_status(void *opaque) if (sc->sc_first != false) sc->sc_zone.prevtmp = tmp; /* XXX: Sanity check? */ - if (acpitz_get_fanspeed(dv, &fmin, &fmax, &fcurrent) == 0) { + if (sc->sc_zone.prevtmp != sc->sc_zone.tmp) { + rnd_add_uint32(&sc->sc_tmp_rs, sc->sc_zone.tmp); + } - if (fcurrent != ATZ_TMP_INVALID) + if (acpitz_get_fanspeed(dv, &fmin, &fmax, &fcurrent) == 0) { + if (fcurrent != ATZ_TMP_INVALID) { + sc->sc_zone.fanprev = sc->sc_zone.fancurrent; sc->sc_zone.fancurrent = fcurrent; + if (sc->sc_zone.fanprev != sc->sc_zone.fancurrent) { + rnd_add_uint32(&sc->sc_fan_rs, + sc->sc_zone.fancurrent); + } + } } sc->sc_temp_sensor.state = ENVSYS_SVALID; diff --git a/sys/dev/acpi/fdc_acpi.c b/sys/dev/acpi/fdc_acpi.c index 305b7da892b..b5a72191a9f 100644 --- a/sys/dev/acpi/fdc_acpi.c +++ b/sys/dev/acpi/fdc_acpi.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_acpi.c,v 1.41 2010/08/07 09:55:59 jruoho Exp $ */ +/* $NetBSD: fdc_acpi.c,v 1.42 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca> @@ -31,16 +31,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.41 2010/08/07 09:55:59 jruoho Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdc_acpi.c,v 1.42 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/device.h> #include <sys/disk.h> #include <sys/systm.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/acpi/acpireg.h> #include <dev/acpi/acpivar.h> diff --git a/sys/dev/ata/ld_ataraid.c b/sys/dev/ata/ld_ataraid.c index 2243f83f628..3447f385d11 100644 --- a/sys/dev/ata/ld_ataraid.c +++ b/sys/dev/ata/ld_ataraid.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $ */ +/* $NetBSD: ld_ataraid.c,v 1.39 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -47,10 +47,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.39 2012/02/02 19:43:02 tls Exp $"); #include "bio.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/systm.h> @@ -66,9 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_ataraid.c,v 1.38 2011/06/12 03:35:52 rmind Exp $" #include <sys/malloc.h> #include <sys/vnode.h> #include <sys/kauth.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #if NBIO > 0 #include <dev/ata/atavar.h> #include <dev/ata/atareg.h> diff --git a/sys/dev/ata/wd.c b/sys/dev/ata/wd.c index 649f25e0a83..e253fded7eb 100644 --- a/sys/dev/ata/wd.c +++ b/sys/dev/ata/wd.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $ */ +/* $NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved. @@ -54,12 +54,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.392 2012/02/02 19:43:02 tls Exp $"); #include "opt_ata.h" -#include "rnd.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -78,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.391 2012/01/24 20:04:07 jakllsch Exp $"); #include <sys/proc.h> #include <sys/reboot.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/intr.h> #include <sys/bus.h> @@ -391,10 +387,8 @@ wdattach(device_t parent, device_t self, void *aux) disk_init(&wd->sc_dk, device_xname(wd->sc_dev), &wddkdriver); disk_attach(&wd->sc_dk); wd->sc_wdc_bio.lp = wd->sc_dk.dk_label; -#if NRND > 0 rnd_attach_source(&wd->rnd_source, device_xname(wd->sc_dev), RND_TYPE_DISK, 0); -#endif /* Discover wedges on this disk. */ dkwedge_discover(&wd->sc_dk); @@ -462,10 +456,8 @@ wddetach(device_t self, int flags) pmf_device_deregister(self); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif callout_destroy(&sc->sc_restart_ch); @@ -829,9 +821,7 @@ noerror: if ((wd->sc_wdc_bio.flags & ATA_CORR) || wd->retries > 0) } disk_unbusy(&wd->sc_dk, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&wd->rnd_source, bp->b_blkno); -#endif /* XXX Yuck, but we don't want to increment openings in this case */ if (__predict_false(bp->b_iodone == wd_split_mod15_write)) biodone(bp); diff --git a/sys/dev/ata/wdvar.h b/sys/dev/ata/wdvar.h index fea02e9ffdd..e85b7ea5a45 100644 --- a/sys/dev/ata/wdvar.h +++ b/sys/dev/ata/wdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: wdvar.h,v 1.39 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: wdvar.h,v 1.40 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -31,6 +31,8 @@ #include "opt_wd_softbadsect.h" #endif +#include <sys/rnd.h> + struct wd_softc { /* General disk infos */ device_t sc_dev; @@ -66,9 +68,7 @@ struct wd_softc { SLIST_HEAD(, disk_badsectors) sc_bslist; u_int sc_bscount; #endif -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define sc_drive sc_wdc_bio.drive diff --git a/sys/dev/cardbus/if_fxp_cardbus.c b/sys/dev/cardbus/if_fxp_cardbus.c index 8244373c2cf..fac70a3cf3a 100644 --- a/sys/dev/cardbus/if_fxp_cardbus.c +++ b/sys/dev/cardbus/if_fxp_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fxp_cardbus.c,v 1.49 2011/09/05 04:36:50 msaitoh Exp $ */ +/* $NetBSD: if_fxp_cardbus.c,v 1.50 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,10 +34,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.49 2011/09/05 04:36:50 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.50 2012/02/02 19:43:02 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -49,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_fxp_cardbus.c,v 1.49 2011/09/05 04:36:50 msaitoh #include <sys/errno.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> diff --git a/sys/dev/cardbus/if_rtk_cardbus.c b/sys/dev/cardbus/if_rtk_cardbus.c index 26309c9af2f..0ec5b65f4c7 100644 --- a/sys/dev/cardbus/if_rtk_cardbus.c +++ b/sys/dev/cardbus/if_rtk_cardbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_rtk_cardbus.c,v 1.46 2011/08/01 11:20:27 drochner Exp $ */ +/* $NetBSD: if_rtk_cardbus.c,v 1.47 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 2000 Masanori Kanaoka @@ -36,10 +36,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.46 2011/08/01 11:20:27 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.47 2012/02/02 19:43:02 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -61,9 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_rtk_cardbus.c,v 1.46 2011/08/01 11:20:27 drochner #include <netinet/if_inarp.h> #endif -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/cardbus/rbus_ppb.c b/sys/dev/cardbus/rbus_ppb.c index efdc59eb7e2..4fdd8cec4f9 100644 --- a/sys/dev/cardbus/rbus_ppb.c +++ b/sys/dev/cardbus/rbus_ppb.c @@ -1,4 +1,4 @@ -/* $NetBSD: rbus_ppb.c,v 1.41 2011/08/01 11:20:28 drochner Exp $ */ +/* $NetBSD: rbus_ppb.c,v 1.42 2012/02/02 19:43:02 tls Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rbus_ppb.c,v 1.41 2011/08/01 11:20:28 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rbus_ppb.c,v 1.42 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: rbus_ppb.c,v 1.41 2011/08/01 11:20:28 drochner Exp $ #include <sys/device.h> #include <sys/kmem.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <machine/endian.h> diff --git a/sys/dev/gpib/rd.c b/sys/dev/gpib/rd.c index 069179d9b81..5352e09af21 100644 --- a/sys/dev/gpib/rd.c +++ b/sys/dev/gpib/rd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rd.c,v 1.29 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: rd.c,v 1.30 2012/02/02 19:43:02 tls Exp $ */ /*- * Copyright (c) 1996-2003 The NetBSD Foundation, Inc. @@ -72,9 +72,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.29 2011/11/19 22:51:22 tls Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.30 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -91,9 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.29 2011/11/19 22:51:22 tls Exp $"); #include <sys/proc.h> #include <sys/stat.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/gpib/gpibvar.h> #include <dev/gpib/cs80busvar.h> @@ -142,9 +138,7 @@ struct rd_softc { struct callout sc_restart_ch; -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define RDUNIT(dev) DISKUNIT(dev) @@ -412,13 +406,11 @@ rdattach(device_t parent, device_t self, void *aux) if (rddebug & RDB_ERROR) rderrthresh = 0; #endif -#if NRND > 0 /* * attach the device into the random source list */ rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_DISK, 0); -#endif } /* @@ -798,9 +790,7 @@ rdintr(struct rd_softc *sc) } if (rdfinish(sc, bp) != NULL) rdustart(sc); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, bp->b_blkno); -#endif } /* diff --git a/sys/dev/i2o/ld_iop.c b/sys/dev/i2o/ld_iop.c index 366e1f26fe1..21df9ad61f9 100644 --- a/sys/dev/i2o/ld_iop.c +++ b/sys/dev/i2o/ld_iop.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_iop.c,v 1.33 2008/12/15 18:35:48 mhitch Exp $ */ +/* $NetBSD: ld_iop.c,v 1.34 2012/02/02 19:43:02 tls Exp $ */ /*- * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -36,9 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.33 2008/12/15 18:35:48 mhitch Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.34 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_iop.c,v 1.33 2008/12/15 18:35:48 mhitch Exp $"); #include <sys/dkio.h> #include <sys/disk.h> #include <sys/proc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index d43bc81abc5..0142fef78b5 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $NetBSD: am7990.c,v 1.73 2010/04/05 07:19:33 joerg Exp $ */ +/* $NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -65,9 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.73 2010/04/05 07:19:33 joerg Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.74 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -78,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: am7990.c,v 1.73 2010/04/05 07:19:33 joerg Exp $"); #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -449,9 +445,7 @@ am7990_intr(void *arg) if (isr & LE_C0_TINT) am7990_tint(sc); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, isr); -#endif return (1); } diff --git a/sys/dev/ic/am79900.c b/sys/dev/ic/am79900.c index 4be36bb6193..ae9646a7314 100644 --- a/sys/dev/ic/am79900.c +++ b/sys/dev/ic/am79900.c @@ -1,4 +1,4 @@ -/* $NetBSD: am79900.c,v 1.22 2010/04/05 07:19:33 joerg Exp $ */ +/* $NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -103,9 +103,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.22 2010/04/05 07:19:33 joerg Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.23 2012/02/02 19:43:02 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -116,9 +114,7 @@ __KERNEL_RCSID(0, "$NetBSD: am79900.c,v 1.22 2010/04/05 07:19:33 joerg Exp $"); #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -470,9 +466,7 @@ am79900_intr(void *arg) if (isr & LE_C0_TINT) am79900_tint(sc); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, isr); -#endif return (1); } diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index db1554e35eb..f1d8d7b01b2 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.303 2011/11/27 18:17:08 jakllsch Exp $ */ +/* $NetBSD: com.c,v 1.304 2012/02/02 19:43:02 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.303 2011/11/27 18:17:08 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.304 2012/02/02 19:43:02 tls Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -76,7 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.303 2011/11/27 18:17:08 jakllsch Exp $"); #include "opt_ntp.h" #include "rnd.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -554,7 +554,7 @@ fifodone: sc->sc_si = softint_establish(SOFTINT_SERIAL, comsoft, sc); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -684,7 +684,7 @@ com_detach(device_t self, int flags) /* Unhook the soft interrupt handler. */ softint_disestablish(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); #endif @@ -2070,7 +2070,7 @@ again: do { /* Wake up the poller. */ softint_schedule(sc->sc_si); -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM rnd_add_uint32(&sc->rnd_source, iir | lsr); #endif diff --git a/sys/dev/ic/comvar.h b/sys/dev/ic/comvar.h index 52e804dbe74..2ef880de278 100644 --- a/sys/dev/ic/comvar.h +++ b/sys/dev/ic/comvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: comvar.h,v 1.72 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: comvar.h,v 1.73 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. @@ -36,7 +36,7 @@ #include "opt_com.h" #include "opt_kgdb.h" -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM #include <sys/rnd.h> #endif @@ -227,7 +227,7 @@ struct com_softc { struct pps_state sc_pps_state; /* pps state */ -#if NRND > 0 && defined(RND_COM) +#ifdef RND_COM krndsource_t rnd_source; #endif kmutex_t sc_lock; diff --git a/sys/dev/ic/cs89x0.c b/sys/dev/ic/cs89x0.c index 237bfb5a3dd..e92714dc9c6 100644 --- a/sys/dev/ic/cs89x0.c +++ b/sys/dev/ic/cs89x0.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs89x0.c,v 1.32 2010/11/13 13:52:00 uebayasi Exp $ */ +/* $NetBSD: cs89x0.c,v 1.33 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2004 Christopher Gilbert @@ -212,7 +212,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.32 2010/11/13 13:52:00 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.33 2012/02/02 19:43:03 tls Exp $"); #include "opt_inet.h" @@ -226,10 +226,7 @@ __KERNEL_RCSID(0, "$NetBSD: cs89x0.c,v 1.32 2010/11/13 13:52:00 uebayasi Exp $") #include <sys/ioctl.h> #include <sys/errno.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> @@ -491,10 +488,8 @@ cs_attach(struct cs_softc *sc, u_int8_t *enaddr, int *media, if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif sc->sc_cfgflags |= CFGFLG_ATTACHED; if (pmf_device_register1(sc->sc_dev, NULL, NULL, cs_shutdown)) @@ -519,9 +514,7 @@ cs_detach(struct cs_softc *sc) struct ifnet *ifp = &sc->sc_ethercom.ec_if; if (sc->sc_cfgflags & CFGFLG_ATTACHED) { -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); sc->sc_cfgflags &= ~CFGFLG_ATTACHED; @@ -1390,9 +1383,7 @@ cs_intr(void *arg) { struct cs_softc *sc = arg; u_int16_t Event; -#if NRND > 0 u_int16_t rndEvent; -#endif /*printf("cs_intr %p\n", sc);*/ /* Ignore any interrupts that happen while the chip is being reset */ @@ -1411,9 +1402,7 @@ cs_intr(void *arg) if ((Event & REG_NUM_MASK) == 0 || Event == 0xffff) return 0; /* not ours */ -#if NRND > 0 rndEvent = Event; -#endif /* Process all the events in the Interrupt Status Queue */ while ((Event & REG_NUM_MASK) != 0 && Event != 0xffff) { @@ -1446,9 +1435,7 @@ cs_intr(void *arg) } /* have handled the interrupt */ -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, rndEvent); -#endif return 1; } diff --git a/sys/dev/ic/cs89x0var.h b/sys/dev/ic/cs89x0var.h index 6d433d83530..9453d7ea6ea 100644 --- a/sys/dev/ic/cs89x0var.h +++ b/sys/dev/ic/cs89x0var.h @@ -1,4 +1,4 @@ -/* $NetBSD: cs89x0var.h,v 1.15 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: cs89x0var.h,v 1.16 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright 1997 @@ -104,9 +104,7 @@ struct cs_softc { int eeprom_size; /* how large is the eeprom (in bytes) */ u_int16_t *eeprom_data; /* copy of the eeprom data */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif /* power management */ int (*sc_enable)(struct cs_softc *); diff --git a/sys/dev/ic/dp8390.c b/sys/dev/ic/dp8390.c index b00fc84daa9..a29cc3853d4 100644 --- a/sys/dev/ic/dp8390.c +++ b/sys/dev/ic/dp8390.c @@ -1,4 +1,4 @@ -/* $NetBSD: dp8390.c,v 1.79 2010/04/11 09:58:36 tsutsui Exp $ */ +/* $NetBSD: dp8390.c,v 1.80 2012/02/02 19:43:03 tls Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -14,11 +14,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.79 2010/04/11 09:58:36 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.80 2012/02/02 19:43:03 tls Exp $"); #include "opt_ipkdb.h" #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -29,9 +28,7 @@ __KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.79 2010/04/11 09:58:36 tsutsui Exp $"); #include <sys/socket.h> #include <sys/syslog.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -156,10 +153,8 @@ dp8390_config(struct dp8390_softc *sc) if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif /* The attach is successful. */ sc->sc_flags |= DP8390_ATTACHED; @@ -627,9 +622,7 @@ dp8390_intr(void *arg) bus_space_handle_t regh = sc->sc_regh; struct ifnet *ifp = &sc->sc_ec.ec_if; uint8_t isr; -#if NRND > 0 uint8_t rndisr; -#endif if (sc->sc_enabled == 0 || !device_is_active(sc->sc_dev)) @@ -645,9 +638,7 @@ dp8390_intr(void *arg) if (isr == 0) return 0; -#if NRND > 0 rndisr = isr; -#endif /* Loop until there are no more new interrupts. */ for (;;) { @@ -825,9 +816,7 @@ dp8390_intr(void *arg) } out: -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, rndisr); -#endif return 1; } @@ -1258,9 +1247,7 @@ dp8390_detach(struct dp8390_softc *sc, int flags) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/dp8390var.h b/sys/dev/ic/dp8390var.h index daf23afd520..635e2ecb4d1 100644 --- a/sys/dev/ic/dp8390var.h +++ b/sys/dev/ic/dp8390var.h @@ -1,4 +1,4 @@ -/* $NetBSD: dp8390var.h,v 1.31 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: dp8390var.h,v 1.32 2012/02/02 19:43:03 tls Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -13,10 +13,7 @@ * the author assume any responsibility for damages incurred with its use. */ -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif /* * We include MII glue here -- some DP8390 compatible chips have @@ -71,9 +68,7 @@ struct dp8390_softc { int sc_enabled; /* boolean; power enabled on interface */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif int (*test_mem)(struct dp8390_softc *); void (*init_card)(struct dp8390_softc *); diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c index 8574dee2da7..5f98788e123 100644 --- a/sys/dev/ic/elink3.c +++ b/sys/dev/ic/elink3.c @@ -1,4 +1,4 @@ -/* $NetBSD: elink3.c,v 1.131 2010/04/05 07:19:34 joerg Exp $ */ +/* $NetBSD: elink3.c,v 1.132 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -62,10 +62,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.131 2010/04/05 07:19:34 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.132 2012/02/02 19:43:03 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -78,9 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: elink3.c,v 1.131 2010/04/05 07:19:34 joerg Exp $"); #include <sys/syslog.h> #include <sys/select.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -490,10 +487,8 @@ epconfig(struct ep_softc *sc, u_short chipset, u_int8_t *enaddr) GO_WINDOW(1); /* Window 1 is operating window */ -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif sc->tx_start_thresh = 20; /* probably a good starting point. */ @@ -1433,10 +1428,8 @@ epintr(void *arg) epstart(ifp); } -#if NRND > 0 if (status) rnd_add_uint32(&sc->rnd_source, status); -#endif } /* no more interrupts */ @@ -2031,9 +2024,7 @@ ep_detach(device_t self, int flags) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h index bef646843f0..30711686d4b 100644 --- a/sys/dev/ic/elink3var.h +++ b/sys/dev/ic/elink3var.h @@ -1,4 +1,4 @@ -/* $NetBSD: elink3var.h,v 1.37 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: elink3var.h,v 1.38 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1994 Herb Peyerl <hpeyerl@beer.org> @@ -30,11 +30,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Ethernet software status per interface. @@ -101,9 +97,7 @@ struct ep_softc { #define ELINK_IS_BUS_32(a) ((a) & 0x2) int ep_pktlenshift; /* scale factor for pkt lengths */ -#if NRND > 0 krndsource_t rnd_source; -#endif /* power management hooks */ int (*enable)(struct ep_softc *); diff --git a/sys/dev/ic/elinkxl.c b/sys/dev/ic/elinkxl.c index c0e90d0cc07..a76c6efcac9 100644 --- a/sys/dev/ic/elinkxl.c +++ b/sys/dev/ic/elinkxl.c @@ -1,4 +1,4 @@ -/* $NetBSD: elinkxl.c,v 1.113 2010/11/13 13:52:01 uebayasi Exp $ */ +/* $NetBSD: elinkxl.c,v 1.114 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -30,9 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.113 2010/11/13 13:52:01 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.114 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -45,9 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: elinkxl.c,v 1.113 2010/11/13 13:52:01 uebayasi Exp $ #include <sys/syslog.h> #include <sys/select.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -440,10 +436,8 @@ ex_config(struct ex_softc *sc) /* TODO: set queues to 0 */ -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif if (pmf_device_register1(sc->sc_dev, NULL, NULL, ex_shutdown)) pmf_class_network_register(sc->sc_dev, &sc->sc_ethercom.ec_if); @@ -1420,10 +1414,8 @@ ex_intr(void *arg) } } -#if NRND > 0 if (stat) rnd_add_uint32(&sc->rnd_source, stat); -#endif } /* no more interrupts */ @@ -1707,9 +1699,7 @@ ex_detach(struct ex_softc *sc) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->ex_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/elinkxlvar.h b/sys/dev/ic/elinkxlvar.h index b327dfa9302..b2f01c842cf 100644 --- a/sys/dev/ic/elinkxlvar.h +++ b/sys/dev/ic/elinkxlvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: elinkxlvar.h,v 1.23 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: elinkxlvar.h,v 1.24 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -29,11 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Ethernet software status per interface. @@ -109,9 +105,7 @@ struct ex_softc { #define EX_FLAGS_POWERMGMT 0x2000 #define EX_FLAGS_ATTACHED 0x4000 /* attach has succeeded */ -#if NRND > 0 krndsource_t rnd_source; -#endif /* power management hooks */ int (*enable)(struct ex_softc *); diff --git a/sys/dev/ic/gem.c b/sys/dev/ic/gem.c index fbc62249d65..928cabb2398 100644 --- a/sys/dev/ic/gem.c +++ b/sys/dev/ic/gem.c @@ -1,4 +1,4 @@ -/* $NetBSD: gem.c,v 1.97 2011/05/22 11:19:23 jdc Exp $ */ +/* $NetBSD: gem.c,v 1.98 2012/02/02 19:43:03 tls Exp $ */ /* * @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.97 2011/05/22 11:19:23 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.98 2012/02/02 19:43:03 tls Exp $"); #include "opt_inet.h" @@ -171,9 +171,7 @@ gem_detach(struct gem_softc *sc, int flags) #endif evcnt_detach(&sc->sc_ev_intr); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); @@ -580,10 +578,8 @@ gem_attach(struct gem_softc *sc, const uint8_t *enaddr) ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, gem_ifflags_cb); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR, NULL, device_xname(sc->sc_dev), "interrupts"); @@ -2236,9 +2232,7 @@ gem_intr(void *v) if ((status & GEM_INTR_MIF) != 0) aprintf_debug_dev(sc->sc_dev, "MIF interrupt\n"); */ -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, status); -#endif return (r); } diff --git a/sys/dev/ic/gemvar.h b/sys/dev/ic/gemvar.h index cdf5b5b1406..d3c8d0b69ae 100644 --- a/sys/dev/ic/gemvar.h +++ b/sys/dev/ic/gemvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: gemvar.h,v 1.22 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: gemvar.h,v 1.23 2012/02/02 19:43:03 tls Exp $ */ /* * @@ -33,14 +33,10 @@ #define _IF_GEMVAR_H -#include "rnd.h" - #include <sys/queue.h> #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Misc. definitions for the Sun ``Gem'' Ethernet controller family driver. @@ -216,9 +212,7 @@ struct gem_softc { void (*sc_hwreset)(struct gem_softc *); void (*sc_hwinit)(struct gem_softc *); -#if NRND > 0 krndsource_t rnd_source; -#endif struct evcnt sc_ev_intr; #ifdef GEM_COUNTERS diff --git a/sys/dev/ic/hme.c b/sys/dev/ic/hme.c index 4fbbda86f2c..ddb9d7d8940 100644 --- a/sys/dev/ic/hme.c +++ b/sys/dev/ic/hme.c @@ -1,4 +1,4 @@ -/* $NetBSD: hme.c,v 1.86 2010/04/05 07:19:34 joerg Exp $ */ +/* $NetBSD: hme.c,v 1.87 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -34,12 +34,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.86 2010/04/05 07:19:34 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.87 2012/02/02 19:43:03 tls Exp $"); /* #define HMEDEBUG */ #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -51,9 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.86 2010/04/05 07:19:34 joerg Exp $"); #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -324,10 +321,8 @@ hme_config(struct hme_softc *sc) aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif callout_init(&sc->sc_tick_ch, 0); } @@ -1162,9 +1157,7 @@ hme_intr(void *v) if ((status & HME_SEB_STAT_RXTOHOST) != 0) r |= hme_rint(sc); -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, status); -#endif return (r); } diff --git a/sys/dev/ic/hmevar.h b/sys/dev/ic/hmevar.h index ed24b11d4f1..cc83fa08d4f 100644 --- a/sys/dev/ic/hmevar.h +++ b/sys/dev/ic/hmevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: hmevar.h,v 1.22 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: hmevar.h,v 1.23 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -29,12 +29,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif struct hme_ring { @@ -94,9 +91,7 @@ struct hme_softc { void (*sc_hwreset)(struct hme_softc *); void (*sc_hwinit)(struct hme_softc *); -#if NRND > 0 krndsource_t rnd_source; -#endif }; diff --git a/sys/dev/ic/i82557.c b/sys/dev/ic/i82557.c index a6151a56951..ec6b9c8db55 100644 --- a/sys/dev/ic/i82557.c +++ b/sys/dev/ic/i82557.c @@ -1,4 +1,4 @@ -/* $NetBSD: i82557.c,v 1.138 2011/09/02 03:16:18 msaitoh Exp $ */ +/* $NetBSD: i82557.c,v 1.139 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc. @@ -66,9 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.138 2011/09/02 03:16:18 msaitoh Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.139 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -85,9 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.138 2011/09/02 03:16:18 msaitoh Exp $") #include <machine/endian.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -412,10 +408,8 @@ fxp_attach(struct fxp_softc *sc) */ if_attach(ifp); ether_ifattach(ifp, enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif #ifdef FXP_EVENT_COUNTERS evcnt_attach_dynamic(&sc->sc_ev_txstall, EVCNT_TYPE_MISC, @@ -1149,10 +1143,8 @@ fxp_intr(void *arg) } } -#if NRND > 0 if (claimed) rnd_add_uint32(&sc->rnd_source, statack); -#endif return (claimed); } @@ -2526,9 +2518,7 @@ fxp_detach(struct fxp_softc *sc, int flags) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/i82557var.h b/sys/dev/ic/i82557var.h index 792913ef555..c9008f36dc8 100644 --- a/sys/dev/ic/i82557var.h +++ b/sys/dev/ic/i82557var.h @@ -1,4 +1,4 @@ -/* $NetBSD: i82557var.h,v 1.49 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: i82557var.h,v 1.50 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2001 The NetBSD Foundation, Inc. @@ -241,10 +241,7 @@ struct fxp_softc { void (*sc_disable)(struct fxp_softc *); int sc_eeprom_size; /* log2 size of EEPROM */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif - }; #ifdef FXP_EVENT_COUNTERS diff --git a/sys/dev/ic/lan9118.c b/sys/dev/ic/lan9118.c index 1d2d3357a7f..cd080695079 100644 --- a/sys/dev/ic/lan9118.c +++ b/sys/dev/ic/lan9118.c @@ -1,4 +1,4 @@ -/* $NetBSD: lan9118.c,v 1.14 2010/04/05 07:19:35 joerg Exp $ */ +/* $NetBSD: lan9118.c,v 1.15 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.14 2010/04/05 07:19:35 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.15 2012/02/02 19:43:03 tls Exp $"); /* * The LAN9118 Family @@ -47,8 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.14 2010/04/05 07:19:35 joerg Exp $"); * Also support HP Auto-MDIX. */ -#include "rnd.h" - #include <sys/param.h> #include <sys/callout.h> #include <sys/device.h> @@ -67,9 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: lan9118.c,v 1.14 2010/04/05 07:19:35 joerg Exp $"); #include <dev/mii/miivar.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/ic/lan9118reg.h> #include <dev/ic/lan9118var.h> @@ -282,10 +278,8 @@ lan9118_attach(struct lan9118_softc *sc) callout_init(&sc->sc_tick, 0); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif return 0; } @@ -341,10 +335,7 @@ lan9118_intr(void *arg) if (!IFQ_IS_EMPTY(&ifp->if_snd)) lan9118_start(ifp); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, datum); -#endif + rnd_add_uint32(&sc->rnd_source, datum); return handled; } diff --git a/sys/dev/ic/lan9118var.h b/sys/dev/ic/lan9118var.h index 7a4fc836550..1cdc5fdd72b 100644 --- a/sys/dev/ic/lan9118var.h +++ b/sys/dev/ic/lan9118var.h @@ -1,4 +1,4 @@ -/* $NetBSD: lan9118var.h,v 1.3 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: lan9118var.h,v 1.4 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -28,11 +28,7 @@ #ifndef _LAN9118VAR_H_ #define _LAN9118VAR_H_ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif #define LAN9118_DEFAULT_TX_FIF_SZ 5 /*kB*/ @@ -75,9 +71,7 @@ struct lan9118_softc { #define LAN9118_FLAGS_SWAP 0x00000001 #define LAN9118_FLAGS_NO_EEPROM 0x00000002 -#if NRND > 0 krndsource_t rnd_source; -#endif }; diff --git a/sys/dev/ic/lance.c b/sys/dev/ic/lance.c index de4bce9709b..6308e2cc9f0 100644 --- a/sys/dev/ic/lance.c +++ b/sys/dev/ic/lance.c @@ -1,4 +1,4 @@ -/* $NetBSD: lance.c,v 1.45 2010/04/05 07:19:35 joerg Exp $ */ +/* $NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -65,9 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.45 2010/04/05 07:19:35 joerg Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.46 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -78,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: lance.c,v 1.45 2010/04/05 07:19:35 joerg Exp $"); #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -258,10 +254,8 @@ lance_config(struct lance_softc *sc) sc->sc_tbufaddr = malloc(sc->sc_ntbuf * sizeof(int), M_DEVBUF, M_WAITOK); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif } void diff --git a/sys/dev/ic/lancevar.h b/sys/dev/ic/lancevar.h index ed8d5a53b5d..11d4b3a7225 100644 --- a/sys/dev/ic/lancevar.h +++ b/sys/dev/ic/lancevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: lancevar.h,v 1.14 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: lancevar.h,v 1.15 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -30,11 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif struct lance_softc { device_t sc_dev; /* base device glue */ @@ -115,9 +111,7 @@ struct lance_softc { #endif uint8_t sc_enaddr[ETHER_ADDR_LEN]; uint8_t sc_pad[2]; -#if NRND > 0 krndsource_t rnd_source; -#endif void (*sc_meminit)(struct lance_softc *); void (*sc_start)(struct ifnet *); diff --git a/sys/dev/ic/ld_aac.c b/sys/dev/ic/ld_aac.c index fe185b39fcc..de664a7ce36 100644 --- a/sys/dev/ic/ld_aac.c +++ b/sys/dev/ic/ld_aac.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_aac.c,v 1.25 2010/11/13 13:52:01 uebayasi Exp $ */ +/* $NetBSD: ld_aac.c,v 1.26 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,9 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_aac.c,v 1.25 2010/11/13 13:52:01 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_aac.c,v 1.26 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -43,9 +41,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_aac.c,v 1.25 2010/11/13 13:52:01 uebayasi Exp $") #include <sys/endian.h> #include <sys/dkio.h> #include <sys/disk.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/ic/ld_cac.c b/sys/dev/ic/ld_cac.c index f15bac7ab35..e8b14e4d3fa 100644 --- a/sys/dev/ic/ld_cac.c +++ b/sys/dev/ic/ld_cac.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_cac.c,v 1.25 2009/05/12 14:25:17 cegger Exp $ */ +/* $NetBSD: ld_cac.c,v 1.26 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.25 2009/05/12 14:25:17 cegger Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.26 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_cac.c,v 1.25 2009/05/12 14:25:17 cegger Exp $"); #include <sys/endian.h> #include <sys/dkio.h> #include <sys/disk.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/ic/ld_icp.c b/sys/dev/ic/ld_icp.c index bdeeb7fa1e5..c4ca80a42a6 100644 --- a/sys/dev/ic/ld_icp.c +++ b/sys/dev/ic/ld_icp.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_icp.c,v 1.24 2010/11/13 13:52:01 uebayasi Exp $ */ +/* $NetBSD: ld_icp.c,v 1.25 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_icp.c,v 1.24 2010/11/13 13:52:01 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_icp.c,v 1.25 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_icp.c,v 1.24 2010/11/13 13:52:01 uebayasi Exp $") #include <sys/endian.h> #include <sys/dkio.h> #include <sys/disk.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/ic/ld_mlx.c b/sys/dev/ic/ld_mlx.c index 0d804f57317..51e16806e15 100644 --- a/sys/dev/ic/ld_mlx.c +++ b/sys/dev/ic/ld_mlx.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_mlx.c,v 1.19 2009/01/16 04:20:28 mhitch Exp $ */ +/* $NetBSD: ld_mlx.c,v 1.20 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_mlx.c,v 1.19 2009/01/16 04:20:28 mhitch Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_mlx.c,v 1.20 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_mlx.c,v 1.19 2009/01/16 04:20:28 mhitch Exp $"); #include <sys/endian.h> #include <sys/dkio.h> #include <sys/disk.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <machine/vmparam.h> #include <sys/bus.h> diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c index 62fce6e7063..ff92829d4a0 100644 --- a/sys/dev/ic/lemac.c +++ b/sys/dev/ic/lemac.c @@ -1,4 +1,4 @@ -/* $NetBSD: lemac.c,v 1.39 2010/11/13 13:52:01 uebayasi Exp $ */ +/* $NetBSD: lemac.c,v 1.40 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1994, 1995, 1997 Matt Thomas <matt@3am-software.com> @@ -34,10 +34,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.39 2010/11/13 13:52:01 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.40 2012/02/02 19:43:03 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -48,9 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: lemac.c,v 1.39 2010/11/13 13:52:01 uebayasi Exp $"); #include <sys/errno.h> #include <sys/malloc.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_types.h> @@ -955,10 +952,8 @@ lemac_intr( LEMAC_OUTB(sc, LEMAC_REG_CTL, LEMAC_INB(sc, LEMAC_REG_CTL) ^ LEMAC_CTL_LED); LEMAC_INTR_ENABLE(sc); /* Unmask interrupts */ -#if NRND > 0 if (cs_value) rnd_add_uint32(&sc->rnd_source, cs_value); -#endif return 1; } @@ -1016,10 +1011,8 @@ lemac_ifattach( if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dv), RND_TYPE_NET, 0); -#endif ifmedia_init(&sc->sc_ifmedia, 0, lemac_ifmedia_change, diff --git a/sys/dev/ic/lemacvar.h b/sys/dev/ic/lemacvar.h index 6b1cf6c5e7d..e0e6cf2c7a2 100644 --- a/sys/dev/ic/lemacvar.h +++ b/sys/dev/ic/lemacvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: lemacvar.h,v 1.10 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: lemacvar.h,v 1.11 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1997 Matt Thomas <matt@3am-software.com> @@ -27,10 +27,8 @@ #ifndef _LEMAC_VAR_H #define _LEMAC_VAR_H -#include "rnd.h" -#if NRND > 0 + #include <sys/rnd.h> -#endif /* * Ethernet status, per interface. @@ -79,9 +77,7 @@ typedef struct { unsigned char sc_enaddr[ETHER_ADDR_LEN]; /* current Ethernet address */ char sc_prodname[LEMAC_EEP_PRDNMSZ+1]; /* product name DE20x-xx */ u_int8_t sc_eeprom[LEMAC_EEP_SIZE]; /* local copy eeprom */ -#if NRND > 0 krndsource_t rnd_source; -#endif } lemac_softc_t; #define sc_if sc_ec.ec_if diff --git a/sys/dev/ic/mb86950.c b/sys/dev/ic/mb86950.c index 33bd71e40f0..05c8ceab101 100644 --- a/sys/dev/ic/mb86950.c +++ b/sys/dev/ic/mb86950.c @@ -1,4 +1,4 @@ -/* $NetBSD: mb86950.c,v 1.18 2010/04/05 07:19:35 joerg Exp $ */ +/* $NetBSD: mb86950.c,v 1.19 2012/02/02 19:43:03 tls Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -67,7 +67,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.18 2010/04/05 07:19:35 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.19 2012/02/02 19:43:03 tls Exp $"); /* * Device driver for Fujitsu mb86950 based Ethernet cards. @@ -120,7 +120,6 @@ __KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.18 2010/04/05 07:19:35 joerg Exp $"); */ #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -130,9 +129,7 @@ __KERNEL_RCSID(0, "$NetBSD: mb86950.c,v 1.18 2010/04/05 07:19:35 joerg Exp $"); #include <sys/socket.h> #include <sys/syslog.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -296,10 +293,8 @@ mb86950_config(struct mb86950_softc *sc, int *media, ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif /* XXX No! This doesn't work - DLCR6 of the mb86950 is different @@ -984,10 +979,9 @@ mb86950_detach(struct mb86950_softc *sc) /* Delete all media. */ ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif + ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/mb86950var.h b/sys/dev/ic/mb86950var.h index b4e2aafbb4c..230de8b4c44 100644 --- a/sys/dev/ic/mb86950var.h +++ b/sys/dev/ic/mb86950var.h @@ -1,4 +1,4 @@ -/* $NetBSD: mb86950var.h,v 1.6 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: mb86950var.h,v 1.7 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1995 Mika Kortelainen @@ -59,9 +59,7 @@ struct mb86950_softc { u_int8_t sc_enaddr[ETHER_ADDR_LEN]; -#if NRND > 0 krndsource_t rnd_source; -#endif u_int32_t sc_stat; /* driver status */ diff --git a/sys/dev/ic/mb86960.c b/sys/dev/ic/mb86960.c index e62b4f8e73a..12919ef03d7 100644 --- a/sys/dev/ic/mb86960.c +++ b/sys/dev/ic/mb86960.c @@ -1,4 +1,4 @@ -/* $NetBSD: mb86960.c,v 1.77 2010/04/05 07:19:35 joerg Exp $ */ +/* $NetBSD: mb86960.c,v 1.78 2012/02/02 19:43:03 tls Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.77 2010/04/05 07:19:35 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.78 2012/02/02 19:43:03 tls Exp $"); /* * Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards. @@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.77 2010/04/05 07:19:35 joerg Exp $"); */ #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -58,9 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.77 2010/04/05 07:19:35 joerg Exp $"); #include <sys/socket.h> #include <sys/syslog.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -252,10 +249,9 @@ mb86960_config(struct mb86960_softc *sc, int *media, int nmedia, int defmedia) if_attach(ifp); ether_ifattach(ifp, sc->sc_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif + /* Print additional info when attached. */ aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n", ether_sprintf(sc->sc_enaddr)); @@ -1149,10 +1145,8 @@ mb86960_intr(void *arg) if ((ifp->if_flags & IFF_OACTIVE) == 0) mb86960_start(ifp); -#if NRND > 0 if (rstat != 0 || tstat != 0) rnd_add_uint32(&sc->rnd_source, rstat + tstat); -#endif /* * Get interrupt conditions, masking unneeded flags. @@ -1821,10 +1815,9 @@ mb86960_detach(struct mb86960_softc *sc) /* Delete all media. */ ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->rnd_source); -#endif + ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/mb86960var.h b/sys/dev/ic/mb86960var.h index dc703308ebf..fde21286b1f 100644 --- a/sys/dev/ic/mb86960var.h +++ b/sys/dev/ic/mb86960var.h @@ -1,4 +1,4 @@ -/* $NetBSD: mb86960var.h,v 1.38 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: mb86960var.h,v 1.39 2012/02/02 19:43:03 tls Exp $ */ /* * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 @@ -44,11 +44,7 @@ * they are useful. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Default settings for fe driver specific options. @@ -161,9 +157,7 @@ struct mb86960_softc { uint8_t sc_enaddr[ETHER_ADDR_LEN]; -#if NRND > 0 krndsource_t rnd_source; -#endif uint32_t sc_stat; /* driver status */ #define FE_STAT_ENABLED 0x0001 /* power enabled on interface */ diff --git a/sys/dev/ic/mtd803.c b/sys/dev/ic/mtd803.c index 3b4b90f2222..5b28ff168e3 100644 --- a/sys/dev/ic/mtd803.c +++ b/sys/dev/ic/mtd803.c @@ -1,4 +1,4 @@ -/* $NetBSD: mtd803.c,v 1.24 2010/04/05 07:19:35 joerg Exp $ */ +/* $NetBSD: mtd803.c,v 1.25 2012/02/02 19:43:03 tls Exp $ */ /*- * @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.24 2010/04/05 07:19:35 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.25 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> @@ -175,10 +175,9 @@ mtd_config(struct mtd_softc *sc) if_attach(ifp); ether_ifattach(ifp, sc->eaddr); -#if NRND > 0 /* Initialise random source */ - rnd_attach_source(&sc->rnd_src, device_xname(&sc->dev), RND_TYPE_NET, 0); -#endif + rnd_attach_source(&sc->rnd_src, device_xname(&sc->dev), + RND_TYPE_NET, 0); /* Add shutdown hook to reset card when we reboot */ sc->sd_hook = shutdownhook_establish(mtd_shutdown, sc); @@ -737,11 +736,11 @@ mtd_irq_h(void *args) for(;;) { status = MTD_READ_4(sc, MTD_ISR); -#if NRND > 0 + /* Add random seed before masking out bits */ if (status) rnd_add_uint32(&sc->rnd_src, status); -#endif + status &= MTD_ISR_MASK; if (!status) /* We didn't ask for this */ break; @@ -890,8 +889,6 @@ mtd_shutdown (void *arg) struct mtd_softc *sc = arg; struct ifnet *ifp = &sc->ethercom.ec_if; -#if NRND > 0 rnd_detach_source(&sc->rnd_src); -#endif mtd_stop(ifp, 1); } diff --git a/sys/dev/ic/mtd803var.h b/sys/dev/ic/mtd803var.h index bb4f95f7c51..57e87e21bd8 100644 --- a/sys/dev/ic/mtd803var.h +++ b/sys/dev/ic/mtd803var.h @@ -1,4 +1,4 @@ -/* $NetBSD: mtd803var.h,v 1.7 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: mtd803var.h,v 1.8 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -31,6 +31,7 @@ #include <sys/device.h> #include <sys/socket.h> +#include <sys/rnd.h> #include <net/if.h> #include <net/if_ether.h> #include <net/if_media.h> @@ -74,9 +75,7 @@ struct mtd_softc { void * buf; bus_dmamap_t buf_dma_map; -#if NRND > 0 krndsource_t rnd_src; -#endif }; diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c index ca567b5b144..17ffb89c3f9 100644 --- a/sys/dev/ic/pckbc.c +++ b/sys/dev/ic/pckbc.c @@ -1,4 +1,4 @@ -/* $NetBSD: pckbc.c,v 1.52 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: pckbc.c,v 1.53 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2004 Ben Harris. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.52 2011/11/19 22:51:22 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.53 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -46,21 +46,16 @@ __KERNEL_RCSID(0, "$NetBSD: pckbc.c,v 1.52 2011/11/19 22:51:22 tls Exp $"); #include <dev/pckbport/pckbportvar.h> -#include "rnd.h" #include "locators.h" -#if NRND > 0 #include <sys/rnd.h> -#endif /* data per slave device */ struct pckbc_slotdata { int polling; /* don't process data in interrupt handler */ int poll_data; /* data read from inr handler if polling */ int poll_stat; /* status read from inr handler if polling */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; static void pckbc_init_slotdata(struct pckbc_slotdata *); @@ -275,11 +270,10 @@ pckbc_attach_slot(struct pckbc_softc *sc, pckbc_slot_t slot) t->t_slotdata[slot] = NULL; } -#if NRND > 0 if (child != NULL && t->t_slotdata[slot] != NULL) rnd_attach_source(&t->t_slotdata[slot]->rnd_source, device_xname(child), RND_TYPE_TTY, 0); -#endif + return child != NULL; } @@ -517,9 +511,7 @@ pckbcintr_hard(void *vsc) KBD_DELAY; data = bus_space_read_1(t->t_iot, t->t_ioh_d, 0); -#if NRND > 0 rnd_add_uint32(&q->rnd_source, (stat<<8)|data); -#endif if (q->polling) { q->poll_data = data; @@ -600,9 +592,7 @@ pckbcintr(void *vsc) KBD_DELAY; data = bus_space_read_1(t->t_iot, t->t_ioh_d, 0); -#if NRND > 0 rnd_add_uint32(&q->rnd_source, (stat<<8)|data); -#endif pckbportintr(t->t_pt, slot, data); } diff --git a/sys/dev/ic/pckbcvar.h b/sys/dev/ic/pckbcvar.h index eeec1230d23..9f4d24845f1 100644 --- a/sys/dev/ic/pckbcvar.h +++ b/sys/dev/ic/pckbcvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: pckbcvar.h,v 1.18 2010/11/14 03:22:01 uebayasi Exp $ */ +/* $NetBSD: pckbcvar.h,v 1.19 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1998 @@ -34,10 +34,9 @@ #include <dev/pckbport/pckbportvar.h> -#include "rnd.h" -#if NRND > 0 + + #include <sys/rnd.h> -#endif typedef void *pckbc_tag_t; typedef int pckbc_slot_t; diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index b06623fb77b..4da14131685 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $NetBSD: rtl81x9.c,v 1.92 2010/11/13 13:52:02 uebayasi Exp $ */ +/* $NetBSD: rtl81x9.c,v 1.93 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1997, 1998 @@ -86,9 +86,8 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.92 2010/11/13 13:52:02 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.93 2012/02/02 19:43:03 tls Exp $"); -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -107,9 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.92 2010/11/13 13:52:02 uebayasi Exp $" #include <net/if_media.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <machine/endian.h> @@ -742,10 +739,8 @@ rtk_attach(struct rtk_softc *sc) if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif return; fail_4: @@ -830,9 +825,7 @@ rtk_detach(struct rtk_softc *sc) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); @@ -1213,10 +1206,7 @@ rtk_intr(void *arg) if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) rtk_start(ifp); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, status); -#endif + rnd_add_uint32(&sc->rnd_source, status); return handled; } diff --git a/sys/dev/ic/rtl81x9var.h b/sys/dev/ic/rtl81x9var.h index 692db4b94d0..106502ed433 100644 --- a/sys/dev/ic/rtl81x9var.h +++ b/sys/dev/ic/rtl81x9var.h @@ -1,4 +1,4 @@ -/* $NetBSD: rtl81x9var.h,v 1.52 2011/11/22 18:42:57 garbled Exp $ */ +/* $NetBSD: rtl81x9var.h,v 1.53 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 1997, 1998 @@ -34,11 +34,7 @@ * FreeBSD Id: if_rlreg.h,v 1.9 1999/06/20 18:56:09 wpaul Exp */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif #define RTK_ETHER_ALIGN 2 #define RTK_RXSTAT_LEN 4 @@ -226,9 +222,8 @@ struct rtk_softc { /* Power management hooks. */ int (*sc_enable) (struct rtk_softc *); void (*sc_disable) (struct rtk_softc *); -#if NRND > 0 + krndsource_t rnd_source; -#endif }; #define RE_TX_DESC_CNT(sc) ((sc)->re_ldata.re_tx_desc_cnt) diff --git a/sys/dev/ic/seeq8005.c b/sys/dev/ic/seeq8005.c index 280d0fb85a5..365c6788f49 100644 --- a/sys/dev/ic/seeq8005.c +++ b/sys/dev/ic/seeq8005.c @@ -1,4 +1,4 @@ -/* $NetBSD: seeq8005.c,v 1.45 2010/04/05 07:19:36 joerg Exp $ */ +/* $NetBSD: seeq8005.c,v 1.46 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2000, 2001 Ben Harris @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.45 2010/04/05 07:19:36 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.46 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -82,10 +82,7 @@ __KERNEL_RCSID(0, "$NetBSD: seeq8005.c,v 1.45 2010/04/05 07:19:36 joerg Exp $"); #include <net/bpf.h> #include <net/bpfdesc.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <sys/intr.h> @@ -290,11 +287,9 @@ seeq8005_attach(struct seeq8005_softc *sc, const u_int8_t *myaddr, int *media, printf("\n"); -#if NRND > 0 /* After \n because it can print a line of its own. */ rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif } /* @@ -1032,10 +1027,9 @@ seeq8005intr(void *arg) ea_rxint(sc); } -#if NRND > 0 if (handled) rnd_add_uint32(&sc->rnd_source, status); -#endif + return handled; } diff --git a/sys/dev/ic/seeq8005var.h b/sys/dev/ic/seeq8005var.h index 3585f92117b..6a10c2adfe5 100644 --- a/sys/dev/ic/seeq8005var.h +++ b/sys/dev/ic/seeq8005var.h @@ -1,4 +1,4 @@ -/* $NetBSD: seeq8005var.h,v 1.6 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: seeq8005var.h,v 1.7 2012/02/02 19:43:03 tls Exp $ */ /* * Copyright (c) 2000 Ben Harris @@ -38,10 +38,7 @@ #include <net/if_media.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif /* Enumerate the possible cip variants */ enum seeq_variant { @@ -85,9 +82,7 @@ struct seeq8005_softc { enum seeq_variant sc_variant; /* Chip variant */ int sc_flags; #define SF_8BIT 0x01 -#if NRND > 0 krndsource_t rnd_source; -#endif }; extern void seeq8005_attach(struct seeq8005_softc *, const u_int8_t *, int *, diff --git a/sys/dev/ic/smc91cxx.c b/sys/dev/ic/smc91cxx.c index 76ae86ce08d..9e8d6175a73 100644 --- a/sys/dev/ic/smc91cxx.c +++ b/sys/dev/ic/smc91cxx.c @@ -1,4 +1,4 @@ -/* $NetBSD: smc91cxx.c,v 1.79 2010/11/13 13:52:02 uebayasi Exp $ */ +/* $NetBSD: smc91cxx.c,v 1.80 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -71,10 +71,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.79 2010/11/13 13:52:02 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.80 2012/02/02 19:43:03 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -86,9 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.79 2010/11/13 13:52:02 uebayasi Exp $ #include <sys/malloc.h> #include <sys/ioctl.h> #include <sys/errno.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <sys/intr.h> @@ -384,10 +381,8 @@ smc91cxx_attach(struct smc91cxx_softc *sc, u_int8_t *myea) break; } -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif callout_init(&sc->sc_mii_callout, 0); @@ -1131,10 +1126,8 @@ out: mask |= sc->sc_intmask; smc91cxx_intr_mask_write(bst, bsh, mask); -#if NRND > 0 if (status) rnd_add_uint32(&sc->rnd_source, status); -#endif return (1); } @@ -1528,9 +1521,8 @@ smc91cxx_detach(device_t self, int flags) /* Delete all media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif + ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/ic/smc91cxxvar.h b/sys/dev/ic/smc91cxxvar.h index fb5a1b8b8ad..d15df5e07d9 100644 --- a/sys/dev/ic/smc91cxxvar.h +++ b/sys/dev/ic/smc91cxxvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: smc91cxxvar.h,v 1.17 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: smc91cxxvar.h,v 1.18 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -30,11 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif struct smc91cxx_softc { struct device sc_dev; /* generic device glue */ @@ -60,9 +56,8 @@ struct smc91cxx_softc { uint8_t sc_intmask; uint8_t sc_txpacketno; /* cached packetno */ -#if NRND > 0 + krndsource_t rnd_source; -#endif }; #define SMC_SELECT_BANK(sc, x) \ diff --git a/sys/dev/ic/tulip.c b/sys/dev/ic/tulip.c index 28ac3890f26..1230738b00d 100644 --- a/sys/dev/ic/tulip.c +++ b/sys/dev/ic/tulip.c @@ -1,4 +1,4 @@ -/* $NetBSD: tulip.c,v 1.179 2011/08/13 19:23:34 jakllsch Exp $ */ +/* $NetBSD: tulip.c,v 1.180 2012/02/02 19:43:03 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.179 2011/08/13 19:23:34 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.180 2012/02/02 19:43:03 tls Exp $"); #include <sys/param.h> @@ -525,10 +525,9 @@ tlp_attach(struct tulip_softc *sc, const uint8_t *enaddr) if_attach(ifp); ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, tlp_ifflags_cb); -#if NRND > 0 + rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif if (pmf_device_register(self, NULL, NULL)) pmf_class_network_register(self, ifp); @@ -616,9 +615,8 @@ tlp_detach(struct tulip_softc *sc) /* Delete all remaining media. */ ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); -#if NRND > 0 rnd_detach_source(&sc->sc_rnd_source); -#endif + ether_ifdetach(ifp); if_detach(ifp); @@ -1195,10 +1193,9 @@ tlp_intr(void *arg) /* Try to get more packets going. */ tlp_start(ifp); -#if NRND > 0 if (handled) rnd_add_uint32(&sc->sc_rnd_source, status); -#endif + return (handled); } diff --git a/sys/dev/ic/tulipvar.h b/sys/dev/ic/tulipvar.h index 72e2e6b2363..1a5b9438962 100644 --- a/sys/dev/ic/tulipvar.h +++ b/sys/dev/ic/tulipvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: tulipvar.h,v 1.66 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: tulipvar.h,v 1.67 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -33,14 +33,10 @@ #ifndef _DEV_IC_TULIPVAR_H_ #define _DEV_IC_TULIPVAR_H_ -#include "rnd.h" - #include <sys/queue.h> #include <sys/callout.h> -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Misc. definitions for the Digital Semiconductor ``Tulip'' (21x4x) @@ -447,9 +443,7 @@ struct tulip_softc { int sc_rxptr; /* next ready RX descriptor/descsoft */ -#if NRND > 0 krndsource_t sc_rnd_source; /* random source */ -#endif }; #endif diff --git a/sys/dev/isa/cs89x0isa.c b/sys/dev/isa/cs89x0isa.c index e591a5b019e..87c9b427deb 100644 --- a/sys/dev/isa/cs89x0isa.c +++ b/sys/dev/isa/cs89x0isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs89x0isa.c,v 1.15 2009/09/22 15:34:22 tsutsui Exp $ */ +/* $NetBSD: cs89x0isa.c,v 1.16 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright 1997 @@ -36,7 +36,7 @@ /* isa DMA routines for cs89x0 */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.15 2009/09/22 15:34:22 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.16 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -44,10 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: cs89x0isa.c,v 1.15 2009/09/22 15:34:22 tsutsui Exp $ #include <sys/socket.h> #include <sys/device.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 8f02def8b1e..c511fdbe3ec 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $NetBSD: fd.c,v 1.99 2010/11/13 13:52:03 uebayasi Exp $ */ +/* $NetBSD: fd.c,v 1.100 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc. @@ -81,9 +81,8 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.99 2010/11/13 13:52:03 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.100 2012/02/02 19:43:04 tls Exp $"); -#include "rnd.h" #include "opt_ddb.h" /* @@ -116,9 +115,7 @@ __KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.99 2010/11/13 13:52:03 uebayasi Exp $"); #include <sys/fdio.h> #include <sys/conf.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <prop/proplib.h> @@ -572,10 +569,8 @@ fdattach(device_t parent, device_t self, void *aux) fd->sc_roothook = mountroothook_establish(fd_mountroot_hook, fd->sc_dev); -#if NRND > 0 rnd_attach_source(&fd->rnd_source, device_xname(fd->sc_dev), RND_TYPE_DISK, 0); -#endif fd_set_properties(fd); @@ -607,9 +602,8 @@ fddetach(device_t self, int flags) #if 0 /* XXX need to undo at detach? */ fd_set_properties(fd); #endif -#if NRND > 0 + rnd_detach_source(&fd->rnd_source); -#endif disk_detach(&fd->sc_dk); disk_destroy(&fd->sc_dk); @@ -786,9 +780,7 @@ fdfinish(struct fd_softc *fd, struct buf *bp) bp->b_resid = fd->sc_bcount; fd->sc_skip = 0; -#if NRND > 0 rnd_add_uint32(&fd->rnd_source, bp->b_blkno); -#endif biodone(bp); /* turn off motor 5s from now */ diff --git a/sys/dev/isa/fdc_isa.c b/sys/dev/isa/fdc_isa.c index 9f4a0a05a76..4ea2d396668 100644 --- a/sys/dev/isa/fdc_isa.c +++ b/sys/dev/isa/fdc_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: fdc_isa.c,v 1.18 2008/04/28 20:23:52 martin Exp $ */ +/* $NetBSD: fdc_isa.c,v 1.19 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -64,9 +64,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.18 2008/04/28 20:23:52 martin Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.19 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -74,9 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: fdc_isa.c,v 1.18 2008/04/28 20:23:52 martin Exp $"); #include <sys/device.h> #include <sys/buf.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <sys/intr.h> diff --git a/sys/dev/isa/fdvar.h b/sys/dev/isa/fdvar.h index eb35a97b631..689ba1dd605 100644 --- a/sys/dev/isa/fdvar.h +++ b/sys/dev/isa/fdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: fdvar.h,v 1.7 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: fdvar.h,v 1.8 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -29,11 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif /* * Floppies come in various flavors, e.g., 1.2MB vs 1.44MB; here is how @@ -90,7 +86,5 @@ struct fd_softc { struct bufq_state *sc_q;/* pending I/O requests */ int sc_active; /* number of active I/O operations */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; diff --git a/sys/dev/isa/if_cs_isa.c b/sys/dev/isa/if_cs_isa.c index 20ba02e370a..566ebabd3a0 100644 --- a/sys/dev/isa/if_cs_isa.c +++ b/sys/dev/isa/if_cs_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_isa.c,v 1.25 2009/09/22 16:44:08 tsutsui Exp $ */ +/* $NetBSD: if_cs_isa.c,v 1.26 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright 1997 @@ -34,17 +34,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_isa.c,v 1.25 2009/09/22 16:44:08 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_isa.c,v 1.26 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> #include <sys/device.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/isa/if_eg.c b/sys/dev/isa/if_eg.c index 4f0a6455310..946df4a1586 100644 --- a/sys/dev/isa/if_eg.c +++ b/sys/dev/isa/if_eg.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_eg.c,v 1.83 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_eg.c,v 1.84 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 1993 Dean Huxley <dean@fsa.ca> @@ -40,10 +40,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.83 2011/11/19 22:51:23 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.84 2012/02/02 19:43:04 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -54,9 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_eg.c,v 1.83 2011/11/19 22:51:23 tls Exp $"); #include <sys/syslog.h> #include <sys/select.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -113,9 +110,7 @@ struct eg_softc { void * eg_inbuf; /* Incoming packet buffer */ void * eg_outbuf; /* Outgoing packet buffer */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; int egprobe(device_t, cfdata_t, void *); @@ -482,10 +477,8 @@ egattach(device_t parent, device_t self, void *aux) sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, egintr, sc); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif } void @@ -713,9 +706,7 @@ egintr(void *arg) break; } -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, sc->eg_pcb[0]); -#endif } return serviced; diff --git a/sys/dev/isa/if_el.c b/sys/dev/isa/if_el.c index beb042d365b..969e3ad7781 100644 --- a/sys/dev/isa/if_el.c +++ b/sys/dev/isa/if_el.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_el.c,v 1.87 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_el.c,v 1.88 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 1994, Matthew E. Kimmel. Permission is hereby granted @@ -19,10 +19,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.87 2011/11/19 22:51:23 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.88 2012/02/02 19:43:04 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -32,9 +31,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_el.c,v 1.87 2011/11/19 22:51:23 tls Exp $"); #include <sys/socket.h> #include <sys/syslog.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -79,9 +76,7 @@ struct el_softc { bus_space_tag_t sc_iot; /* bus space identifier */ bus_space_handle_t sc_ioh; /* i/o handle */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* @@ -256,11 +251,9 @@ elattach(device_t parent, device_t self, void *aux) sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, elintr, sc); -#if NRND > 0 DPRINTF(("Attaching to random...\n")); rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif DPRINTF(("elattach() finished.\n")); } @@ -554,9 +547,7 @@ elintr(void *arg) if ((bus_space_read_1(iot, ioh, EL_AS) & EL_AS_RXBUSY) != 0) break; -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, rxstat); -#endif DPRINTF(("<rescan> ")); } diff --git a/sys/dev/isa/if_iy.c b/sys/dev/isa/if_iy.c index 37d4c0cf873..851a4d3fce2 100644 --- a/sys/dev/isa/if_iy.c +++ b/sys/dev/isa/if_iy.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iy.c,v 1.89 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_iy.c,v 1.90 2012/02/02 19:43:04 tls Exp $ */ /* #define IYDEBUG */ /* #define IYMEMDEBUG */ @@ -39,10 +39,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.89 2011/11/19 22:51:23 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.90 2012/02/02 19:43:04 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -55,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_iy.c,v 1.89 2011/11/19 22:51:23 tls Exp $"); #include <sys/syslog.h> #include <sys/device.h> #include <sys/endian.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_types.h> @@ -128,9 +125,7 @@ struct iy_softc { int sc_debug; #endif -#if NRND > 0 krndsource_t rnd_source; -#endif }; void iywatchdog(struct ifnet *); @@ -367,10 +362,8 @@ iyattach(device_t parent, device_t self, void *aux) sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq[0].ir_irq, IST_EDGE, IPL_NET, iyintr, sc); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif temp = bus_space_read_1(iot, ioh, INT_NO_REG); bus_space_write_1(iot, ioh, INT_NO_REG, (temp & 0xf8) | sc->mappedirq); @@ -982,9 +975,7 @@ iyintr(void *arg) bus_space_write_1(iot, ioh, STATUS_REG, TX_INT); } -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, status); -#endif return 1; } diff --git a/sys/dev/isa/if_tscs_isa.c b/sys/dev/isa/if_tscs_isa.c index 6d512dab476..17af54f6047 100644 --- a/sys/dev/isa/if_tscs_isa.c +++ b/sys/dev/isa/if_tscs_isa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tscs_isa.c,v 1.14 2009/09/22 16:44:08 tsutsui Exp $ */ +/* $NetBSD: if_tscs_isa.c,v 1.15 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -30,17 +30,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tscs_isa.c,v 1.14 2009/09/22 16:44:08 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tscs_isa.c,v 1.15 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/socket.h> #include <sys/device.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/isapnp/if_cs_isapnp.c b/sys/dev/isapnp/if_cs_isapnp.c index 23fe62a8675..83af85b539b 100644 --- a/sys/dev/isapnp/if_cs_isapnp.c +++ b/sys/dev/isapnp/if_cs_isapnp.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_isapnp.c,v 1.17 2009/09/22 16:44:08 tsutsui Exp $ */ +/* $NetBSD: if_cs_isapnp.c,v 1.18 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c)2001 YAMAMOTO Takashi, @@ -27,17 +27,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_isapnp.c,v 1.17 2009/09/22 16:44:08 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_isapnp.c,v 1.18 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/device.h> #include <sys/socket.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/ld.c b/sys/dev/ld.c index 7798a3d1726..300f43e5843 100644 --- a/sys/dev/ld.c +++ b/sys/dev/ld.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld.c,v 1.68 2010/09/20 06:54:06 kiyohara Exp $ */ +/* $NetBSD: ld.c,v 1.69 2012/02/02 19:43:01 tls Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.68 2010/09/20 06:54:06 kiyohara Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.69 2012/02/02 19:43:01 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -56,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.68 2010/09/20 06:54:06 kiyohara Exp $"); #include <sys/vnode.h> #include <sys/syslog.h> #include <sys/mutex.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/ldvar.h> @@ -149,11 +145,9 @@ ldattach(struct ld_softc *sc) ld_set_properties(sc); -#if NRND > 0 /* Attach the device into the rnd source list. */ rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dv), RND_TYPE_DISK, 0); -#endif /* Register with PMF */ if (!pmf_device_register1(sc->sc_dv, ld_suspend, NULL, ld_shutdown)) @@ -243,10 +237,8 @@ ldenddetach(struct ld_softc *sc) disk_detach(&sc->sc_dk); disk_destroy(&sc->sc_dk); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sc->sc_rnd_source); -#endif /* Deregister with PMF */ pmf_device_deregister(sc->sc_dv); @@ -725,9 +717,7 @@ lddone(struct ld_softc *sc, struct buf *bp) disk_unbusy(&sc->sc_dk, bp->b_bcount - bp->b_resid, (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, bp->b_rawblkno); -#endif biodone(bp); mutex_enter(&sc->sc_mutex); diff --git a/sys/dev/ldvar.h b/sys/dev/ldvar.h index dccadae861b..536fdfb0e27 100644 --- a/sys/dev/ldvar.h +++ b/sys/dev/ldvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: ldvar.h,v 1.19 2011/11/19 22:51:22 tls Exp $ */ +/* $NetBSD: ldvar.h,v 1.20 2012/02/02 19:43:01 tls Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -32,22 +32,16 @@ #ifndef _DEV_LDVAR_H_ #define _DEV_LDVAR_H_ -#include "rnd.h" - #include <sys/mutex.h> #include <sys/device.h> /* for device_t */ -#if NRND > 0 #include <sys/rnd.h> -#endif struct ld_softc { device_t sc_dv; struct disk sc_dk; struct bufq_state *sc_bufq; kmutex_t sc_mutex; -#if NRND > 0 krndsource_t sc_rnd_source; -#endif int sc_queuecnt; /* current h/w queue depth */ int sc_ncylinders; /* # cylinders */ int sc_nheads; /* # heads */ diff --git a/sys/dev/marvell/if_gfe.c b/sys/dev/marvell/if_gfe.c index 7d026220925..48f6c4751c2 100644 --- a/sys/dev/marvell/if_gfe.c +++ b/sys/dev/marvell/if_gfe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $ */ +/* $NetBSD: if_gfe.c,v 1.40 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,10 +42,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.40 2012/02/02 19:43:04 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/bus.h> @@ -68,9 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.39 2010/11/13 13:52:04 uebayasi Exp $") #include <netinet/if_inarp.h> #endif #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/mii/mii.h> #include <dev/mii/miivar.h> @@ -539,10 +536,8 @@ gfe_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, enaddr); bpf_attach(ifp, DLT_EN10MB, sizeof(struct ether_header)); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif marvell_intr_establish(mva->mva_irq, IPL_NET, gfe_intr, sc); } diff --git a/sys/dev/marvell/if_gfevar.h b/sys/dev/marvell/if_gfevar.h index f3e1478515e..d0e30fc508c 100644 --- a/sys/dev/marvell/if_gfevar.h +++ b/sys/dev/marvell/if_gfevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfevar.h,v 1.11 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_gfevar.h,v 1.12 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -167,8 +167,6 @@ struct gfe_softc { */ struct gfe_rxqueue sc_rxq[4]; /* Hi/MedHi/MedLo/Lo receive queues */ -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; #endif /* _IF_GFEVAR_H_ */ diff --git a/sys/dev/marvell/if_mvgbe.c b/sys/dev/marvell/if_mvgbe.c index 0679be5661d..b4b82c7f940 100644 --- a/sys/dev/marvell/if_mvgbe.c +++ b/sys/dev/marvell/if_mvgbe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,9 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/bus.h> @@ -51,9 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.15 2011/11/19 22:51:23 tls Exp $"); #include <netinet/ip.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/mii/mii.h> #include <dev/mii/miivar.h> @@ -215,9 +211,7 @@ struct mvgbe_softc { LIST_HEAD(__mvgbe_jinusehead, mvgbe_jpool_entry) sc_jinuse_listhead; SIMPLEQ_HEAD(__mvgbe_txmaphead, mvgbe_txmap_entry) sc_txmap_head; -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; @@ -784,10 +778,8 @@ mvgbe_attach(device_t parent, device_t self, void *aux) ether_ifattach(ifp, sc->sc_enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, mvgbe_ifflags_cb); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif return; @@ -851,10 +843,7 @@ mvgbe_intr(void *arg) if (!IFQ_IS_EMPTY(&ifp->if_snd)) mvgbe_start(ifp); -#if NRND > 0 - if (RND_ENABLED(&sc->sc_rnd_source)) - rnd_add_uint32(&sc->sc_rnd_source, datum); -#endif + rnd_add_uint32(&sc->sc_rnd_source, datum); return claimed; } diff --git a/sys/dev/mca/ed_mca.c b/sys/dev/mca/ed_mca.c index cda2cf7c6cc..7a3cfdcb543 100644 --- a/sys/dev/mca/ed_mca.c +++ b/sys/dev/mca/ed_mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: ed_mca.c,v 1.48 2011/08/07 13:39:24 rmind Exp $ */ +/* $NetBSD: ed_mca.c,v 1.49 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.48 2011/08/07 13:39:24 rmind Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.49 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -55,9 +53,7 @@ __KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.48 2011/08/07 13:39:24 rmind Exp $"); #include <sys/syslog.h> #include <sys/proc.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/intr.h> #include <sys/bus.h> @@ -176,10 +172,8 @@ ed_mca_attach(device_t parent, device_t self, void *aux) */ disk_init(&ed->sc_dk, device_xname(&ed->sc_dev), &eddkdriver); disk_attach(&ed->sc_dk); -#if NRND > 0 rnd_attach_source(&ed->rnd_source, device_xname(&ed->sc_dev), RND_TYPE_DISK, 0); -#endif ed->sc_flags |= EDF_INIT; diff --git a/sys/dev/mca/edc_mca.c b/sys/dev/mca/edc_mca.c index a69b8c3f861..b43ebf3cbce 100644 --- a/sys/dev/mca/edc_mca.c +++ b/sys/dev/mca/edc_mca.c @@ -1,4 +1,4 @@ -/* $NetBSD: edc_mca.c,v 1.45 2011/08/07 13:39:24 rmind Exp $ */ +/* $NetBSD: edc_mca.c,v 1.46 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -46,9 +46,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.45 2011/08/07 13:39:24 rmind Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.46 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -65,9 +63,7 @@ __KERNEL_RCSID(0, "$NetBSD: edc_mca.c,v 1.45 2011/08/07 13:39:24 rmind Exp $"); #include <sys/vnode.h> #include <sys/kernel.h> #include <sys/kthread.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> #include <sys/intr.h> @@ -840,9 +836,7 @@ edcworker(void *arg) disk_unbusy(&ed->sc_dk, (bp->b_bcount - bp->b_resid), (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&ed->rnd_source, bp->b_blkno); -#endif biodone(bp); } } diff --git a/sys/dev/mca/edvar.h b/sys/dev/mca/edvar.h index b7262dfb13f..c2d7944a355 100644 --- a/sys/dev/mca/edvar.h +++ b/sys/dev/mca/edvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: edvar.h,v 1.14 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: edvar.h,v 1.15 2012/02/02 19:43:04 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -60,7 +60,5 @@ struct ed_softc { u_int8_t spares; /* spares per cylinder */ u_int32_t rba; /* # of RBAs */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; diff --git a/sys/dev/ofisa/if_cs_ofisa.c b/sys/dev/ofisa/if_cs_ofisa.c index da3c08a515f..fedf421b85e 100644 --- a/sys/dev/ofisa/if_cs_ofisa.c +++ b/sys/dev/ofisa/if_cs_ofisa.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_ofisa.c,v 1.24 2009/09/22 16:44:08 tsutsui Exp $ */ +/* $NetBSD: if_cs_ofisa.c,v 1.25 2012/02/02 19:43:04 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa.c,v 1.24 2009/09/22 16:44:08 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa.c,v 1.25 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -39,10 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cs_ofisa.c,v 1.24 2009/09/22 16:44:08 tsutsui Exp #include <sys/device.h> #include <sys/malloc.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index 0a2a1465326..510ade6f171 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $NetBSD: hifn7751.c,v 1.49 2012/01/30 19:41:19 drochner Exp $ */ +/* $NetBSD: hifn7751.c,v 1.50 2012/02/02 19:43:04 tls Exp $ */ /* $FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */ /* $OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $ */ @@ -48,7 +48,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.49 2012/01/30 19:41:19 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.50 2012/02/02 19:43:04 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -544,11 +544,11 @@ hifn_rng(void *vsc) { struct hifn_softc *sc = vsc; #ifdef __NetBSD__ - u_int32_t num[HIFN_RNG_BITSPER * SHA1_DIGEST_LENGTH]; + uint32_t num[64]; #else - u_int32_t num[2]; + uint32_t num[2]; #endif - u_int32_t sts; + uint32_t sts; int i; if (sc->sc_flags & HIFN_IS_7811) { diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index ff3b7dd5ccd..2c6b66f9f05 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bce.c,v 1.34 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_bce.c,v 1.35 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2003 Clifford Wright. All rights reserved. @@ -35,10 +35,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.34 2011/11/19 22:51:23 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.35 2012/02/02 19:43:05 tls Exp $"); #include "vlan.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -56,9 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_bce.c,v 1.34 2011/11/19 22:51:23 tls Exp $"); #include <net/if_ether.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> @@ -138,9 +135,7 @@ struct bce_softc { int bce_txsfree; /* no. tx slots available */ int bce_txsnext; /* next available tx slot */ callout_t bce_timeout; -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* for ring descriptors */ @@ -461,10 +456,8 @@ bce_attach(device_t parent, device_t self, void *aux) aprint_normal_dev(self, "Ethernet address %s\n", ether_sprintf(sc->enaddr)); ether_ifattach(ifp, sc->enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif callout_init(&sc->bce_timeout, 0); if (pmf_device_register(self, NULL, bce_resume)) @@ -714,10 +707,7 @@ bce_intr(void *xsc) if (handled) { if (wantinit) bce_init(ifp); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, intstatus); -#endif + rnd_add_uint32(&sc->rnd_source, intstatus); /* Try to get more packets going. */ bce_start(ifp); } diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 595a480b6e9..d270155e4f9 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bge.c,v 1.199 2011/11/02 16:26:30 yamt Exp $ */ +/* $NetBSD: if_bge.c,v 1.200 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -79,10 +79,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.199 2011/11/02 16:26:30 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.200 2012/02/02 19:43:05 tls Exp $"); #include "vlan.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -100,9 +99,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.199 2011/11/02 16:26:30 yamt Exp $"); #include <net/if_media.h> #include <net/if_ether.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #ifdef INET #include <netinet/in.h> @@ -3030,10 +3027,8 @@ bge_attach(device_t parent, device_t self, void *aux) DPRINTFN(5, ("ether_ifattach\n")); ether_ifattach(ifp, eaddr); ether_set_ifflags_cb(&sc->ethercom, bge_ifflags_cb); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->bge_dev), RND_TYPE_NET, 0); -#endif #ifdef BGE_EVENT_COUNTERS /* * Attach event counters. @@ -3351,10 +3346,8 @@ bge_rxeof(struct bge_softc *sc) offset = offsetof(struct bge_ring_data, bge_rx_return_ring); tosync = rx_prod - rx_cons; -#if NRND > 0 - if (tosync != 0 && RND_ENABLED(&sc->rnd_source)) + if (tosync != 0) rnd_add_uint32(&sc->rnd_source, tosync); -#endif toff = offset + (rx_cons * sizeof (struct bge_rx_bd)); @@ -3511,10 +3504,8 @@ bge_txeof(struct bge_softc *sc) tosync = sc->bge_rdata->bge_status_block.bge_idx[0].bge_tx_cons_idx - sc->bge_tx_saved_considx; -#if NRND > 0 - if (tosync != 0 && RND_ENABLED(&sc->rnd_source)) + if (tosync != 0) rnd_add_uint32(&sc->rnd_source, tosync); -#endif toff = offset + (sc->bge_tx_saved_considx * sizeof (struct bge_tx_bd)); diff --git a/sys/dev/pci/if_bgevar.h b/sys/dev/pci/if_bgevar.h index db681571ea6..7bcc5be9c7c 100644 --- a/sys/dev/pci/if_bgevar.h +++ b/sys/dev/pci/if_bgevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_bgevar.h,v 1.8 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_bgevar.h,v 1.9 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2001 @@ -289,9 +289,7 @@ struct bge_softc { struct sysctllog *bge_log; -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; #endif /* _DEV_PCI_IF_BGEVAR_H_ */ diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index c939852ef40..0564912347e 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cas.c,v 1.15 2012/01/30 19:41:19 drochner Exp $ */ +/* $NetBSD: if_cas.c,v 1.16 2012/02/02 19:43:05 tls Exp $ */ /* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ /* @@ -44,7 +44,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.15 2012/01/30 19:41:19 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.16 2012/02/02 19:43:05 tls Exp $"); #ifndef _MODULE #include "opt_inet.h" @@ -610,10 +610,8 @@ cas_config(struct cas_softc *sc, const uint8_t *enaddr) if_attach(ifp); ether_ifattach(ifp, enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif evcnt_attach_dynamic(&sc->sc_ev_intr, EVCNT_TYPE_INTR, NULL, device_xname(sc->sc_dev), "interrupts"); @@ -643,9 +641,7 @@ cas_detach(device_t self, int flags) cas_stop(&sc->sc_ethercom.ec_if, 1); evcnt_detach(&sc->sc_ev_intr); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); @@ -1493,9 +1489,7 @@ cas_intr(void *v) device_xname(sc->sc_dev), rxstat); #endif } -#if NRND > 0 rnd_add_uint32(&sc->rnd_source, status); -#endif return (r); } diff --git a/sys/dev/pci/if_casvar.h b/sys/dev/pci/if_casvar.h index 04ed095caaf..bc527cca1b7 100644 --- a/sys/dev/pci/if_casvar.h +++ b/sys/dev/pci/if_casvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_casvar.h,v 1.3 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_casvar.h,v 1.4 2012/02/02 19:43:05 tls Exp $ */ /* $OpenBSD: if_casvar.h,v 1.6 2009/06/13 12:18:58 kettenis Exp $ */ /* @@ -194,9 +194,7 @@ struct cas_softc { int sc_debug; void *sc_sh; /* shutdownhook cookie */ -#if NRND > 0 krndsource_t rnd_source; -#endif struct evcnt sc_ev_intr; enum cas_attach_stage sc_att_stage; diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 57547c3f0f8..215fc23d899 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_de.c,v 1.138 2010/11/13 13:52:06 uebayasi Exp $ */ +/* $NetBSD: if_de.c,v 1.139 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -37,7 +37,7 @@ * board which support 21040, 21041, or 21140 (mostly). */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.138 2010/11/13 13:52:06 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.139 2012/02/02 19:43:05 tls Exp $"); #define TULIP_HDR_DATA @@ -63,11 +63,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_de.c,v 1.138 2010/11/13 13:52:06 uebayasi Exp $") #endif #if defined(__NetBSD__) -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> #endif -#endif #include <net/if.h> #if defined(SIOCSIFMEDIA) && !defined(TULIP_NOIFMEDIA) @@ -4029,9 +4026,7 @@ tulip_intr_handler( while ((csr = TULIP_CSR_READ(sc, csr_status)) & sc->tulip_intrmask) { #if defined(__NetBSD__) && !defined(TULIP_USE_SOFTINTR) if (only_once == 1) { -#if NRND > 0 rnd_add_uint32(&sc->tulip_rndsource, csr); -#endif only_once = 0; } #endif @@ -4159,7 +4154,7 @@ tulip_hardintr_handler( */ tulip_softintr_mask |= (1U << sc->tulip_unit); -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) /* * This isn't all that random (the value we feed in) but it is * better than a constant probably. It isn't used in entropy @@ -5146,7 +5141,7 @@ tulip_attach( #endif #endif /* __bsdi__ */ -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) rnd_attach_source(&sc->tulip_rndsource, device_xname(&sc->tulip_dev), RND_TYPE_NET, 0); #endif diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index ae292477be3..ba0010fd5ab 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_devar.h,v 1.56 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_devar.h,v 1.57 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 1994-1997 Matt Thomas (matt@3am-software.com) @@ -31,10 +31,7 @@ #if defined(__NetBSD__) -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #if NetBSD >= 199803 #define TULIP_BUS_DMA 1 @@ -694,7 +691,7 @@ struct _tulip_softc_t { tulip_srom_connection_t tulip_conntype; tulip_desc_t *tulip_rxdescs; tulip_desc_t *tulip_txdescs; -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) krndsource_t tulip_rndsource; #endif }; diff --git a/sys/dev/pci/if_dge.c b/sys/dev/pci/if_dge.c index 05e9f8d7322..86c432480d8 100644 --- a/sys/dev/pci/if_dge.c +++ b/sys/dev/pci/if_dge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_dge.c,v 1.33 2012/01/30 19:41:19 drochner Exp $ */ +/* $NetBSD: if_dge.c,v 1.34 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -80,9 +80,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.33 2012/01/30 19:41:19 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.34 2012/02/02 19:43:05 tls Exp $"); + -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -96,9 +96,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_dge.c,v 1.33 2012/01/30 19:41:19 drochner Exp $") #include <sys/device.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -333,9 +331,7 @@ struct dge_softc { uint16_t sc_eeprom[EEPROM_SIZE]; -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif #ifdef DGE_OFFBYONE_RXBUG void *sc_bugbuf; SLIST_HEAD(, rxbugentry) sc_buglist; @@ -897,10 +893,8 @@ dge_attach(device_t parent, device_t self, void *aux) */ if_attach(ifp); ether_ifattach(ifp, enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(&sc->sc_dev), RND_TYPE_NET, 0); -#endif #ifdef DGE_EVENT_COUNTERS /* Fix segment event naming */ @@ -1490,10 +1484,7 @@ dge_intr(void *arg) if ((icr & sc->sc_icr) == 0) break; -#if 0 /*NRND > 0*/ - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, icr); -#endif + rnd_add_uint32(&sc->rnd_source, icr); handled = 1; diff --git a/sys/dev/pci/if_fxp_pci.c b/sys/dev/pci/if_fxp_pci.c index 9d3c3b86e95..397a20f54d3 100644 --- a/sys/dev/pci/if_fxp_pci.c +++ b/sys/dev/pci/if_fxp_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_fxp_pci.c,v 1.78 2012/01/30 19:41:20 drochner Exp $ */ +/* $NetBSD: if_fxp_pci.c,v 1.79 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc. @@ -36,9 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.78 2012/01/30 19:41:20 drochner Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.79 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_fxp_pci.c,v 1.78 2012/01/30 19:41:20 drochner Exp #include <sys/errno.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <machine/endian.h> diff --git a/sys/dev/pci/if_jme.c b/sys/dev/pci/if_jme.c index 153327c5a91..86903888d5d 100644 --- a/sys/dev/pci/if_jme.c +++ b/sys/dev/pci/if_jme.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_jme.c,v 1.18 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_jme.c,v 1.19 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2008 Manuel Bouyer. All rights reserved. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.18 2011/11/19 22:51:23 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.19 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> @@ -87,10 +87,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_jme.c,v 1.18 2011/11/19 22:51:23 tls Exp $"); #include <net/bpf.h> #include <net/bpfdesc.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <netinet/in.h> #include <netinet/in_systm.h> @@ -167,9 +164,7 @@ struct jme_softc { u_int32_t jme_flags; /* device features, see below */ uint32_t jme_txcsr; /* TX config register */ uint32_t jme_rxcsr; /* RX config register */ -#if NRND > 0 krndsource_t rnd_source; -#endif /* interrupt coalition parameters */ struct sysctllog *jme_clog; int jme_intrxto; /* interrupt RX timeout */ @@ -513,10 +508,9 @@ jme_pci_attach(device_t parent, device_t self, void *aux) else aprint_error_dev(self, "couldn't establish power handler\n"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif + sc->jme_intrxto = PCCRX_COAL_TO_DEFAULT; sc->jme_intrxct = PCCRX_COAL_PKT_DEFAULT; sc->jme_inttxto = PCCTX_COAL_TO_DEFAULT; @@ -1221,11 +1215,8 @@ jme_intr_rx(jme_softc_t *sc) { } (*ifp->if_input)(ifp, mhead); } -#if NRND > 0 - if (ipackets && RND_ENABLED(&sc->rnd_source)) + if (ipackets) rnd_add_uint32(&sc->rnd_source, ipackets); -#endif /* NRND > 0 */ - } static int diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index 8475ca0e5df..b5e906b7304 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_msk.c,v 1.38 2011/04/24 18:53:02 plunky Exp $ */ +/* $NetBSD: if_msk.c,v 1.39 2012/02/02 19:43:05 tls Exp $ */ /* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */ /* @@ -52,9 +52,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.38 2011/04/24 18:53:02 plunky Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.39 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -81,9 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.38 2011/04/24 18:53:02 plunky Exp $"); #include <net/if_media.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/mii/mii.h> #include <dev/mii/miivar.h> @@ -1120,10 +1116,8 @@ msk_attach(device_t parent, device_t self, void *aux) else aprint_error_dev(self, "couldn't establish power handler\n"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sk_dev), RND_TYPE_NET, 0); -#endif DPRINTFN(2, ("msk_attach: end\n")); return; @@ -1954,10 +1948,7 @@ msk_intr(void *xsc) if (ifp1 != NULL && !IFQ_IS_EMPTY(&ifp1->if_snd)) msk_start(ifp1); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, status); -#endif + rnd_add_uint32(&sc->rnd_source, status); if (sc->sk_int_mod_pending) msk_update_int_mod(sc, 1); diff --git a/sys/dev/pci/if_mskvar.h b/sys/dev/pci/if_mskvar.h index 01ac7e2df75..3f192c0661e 100644 --- a/sys/dev/pci/if_mskvar.h +++ b/sys/dev/pci/if_mskvar.h @@ -1,5 +1,5 @@ /* $OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $ */ -/* $NetBSD: if_mskvar.h,v 1.9 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_mskvar.h,v 1.10 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -81,11 +81,7 @@ #ifndef _DEV_PCI_IF_MSKVAR_H_ #define _DEV_PCI_IF_MSKVAR_H_ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif struct sk_jpool_entry { int slot; @@ -209,9 +205,7 @@ struct sk_softc { bus_dmamap_t sk_status_map; int sk_status_idx; int sk_status_own_idx; -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* Softc for each logical interface */ diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index d49408332ef..03bc711b478 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_pcn.c,v 1.53 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_pcn.c,v 1.54 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -65,9 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.53 2011/11/19 22:51:23 tls Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.54 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -81,9 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.53 2011/11/19 22:51:23 tls Exp $"); #include <sys/device.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -312,9 +308,7 @@ struct pcn_softc { uint32_t sc_csr5; /* prototype CSR5 register */ uint32_t sc_mode; /* prototype MODE register */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; /* sc_flags */ @@ -818,10 +812,8 @@ pcn_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); ether_ifattach(ifp, enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif #ifdef PCN_EVENT_COUNTERS /* Attach event counters. */ @@ -1237,10 +1229,7 @@ pcn_intr(void *arg) if ((csr0 & LE_C0_INTR) == 0) break; -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, csr0); -#endif + rnd_add_uint32(&sc->rnd_source, csr0); /* ACK the bits and re-enable interrupts. */ pcn_csr_write(sc, LE_CSR0, csr0 & diff --git a/sys/dev/pci/if_sip.c b/sys/dev/pci/if_sip.c index 0289d36af05..4132abc9d78 100644 --- a/sys/dev/pci/if_sip.c +++ b/sys/dev/pci/if_sip.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sip.c,v 1.152 2011/12/12 02:44:14 jakllsch Exp $ */ +/* $NetBSD: if_sip.c,v 1.153 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -73,9 +73,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.152 2011/12/12 02:44:14 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.153 2012/02/02 19:43:05 tls Exp $"); + -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -89,9 +89,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_sip.c,v 1.152 2011/12/12 02:44:14 jakllsch Exp $" #include <sys/device.h> #include <sys/queue.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -354,9 +352,7 @@ struct sip_softc { void (*sc_rxintr)(struct sip_softc *); -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; #define sc_bits sc_parm->p_bits @@ -911,9 +907,7 @@ sipcom_do_detach(device_t self, enum sip_attach_stage stage) } #endif /* SIP_EVENT_COUNTERS */ -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); @@ -1291,10 +1285,8 @@ sipcom_attach(device_t parent, device_t self, void *aux) sc->sc_prev.ec_capenable = sc->sc_ethercom.ec_capenable; sc->sc_prev.is_vlan = VLAN_ATTACHED(&(sc)->sc_ethercom); sc->sc_prev.if_capenable = ifp->if_capenable; -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif /* * The number of bytes that must be available in @@ -1842,10 +1834,7 @@ sipcom_intr(void *arg) if ((isr & sc->sc_imr) == 0) break; -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, isr); -#endif + rnd_add_uint32(&sc->rnd_source, isr); handled = 1; diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index c02d118f019..6787422eb5d 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sk.c,v 1.69 2011/05/29 13:31:30 phx Exp $ */ +/* $NetBSD: if_sk.c,v 1.70 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -115,9 +115,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.69 2011/05/29 13:31:30 phx Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.70 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -140,9 +138,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.69 2011/05/29 13:31:30 phx Exp $"); #include <net/if_media.h> #include <net/bpf.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/mii/mii.h> #include <dev/mii/miivar.h> @@ -1465,10 +1461,8 @@ sk_attach(device_t parent, device_t self, void *aux) ether_ifattach(ifp, sc_if->sk_enaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->sk_dev), RND_TYPE_NET, 0); -#endif if (pmf_device_register(self, NULL, sk_resume)) pmf_class_network_register(self, ifp); @@ -2402,10 +2396,7 @@ sk_intr(void *xsc) if (ifp1 != NULL && !IFQ_IS_EMPTY(&ifp1->if_snd)) sk_start(ifp1); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, status); -#endif + rnd_add_uint32(&sc->rnd_source, status); if (sc->sk_int_mod_pending) sk_update_int_mod(sc); diff --git a/sys/dev/pci/if_skvar.h b/sys/dev/pci/if_skvar.h index 79b3479f900..217aa07b21b 100644 --- a/sys/dev/pci/if_skvar.h +++ b/sys/dev/pci/if_skvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_skvar.h,v 1.16 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_skvar.h,v 1.17 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -80,11 +80,7 @@ #ifndef _DEV_PCI_IF_SKVAR_H_ #define _DEV_PCI_IF_SKVAR_H_ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif struct sk_jpool_entry { int slot; @@ -204,9 +200,7 @@ struct sk_softc { int sk_int_mod_pending; bus_dma_tag_t sc_dmatag; struct sk_if_softc *sk_if[2]; -#if NRND > 0 krndsource_t rnd_source; -#endif }; /* Softc for each logical interface */ diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index 4a9eb4a4167..a96057871c7 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_tl.c,v 1.96 2010/11/13 13:52:07 uebayasi Exp $ */ +/* $NetBSD: if_tl.c,v 1.97 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.96 2010/11/13 13:52:07 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.97 2012/02/02 19:43:05 tls Exp $"); #undef TLDEBUG #define TL_PRIV_STATS @@ -65,10 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.96 2010/11/13 13:52:07 uebayasi Exp $"); #include <net/bpf.h> #include <net/bpfdesc.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #ifdef INET #include <netinet/in.h> @@ -471,10 +468,8 @@ tl_pci_attach(device_t parent, device_t self, void *aux) else aprint_error_dev(self, "couldn't establish power handler\n"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif } static void @@ -1226,10 +1221,7 @@ tl_intr(void *v) /* Ack the interrupt and enable interrupts */ TL_HR_WRITE(sc, TL_HOST_CMD, ack | int_type | HOST_CMD_ACK | HOST_CMD_IntOn); -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, int_reg); -#endif + rnd_add_uint32(&sc->rnd_source, int_reg); return 1; } /* ack = 0 ; interrupt was perhaps not our. Just enable interrupts */ diff --git a/sys/dev/pci/if_tlvar.h b/sys/dev/pci/if_tlvar.h index ad34eda5450..49a1b0bf005 100644 --- a/sys/dev/pci/if_tlvar.h +++ b/sys/dev/pci/if_tlvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlvar.h,v 1.15 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_tlvar.h,v 1.16 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -30,11 +30,7 @@ * available from www.ti.com */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/i2c/i2cvar.h> @@ -84,9 +80,7 @@ struct tl_softc { int oerr_carrloss; int oerr_mcopy; #endif -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define tl_if tl_ec.ec_if #define tl_bpf tl_if.if_bpf diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 0e13a61512b..7faf36dbb21 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vr.c,v 1.109 2012/01/30 19:41:21 drochner Exp $ */ +/* $NetBSD: if_vr.c,v 1.110 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -97,9 +97,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.109 2012/01/30 19:41:21 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.110 2012/02/02 19:43:05 tls Exp $"); + -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -111,9 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.109 2012/01/30 19:41:21 drochner Exp $") #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> @@ -233,9 +231,7 @@ struct vr_softc { uint32_t vr_save_membase; uint32_t vr_save_irq; -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; #define VR_CDTXADDR(sc, x) ((sc)->vr_cddma + VR_CDTXOFF((x))) @@ -908,10 +904,7 @@ vr_intr(void *arg) handled = 1; -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, status); -#endif + rnd_add_uint32(&sc->rnd_source, status); if (status & VR_ISR_RX_OK) vr_rxeof(sc); @@ -1689,10 +1682,9 @@ vr_attach(device_t parent, device_t self, void *aux) */ if_attach(ifp); ether_ifattach(ifp, sc->vr_enaddr); -#if NRND > 0 + rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif if (pmf_device_register1(self, NULL, vr_resume, vr_shutdown)) pmf_class_network_register(self, ifp); diff --git a/sys/dev/pci/if_vte.c b/sys/dev/pci/if_vte.c index e42268e0e68..d9740fd4c9a 100644 --- a/sys/dev/pci/if_vte.c +++ b/sys/dev/pci/if_vte.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vte.c,v 1.4 2012/01/30 19:41:21 drochner Exp $ */ +/* $NetBSD: if_vte.c,v 1.5 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2011 Manuel Bouyer. All rights reserved. @@ -55,7 +55,7 @@ /* Driver for DM&P Electronics, Inc, Vortex86 RDC R6040 FastEthernet. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.4 2012/01/30 19:41:21 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.5 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -79,10 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_vte.c,v 1.4 2012/01/30 19:41:21 drochner Exp $"); #include <net/bpf.h> #include <net/bpfdesc.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include "opt_inet.h" #include <net/if_ether.h> @@ -277,10 +274,9 @@ vte_attach(device_t parent, device_t self, void *aux) else aprint_error_dev(self, "couldn't establish power handler\n"); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif + if (sysctl_createv(&sc->vte_clog, 0, NULL, &node, 0, CTLTYPE_NODE, device_xname(sc->vte_dev), SYSCTL_DESCR("vte per-controller controls"), @@ -1177,10 +1173,7 @@ vte_rxeof(struct vte_softc *sc) (((VTE_RX_RING_CNT * 2) / 10) << VTE_MRDCR_RX_PAUSE_THRESH_SHIFT)); #endif -#if NRND > 0 - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, prog); -#endif /* NRND > 0 */ + rnd_add_uint32(&sc->rnd_source, prog); } } diff --git a/sys/dev/pci/if_vtevar.h b/sys/dev/pci/if_vtevar.h index 9abc8928ee5..3f752041cfe 100644 --- a/sys/dev/pci/if_vtevar.h +++ b/sys/dev/pci/if_vtevar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_vtevar.h,v 1.2 2011/11/19 22:51:23 tls Exp $ */ +/* $NetBSD: if_vtevar.h,v 1.3 2012/02/02 19:43:05 tls Exp $ */ /*- * Copyright (c) 2010, Pyun YongHyeon <yongari@FreeBSD.org> @@ -138,9 +138,7 @@ struct vte_softc { int vte_int_rx_mod; int vte_int_tx_mod; -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define vte_if vte_ec.ec_if diff --git a/sys/dev/pci/if_wm.c b/sys/dev/pci/if_wm.c index ad7223bb101..7bb8f930fd8 100644 --- a/sys/dev/pci/if_wm.c +++ b/sys/dev/pci/if_wm.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.226 2012/01/30 19:41:21 drochner Exp $ */ +/* $NetBSD: if_wm.c,v 1.227 2012/02/02 19:43:05 tls Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -76,9 +76,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.226 2012/01/30 19:41:21 drochner Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.227 2012/02/02 19:43:05 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -93,9 +91,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.226 2012/01/30 19:41:21 drochner Exp $") #include <sys/queue.h> #include <sys/syslog.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -378,9 +374,7 @@ struct wm_softc { int sc_mchash_type; /* multicast filter offset */ -#if NRND > 0 krndsource_t rnd_source; /* random source */ -#endif }; #define WM_RXCHAIN_RESET(sc) \ @@ -1958,9 +1952,7 @@ wm_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, xname, RND_TYPE_NET, 0); -#endif #ifdef WM_EVENT_COUNTERS /* Attach event counters. */ @@ -2886,10 +2878,7 @@ wm_intr(void *arg) icr = CSR_READ(sc, WMREG_ICR); if ((icr & sc->sc_icr) == 0) break; -#if 0 /*NRND > 0*/ - if (RND_ENABLED(&sc->rnd_source)) - rnd_add_uint32(&sc->rnd_source, icr); -#endif + rnd_add_uint32(&sc->rnd_source, icr); handled = 1; diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 5ebd24cf667..527da72558a 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xge.c,v 1.15 2010/04/05 07:20:28 joerg Exp $ */ +/* $NetBSD: if_xge.c,v 1.16 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 2004, SUNET, Swedish University Computer Network. @@ -43,9 +43,8 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.15 2010/04/05 07:20:28 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.16 2012/02/02 19:43:06 tls Exp $"); -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -55,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xge.c,v 1.15 2010/04/05 07:20:28 joerg Exp $"); #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> diff --git a/sys/dev/pci/ld_amr.c b/sys/dev/pci/ld_amr.c index 2fc61427b0c..b8e6c285e44 100644 --- a/sys/dev/pci/ld_amr.c +++ b/sys/dev/pci/ld_amr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_amr.c,v 1.20 2010/11/13 13:52:07 uebayasi Exp $ */ +/* $NetBSD: ld_amr.c,v 1.21 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_amr.c,v 1.20 2010/11/13 13:52:07 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_amr.c,v 1.21 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -47,9 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_amr.c,v 1.20 2010/11/13 13:52:07 uebayasi Exp $") #include <sys/endian.h> #include <sys/dkio.h> #include <sys/disk.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/pci/ld_twa.c b/sys/dev/pci/ld_twa.c index 182e0165561..94bc445ec8f 100644 --- a/sys/dev/pci/ld_twa.c +++ b/sys/dev/pci/ld_twa.c @@ -1,5 +1,5 @@ /* $wasabi: ld_twa.c,v 1.9 2006/02/14 18:44:37 jordanr Exp $ */ -/* $NetBSD: ld_twa.c,v 1.14 2010/11/13 13:52:07 uebayasi Exp $ */ +/* $NetBSD: ld_twa.c,v 1.15 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -36,9 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_twa.c,v 1.14 2010/11/13 13:52:07 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_twa.c,v 1.15 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -50,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_twa.c,v 1.14 2010/11/13 13:52:07 uebayasi Exp $") #include <sys/dkio.h> #include <sys/disk.h> #include <sys/proc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/pci/ld_twe.c b/sys/dev/pci/ld_twe.c index 40dc3f59c63..2b0cf8da704 100644 --- a/sys/dev/pci/ld_twe.c +++ b/sys/dev/pci/ld_twe.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_twe.c,v 1.35 2010/11/13 13:52:07 uebayasi Exp $ */ +/* $NetBSD: ld_twe.c,v 1.36 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -34,9 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.35 2010/11/13 13:52:07 uebayasi Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.36 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -48,9 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_twe.c,v 1.35 2010/11/13 13:52:07 uebayasi Exp $") #include <sys/dkio.h> #include <sys/disk.h> #include <sys/proc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <sys/bus.h> diff --git a/sys/dev/pci/ld_virtio.c b/sys/dev/pci/ld_virtio.c index 8c3aac2026e..96e1579dbae 100644 --- a/sys/dev/pci/ld_virtio.c +++ b/sys/dev/pci/ld_virtio.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_virtio.c,v 1.4 2011/12/03 10:53:09 hannken Exp $ */ +/* $NetBSD: ld_virtio.c,v 1.5 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 2010 Minoura Makoto. @@ -26,9 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.4 2011/12/03 10:53:09 hannken Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.5 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -38,9 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_virtio.c,v 1.4 2011/12/03 10:53:09 hannken Exp $" #include <sys/device.h> #include <sys/disk.h> #include <sys/mutex.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/pci/pcidevs.h> #include <dev/pci/pcireg.h> diff --git a/sys/dev/pcmcia/if_cs_pcmcia.c b/sys/dev/pcmcia/if_cs_pcmcia.c index 9ab0993a486..34ac776535e 100644 --- a/sys/dev/pcmcia/if_cs_pcmcia.c +++ b/sys/dev/pcmcia/if_cs_pcmcia.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cs_pcmcia.c,v 1.18 2009/05/12 14:42:18 cegger Exp $ */ +/* $NetBSD: if_cs_pcmcia.c,v 1.19 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c)2001 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cs_pcmcia.c,v 1.18 2009/05/12 14:42:18 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cs_pcmcia.c,v 1.19 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -35,10 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cs_pcmcia.c,v 1.18 2009/05/12 14:42:18 cegger Exp #include <sys/socket.h> #include <sys/queue.h> -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_ether.h> diff --git a/sys/dev/pcmcia/if_xi.c b/sys/dev/pcmcia/if_xi.c index c69f5f3ac52..70167ce2be6 100644 --- a/sys/dev/pcmcia/if_xi.c +++ b/sys/dev/pcmcia/if_xi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_xi.c,v 1.71 2010/04/05 07:21:47 joerg Exp $ */ +/* $NetBSD: if_xi.c,v 1.72 2012/02/02 19:43:06 tls Exp $ */ /* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */ /* @@ -55,7 +55,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.71 2010/04/05 07:21:47 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.72 2012/02/02 19:43:06 tls Exp $"); #include "opt_inet.h" #include "opt_ipx.h" @@ -248,9 +248,8 @@ xi_attach(struct xi_softc *sc, u_int8_t *myea) NULL); ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER | IFM_AUTO); -#if NRND > 0 - rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif + rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), + RND_TYPE_NET, 0); } int @@ -263,9 +262,7 @@ xi_detach(device_t self, int flags) xi_disable(sc); -#if NRND > 0 rnd_detach_source(&sc->sc_rnd_source); -#endif mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); @@ -384,9 +381,7 @@ xi_intr(void *arg) ifp->if_oerrors++; /* have handled the interrupt */ -#if NRND > 0 rnd_add_uint32(&sc->sc_rnd_source, tx_status); -#endif end: /* Reenable interrupts. */ diff --git a/sys/dev/pcmcia/if_xivar.h b/sys/dev/pcmcia/if_xivar.h index 2b493881546..b10216db76f 100644 --- a/sys/dev/pcmcia/if_xivar.h +++ b/sys/dev/pcmcia/if_xivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_xivar.h,v 1.7 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_xivar.h,v 1.8 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 2004 Charles M. Hannum. All rights reserved. @@ -18,11 +18,7 @@ * derived from this software without specific prior written permission. */ -#include "rnd.h" - -#if NRND > 0 #include <sys/rnd.h> -#endif struct xi_softc { device_t sc_dev; /* Generic device info */ @@ -44,9 +40,7 @@ struct xi_softc { #define XI_CHIPSET_DINGO 2 u_int8_t sc_rev; /* Chip revision */ -#if NRND > 0 krndsource_t sc_rnd_source; -#endif }; void xi_attach(struct xi_softc *, u_int8_t *); diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index 95aef944511..a392bb0c888 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.77 2010/04/05 07:21:47 joerg Exp $ */ +/* $NetBSD: be.c,v 1.78 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -57,11 +57,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.77 2010/04/05 07:21:47 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.78 2012/02/02 19:43:06 tls Exp $"); #include "opt_ddb.h" #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -74,9 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: be.c,v 1.77 2010/04/05 07:21:47 joerg Exp $"); #include <sys/syslog.h> #include <sys/device.h> #include <sys/malloc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index 5ccaad73508..5b667742870 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.59 2011/07/18 00:58:52 mrg Exp $ */ +/* $NetBSD: qe.c,v 1.60 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -66,13 +66,12 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.59 2011/07/18 00:58:52 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.60 2012/02/02 19:43:06 tls Exp $"); #define QEDEBUG #include "opt_ddb.h" #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -84,9 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.59 2011/07/18 00:58:52 mrg Exp $"); #include <sys/syslog.h> #include <sys/device.h> #include <sys/malloc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> diff --git a/sys/dev/scsipi/cd.c b/sys/dev/scsipi/cd.c index ff6f2db56d5..b4d886e06a5 100644 --- a/sys/dev/scsipi/cd.c +++ b/sys/dev/scsipi/cd.c @@ -1,4 +1,4 @@ -/* $NetBSD: cd.c,v 1.304 2011/11/25 12:39:55 joerg Exp $ */ +/* $NetBSD: cd.c,v 1.305 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998, 2001, 2003, 2004, 2005, 2008 The NetBSD Foundation, @@ -50,9 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.304 2011/11/25 12:39:55 joerg Exp $"); - -#include "rnd.h" +__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.305 2012/02/02 19:43:06 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -74,9 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.304 2011/11/25 12:39:55 joerg Exp $"); #include <sys/proc.h> #include <sys/conf.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/scsipi/scsi_spc.h> #include <dev/scsipi/scsipi_all.h> @@ -289,10 +285,8 @@ cdattach(device_t parent, device_t self, void *aux) aprint_normal("\n"); aprint_naive("\n"); -#if NRND > 0 rnd_attach_source(&cd->rnd_source, device_xname(cd->sc_dev), RND_TYPE_DISK, 0); -#endif if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); @@ -335,10 +329,8 @@ cddetach(device_t self, int flags) disk_detach(&cd->sc_dk); disk_destroy(&cd->sc_dk); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&cd->rnd_source); -#endif return (0); } @@ -904,9 +896,7 @@ cddone(struct scsipi_xfer *xs, int error) disk_unbusy(&cd->sc_dk, bp->b_bcount - bp->b_resid, (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&cd->rnd_source, bp->b_rawblkno); -#endif biodone(bp); } diff --git a/sys/dev/scsipi/cdvar.h b/sys/dev/scsipi/cdvar.h index 5f48abdbe5f..2c3c297b87a 100644 --- a/sys/dev/scsipi/cdvar.h +++ b/sys/dev/scsipi/cdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cdvar.h,v 1.30 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: cdvar.h,v 1.31 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -47,7 +47,5 @@ struct cd_softc { struct bufq_state *buf_queue; struct callout sc_callout; -#if NRND > 0 krndsource_t rnd_source; -#endif }; diff --git a/sys/dev/scsipi/sd.c b/sys/dev/scsipi/sd.c index a2741a09355..6a4be28125b 100644 --- a/sys/dev/scsipi/sd.c +++ b/sys/dev/scsipi/sd.c @@ -1,4 +1,4 @@ -/* $NetBSD: sd.c,v 1.295 2011/11/25 12:39:56 joerg Exp $ */ +/* $NetBSD: sd.c,v 1.296 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc. @@ -47,10 +47,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.295 2011/11/25 12:39:56 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.296 2012/02/02 19:43:06 tls Exp $"); #include "opt_scsi.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -70,9 +69,8 @@ __KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.295 2011/11/25 12:39:56 joerg Exp $"); #include <sys/proc.h> #include <sys/conf.h> #include <sys/vnode.h> -#if NRND > 0 #include <sys/rnd.h> -#endif +#include <sys/cprng.h> #include <dev/scsipi/scsi_spc.h> #include <dev/scsipi/scsipi_all.h> @@ -217,7 +215,7 @@ sdattach(device_t parent, device_t self, void *aux) struct sd_softc *sd = device_private(self); struct scsipibus_attach_args *sa = aux; struct scsipi_periph *periph = sa->sa_periph; - int error, result; + int error, result, rndval = cprng_strong32(); struct disk_parms *dp = &sd->params; char pbuf[9]; @@ -312,23 +310,31 @@ sdattach(device_t parent, device_t self, void *aux) if (!pmf_device_register1(self, sd_suspend, NULL, sd_shutdown)) aprint_error_dev(self, "couldn't establish power handler\n"); -#if NRND > 0 /* * attach the device into the random source list */ rnd_attach_source(&sd->rnd_source, device_xname(sd->sc_dev), RND_TYPE_DISK, 0); -#endif /* Discover wedges on this disk. */ dkwedge_discover(&sd->sc_dk); + + /* + * Disk insertion and removal times can be a useful source + * of entropy, though the estimator should never _count_ + * these bits, on insertion, because the deltas to the + * nonexistent) previous event should never allow it. + */ + rnd_add_uint32(&sd->rnd_source, rndval); } static int sddetach(device_t self, int flags) { struct sd_softc *sd = device_private(self); - int s, bmaj, cmaj, i, mn, rc; + int s, bmaj, cmaj, i, mn, rc, rndval = cprng_strong32(); + + rnd_add_uint32(&sd->rnd_source, rndval); if ((rc = disk_begindetach(&sd->sc_dk, sdlastclose, self, flags)) != 0) return rc; @@ -370,10 +376,8 @@ sddetach(device_t self, int flags) pmf_device_deregister(self); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&sd->rnd_source); -#endif return (0); } @@ -932,9 +936,7 @@ sddone(struct scsipi_xfer *xs, int error) disk_unbusy(&sd->sc_dk, bp->b_bcount - bp->b_resid, (bp->b_flags & B_READ)); -#if NRND > 0 rnd_add_uint32(&sd->rnd_source, bp->b_rawblkno); -#endif biodone(bp); } diff --git a/sys/dev/scsipi/sdvar.h b/sys/dev/scsipi/sdvar.h index 11646e20434..f686ce5bf8f 100644 --- a/sys/dev/scsipi/sdvar.h +++ b/sys/dev/scsipi/sdvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sdvar.h,v 1.33 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: sdvar.h,v 1.34 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -50,10 +50,8 @@ #define _DEV_SCSIPI_SDVAR_H_ #include "opt_scsi.h" -#include "rnd.h" -#if NRND > 0 + #include <sys/rnd.h> -#endif #ifndef SDRETRIES #define SDRETRIES 4 @@ -91,9 +89,7 @@ struct sd_softc { u_int8_t type; char name[16]; /* product name, for default disklabel */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define SDGP_RESULT_OK 0 /* parameters obtained */ diff --git a/sys/dev/scsipi/st.c b/sys/dev/scsipi/st.c index 5b448b4a709..130d33d56ee 100644 --- a/sys/dev/scsipi/st.c +++ b/sys/dev/scsipi/st.c @@ -1,4 +1,4 @@ -/* $NetBSD: st.c,v 1.217 2010/05/30 04:38:04 pgoyette Exp $ */ +/* $NetBSD: st.c,v 1.218 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.217 2010/05/30 04:38:04 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st.c,v 1.218 2012/02/02 19:43:06 tls Exp $"); #include "opt_scsi.h" @@ -410,10 +410,8 @@ stattach(device_t parent, struct st_softc *st, void *aux) st->stats = iostat_alloc(IOSTAT_TAPE, parent, device_xname(&st->sc_dev)); -#if NRND > 0 rnd_attach_source(&st->rnd_source, device_xname(&st->sc_dev), RND_TYPE_TAPE, 0); -#endif } int @@ -448,10 +446,8 @@ stdetach(device_t self, int flags) iostat_free(st->stats); -#if NRND > 0 /* Unhook the entropy source. */ rnd_detach_source(&st->rnd_source); -#endif return (0); } @@ -1321,9 +1317,7 @@ stdone(struct scsipi_xfer *xs, int error) iostat_unbusy(st->stats, bp->b_bcount, ((bp->b_flags & B_READ) == B_READ)); -#if NRND > 0 rnd_add_uint32(&st->rnd_source, bp->b_blkno); -#endif if ((st->flags & ST_POSUPDATED) == 0) { if (error) { diff --git a/sys/dev/scsipi/st_atapi.c b/sys/dev/scsipi/st_atapi.c index dfb8f9933ae..106e0c8a9a4 100644 --- a/sys/dev/scsipi/st_atapi.c +++ b/sys/dev/scsipi/st_atapi.c @@ -1,4 +1,4 @@ -/* $NetBSD: st_atapi.c,v 1.26 2009/12/06 22:48:17 dyoung Exp $ */ +/* $NetBSD: st_atapi.c,v 1.27 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 2001 Manuel Bouyer. @@ -26,10 +26,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: st_atapi.c,v 1.26 2009/12/06 22:48:17 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st_atapi.c,v 1.27 2012/02/02 19:43:06 tls Exp $"); #include "opt_scsi.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/device.h> diff --git a/sys/dev/scsipi/st_scsi.c b/sys/dev/scsipi/st_scsi.c index 674e9498640..0a9bde5de79 100644 --- a/sys/dev/scsipi/st_scsi.c +++ b/sys/dev/scsipi/st_scsi.c @@ -1,4 +1,4 @@ -/* $NetBSD: st_scsi.c,v 1.32 2009/12/06 22:48:17 dyoung Exp $ */ +/* $NetBSD: st_scsi.c,v 1.33 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -50,10 +50,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.32 2009/12/06 22:48:17 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: st_scsi.c,v 1.33 2012/02/02 19:43:06 tls Exp $"); #include "opt_scsi.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/device.h> diff --git a/sys/dev/scsipi/stvar.h b/sys/dev/scsipi/stvar.h index 45e32e29468..9dcc56dea56 100644 --- a/sys/dev/scsipi/stvar.h +++ b/sys/dev/scsipi/stvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: stvar.h,v 1.22 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: stvar.h,v 1.23 2012/02/02 19:43:06 tls Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -49,10 +49,7 @@ * A lot of rewhacking done by mjacob (mjacob@nas.nasa.gov). */ -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/scsipi/scsipi_all.h> #include <dev/scsipi/scsiconf.h> @@ -146,9 +143,7 @@ struct st_softc { struct io_stats *stats; /* statistics for the drive */ -#if NRND > 0 krndsource_t rnd_source; -#endif }; #define ST_INFO_VALID 0x0001 diff --git a/sys/dev/sdmmc/ld_sdmmc.c b/sys/dev/sdmmc/ld_sdmmc.c index 5faaaa15364..b767225ba27 100644 --- a/sys/dev/sdmmc/ld_sdmmc.c +++ b/sys/dev/sdmmc/ld_sdmmc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ld_sdmmc.c,v 1.9 2012/02/01 22:34:42 matt Exp $ */ +/* $NetBSD: ld_sdmmc.c,v 1.10 2012/02/02 19:43:06 tls Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi @@ -28,9 +28,8 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.9 2012/02/01 22:34:42 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.10 2012/02/02 19:43:06 tls Exp $"); -#include "rnd.h" #ifdef _KERNEL_OPT #include "opt_sdmmc.h" #endif @@ -47,9 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: ld_sdmmc.c,v 1.9 2012/02/01 22:34:42 matt Exp $"); #include <sys/dkio.h> #include <sys/disk.h> #include <sys/kthread.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <dev/ldvar.h> diff --git a/sys/dev/sysmon/sysmon_power.c b/sys/dev/sysmon/sysmon_power.c index 8b531818b00..ff55ad5e698 100644 --- a/sys/dev/sysmon/sysmon_power.c +++ b/sys/dev/sysmon/sysmon_power.c @@ -1,4 +1,4 @@ -/* $NetBSD: sysmon_power.c,v 1.45 2011/07/22 14:21:40 jakllsch Exp $ */ +/* $NetBSD: sysmon_power.c,v 1.46 2012/02/02 19:43:07 tls Exp $ */ /*- * Copyright (c) 2007 Juan Romero Pardines. @@ -69,7 +69,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.45 2011/07/22 14:21:40 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.46 2012/02/02 19:43:07 tls Exp $"); #include "opt_compat_netbsd.h" #include <sys/param.h> @@ -83,6 +83,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysmon_power.c,v 1.45 2011/07/22 14:21:40 jakllsch E #include <sys/kmem.h> #include <sys/proc.h> #include <sys/device.h> +#include <sys/rnd.h> #include <dev/sysmon/sysmonvar.h> #include <prop/proplib.h> @@ -166,6 +167,8 @@ static int sysmon_power_event_queue_head; static int sysmon_power_event_queue_tail; static int sysmon_power_event_queue_count; +static krndsource_t sysmon_rndsource; + static SIMPLEQ_HEAD(, power_event_dictionary) pev_dict_list = SIMPLEQ_HEAD_INITIALIZER(pev_dict_list); @@ -196,6 +199,10 @@ sysmon_power_init(void) mutex_init(&sysmon_power_event_queue_mtx, MUTEX_DEFAULT, IPL_NONE); cv_init(&sysmon_power_event_queue_cv, "smpower"); selinit(&sysmon_power_event_queue_selinfo); + + rnd_attach_source(&sysmon_rndsource, "system-power", + RND_TYPE_POWER, 0); + } /* @@ -779,6 +786,8 @@ sysmon_penvsys_event(struct penvsys_state *pes, int event) KASSERT(pes != NULL); + rnd_add_uint32(&sysmon_rndsource, pes->pes_type); + if (sysmon_power_daemon != NULL) { /* * Create a dictionary for the new event. diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index 77e6eec31ce..7142b9bba15 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $ */ +/* $NetBSD: if_aue.c,v 1.124 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -77,10 +77,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.124 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -91,9 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.123 2011/12/23 00:51:43 jakllsch Exp $" #include <sys/kernel.h> #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> @@ -857,10 +854,8 @@ aue_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->aue_dev), RND_TYPE_NET, 0); -#endif callout_init(&(sc->aue_stat_ch), 0); @@ -910,9 +905,7 @@ aue_detach(device_t self, int flags) if (ifp->if_flags & IFF_RUNNING) aue_stop(sc); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif mii_detach(&sc->aue_mii, MII_PHY_ANY, MII_OFFSET_ANY); ifmedia_delete_instance(&sc->aue_mii.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h index 56f9839f8df..283f6730a21 100644 --- a/sys/dev/usb/if_auereg.h +++ b/sys/dev/usb/if_auereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_auereg.h,v 1.24 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_auereg.h,v 1.25 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -228,9 +228,7 @@ struct aue_softc { struct ethercom aue_ec; struct mii_data aue_mii; -#if NRND > 0 krndsource_t rnd_source; -#endif struct lwp *aue_thread; int aue_closing; kcondvar_t aue_domc; diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 61b02e9a4ec..6e707c7e70f 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $ */ +/* $NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $ */ /* $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */ /* @@ -89,12 +89,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.51 2012/02/02 19:43:07 tls Exp $"); #if defined(__NetBSD__) #ifndef _MODULE #include "opt_inet.h" -#include "rnd.h" #endif #endif @@ -110,9 +109,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $") #include <sys/sockio.h> #include <sys/systm.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_dl.h> @@ -727,10 +724,8 @@ axe_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->axe_dev), RND_TYPE_NET, 0); -#endif callout_init(&sc->axe_stat_ch, 0); callout_setfunc(&sc->axe_stat_ch, axe_tick, sc); @@ -769,9 +764,7 @@ axe_detach(device_t self, int flags) callout_destroy(&sc->axe_stat_ch); mutex_destroy(&sc->axe_mii_lock); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif mii_detach(&sc->axe_mii, MII_PHY_ANY, MII_OFFSET_ANY); ifmedia_delete_instance(&sc->axe_mii.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h index cb3d55fd0d4..65741a87474 100644 --- a/sys/dev/usb/if_axereg.h +++ b/sys/dev/usb/if_axereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_axereg.h,v 1.13 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_axereg.h,v 1.14 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 @@ -199,9 +199,7 @@ struct axe_softc { device_t axe_dev; struct ethercom axe_ec; struct mii_data axe_mii; -#if NRND > 0 krndsource_t rnd_source; -#endif usbd_device_handle axe_udev; usbd_interface_handle axe_iface; diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c index fadd67ecaf7..450aee6a8aa 100644 --- a/sys/dev/usb/if_cdce.c +++ b/sys/dev/usb/if_cdce.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $ */ +/* $NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -41,7 +41,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.35 2012/02/02 19:43:07 tls Exp $"); #ifdef __NetBSD__ #include "opt_inet.h" #endif @@ -54,9 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.34 2012/01/10 11:32:25 ws Exp $"); #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> diff --git a/sys/dev/usb/if_cdcereg.h b/sys/dev/usb/if_cdcereg.h index 90f2da7be4e..0ee49902302 100644 --- a/sys/dev/usb/if_cdcereg.h +++ b/sys/dev/usb/if_cdcereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_cdcereg.h,v 1.6 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_cdcereg.h,v 1.7 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com> @@ -68,9 +68,7 @@ struct cdce_cdata { struct cdce_softc { device_t cdce_dev; struct ethercom cdce_ec; -#if NRND > 0 krndsource_t rnd_source; -#endif #define GET_IFP(sc) (&(sc)->cdce_ec.ec_if) usbd_device_handle cdce_udev; usbd_interface_handle cdce_ctl_iface; diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index b889e28c21c..f5c32815a5d 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $ */ +/* $NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -56,11 +56,10 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.61 2012/02/02 19:43:07 tls Exp $"); #if defined(__NetBSD__) #include "opt_inet.h" -#include "rnd.h" #elif defined(__OpenBSD__) #include "bpfilter.h" #endif /* defined(__OpenBSD__) */ @@ -77,9 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.60 2010/11/03 22:28:31 dyoung Exp $"); #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #if defined(__NetBSD__) @@ -578,10 +575,8 @@ cue_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->cue_dev), RND_TYPE_NET, 0); -#endif callout_init(&(sc->cue_stat_ch), 0); @@ -621,9 +616,7 @@ cue_detach(device_t self, int flags) cue_stop(sc); #if defined(__NetBSD__) -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); #endif /* __NetBSD__ */ diff --git a/sys/dev/usb/if_cuereg.h b/sys/dev/usb/if_cuereg.h index f5d53b894d4..12cff48710e 100644 --- a/sys/dev/usb/if_cuereg.h +++ b/sys/dev/usb/if_cuereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_cuereg.h,v 1.17 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_cuereg.h,v 1.18 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -168,9 +168,7 @@ struct cue_softc { device_t cue_dev; struct ethercom cue_ec; -#if NRND > 0 krndsource_t rnd_source; -#endif #define GET_IFP(sc) (&(sc)->cue_ec.ec_if) struct callout cue_stat_ch; diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 0e1d76ceee8..cae16cfdfa9 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $ */ +/* $NetBSD: if_kue.c,v 1.75 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -70,10 +70,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.75 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -85,9 +84,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.74 2010/11/03 22:28:31 dyoung Exp $"); #include <sys/device.h> #include <sys/proc.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> @@ -507,10 +504,8 @@ kue_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); ether_ifattach(ifp, sc->kue_desc.kue_macaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(sc->kue_dev), RND_TYPE_NET, 0); -#endif sc->kue_attached = true; splx(s); @@ -544,9 +539,7 @@ kue_detach(device_t self, int flags) if (ifp->if_flags & IFF_RUNNING) kue_stop(sc); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif ether_ifdetach(ifp); if_detach(ifp); diff --git a/sys/dev/usb/if_kuereg.h b/sys/dev/usb/if_kuereg.h index 5920c98e4b1..4f6385bdd37 100644 --- a/sys/dev/usb/if_kuereg.h +++ b/sys/dev/usb/if_kuereg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_kuereg.h,v 1.17 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_kuereg.h,v 1.18 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -162,9 +162,7 @@ struct kue_softc { device_t kue_dev; struct ethercom kue_ec; -#if NRND > 0 krndsource_t rnd_source; -#endif #define GET_IFP(sc) (&(sc)->kue_ec.ec_if) usbd_device_handle kue_udev; diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 85e645a8a19..3df65c323b7 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $ */ +/* $NetBSD: if_udav.c,v 1.34 2012/02/02 19:43:07 tls Exp $ */ /* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */ /* * Copyright (c) 2003 @@ -44,10 +44,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.34 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -56,9 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.33 2011/12/23 00:51:43 jakllsch Exp $" #include <sys/kernel.h> #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> @@ -306,10 +303,8 @@ udav_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif callout_init(&sc->sc_stat_ch, 0); sc->sc_attached = 1; @@ -353,9 +348,7 @@ udav_detach(device_t self, int flags) if (ifp->if_flags & IFF_RUNNING) udav_stop(GET_IFP(sc), 1); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); diff --git a/sys/dev/usb/if_udavreg.h b/sys/dev/usb/if_udavreg.h index 9aa6f1b2513..c9a58c88be6 100644 --- a/sys/dev/usb/if_udavreg.h +++ b/sys/dev/usb/if_udavreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_udavreg.h,v 1.7 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_udavreg.h,v 1.8 2012/02/02 19:43:07 tls Exp $ */ /* $nabe: if_udavreg.h,v 1.2 2003/08/21 16:26:40 nabe Exp $ */ /* * Copyright (c) 2003 @@ -189,9 +189,7 @@ struct udav_softc { kmutex_t sc_mii_lock; int sc_link; #define sc_media udav_mii.mii_media -#if NRND > 0 krndsource_t rnd_source; -#endif struct udav_cdata sc_cdata; int sc_attached; diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c index 67b0b056621..72d1a3da527 100644 --- a/sys/dev/usb/if_upl.c +++ b/sys/dev/usb/if_upl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $ */ +/* $NetBSD: if_upl.c,v 1.42 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,10 +34,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.42 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -49,9 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.41 2011/12/23 00:51:44 jakllsch Exp $") #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_types.h> @@ -134,9 +131,7 @@ struct upl_softc { device_t sc_dev; struct ifnet sc_if; -#if NRND > 0 krndsource_t sc_rnd_source; -#endif struct callout sc_stat_ch; @@ -312,10 +307,8 @@ upl_attach(device_t parent, device_t self, void *aux) if_alloc_sadl(ifp); bpf_attach(ifp, DLT_RAW, 0); -#if NRND > 0 rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); -#endif sc->sc_attached = 1; splx(s); @@ -346,9 +339,7 @@ upl_detach(device_t self, int flags) if (ifp->if_flags & IFF_RUNNING) upl_stop(sc); -#if NRND > 0 rnd_detach_source(&sc->sc_rnd_source); -#endif bpf_detach(ifp); if_detach(ifp); diff --git a/sys/dev/usb/if_url.c b/sys/dev/usb/if_url.c index 39adf451506..15981001652 100644 --- a/sys/dev/usb/if_url.c +++ b/sys/dev/usb/if_url.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $ */ +/* $NetBSD: if_url.c,v 1.41 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 2001, 2002 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. @@ -43,10 +43,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.41 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" -#include "rnd.h" #include <sys/param.h> #include <sys/systm.h> @@ -56,9 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.40 2011/12/23 00:51:44 jakllsch Exp $") #include <sys/socket.h> #include <sys/device.h> -#if NRND > 0 #include <sys/rnd.h> -#endif #include <net/if.h> #include <net/if_arp.h> @@ -313,10 +310,8 @@ url_attach(device_t parent, device_t self, void *aux) if_attach(ifp); ether_ifattach(ifp, eaddr); -#if NRND > 0 rnd_attach_source(&sc->rnd_source, device_xname(self), RND_TYPE_NET, 0); -#endif callout_init(&sc->sc_stat_ch, 0); sc->sc_attached = 1; @@ -361,9 +356,7 @@ url_detach(device_t self, int flags) if (ifp->if_flags & IFF_RUNNING) url_stop(GET_IFP(sc), 1); -#if NRND > 0 rnd_detach_source(&sc->rnd_source); -#endif mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); ifmedia_delete_instance(&sc->sc_mii.mii_media, IFM_INST_ANY); ether_ifdetach(ifp); diff --git a/sys/dev/usb/if_urlreg.h b/sys/dev/usb/if_urlreg.h index 8a0ed59fb0d..80dd5139fde 100644 --- a/sys/dev/usb/if_urlreg.h +++ b/sys/dev/usb/if_urlreg.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_urlreg.h,v 1.7 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: if_urlreg.h,v 1.8 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 2001, 2002 * Shingo WATANABE <nabe@nabechan.org>. All rights reserved. @@ -175,9 +175,7 @@ struct url_softc { krwlock_t sc_mii_rwlock; int sc_link; #define sc_media url_mii.mii_media -#if NRND > 0 krndsource_t rnd_source; -#endif struct url_cdata sc_cdata; int sc_attached; diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 8b67c31b34d..3021dd58b4d 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $ */ +/* $NetBSD: ucom.c,v 1.97 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.97 2012/02/02 19:43:07 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -51,11 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.96 2012/01/14 20:51:00 jakllsch Exp $"); #include <sys/queue.h> #include <sys/kauth.h> #if defined(__NetBSD__) -#include "rnd.h" -#if NRND > 0 #include <sys/rnd.h> #endif -#endif #include <dev/usb/usb.h> @@ -146,9 +143,7 @@ struct ucom_softc { int sc_refcnt; u_char sc_dying; /* disconnecting */ -#if defined(__NetBSD__) && NRND > 0 krndsource_t sc_rndsource; /* random source */ -#endif }; dev_type_open(ucomopen); @@ -246,7 +241,7 @@ ucom_attach(device_t parent, device_t self, void *aux) DPRINTF(("ucom_attach: tty_attach %p\n", tp)); tty_attach(tp); -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev), RND_TYPE_TTY, 0); #endif @@ -320,7 +315,7 @@ ucom_detach(device_t self, int flags) } /* Detach the random source */ -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) rnd_detach_source(&sc->sc_rndsource); #endif @@ -1074,7 +1069,7 @@ ucom_write_status(struct ucom_softc *sc, struct ucom_buffer *ub, break; case USBD_NORMAL_COMPLETION: usbd_get_xfer_status(ub->ub_xfer, NULL, NULL, &cc, NULL); -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) rnd_add_uint32(&sc->sc_rndsource, cc); #endif /*FALLTHROUGH*/ @@ -1259,7 +1254,7 @@ ucomreadcb(usbd_xfer_handle xfer, usbd_private_handle p, usbd_status status) KDASSERT(cp == ub->ub_data); -#if defined(__NetBSD__) && NRND > 0 +#if defined(__NetBSD__) rnd_add_uint32(&sc->sc_rndsource, cc); #endif diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 7cad557360b..623d479923a 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.c,v 1.54 2011/12/23 00:51:46 jakllsch Exp $ */ +/* $NetBSD: uhidev.c,v 1.55 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.54 2011/12/23 00:51:46 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.55 2012/02/02 19:43:07 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -354,11 +354,9 @@ nomem: return; } #endif -#if NRND > 0 rnd_attach_source(&csc->rnd_source, device_xname(dev), RND_TYPE_TTY, 0); -#endif } } } @@ -428,9 +426,7 @@ uhidev_detach(device_t self, int flags) { struct uhidev_softc *sc = device_private(self); int i, rv; -#if NRND > 0 struct uhidev *csc; -#endif DPRINTF(("uhidev_detach: sc=%p flags=%d\n", sc, flags)); @@ -444,10 +440,8 @@ uhidev_detach(device_t self, int flags) rv = 0; for (i = 0; i < sc->sc_nrepid; i++) { if (sc->sc_subdevs[i] != NULL) { -#if NRND > 0 csc = device_private(sc->sc_subdevs[i]); rnd_detach_source(&csc->rnd_source); -#endif rv |= config_detach(sc->sc_subdevs[i], flags); } } @@ -522,9 +516,7 @@ uhidev_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) device_xname(sc->sc_dev))); return; } -#if NRND > 0 rnd_add_uint32(&scd->rnd_source, (uintptr_t)(sc->sc_ibuf)); -#endif scd->sc_intr(scd, p, cc); } diff --git a/sys/dev/usb/uhidev.h b/sys/dev/usb/uhidev.h index 425189f0eec..678296bc4ba 100644 --- a/sys/dev/usb/uhidev.h +++ b/sys/dev/usb/uhidev.h @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.h,v 1.11 2011/11/19 22:51:24 tls Exp $ */ +/* $NetBSD: uhidev.h,v 1.12 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,10 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "rnd.h" -#if NRND > 0 + #include <sys/rnd.h> -#endif struct uhidev_softc { device_t sc_dev; /* base device */ @@ -67,9 +65,7 @@ struct uhidev { int sc_in_rep_size; #define UHIDEV_OPEN 0x01 /* device is open */ void (*sc_intr)(struct uhidev *, void *, u_int); -#if NRND > 0 krndsource_t rnd_source; -#endif }; struct uhidev_attach_arg { diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 05d22a707f9..fab81ccbba4 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.440 2012/01/29 22:55:40 rmind Exp $ */ +/* $NetBSD: init_main.c,v 1.441 2012/02/02 19:43:07 tls Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.440 2012/01/29 22:55:40 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.441 2012/02/02 19:43:07 tls Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -116,7 +116,7 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.440 2012/01/29 22:55:40 rmind Exp $" #include "drvctl.h" #include "ksyms.h" -#include "rnd.h" + #include "sysmon_envsys.h" #include "sysmon_power.h" #include "sysmon_taskq.h" diff --git a/sys/dev/rndpool.c b/sys/kern/kern_rndpool.c index 10c8fb70ef1..2fd1748ec63 100644 --- a/sys/dev/rndpool.c +++ b/sys/kern/kern_rndpool.c @@ -1,4 +1,4 @@ -/* $NetBSD: rndpool.c,v 1.22 2011/12/17 20:05:38 tls Exp $ */ +/* $NetBSD: kern_rndpool.c,v 1.1 2012/02/02 19:43:07 tls Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rndpool.c,v 1.22 2011/12/17 20:05:38 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.1 2012/02/02 19:43:07 tls Exp $"); #include <sys/param.h> #include <sys/systm.h> diff --git a/sys/dev/rnd.c b/sys/kern/kern_rndq.c index e926d9b96ec..4cb4f484125 100644 --- a/sys/dev/rnd.c +++ b/sys/kern/kern_rndq.c @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.c,v 1.89 2011/12/17 20:05:38 tls Exp $ */ +/* $NetBSD: kern_rndq.c,v 1.1 2012/02/02 19:43:07 tls Exp $ */ /*- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.89 2011/12/17 20:05:38 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.1 2012/02/02 19:43:07 tls Exp $"); #include <sys/param.h> #include <sys/ioctl.h> @@ -152,7 +152,7 @@ static krndsource_t rnd_source_no_collect = { .test = NULL }; -struct callout rnd_callout; +struct callout rnd_callout, skew_callout; void rnd_wakeup_readers(void); static inline u_int32_t rnd_estimate_entropy(krndsource_t *, u_int32_t); @@ -160,6 +160,8 @@ static inline u_int32_t rnd_counter(void); static void rnd_timeout(void *); static void rnd_process_events(void *); u_int32_t rnd_extract_data_locked(void *, u_int32_t, u_int32_t); /* XXX */ +static void rnd_add_data_ts(krndsource_t *, const void *const, + uint32_t, uint32_t, uint32_t); int rnd_ready = 0; static int rnd_have_entropy = 0; @@ -173,6 +175,7 @@ static uint8_t rnd_testbits[sizeof(rnd_rt.rt_b)]; LIST_HEAD(, krndsource) rnd_sources; rndsave_t *boot_rsp; + /* * Generate a 32-bit counter. This should be more machine dependent, * using cycle counters and the like when possible. @@ -308,6 +311,43 @@ rnd_estimate_entropy(krndsource_t *rs, u_int32_t t) return (1); } +#if defined(__HAVE_CPU_COUNTER) && !defined(_RUMPKERNEL) +static void +rnd_skew(void *arg) +{ + static krndsource_t skewsrc; + static int live, flipflop; + + /* + * Only one instance of this callout will ever be scheduled + * at a time (it is only ever scheduled by itself). So no + * locking is required here. + */ + + /* + * Even on systems with seemingly stable clocks, the + * entropy estimator seems to think we get 1 bit here + * about every 2 calls. That seems like too much. Set + * NO_ESTIMATE on this source until we can better analyze + * the entropy of its output. + */ + if (__predict_false(!live)) { + rnd_attach_source(&skewsrc, "callout", RND_TYPE_SKEW, + RND_FLAG_NO_ESTIMATE); + live = 1; + } + + flipflop = !flipflop; + + if (flipflop) { + rnd_add_uint32(&skewsrc, rnd_counter()); + callout_schedule(&skew_callout, hz); + } else { + callout_schedule(&skew_callout, 1); + } +} +#endif + /* * initialize the global random pool for our use. * rnd_init() must be called very early on in the boot process, so @@ -358,6 +398,21 @@ rnd_init(void) rnd_ready = 1; + /* + * If we have a cycle counter, take its error with respect + * to the callout mechanism as a source of entropy, ala + * TrueRand. + * + * XXX This will do little when the cycle counter *is* what's + * XXX clocking the callout mechanism. How to get this right + * XXX without unsightly spelunking in the timecounter code? + */ +#if defined(__HAVE_CPU_COUNTER) && !defined(_RUMPKERNEL) /* XXX: bad pooka */ + callout_init(&skew_callout, CALLOUT_MPSAFE); + callout_setfunc(&skew_callout, rnd_skew, NULL); + rnd_skew(NULL); +#endif + #ifdef RND_VERBOSE printf("rnd: initialised (%u)%s", RND_POOLBITS, c ? " with counter\n" : "\n"); @@ -529,11 +584,11 @@ rnd_detach_source(krndsource_t *source) } /* - * Add a value to the entropy pool. The rs parameter should point to the - * source-specific source structure. + * Add a 32-bit value to the entropy pool. The rs parameter should point to + * the source-specific source structure. */ void -rnd_add_uint32(krndsource_t *rs, u_int32_t val) +_rnd_add_uint32(krndsource_t *rs, u_int32_t val) { u_int32_t ts; u_int32_t entropy = 0; @@ -556,15 +611,21 @@ rnd_add_uint32(krndsource_t *rs, u_int32_t val) entropy = rnd_estimate_entropy(rs, ts); } - rnd_add_data(rs, &val, sizeof(val), entropy); + rnd_add_data_ts(rs, &val, sizeof(val), entropy, ts); } void -rnd_add_data(krndsource_t *rs, const void *const data, u_int32_t len, - u_int32_t entropy) +rnd_add_data(krndsource_t *rs, const void *const data, uint32_t len, + uint32_t entropy) +{ + rnd_add_data_ts(rs, data, len, entropy, rnd_counter()); +} + +static void +rnd_add_data_ts(krndsource_t *rs, const void *const data, u_int32_t len, + u_int32_t entropy, uint32_t ts) { rnd_sample_t *state = NULL; - uint32_t ts; const uint32_t *dint = data; int todo, done, filled = 0; SIMPLEQ_HEAD(, _rnd_sample_t) tmp_samples = @@ -574,12 +635,6 @@ rnd_add_data(krndsource_t *rs, const void *const data, u_int32_t len, return; } - /* - * Sample the counter as soon as possible to avoid entropy - * overestimation. - */ - ts = rnd_counter(); - /* * Loop over data packaging it into sample buffers. * If a sample buffer allocation fails, drop all data. diff --git a/sys/lib/libkern/arc4random.c b/sys/lib/libkern/arc4random.c index 279c01648e2..7bdeb6bbfc2 100644 --- a/sys/lib/libkern/arc4random.c +++ b/sys/lib/libkern/arc4random.c @@ -1,4 +1,4 @@ -/* $NetBSD: arc4random.c,v 1.29 2011/11/29 13:16:27 drochner Exp $ */ +/* $NetBSD: arc4random.c,v 1.30 2012/02/02 19:43:07 tls Exp $ */ /*- * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc. @@ -44,7 +44,7 @@ #include <sys/cdefs.h> #ifdef _KERNEL -#include "rnd.h" +#define NRND 1 #else #define NRND 0 #endif diff --git a/sys/modules/if_axe/Makefile b/sys/modules/if_axe/Makefile index d4476f1e626..5b50d951045 100644 --- a/sys/modules/if_axe/Makefile +++ b/sys/modules/if_axe/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2011/08/23 12:54:05 pgoyette Exp $ +# $NetBSD: Makefile,v 1.2 2012/02/02 19:43:07 tls Exp $ .include "../Makefile.inc" @@ -10,6 +10,6 @@ SRCS= if_axe.c WARNS= 4 -CPPFLAGS+= -DINET -DNRND=1 +CPPFLAGS+= -DINET .include <bsd.kmodule.mk> diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 015a45df850..3a106ede40d 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.161 2011/12/19 11:59:57 drochner Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.162 2012/02/02 19:43:07 tls Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -95,13 +95,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.161 2011/12/19 11:59:57 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.162 2012/02/02 19:43:07 tls Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" #include "opt_tcp_debug.h" #include "opt_mbuftrace.h" -#include "rnd.h" + #include <sys/param.h> #include <sys/systm.h> @@ -2020,7 +2020,6 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname, SYSCTL_DESCR("TCP drop connection"), sysctl_net_inet_tcp_drop, 0, NULL, 0, CTL_NET, pf, IPPROTO_TCP, TCPCTL_DROP, CTL_EOL); -#if NRND > 0 sysctl_createv(clog, 0, NULL, NULL, CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, "iss_hash", @@ -2029,7 +2028,6 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname, NULL, 0, &tcp_do_rfc1948, sizeof(tcp_do_rfc1948), CTL_NET, pf, IPPROTO_TCP, CTL_CREATE, CTL_EOL); -#endif /* ABC subtree */ diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index f01c60c05ef..46b0d6e3d44 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_var.h,v 1.168 2011/10/31 12:52:19 yamt Exp $ */ +/* $NetBSD: tcp_var.h,v 1.169 2012/02/02 19:43:08 tls Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -138,7 +138,7 @@ #if defined(_KERNEL_OPT) #include "opt_inet.h" #include "opt_mbuftrace.h" -#include "rnd.h" + #endif /* @@ -807,9 +807,7 @@ extern int tcp_syn_bucket_limit;/* max entries per hash bucket */ extern int tcp_log_refused; /* log refused connections */ extern int tcp_do_ecn; /* TCP ECN enabled/disabled? */ extern int tcp_ecn_maxretries; /* Max ECN setup retries */ -#if NRND > 0 extern int tcp_do_rfc1948; /* ISS by cryptographic hash */ -#endif extern int tcp_sack_tp_maxholes; /* Max holes per connection. */ extern int tcp_sack_globalmaxholes; /* Max holes per system. */ extern int tcp_sack_globalholes; /* Number of holes present. */ diff --git a/sys/rump/dev/lib/librnd/Makefile b/sys/rump/dev/lib/librnd/Makefile index a4067076676..950fe6c72b1 100644 --- a/sys/rump/dev/lib/librnd/Makefile +++ b/sys/rump/dev/lib/librnd/Makefile @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.5 2011/12/20 17:09:04 apb Exp $ +# $NetBSD: Makefile,v 1.6 2012/02/02 19:43:08 tls Exp $ # .PATH: ${.CURDIR}/../../../../dev LIB= rumpdev_rnd -SRCS= rnd.c rndpseudo.c rndpool.c +SRCS= rndpseudo.c SRCS+= component.c diff --git a/sys/rump/librump/rumpkern/Makefile.rumpkern b/sys/rump/librump/rumpkern/Makefile.rumpkern index 51a6d93b660..96afdafbcee 100644 --- a/sys/rump/librump/rumpkern/Makefile.rumpkern +++ b/sys/rump/librump/rumpkern/Makefile.rumpkern @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.rumpkern,v 1.114 2011/12/04 19:24:59 jym Exp $ +# $NetBSD: Makefile.rumpkern,v 1.115 2012/02/02 19:43:08 tls Exp $ # .include "${RUMPTOP}/Makefile.rump" @@ -73,6 +73,8 @@ SRCS+= init_sysctl_base.c \ kern_prot.c \ kern_rate.c \ kern_resource.c \ + kern_rndpool.c \ + kern_rndq.c \ kern_stub.c \ kern_syscall.c \ kern_sysctl.c \ diff --git a/sys/sys/rnd.h b/sys/sys/rnd.h index 831e79299fb..6cf4cf30410 100644 --- a/sys/sys/rnd.h +++ b/sys/sys/rnd.h @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.h,v 1.28 2011/12/17 20:05:40 tls Exp $ */ +/* $NetBSD: rnd.h,v 1.29 2012/02/02 19:43:08 tls Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -96,9 +96,12 @@ typedef struct { #define RND_TYPE_NET 2 /* source is a network device */ #define RND_TYPE_TAPE 3 /* source is a tape drive */ #define RND_TYPE_TTY 4 /* source is a tty device */ -#define RND_TYPE_RNG 5 /* source is a random number - generator */ -#define RND_TYPE_MAX 5 /* last type id used */ +#define RND_TYPE_RNG 5 /* source is a hardware RNG */ +#define RND_TYPE_SKEW 6 /* source is skew between clocks */ +#define RND_TYPE_ENV 7 /* source is temp or fan sensor */ +#define RND_TYPE_VM 8 /* source is VM system events */ +#define RND_TYPE_POWER 9 /* source is power events */ +#define RND_TYPE_MAX 9 /* last type id used */ #ifdef _KERNEL /* @@ -153,7 +156,7 @@ uint32_t rndpool_get_poolsize(void); void rndpool_add_data(rndpool_t *, void *, uint32_t, uint32_t); uint32_t rndpool_extract_data(rndpool_t *, void *, uint32_t, uint32_t); void rnd_init(void); -void rnd_add_uint32(krndsource_t *, uint32_t); +void _rnd_add_uint32(krndsource_t *, uint32_t); void rnd_add_data(krndsource_t *, const void *const, uint32_t, uint32_t); void rnd_attach_source(krndsource_t *, const char *, @@ -165,6 +168,14 @@ void rndsink_detach(rndsink_t *); void rnd_seed(void *, size_t); +static inline void +rnd_add_uint32(krndsource_t *kr, uint32_t val) +{ + if (RND_ENABLED(kr)) { + _rnd_add_uint32(kr, val); + } +} + extern int rnd_full; #endif /* _KERNEL */ diff --git a/sys/uvm/uvm.h b/sys/uvm/uvm.h index aa2aaca23cc..5efa0cc374b 100644 --- a/sys/uvm/uvm.h +++ b/sys/uvm/uvm.h @@ -1,4 +1,4 @@ -/* $NetBSD: uvm.h,v 1.62 2011/05/17 04:18:07 mrg Exp $ */ +/* $NetBSD: uvm.h,v 1.63 2012/02/02 19:43:08 tls Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -59,6 +59,7 @@ #include <uvm/uvm_pager.h> #include <uvm/uvm_pdaemon.h> #include <uvm/uvm_swap.h> +#include <sys/rnd.h> #ifdef _KERNEL @@ -81,6 +82,11 @@ struct uvm_cpu { pages in the idle loop */ int pages[PGFL_NQUEUES]; /* total of pages in page_free */ u_int emap_gen; /* emap generation number */ + + uintptr_t last_fltaddr; /* last faulted address */ + uintptr_t last_delta; /* difference of last two flt addrs */ + uintptr_t last_delta2; /* difference of differences */ + krndsource_t rs; /* entropy source */ }; /* diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c index 6a35739e4aa..b2b5b535c92 100644 --- a/sys/uvm/uvm_fault.c +++ b/sys/uvm/uvm_fault.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.192 2012/01/27 19:48:41 para Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.193 2012/02/02 19:43:08 tls Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.192 2012/01/27 19:48:41 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.193 2012/02/02 19:43:08 tls Exp $"); #include "opt_uvmhist.h" @@ -169,6 +169,12 @@ static const struct uvm_advice uvmadvice[] = { */ /* + * externs from other modules + */ + +extern int start_init_exec; /* Is init_main() done / init running? */ + +/* * inline functions */ @@ -780,6 +786,8 @@ int uvm_fault_internal(struct vm_map *orig_map, vaddr_t vaddr, vm_prot_t access_type, int fault_flag) { + struct cpu_data *cd; + struct uvm_cpu *ucpu; struct uvm_faultinfo ufi; struct uvm_faultctx flt = { .access_type = access_type, @@ -795,13 +803,64 @@ uvm_fault_internal(struct vm_map *orig_map, vaddr_t vaddr, struct vm_anon *anons_store[UVM_MAXRANGE], **anons; struct vm_page *pages_store[UVM_MAXRANGE], **pages; int error; +#if 0 + uintptr_t delta, delta2, delta3; +#endif UVMHIST_FUNC("uvm_fault"); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist, "(map=0x%x, vaddr=0x%x, at=%d, ff=%d)", orig_map, vaddr, access_type, fault_flag); - curcpu()->ci_data.cpu_nfault++; + cd = &(curcpu()->ci_data); + cd->cpu_nfault++; + ucpu = cd->cpu_uvm; + /* Don't flood RNG subsystem with samples. */ + if (cd->cpu_nfault % 503) + goto norng; +#if 0 + /* + * Avoid trying to count "entropy" for accesses of regular + * stride, by checking the 1st, 2nd, 3rd order differentials + * of vaddr, like the rnd code does internally with sample times. + * + * XXX If the selection of only every 503rd fault above is + * XXX removed, this code should exclude most samples, but + * XXX does not, and is therefore disabled. + */ + if (ucpu->last_fltaddr > (uintptr_t)trunc_page(vaddr)) + delta = ucpu->last_fltaddr - (uintptr_t)trunc_page(vaddr); + else + delta = (uintptr_t)trunc_page(vaddr) - ucpu->last_fltaddr; + + if (ucpu->last_delta > delta) + delta2 = ucpu->last_delta - delta; + else + delta2 = delta - ucpu->last_delta; + + if (ucpu->last_delta2 > delta2) + delta3 = ucpu->last_delta2 - delta2; + else + delta3 = delta2 - ucpu->last_delta2; + + ucpu->last_fltaddr = (uintptr_t)vaddr; + ucpu->last_delta = delta; + ucpu->last_delta2 = delta2; + + if (delta != 0 && delta2 != 0 && delta3 != 0) +#endif + /* Don't count anything until user interaction is possible */ + if (__predict_true(start_init_exec)) { + kpreempt_disable(); + rnd_add_uint32(&ucpu->rs, + sizeof(vaddr_t) == sizeof(uint32_t) ? + (uint32_t)vaddr : sizeof(vaddr_t) == + sizeof(uint64_t) ? + (uint32_t)(vaddr & 0x00000000ffffffff) : + (uint32_t)(cd->cpu_nfault & 0x00000000ffffffff)); + kpreempt_enable(); + } +norng: /* * init the IN parameters in the ufi */ diff --git a/sys/uvm/uvm_page.c b/sys/uvm/uvm_page.c index 9f34f444b90..de4451f5274 100644 --- a/sys/uvm/uvm_page.c +++ b/sys/uvm/uvm_page.c @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.180 2012/01/28 15:43:34 matt Exp $ */ +/* $NetBSD: uvm_page.c,v 1.181 2012/02/02 19:43:08 tls Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.180 2012/01/28 15:43:34 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.181 2012/02/02 19:43:08 tls Exp $"); #include "opt_ddb.h" #include "opt_uvmhist.h" @@ -1076,7 +1076,7 @@ uvm_cpu_attach(struct cpu_info *ci) if (CPU_IS_PRIMARY(ci)) { /* Already done in uvm_page_init(). */ - return; + goto attachrnd; } /* Add more reserve pages for this CPU. */ @@ -1094,6 +1094,14 @@ uvm_cpu_attach(struct cpu_info *ci) uvm_page_init_buckets(&pgfl); ucpu->page_free[lcv].pgfl_buckets = pgfl.pgfl_buckets; } + +attachrnd: + /* + * Attach RNG source for this CPU's VM events + */ + rnd_attach_source(&uvm.cpus[cpu_index(ci)]->rs, + ci->ci_data.cpu_name, RND_TYPE_VM, 0); + } /* |
