summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authortls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
committertls <tls@NetBSD.org>2012-02-02 19:42:57 +0000
commitcc9ee3de3e25ef31d3a97dc35bedc36945e35d2a (patch)
tree06a2889eb6b4b02bc8b8bba6b5cc3f9b1938d18b /sys/dev
parentf622122a62827e27b444c2f95632d61f73357ced (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/dev')
-rw-r--r--sys/dev/acpi/acpi_tz.c42
-rw-r--r--sys/dev/acpi/fdc_acpi.c6
-rw-r--r--sys/dev/ata/ld_ataraid.c8
-rw-r--r--sys/dev/ata/wd.c14
-rw-r--r--sys/dev/ata/wdvar.h6
-rw-r--r--sys/dev/cardbus/if_fxp_cardbus.c7
-rw-r--r--sys/dev/cardbus/if_rtk_cardbus.c7
-rw-r--r--sys/dev/cardbus/rbus_ppb.c6
-rw-r--r--sys/dev/gpib/rd.c14
-rw-r--r--sys/dev/i2o/ld_iop.c8
-rw-r--r--sys/dev/ic/am7990.c10
-rw-r--r--sys/dev/ic/am79900.c10
-rw-r--r--sys/dev/ic/com.c12
-rw-r--r--sys/dev/ic/comvar.h6
-rw-r--r--sys/dev/ic/cs89x0.c17
-rw-r--r--sys/dev/ic/cs89x0var.h4
-rw-r--r--sys/dev/ic/dp8390.c17
-rw-r--r--sys/dev/ic/dp8390var.h7
-rw-r--r--sys/dev/ic/elink3.c13
-rw-r--r--sys/dev/ic/elink3var.h8
-rw-r--r--sys/dev/ic/elinkxl.c14
-rw-r--r--sys/dev/ic/elinkxlvar.h8
-rw-r--r--sys/dev/ic/gem.c10
-rw-r--r--sys/dev/ic/gemvar.h8
-rw-r--r--sys/dev/ic/hme.c11
-rw-r--r--sys/dev/ic/hmevar.h7
-rw-r--r--sys/dev/ic/i82557.c14
-rw-r--r--sys/dev/ic/i82557var.h5
-rw-r--r--sys/dev/ic/lan9118.c15
-rw-r--r--sys/dev/ic/lan9118var.h8
-rw-r--r--sys/dev/ic/lance.c10
-rw-r--r--sys/dev/ic/lancevar.h8
-rw-r--r--sys/dev/ic/ld_aac.c8
-rw-r--r--sys/dev/ic/ld_cac.c8
-rw-r--r--sys/dev/ic/ld_icp.c8
-rw-r--r--sys/dev/ic/ld_mlx.c8
-rw-r--r--sys/dev/ic/lemac.c11
-rw-r--r--sys/dev/ic/lemacvar.h8
-rw-r--r--sys/dev/ic/mb86950.c12
-rw-r--r--sys/dev/ic/mb86950var.h4
-rw-r--r--sys/dev/ic/mb86960.c15
-rw-r--r--sys/dev/ic/mb86960var.h8
-rw-r--r--sys/dev/ic/mtd803.c15
-rw-r--r--sys/dev/ic/mtd803var.h5
-rw-r--r--sys/dev/ic/pckbc.c16
-rw-r--r--sys/dev/ic/pckbcvar.h7
-rw-r--r--sys/dev/ic/rtl81x9.c16
-rw-r--r--sys/dev/ic/rtl81x9var.h9
-rw-r--r--sys/dev/ic/seeq8005.c12
-rw-r--r--sys/dev/ic/seeq8005var.h7
-rw-r--r--sys/dev/ic/smc91cxx.c14
-rw-r--r--sys/dev/ic/smc91cxxvar.h9
-rw-r--r--sys/dev/ic/tulip.c13
-rw-r--r--sys/dev/ic/tulipvar.h8
-rw-r--r--sys/dev/isa/cs89x0isa.c7
-rw-r--r--sys/dev/isa/fd.c14
-rw-r--r--sys/dev/isa/fdc_isa.c8
-rw-r--r--sys/dev/isa/fdvar.h8
-rw-r--r--sys/dev/isa/if_cs_isa.c7
-rw-r--r--sys/dev/isa/if_eg.c13
-rw-r--r--sys/dev/isa/if_el.c13
-rw-r--r--sys/dev/isa/if_iy.c13
-rw-r--r--sys/dev/isa/if_tscs_isa.c7
-rw-r--r--sys/dev/isapnp/if_cs_isapnp.c7
-rw-r--r--sys/dev/ld.c14
-rw-r--r--sys/dev/ldvar.h8
-rw-r--r--sys/dev/marvell/if_gfe.c9
-rw-r--r--sys/dev/marvell/if_gfevar.h4
-rw-r--r--sys/dev/marvell/if_mvgbe.c17
-rw-r--r--sys/dev/mca/ed_mca.c10
-rw-r--r--sys/dev/mca/edc_mca.c10
-rw-r--r--sys/dev/mca/edvar.h4
-rw-r--r--sys/dev/ofisa/if_cs_ofisa.c7
-rw-r--r--sys/dev/pci/hifn7751.c10
-rw-r--r--sys/dev/pci/if_bce.c16
-rw-r--r--sys/dev/pci/if_bge.c17
-rw-r--r--sys/dev/pci/if_bgevar.h4
-rw-r--r--sys/dev/pci/if_cas.c10
-rw-r--r--sys/dev/pci/if_casvar.h4
-rw-r--r--sys/dev/pci/if_de.c13
-rw-r--r--sys/dev/pci/if_devar.h7
-rw-r--r--sys/dev/pci/if_dge.c17
-rw-r--r--sys/dev/pci/if_fxp_pci.c8
-rw-r--r--sys/dev/pci/if_jme.c17
-rw-r--r--sys/dev/pci/if_msk.c15
-rw-r--r--sys/dev/pci/if_mskvar.h8
-rw-r--r--sys/dev/pci/if_pcn.c17
-rw-r--r--sys/dev/pci/if_sip.c19
-rw-r--r--sys/dev/pci/if_sk.c15
-rw-r--r--sys/dev/pci/if_skvar.h8
-rw-r--r--sys/dev/pci/if_tl.c14
-rw-r--r--sys/dev/pci/if_tlvar.h8
-rw-r--r--sys/dev/pci/if_vr.c18
-rw-r--r--sys/dev/pci/if_vte.c15
-rw-r--r--sys/dev/pci/if_vtevar.h4
-rw-r--r--sys/dev/pci/if_wm.c17
-rw-r--r--sys/dev/pci/if_xge.c7
-rw-r--r--sys/dev/pci/ld_amr.c8
-rw-r--r--sys/dev/pci/ld_twa.c8
-rw-r--r--sys/dev/pci/ld_twe.c8
-rw-r--r--sys/dev/pci/ld_virtio.c8
-rw-r--r--sys/dev/pcmcia/if_cs_pcmcia.c7
-rw-r--r--sys/dev/pcmcia/if_xi.c13
-rw-r--r--sys/dev/pcmcia/if_xivar.h8
-rw-r--r--sys/dev/rnd.c979
-rw-r--r--sys/dev/rndpool.c311
-rw-r--r--sys/dev/sbus/be.c7
-rw-r--r--sys/dev/sbus/qe.c7
-rw-r--r--sys/dev/scsipi/cd.c14
-rw-r--r--sys/dev/scsipi/cdvar.h4
-rw-r--r--sys/dev/scsipi/sd.c28
-rw-r--r--sys/dev/scsipi/sdvar.h8
-rw-r--r--sys/dev/scsipi/st.c10
-rw-r--r--sys/dev/scsipi/st_atapi.c6
-rw-r--r--sys/dev/scsipi/st_scsi.c6
-rw-r--r--sys/dev/scsipi/stvar.h7
-rw-r--r--sys/dev/sdmmc/ld_sdmmc.c7
-rw-r--r--sys/dev/sysmon/sysmon_power.c13
-rw-r--r--sys/dev/usb/if_aue.c11
-rw-r--r--sys/dev/usb/if_auereg.h4
-rw-r--r--sys/dev/usb/if_axe.c11
-rw-r--r--sys/dev/usb/if_axereg.h4
-rw-r--r--sys/dev/usb/if_cdce.c6
-rw-r--r--sys/dev/usb/if_cdcereg.h4
-rw-r--r--sys/dev/usb/if_cue.c11
-rw-r--r--sys/dev/usb/if_cuereg.h4
-rw-r--r--sys/dev/usb/if_kue.c11
-rw-r--r--sys/dev/usb/if_kuereg.h4
-rw-r--r--sys/dev/usb/if_udav.c11
-rw-r--r--sys/dev/usb/if_udavreg.h4
-rw-r--r--sys/dev/usb/if_upl.c13
-rw-r--r--sys/dev/usb/if_url.c11
-rw-r--r--sys/dev/usb/if_urlreg.h4
-rw-r--r--sys/dev/usb/ucom.c17
-rw-r--r--sys/dev/usb/uhidev.c12
-rw-r--r--sys/dev/usb/uhidev.h8
136 files changed, 350 insertions, 2296 deletions
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/rnd.c b/sys/dev/rnd.c
deleted file mode 100644
index e926d9b96ec..00000000000
--- a/sys/dev/rnd.c
+++ /dev/null
@@ -1,979 +0,0 @@
-/* $NetBSD: rnd.c,v 1.89 2011/12/17 20:05:38 tls Exp $ */
-
-/*-
- * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Michael Graff <explorer@flame.org> and Thor Lancelot Simon.
- * This code uses ideas and algorithms from the Linux driver written by
- * Ted Ts'o.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.89 2011/12/17 20:05:38 tls Exp $");
-
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/fcntl.h>
-#include <sys/select.h>
-#include <sys/poll.h>
-#include <sys/kmem.h>
-#include <sys/mutex.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/conf.h>
-#include <sys/systm.h>
-#include <sys/callout.h>
-#include <sys/rnd.h>
-#include <sys/vnode.h>
-#include <sys/pool.h>
-#include <sys/kauth.h>
-#include <sys/once.h>
-#include <sys/rngtest.h>
-#include <sys/cpu.h> /* XXX temporary, see rnd_detach_source */
-
-#include <dev/rnd_private.h>
-
-#if defined(__HAVE_CPU_COUNTER) && !defined(_RUMPKERNEL) /* XXX: bad pooka */
-#include <machine/cpu_counter.h>
-#endif
-
-#ifdef RND_DEBUG
-#define DPRINTF(l,x) if (rnd_debug & (l)) printf x
-int rnd_debug = 0;
-#else
-#define DPRINTF(l,x)
-#endif
-
-#define RND_DEBUG_WRITE 0x0001
-#define RND_DEBUG_READ 0x0002
-#define RND_DEBUG_IOCTL 0x0004
-#define RND_DEBUG_SNOOZE 0x0008
-
-/*
- * list devices attached
- */
-#if 0
-#define RND_VERBOSE
-#endif
-
-/*
- * The size of a temporary buffer, kmem_alloc()ed when needed, and used for
- * reading and writing data.
- */
-#define RND_TEMP_BUFFER_SIZE 128
-
-/*
- * This is a little bit of state information attached to each device that we
- * collect entropy from. This is simply a collection buffer, and when it
- * is full it will be "detached" from the source and added to the entropy
- * pool after entropy is distilled as much as possible.
- */
-#define RND_SAMPLE_COUNT 64 /* collect N samples, then compress */
-typedef struct _rnd_sample_t {
- SIMPLEQ_ENTRY(_rnd_sample_t) next;
- krndsource_t *source;
- int cursor;
- int entropy;
- u_int32_t ts[RND_SAMPLE_COUNT];
- u_int32_t values[RND_SAMPLE_COUNT];
-} rnd_sample_t;
-
-/*
- * The event queue. Fields are altered at an interrupt level.
- * All accesses must be protected with the mutex.
- */
-volatile int rnd_timeout_pending;
-SIMPLEQ_HEAD(, _rnd_sample_t) rnd_samples;
-kmutex_t rnd_mtx;
-
-/*
- * Entropy sinks: usually other generators waiting to be rekeyed.
- *
- * A sink's callback MUST NOT re-add the sink to the list, or
- * list corruption will occur.
- */
-TAILQ_HEAD(, rndsink) rnd_sinks;
-
-/*
- * Memory pool for sample buffers
- */
-static pool_cache_t rnd_mempc;
-
-/*
- * Our random pool. This is defined here rather than using the general
- * purpose one defined in rndpool.c.
- *
- * Samples are collected and queued into a separate mutex-protected queue
- * (rnd_samples, see above), and processed in a timeout routine; therefore,
- * the mutex protecting the random pool is at IPL_SOFTCLOCK() as well.
- */
-rndpool_t rnd_pool;
-kmutex_t rndpool_mtx;
-kcondvar_t rndpool_cv;
-
-/*
- * This source is used to easily "remove" queue entries when the source
- * which actually generated the events is going away.
- */
-static krndsource_t rnd_source_no_collect = {
- /* LIST_ENTRY list */
- .name = { 'N', 'o', 'C', 'o', 'l', 'l', 'e', 'c', 't',
- 0, 0, 0, 0, 0, 0, 0 },
- .last_time = 0, .last_delta = 0, .last_delta2 = 0, .total = 0,
- .type = RND_TYPE_UNKNOWN,
- .flags = (RND_FLAG_NO_COLLECT |
- RND_FLAG_NO_ESTIMATE |
- RND_TYPE_UNKNOWN),
- .state = NULL,
- .test_cnt = 0,
- .test = NULL
-};
-
-struct callout rnd_callout;
-
-void rnd_wakeup_readers(void);
-static inline u_int32_t rnd_estimate_entropy(krndsource_t *, u_int32_t);
-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 */
-
-int rnd_ready = 0;
-static int rnd_have_entropy = 0;
-
-#ifdef DIAGNOSTIC
-static int rnd_tested = 0;
-static rngtest_t rnd_rt;
-static uint8_t rnd_testbits[sizeof(rnd_rt.rt_b)];
-#endif
-
-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.
- */
-static inline u_int32_t
-rnd_counter(void)
-{
- struct timeval tv;
-
-#if defined(__HAVE_CPU_COUNTER) && !defined(_RUMPKERNEL) /* XXX: bad pooka */
- if (cpu_hascounter())
- return (cpu_counter32());
-#endif
- if (rnd_ready) {
- microtime(&tv);
- return (tv.tv_sec * 1000000 + tv.tv_usec);
- }
- /* when called from rnd_init, its too early to call microtime safely */
- return (0);
-}
-
-/*
- * Check to see if there are readers waiting on us. If so, kick them.
- */
-void
-rnd_wakeup_readers(void)
-{
- rndsink_t *sink, *tsink;
- TAILQ_HEAD(, rndsink) sunk = TAILQ_HEAD_INITIALIZER(sunk);
-
- mutex_spin_enter(&rndpool_mtx);
- if (rndpool_get_entropy_count(&rnd_pool) < RND_ENTROPY_THRESHOLD * 8) {
- mutex_spin_exit(&rndpool_mtx);
- return;
- }
-
- /*
- * First, take care of in-kernel consumers needing rekeying.
- */
- TAILQ_FOREACH_SAFE(sink, &rnd_sinks, tailq, tsink) {
- if ((sink->len + RND_ENTROPY_THRESHOLD) * 8 <
- rndpool_get_entropy_count(&rnd_pool)) {
- /* We have enough entropy to sink some here. */
- if (rndpool_extract_data(&rnd_pool, sink->data,
- sink->len, RND_EXTRACT_GOOD)
- != sink->len) {
- panic("could not extract estimated "
- "entropy from pool");
- }
- /* Move this sink to the list of pending callbacks */
- TAILQ_REMOVE(&rnd_sinks, sink, tailq);
- TAILQ_INSERT_HEAD(&sunk, sink, tailq);
- }
- }
-
- /*
- * If we still have enough new bits to do something, feed userspace.
- */
- if (rndpool_get_entropy_count(&rnd_pool) > RND_ENTROPY_THRESHOLD * 8) {
-#ifdef RND_VERBOSE
- if (!rnd_have_entropy)
- printf("rnd: have initial entropy (%u)\n",
- rndpool_get_entropy_count(&rnd_pool));
-#endif
- rnd_have_entropy = 1;
- mutex_spin_exit(&rndpool_mtx);
- } else {
- mutex_spin_exit(&rndpool_mtx);
- }
-
- /*
- * Now that we have dropped the mutex, we can run sinks' callbacks.
- * Since we have reused the "tailq" member of the sink structure for
- * this temporary on-stack queue, the callback must NEVER re-add
- * the sink to the main queue, or our on-stack queue will become
- * corrupt.
- */
- while ((sink = TAILQ_FIRST(&sunk))) {
-#ifdef RND_VERBOSE
- printf("supplying %d bytes to entropy sink \"%s\""
- " (cb %p, arg %p).\n",
- (int)sink->len, sink->name, sink->cb, sink->arg);
-#endif
- sink->cb(sink->arg);
- TAILQ_REMOVE(&sunk, sink, tailq);
- }
-}
-
-/*
- * Use the timing of the event to estimate the entropy gathered.
- * If all the differentials (first, second, and third) are non-zero, return
- * non-zero. If any of these are zero, return zero.
- */
-static inline u_int32_t
-rnd_estimate_entropy(krndsource_t *rs, u_int32_t t)
-{
- int32_t delta, delta2, delta3;
-
- /*
- * If the time counter has overflowed, calculate the real difference.
- * If it has not, it is simplier.
- */
- if (t < rs->last_time)
- delta = UINT_MAX - rs->last_time + t;
- else
- delta = rs->last_time - t;
-
- if (delta < 0)
- delta = -delta;
-
- /*
- * Calculate the second and third order differentials
- */
- delta2 = rs->last_delta - delta;
- if (delta2 < 0)
- delta2 = -delta2;
-
- delta3 = rs->last_delta2 - delta2;
- if (delta3 < 0)
- delta3 = -delta3;
-
- rs->last_time = t;
- rs->last_delta = delta;
- rs->last_delta2 = delta2;
-
- /*
- * If any delta is 0, we got no entropy. If all are non-zero, we
- * might have something.
- */
- if (delta == 0 || delta2 == 0 || delta3 == 0)
- return (0);
-
- return (1);
-}
-
-/*
- * initialize the global random pool for our use.
- * rnd_init() must be called very early on in the boot process, so
- * the pool is ready for other devices to attach as sources.
- */
-void
-rnd_init(void)
-{
- u_int32_t c;
-
- if (rnd_ready)
- return;
-
- mutex_init(&rnd_mtx, MUTEX_DEFAULT, IPL_VM);
-
- callout_init(&rnd_callout, CALLOUT_MPSAFE);
- callout_setfunc(&rnd_callout, rnd_timeout, NULL);
-
- /*
- * take a counter early, hoping that there's some variance in
- * the following operations
- */
- c = rnd_counter();
-
- LIST_INIT(&rnd_sources);
- SIMPLEQ_INIT(&rnd_samples);
- TAILQ_INIT(&rnd_sinks);
-
- rndpool_init(&rnd_pool);
- mutex_init(&rndpool_mtx, MUTEX_DEFAULT, IPL_VM);
- cv_init(&rndpool_cv, "rndread");
-
- rnd_mempc = pool_cache_init(sizeof(rnd_sample_t), 0, 0, 0,
- "rndsample", NULL, IPL_VM,
- NULL, NULL, NULL);
- /* Mix *something*, *anything* into the pool to help it get started.
- * However, it's not safe for rnd_counter() to call microtime() yet,
- * so on some platforms we might just end up with zeros anyway.
- * XXX more things to add would be nice.
- */
- if (c) {
- mutex_spin_enter(&rndpool_mtx);
- rndpool_add_data(&rnd_pool, &c, sizeof(c), 1);
- c = rnd_counter();
- rndpool_add_data(&rnd_pool, &c, sizeof(c), 1);
- mutex_spin_exit(&rndpool_mtx);
- }
-
- rnd_ready = 1;
-
-#ifdef RND_VERBOSE
- printf("rnd: initialised (%u)%s", RND_POOLBITS,
- c ? " with counter\n" : "\n");
-#endif
- if (boot_rsp != NULL) {
- mutex_spin_enter(&rndpool_mtx);
- rndpool_add_data(&rnd_pool, boot_rsp->data,
- sizeof(boot_rsp->data),
- MIN(boot_rsp->entropy,
- RND_POOLBITS / 2));
- if (rndpool_get_entropy_count(&rnd_pool) >
- RND_ENTROPY_THRESHOLD * 8) {
- rnd_have_entropy = 1;
- }
- mutex_spin_exit(&rndpool_mtx);
-#ifdef RND_VERBOSE
- printf("rnd: seeded with %d bits\n",
- MIN(boot_rsp->entropy, RND_POOLBITS / 2));
-#endif
- memset(boot_rsp, 0, sizeof(*boot_rsp));
- }
-}
-
-static rnd_sample_t *
-rnd_sample_allocate(krndsource_t *source)
-{
- rnd_sample_t *c;
-
- c = pool_cache_get(rnd_mempc, PR_WAITOK);
- if (c == NULL)
- return (NULL);
-
- c->source = source;
- c->cursor = 0;
- c->entropy = 0;
-
- return (c);
-}
-
-/*
- * Don't wait on allocation. To be used in an interrupt context.
- */
-static rnd_sample_t *
-rnd_sample_allocate_isr(krndsource_t *source)
-{
- rnd_sample_t *c;
-
- c = pool_cache_get(rnd_mempc, PR_NOWAIT);
- if (c == NULL)
- return (NULL);
-
- c->source = source;
- c->cursor = 0;
- c->entropy = 0;
-
- return (c);
-}
-
-static void
-rnd_sample_free(rnd_sample_t *c)
-{
- memset(c, 0, sizeof(*c));
- pool_cache_put(rnd_mempc, c);
-}
-
-/*
- * Add a source to our list of sources.
- */
-void
-rnd_attach_source(krndsource_t *rs, const char *name, u_int32_t type,
- u_int32_t flags)
-{
- u_int32_t ts;
-
- ts = rnd_counter();
-
- strlcpy(rs->name, name, sizeof(rs->name));
- rs->last_time = ts;
- rs->last_delta = 0;
- rs->last_delta2 = 0;
- rs->total = 0;
-
- /*
- * Force network devices to not collect any entropy by
- * default.
- */
- if (type == RND_TYPE_NET)
- flags |= (RND_FLAG_NO_COLLECT | RND_FLAG_NO_ESTIMATE);
-
- /*
- * Hardware RNGs get extra space for statistical testing.
- */
- if (type == RND_TYPE_RNG) {
- rs->test = kmem_alloc(sizeof(rngtest_t), KM_NOSLEEP);
- rs->test_cnt = 0;
- } else {
- rs->test = NULL;
- rs->test_cnt = -1;
- }
-
- rs->type = type;
- rs->flags = flags;
-
- rs->state = rnd_sample_allocate(rs);
-
- mutex_spin_enter(&rndpool_mtx);
- LIST_INSERT_HEAD(&rnd_sources, rs, list);
-
-#ifdef RND_VERBOSE
- printf("rnd: %s attached as an entropy source (", rs->name);
- if (!(flags & RND_FLAG_NO_COLLECT)) {
- printf("collecting");
- if (flags & RND_FLAG_NO_ESTIMATE)
- printf(" without estimation");
- }
- else
- printf("off");
- printf(")\n");
-#endif
-
- /*
- * Again, put some more initial junk in the pool.
- * XXX Bogus, but harder to guess than zeros.
- */
- rndpool_add_data(&rnd_pool, &ts, sizeof(u_int32_t), 1);
- mutex_spin_exit(&rndpool_mtx);
-}
-
-/*
- * Remove a source from our list of sources.
- */
-void
-rnd_detach_source(krndsource_t *source)
-{
- rnd_sample_t *sample;
-
- mutex_spin_enter(&rnd_mtx);
-
- LIST_REMOVE(source, list);
-
- /*
- * If there are samples queued up "remove" them from the sample queue
- * by setting the source to the no-collect pseudosource.
- */
- sample = SIMPLEQ_FIRST(&rnd_samples);
- while (sample != NULL) {
- if (sample->source == source)
- sample->source = &rnd_source_no_collect;
-
- sample = SIMPLEQ_NEXT(sample, next);
- }
-
- mutex_spin_exit(&rnd_mtx);
-
- if (!cpu_softintr_p()) { /* XXX XXX very temporary "fix" */
- if (source->state) {
- rnd_sample_free(source->state);
- source->state = NULL;
- }
-
- if (source->test) {
- kmem_free(source->test, sizeof(rngtest_t));
- }
- }
-
-#ifdef RND_VERBOSE
- printf("rnd: %s detached as an entropy source\n", source->name);
-#endif
-}
-
-/*
- * Add a 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)
-{
- u_int32_t ts;
- u_int32_t entropy = 0;
-
- if (rs->flags & RND_FLAG_NO_COLLECT)
- return;
-
- /*
- * Sample the counter as soon as possible to avoid
- * entropy overestimation.
- */
- ts = rnd_counter();
-
- /*
- * If we are estimating entropy on this source,
- * calculate differentials.
- */
-
- if ((rs->flags & RND_FLAG_NO_ESTIMATE) == 0) {
- entropy = rnd_estimate_entropy(rs, ts);
- }
-
- rnd_add_data(rs, &val, sizeof(val), entropy);
-}
-
-void
-rnd_add_data(krndsource_t *rs, const void *const data, u_int32_t len,
- u_int32_t entropy)
-{
- 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 =
- SIMPLEQ_HEAD_INITIALIZER(tmp_samples);
-
- if (rs->flags & RND_FLAG_NO_COLLECT) {
- 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.
- */
- todo = len / sizeof(*dint);
- for (done = 0; done < todo ; done++) {
- state = rs->state;
- if (state == NULL) {
- state = rnd_sample_allocate_isr(rs);
- if (__predict_false(state == NULL)) {
- break;
- }
- rs->state = state;
- }
-
- state->ts[state->cursor] = ts;
- state->values[state->cursor] = dint[done];
- state->cursor++;
-
- if (state->cursor == RND_SAMPLE_COUNT) {
- SIMPLEQ_INSERT_HEAD(&tmp_samples, state, next);
- filled++;
- rs->state = NULL;
- }
- }
-
- if (__predict_false(state == NULL)) {
- while ((state = SIMPLEQ_FIRST(&tmp_samples))) {
- SIMPLEQ_REMOVE_HEAD(&tmp_samples, next);
- rnd_sample_free(state);
- }
- return;
- }
-
- /*
- * Claim all the entropy on the last one we send to
- * the pool, so we don't rely on it being evenly distributed
- * in the supplied data.
- *
- * XXX The rndpool code must accept samples with more
- * XXX claimed entropy than bits for this to work right.
- */
- state->entropy += entropy;
- rs->total += entropy;
-
- /*
- * If we didn't finish any sample buffers, we're done.
- */
- if (!filled) {
- return;
- }
-
- mutex_spin_enter(&rnd_mtx);
- while ((state = SIMPLEQ_FIRST(&tmp_samples))) {
- SIMPLEQ_REMOVE_HEAD(&tmp_samples, next);
- SIMPLEQ_INSERT_HEAD(&rnd_samples, state, next);
- }
-
- /*
- * If we are still starting up, cause immediate processing of
- * the queued samples. Otherwise, if the timeout isn't
- * pending, have it run in the near future.
- */
- if (__predict_false(cold)) {
-#ifdef RND_VERBOSE
- printf("rnd: directly processing boot-time events.\n");
-#endif
- rnd_process_events(NULL); /* Drops lock! */
- return;
- }
- if (rnd_timeout_pending == 0) {
- rnd_timeout_pending = 1;
- mutex_spin_exit(&rnd_mtx);
- callout_schedule(&rnd_callout, 1);
- return;
- }
- mutex_spin_exit(&rnd_mtx);
-}
-
-static int
-rnd_hwrng_test(rnd_sample_t *sample)
-{
- krndsource_t *source = sample->source;
- size_t cmplen;
- uint8_t *v1, *v2;
- size_t resid, totest;
-
- KASSERT(source->type = RND_TYPE_RNG);
-
- /*
- * Continuous-output test: compare two halves of the
- * sample buffer to each other. The sample buffer (64 ints,
- * so either 256 or 512 bytes on any modern machine) should be
- * much larger than a typical hardware RNG output, so this seems
- * a reasonable way to do it without retaining extra data.
- */
- cmplen = sizeof(sample->values) / 2;
- v1 = (uint8_t *)sample->values;
- v2 = (uint8_t *)sample->values + cmplen;
-
- if (__predict_false(!memcmp(v1, v2, cmplen))) {
- printf("rnd: source \"%s\" failed continuous-output test.\n",
- source->name);
- return 1;
- }
-
- /*
- * FIPS 140 statistical RNG test. We must accumulate 20,000 bits.
- */
- if (__predict_true(source->test_cnt == -1)) {
- /* already passed the test */
- return 0;
- }
- resid = FIPS140_RNG_TEST_BYTES - source->test_cnt;
- totest = MIN(RND_SAMPLE_COUNT * 4, resid);
- memcpy(source->test->rt_b + source->test_cnt, sample->values, totest);
- resid -= totest;
- source->test_cnt += totest;
- if (resid == 0) {
- strlcpy(source->test->rt_name, source->name,
- sizeof(source->test->rt_name));
- if (rngtest(source->test)) {
- printf("rnd: source \"%s\" failed statistical test.",
- source->name);
- return 1;
- }
- source->test_cnt = -1;
- memset(source->test, 0, sizeof(*source->test));
- }
- return 0;
-}
-
-/*
- * Process the events in the ring buffer. Called by rnd_timeout or
- * by the add routines directly if the callout has never fired (that
- * is, if we are "cold" -- just booted).
- *
- * Call with rnd_mtx held -- WILL RELEASE IT.
- */
-static void
-rnd_process_events(void *arg)
-{
- rnd_sample_t *sample;
- krndsource_t *source, *badsource = NULL;
- u_int32_t entropy;
- SIMPLEQ_HEAD(, _rnd_sample_t) dq_samples =
- SIMPLEQ_HEAD_INITIALIZER(dq_samples);
- SIMPLEQ_HEAD(, _rnd_sample_t) df_samples =
- SIMPLEQ_HEAD_INITIALIZER(df_samples);
- TAILQ_HEAD(, rndsink) sunk = TAILQ_HEAD_INITIALIZER(sunk);
-
- /*
- * Sample queue is protected by rnd_mtx, drain to onstack queue
- * and drop lock.
- */
-
- while ((sample = SIMPLEQ_FIRST(&rnd_samples))) {
- SIMPLEQ_REMOVE_HEAD(&rnd_samples, next);
- /*
- * We repeat this check here, since it is possible
- * the source was disabled before we were called, but
- * after the entry was queued.
- */
- if (__predict_false(sample->source->flags
- & RND_FLAG_NO_COLLECT)) {
- SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
- } else {
- SIMPLEQ_INSERT_TAIL(&dq_samples, sample, next);
- }
- }
- mutex_spin_exit(&rnd_mtx);
-
- /* Don't thrash the rndpool mtx either. Hold, add all samples. */
- mutex_spin_enter(&rndpool_mtx);
- while ((sample = SIMPLEQ_FIRST(&dq_samples))) {
- SIMPLEQ_REMOVE_HEAD(&dq_samples, next);
- source = sample->source;
- entropy = sample->entropy;
- if (source->flags & RND_FLAG_NO_ESTIMATE)
- entropy = 0;
-
- /*
- * Hardware generators are great but sometimes they
- * have...hardware issues. Don't use any data from
- * them unless it passes some tests.
- */
- if (source->type == RND_TYPE_RNG) {
- if (__predict_false(rnd_hwrng_test(sample))) {
- /*
- * Detach the bad source. See below.
- */
- badsource = source;
- printf("rnd: detaching source \"%s\".",
- badsource->name);
- break;
- }
- }
- rndpool_add_data(&rnd_pool, sample->values,
- RND_SAMPLE_COUNT * 4, 0);
-
- rndpool_add_data(&rnd_pool, sample->ts,
- RND_SAMPLE_COUNT * 4, entropy);
-
- source->total += sample->entropy;
- SIMPLEQ_INSERT_TAIL(&df_samples, sample, next);
- }
- mutex_spin_exit(&rndpool_mtx);
-
- /* Now we hold no locks: clean up. */
- if (__predict_false(badsource)) {
- /*
- * The detach routine frees any samples we have not
- * dequeued ourselves. For sanity's sake, we simply
- * free (without using) all dequeued samples from the
- * point at which we detected a problem onwards.
- */
- rnd_detach_source(badsource);
- while ((sample = SIMPLEQ_FIRST(&dq_samples))) {
- SIMPLEQ_REMOVE_HEAD(&dq_samples, next);
- rnd_sample_free(sample);
- }
- }
- while ((sample = SIMPLEQ_FIRST(&df_samples))) {
- SIMPLEQ_REMOVE_HEAD(&df_samples, next);
- rnd_sample_free(sample);
- }
-
- /*
- * Wake up any potential readers waiting.
- */
- rnd_wakeup_readers();
-}
-
-/*
- * Timeout, run to process the events in the ring buffer.
- */
-static void
-rnd_timeout(void *arg)
-{
- mutex_spin_enter(&rnd_mtx);
- rnd_timeout_pending = 0;
- rnd_process_events(arg);
-}
-
-u_int32_t
-rnd_extract_data_locked(void *p, u_int32_t len, u_int32_t flags)
-{
-
- KASSERT(mutex_owned(&rndpool_mtx));
- if (!rnd_have_entropy) {
- u_int32_t c;
-
-#ifdef RND_VERBOSE
- printf("rnd: WARNING! initial entropy low (%u).\n",
- rndpool_get_entropy_count(&rnd_pool));
-#endif
- /* Try once again to put something in the pool */
- c = rnd_counter();
- rndpool_add_data(&rnd_pool, &c, sizeof(u_int32_t), 1);
- }
-
-#ifdef DIAGNOSTIC
- while (!rnd_tested) {
- int entropy_count;
-
- entropy_count = rndpool_get_entropy_count(&rnd_pool);
-#ifdef RND_VERBOSE
- printf("rnd: starting statistical RNG test, entropy = %d.\n",
- entropy_count);
-#endif
- if (rndpool_extract_data(&rnd_pool, rnd_rt.rt_b,
- sizeof(rnd_rt.rt_b), RND_EXTRACT_ANY)
- != sizeof(rnd_rt.rt_b)) {
- panic("rnd: could not get bits for statistical test");
- }
- /*
- * Stash the tested bits so we can put them back in the
- * pool, restoring the entropy count. DO NOT rely on
- * rngtest to maintain the bits pristine -- we could end
- * up adding back non-random data claiming it were pure
- * entropy.
- */
- memcpy(rnd_testbits, rnd_rt.rt_b, sizeof(rnd_rt.rt_b));
- strlcpy(rnd_rt.rt_name, "entropy pool", sizeof(rnd_rt.rt_name));
- if (rngtest(&rnd_rt)) {
- /*
- * The probabiliity of a Type I error is 3/10000,
- * but note this can only happen at boot time.
- * The relevant standard says to reset the module,
- * but developers objected...
- */
- printf("rnd: WARNING, ENTROPY POOL FAILED "
- "STATISTICAL TEST!\n");
- continue;
- }
- memset(&rnd_rt, 0, sizeof(rnd_rt));
- rndpool_add_data(&rnd_pool, rnd_testbits, sizeof(rnd_testbits),
- entropy_count);
- memset(rnd_testbits, 0, sizeof(rnd_testbits));
-#ifdef RND_VERBOSE
- printf("rnd: statistical RNG test done, entropy = %d.\n",
- rndpool_get_entropy_count(&rnd_pool));
-#endif
- rnd_tested++;
- }
-#endif
- return rndpool_extract_data(&rnd_pool, p, len, flags);
-}
-
-u_int32_t
-rnd_extract_data(void *p, u_int32_t len, u_int32_t flags)
-{
- uint32_t retval;
-
- mutex_spin_enter(&rndpool_mtx);
- retval = rnd_extract_data_locked(p, len, flags);
- mutex_spin_exit(&rndpool_mtx);
- return retval;
-}
-
-void
-rndsink_attach(rndsink_t *rs)
-{
-#ifdef RND_VERBOSE
- printf("rnd: entropy sink \"%s\" wants %d bytes of data.\n",
- rs->name, (int)rs->len);
-#endif
- mutex_spin_enter(&rndpool_mtx);
- TAILQ_INSERT_TAIL(&rnd_sinks, rs, tailq);
- mutex_spin_exit(&rndpool_mtx);
- mutex_spin_enter(&rnd_mtx);
- if (rnd_timeout_pending == 0) {
- rnd_timeout_pending = 1;
- callout_schedule(&rnd_callout, 1);
- }
- mutex_spin_exit(&rnd_mtx);
-}
-
-void
-rndsink_detach(rndsink_t *rs)
-{
- rndsink_t *sink, *tsink;
-#ifdef RND_VERBOSE
- printf("rnd: entropy sink \"%s\" no longer wants data.\n", rs->name);
-#endif
- mutex_spin_enter(&rndpool_mtx);
- TAILQ_FOREACH_SAFE(sink, &rnd_sinks, tailq, tsink) {
- if (sink == rs) {
- TAILQ_REMOVE(&rnd_sinks, rs, tailq);
- }
- }
- mutex_spin_exit(&rndpool_mtx);
-}
-
-void
-rnd_seed(void *base, size_t len)
-{
- SHA1_CTX s;
- uint8_t digest[SHA1_DIGEST_LENGTH];
-
- if (len != sizeof(*boot_rsp)) {
- aprint_error("rnd: bad seed length %d\n", (int)len);
- return;
- }
-
- boot_rsp = (rndsave_t *)base;
- SHA1Init(&s);
- SHA1Update(&s, (uint8_t *)&boot_rsp->entropy,
- sizeof(boot_rsp->entropy));
- SHA1Update(&s, boot_rsp->data, sizeof(boot_rsp->data));
- SHA1Final(digest, &s);
-
- if (memcmp(digest, boot_rsp->digest, sizeof(digest))) {
- aprint_error("rnd: bad seed checksum\n");
- return;
- }
-
- /*
- * It's not really well-defined whether bootloader-supplied
- * modules run before or after rnd_init(). Handle both cases.
- */
- if (rnd_ready) {
-#ifdef RND_VERBOSE
- printf("rnd: ready, feeding in seed data directly.\n");
-#endif
- mutex_spin_enter(&rndpool_mtx);
- rndpool_add_data(&rnd_pool, boot_rsp->data,
- sizeof(boot_rsp->data),
- MIN(boot_rsp->entropy, RND_POOLBITS / 2));
- memset(boot_rsp, 0, sizeof(*boot_rsp));
- mutex_spin_exit(&rndpool_mtx);
- } else {
-#ifdef RND_VERBOSE
- printf("rnd: not ready, deferring seed feed.\n");
-#endif
- }
-}
diff --git a/sys/dev/rndpool.c b/sys/dev/rndpool.c
deleted file mode 100644
index 10c8fb70ef1..00000000000
--- a/sys/dev/rndpool.c
+++ /dev/null
@@ -1,311 +0,0 @@
-/* $NetBSD: rndpool.c,v 1.22 2011/12/17 20:05:38 tls Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Michael Graff <explorer@flame.org>. This code uses ideas and
- * algorithms from the Linux driver written by Ted Ts'o.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rndpool.c,v 1.22 2011/12/17 20:05:38 tls Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/sha1.h>
-
-#include <sys/rnd.h>
-#include <dev/rnd_private.h>
-
-/*
- * The random pool "taps"
- */
-#define TAP1 99
-#define TAP2 59
-#define TAP3 31
-#define TAP4 9
-#define TAP5 7
-
-/*
- * Let others know: the pool is full.
- */
-int rnd_full;
-
-static inline void rndpool_add_one_word(rndpool_t *, u_int32_t);
-
-void
-rndpool_init(rndpool_t *rp)
-{
-
- rp->cursor = 0;
- rp->rotate = 1;
-
- memset(&rp->stats, 0, sizeof(rp->stats));
-
- rp->stats.curentropy = 0;
- rp->stats.poolsize = RND_POOLWORDS;
- rp->stats.threshold = RND_ENTROPY_THRESHOLD;
- rp->stats.maxentropy = RND_POOLBITS;
-
- KASSERT(RND_ENTROPY_THRESHOLD * 2 <= SHA1_DIGEST_LENGTH);
-}
-
-u_int32_t
-rndpool_get_entropy_count(rndpool_t *rp)
-{
-
- return (rp->stats.curentropy);
-}
-
-void rndpool_get_stats(rndpool_t *rp, void *rsp, int size)
-{
-
- memcpy(rsp, &rp->stats, size);
-}
-
-void
-rndpool_increment_entropy_count(rndpool_t *rp, u_int32_t entropy)
-{
-
- rp->stats.curentropy += entropy;
- rp->stats.added += entropy;
- if (rp->stats.curentropy > RND_POOLBITS) {
- rp->stats.discarded += (rp->stats.curentropy - RND_POOLBITS);
- rp->stats.curentropy = RND_POOLBITS;
- }
-}
-
-u_int32_t *
-rndpool_get_pool(rndpool_t *rp)
-{
-
- return (rp->pool);
-}
-
-u_int32_t
-rndpool_get_poolsize(void)
-{
-
- return (RND_POOLWORDS);
-}
-
-/*
- * The input function treats the contents of the pool as an array of
- * 32 LFSR's of length RND_POOLWORDS, one per bit-plane. The LFSR's
- * are clocked once in parallel, using 32-bit xor operations, for each
- * word to be added.
- *
- * Each word to be added is xor'd with the output word of the LFSR
- * array (one tap at a time).
- *
- * In order to facilitate distribution of entropy between the
- * bit-planes, a 32-bit rotate of this result is performed prior to
- * feedback. The rotation distance is incremented every RND_POOLWORDS
- * clocks, by a value that is relativly prime to the word size to try
- * to spread the bits throughout the pool quickly when the pool is
- * empty.
- *
- * Each LFSR thus takes its feedback from another LFSR, and is
- * effectively re-keyed by both that LFSR and the new data. Feedback
- * occurs with another XOR into the new LFSR, rather than assignment,
- * to avoid destroying any entropy in the destination.
- *
- * Even with zeros as input, the LFSR output data are never visible;
- * the contents of the pool are never divulged except via a hash of
- * the entire pool, so there is no information for correlation
- * attacks. With rotation-based rekeying, each LFSR runs at most a few
- * cycles before being permuted. However, beware of initial
- * conditions when no entropy has been added.
- *
- * The output function also stirs the generated hash back into the
- * pool, further permuting the LFSRs and spreading entropy through the
- * pool. Any unknown bits anywhere in the pool are thus reflected
- * across all the LFSRs after output.
- *
- * (The final XOR assignment into the pool for feedback is equivalent
- * to an additional LFSR tap of the MSB before shifting, in the case
- * where no rotation is done, once every 32 cycles. This LFSR runs for
- * at most one length.)
- */
-static inline void
-rndpool_add_one_word(rndpool_t *rp, u_int32_t val)
-{
- /*
- * Shifting is implemented using a cursor and taps as offsets,
- * added mod the size of the pool. For this reason,
- * RND_POOLWORDS must be a power of two.
- */
- val ^= rp->pool[(rp->cursor + TAP1) & (RND_POOLWORDS - 1)];
- val ^= rp->pool[(rp->cursor + TAP2) & (RND_POOLWORDS - 1)];
- val ^= rp->pool[(rp->cursor + TAP3) & (RND_POOLWORDS - 1)];
- val ^= rp->pool[(rp->cursor + TAP4) & (RND_POOLWORDS - 1)];
- val ^= rp->pool[(rp->cursor + TAP5) & (RND_POOLWORDS - 1)];
- if (rp->rotate != 0)
- val = ((val << rp->rotate) | (val >> (32 - rp->rotate)));
- rp->pool[rp->cursor++] ^= val;
-
- /*
- * If we have looped around the pool, increment the rotate
- * variable so the next value will get xored in rotated to
- * a different position.
- */
- if (rp->cursor == RND_POOLWORDS) {
- rp->cursor = 0;
- rp->rotate = (rp->rotate + 7) & 31;
- }
-}
-
-/*
- * Add a buffer's worth of data to the pool.
- */
-void
-rndpool_add_data(rndpool_t *rp, void *p, u_int32_t len, u_int32_t entropy)
-{
- u_int32_t val;
- u_int8_t *buf;
-
- buf = p;
-
- for (; len > 3; len -= 4) {
- val = *((u_int32_t *)buf);
-
- rndpool_add_one_word(rp, val);
- buf += 4;
- }
-
- if (len != 0) {
- val = 0;
- switch (len) {
- case 3:
- val = *buf++;
- case 2:
- val = val << 8 | *buf++;
- case 1:
- val = val << 8 | *buf++;
- }
-
- rndpool_add_one_word(rp, val);
- }
-
- rp->stats.curentropy += entropy;
- rp->stats.added += entropy;
-
- if (rp->stats.curentropy > RND_POOLBITS) {
- rp->stats.discarded += (rp->stats.curentropy - RND_POOLBITS);
- rp->stats.curentropy = RND_POOLBITS;
- rnd_full = 1;
- }
-}
-
-/*
- * Extract some number of bytes from the random pool, decreasing the
- * estimate of randomness as each byte is extracted.
- *
- * Do this by hashing the pool and returning a part of the hash as
- * randomness. Stir the hash back into the pool. Note that no
- * secrets going back into the pool are given away here since parts of
- * the hash are xored together before being returned.
- *
- * Honor the request from the caller to only return good data, any data,
- * etc. Note that we must have at least 64 bits of entropy in the pool
- * before we return anything in the high-quality modes.
- */
-u_int32_t
-rndpool_extract_data(rndpool_t *rp, void *p, u_int32_t len, u_int32_t mode)
-{
- u_int i;
- SHA1_CTX hash;
- u_char digest[SHA1_DIGEST_LENGTH];
- u_int32_t remain, deltae, count;
- u_int8_t *buf;
- int good;
-
- buf = p;
- remain = len;
-
- rnd_full = 0;
-
- if (mode == RND_EXTRACT_ANY)
- good = 1;
- else
- good = (rp->stats.curentropy >= (8 * RND_ENTROPY_THRESHOLD));
-
- KASSERT(RND_ENTROPY_THRESHOLD * 2 <= sizeof(digest));
-
- while (good && (remain != 0)) {
- /*
- * While bytes are requested, compute the hash of the pool,
- * and then "fold" the hash in half with XOR, keeping the
- * exact hash value secret, as it will be stirred back into
- * the pool.
- *
- * XXX this approach needs examination by competant
- * cryptographers! It's rather expensive per bit but
- * also involves every bit of the pool in the
- * computation of every output bit..
- */
- SHA1Init(&hash);
- SHA1Update(&hash, (u_int8_t *)rp->pool, RND_POOLWORDS * 4);
- SHA1Final(digest, &hash);
-
- /*
- * Stir the hash back into the pool. This guarantees
- * that the next hash will generate a different value
- * if no new values were added to the pool.
- */
- for (i = 0; i < 5; i++) {
- u_int32_t word;
- memcpy(&word, &digest[i * 4], 4);
- rndpool_add_one_word(rp, word);
- }
-
- count = min(remain, RND_ENTROPY_THRESHOLD);
-
- for (i = 0; i < count; i++)
- buf[i] = digest[i] ^ digest[i + RND_ENTROPY_THRESHOLD];
-
- buf += count;
- deltae = count * 8;
- remain -= count;
-
- deltae = min(deltae, rp->stats.curentropy);
-
- rp->stats.removed += deltae;
- rp->stats.curentropy -= deltae;
-
- if (rp->stats.curentropy == 0)
- rp->stats.generated += (count * 8) - deltae;
-
- if (mode == RND_EXTRACT_GOOD)
- good = (rp->stats.curentropy >=
- (8 * RND_ENTROPY_THRESHOLD));
- }
-
- memset(&hash, 0, sizeof(hash));
- memset(digest, 0, sizeof(digest));
-
- return (len - remain);
-}
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 {