summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authordan <dan@NetBSD.org>2005-01-23 10:26:06 +0000
committerdan <dan@NetBSD.org>2005-01-23 10:26:06 +0000
commit724df7bd2e95165469ccac41ba0ae0d47d0ada8a (patch)
tree53494ada8b06a0b9d6cf2134894533f8964cd5ac /sys/dev
parent145a9f0bea240bd0b2d922414124eca1161dd7f0 (diff)
attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547 (also added a detach hook)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/rtl81x9.c19
-rw-r--r--sys/dev/ic/rtl81x9var.h11
2 files changed, 27 insertions, 3 deletions
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c
index a46a6ea1d85..8b580ac17c5 100644
--- a/sys/dev/ic/rtl81x9.c
+++ b/sys/dev/ic/rtl81x9.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl81x9.c,v 1.47 2004/10/30 18:08:37 thorpej Exp $ */
+/* $NetBSD: rtl81x9.c,v 1.48 2005/01/23 10:26:06 dan Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.47 2004/10/30 18:08:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.48 2005/01/23 10:26:06 dan Exp $");
#include "bpfilter.h"
#include "rnd.h"
@@ -768,6 +768,12 @@ rtk_attach(sc)
printf("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
+
+#if NRND > 0
+ rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ RND_TYPE_NET, 0);
+#endif
+
return;
fail_4:
for (i = 0; i < RTK_TX_LIST_CNT; i++) {
@@ -863,6 +869,10 @@ rtk_detach(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);
@@ -1265,6 +1275,11 @@ int rtk_intr(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
+
return (handled);
}
diff --git a/sys/dev/ic/rtl81x9var.h b/sys/dev/ic/rtl81x9var.h
index d614fbc6e59..9f9e7b593d2 100644
--- a/sys/dev/ic/rtl81x9var.h
+++ b/sys/dev/ic/rtl81x9var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: rtl81x9var.h,v 1.15 2005/01/09 12:25:25 kanaoka Exp $ */
+/* $NetBSD: rtl81x9var.h,v 1.16 2005/01/23 10:26:06 dan Exp $ */
/*
* Copyright (c) 1997, 1998
@@ -34,6 +34,12 @@
* 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
@@ -143,6 +149,9 @@ struct rtk_softc {
int (*sc_enable) __P((struct rtk_softc *));
void (*sc_disable) __P((struct rtk_softc *));
void (*sc_power) __P((struct rtk_softc *, int));
+#if NRND > 0
+ rndsource_element_t rnd_source;
+#endif
};
#define RTK_ATTACHED 0x00000001 /* attach has succeeded */