Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci attach tl(4) as an event source to rnd(4)
details: https://anonhg.NetBSD.org/src/rev/a409709a591b
branches: trunk
changeset: 573237:a409709a591b
user: dan <dan%NetBSD.org@localhost>
date: Sun Jan 23 10:53:19 2005 +0000
description:
attach tl(4) as an event source to rnd(4)
patches from Sean Davis in PR/28556
(slightly modified to actually catch our own interrupts)
diffstat:
sys/dev/pci/if_tl.c | 18 ++++++++++++++++--
sys/dev/pci/if_tlvar.h | 11 ++++++++++-
2 files changed, 26 insertions(+), 3 deletions(-)
diffs (85 lines):
diff -r 4fb4ebd3103b -r a409709a591b sys/dev/pci/if_tl.c
--- a/sys/dev/pci/if_tl.c Sun Jan 23 10:26:06 2005 +0000
+++ b/sys/dev/pci/if_tl.c Sun Jan 23 10:53:19 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tl.c,v 1.66 2004/10/30 18:09:22 thorpej Exp $ */
+/* $NetBSD: if_tl.c,v 1.67 2005/01/23 10:53:19 dan Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.66 2004/10/30 18:09:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.67 2005/01/23 10:53:19 dan Exp $");
#undef TLDEBUG
#define TL_PRIV_STATS
@@ -74,6 +74,11 @@
#include <net/bpfdesc.h>
#endif
+#include "rnd.h"
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
#ifdef INET
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -482,6 +487,11 @@
IFQ_SET_READY(&ifp->if_snd);
if_attach(ifp);
ether_ifattach(&(sc)->tl_if, (sc)->tl_enaddr);
+
+#if NRND > 0
+ rnd_attach_source(&sc->rnd_source, sc->sc_dev.dv_xname,
+ RND_TYPE_NET, 0);
+#endif
}
static void
@@ -1224,6 +1234,10 @@
/* 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
return 1;
}
/* ack = 0 ; interrupt was perhaps not our. Just enable interrupts */
diff -r 4fb4ebd3103b -r a409709a591b sys/dev/pci/if_tlvar.h
--- a/sys/dev/pci/if_tlvar.h Sun Jan 23 10:26:06 2005 +0000
+++ b/sys/dev/pci/if_tlvar.h Sun Jan 23 10:53:19 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_tlvar.h,v 1.10 2003/11/10 08:51:52 wiz Exp $ */
+/* $NetBSD: if_tlvar.h,v 1.11 2005/01/23 10:53:19 dan Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@@ -35,6 +35,12 @@
* available from www.ti.com
*/
+#include "rnd.h"
+
+#if NRND > 0
+#include <sys/rnd.h>
+#endif
+
#include <dev/i2c/i2cvar.h>
struct tl_product_desc {
@@ -83,6 +89,9 @@
int oerr_carrloss;
int oerr_mcopy;
#endif
+#if NRND > 0
+ rndsource_element_t rnd_source;
+#endif
};
#define tl_if tl_ec.ec_if
#define tl_bpf tl_if.if_bpf
Home |
Main Index |
Thread Index |
Old Index