Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic attach rtk(4) as an event source to rnd(4)
details: https://anonhg.NetBSD.org/src/rev/4fb4ebd3103b
branches: trunk
changeset: 573236:4fb4ebd3103b
user: dan <dan%NetBSD.org@localhost>
date: Sun Jan 23 10:26:06 2005 +0000
description:
attach rtk(4) as an event source to rnd(4)
patches from Sean Davis in PR/28547
(also added a detach hook)
diffstat:
sys/dev/ic/rtl81x9.c | 19 +++++++++++++++++--
sys/dev/ic/rtl81x9var.h | 11 ++++++++++-
2 files changed, 27 insertions(+), 3 deletions(-)
diffs (86 lines):
diff -r 1f4d2e8e4725 -r 4fb4ebd3103b sys/dev/ic/rtl81x9.c
--- a/sys/dev/ic/rtl81x9.c Sun Jan 23 10:03:26 2005 +0000
+++ b/sys/dev/ic/rtl81x9.c Sun Jan 23 10:26:06 2005 +0000
@@ -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 @@
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 @@
/* 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 @@
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 -r 1f4d2e8e4725 -r 4fb4ebd3103b sys/dev/ic/rtl81x9var.h
--- a/sys/dev/ic/rtl81x9var.h Sun Jan 23 10:03:26 2005 +0000
+++ b/sys/dev/ic/rtl81x9var.h Sun Jan 23 10:26:06 2005 +0000
@@ -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 @@
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 */
Home |
Main Index |
Thread Index |
Old Index