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)
This commit is contained in:
dan 2005-01-23 10:53:19 +00:00
parent 724df7bd2e
commit f368e90e9b
2 changed files with 26 additions and 3 deletions

View File

@ -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. * Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@ -36,7 +36,7 @@
*/ */
#include <sys/cdefs.h> #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 #undef TLDEBUG
#define TL_PRIV_STATS #define TL_PRIV_STATS
@ -74,6 +74,11 @@ __KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.66 2004/10/30 18:09:22 thorpej Exp $");
#include <net/bpfdesc.h> #include <net/bpfdesc.h>
#endif #endif
#include "rnd.h"
#if NRND > 0
#include <sys/rnd.h>
#endif
#ifdef INET #ifdef INET
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/in_systm.h> #include <netinet/in_systm.h>
@ -482,6 +487,11 @@ tl_pci_attach(parent, self, aux)
IFQ_SET_READY(&ifp->if_snd); IFQ_SET_READY(&ifp->if_snd);
if_attach(ifp); if_attach(ifp);
ether_ifattach(&(sc)->tl_if, (sc)->tl_enaddr); 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 static void
@ -1224,6 +1234,10 @@ tl_intr(v)
/* Ack the interrupt and enable interrupts */ /* Ack the interrupt and enable interrupts */
TL_HR_WRITE(sc, TL_HOST_CMD, ack | int_type | HOST_CMD_ACK | TL_HR_WRITE(sc, TL_HOST_CMD, ack | int_type | HOST_CMD_ACK |
HOST_CMD_IntOn); HOST_CMD_IntOn);
#if NRND > 0
if (RND_ENABLED(&sc->rnd_source))
rnd_add_uint32(&sc->rnd_source, int_reg);
#endif
return 1; return 1;
} }
/* ack = 0 ; interrupt was perhaps not our. Just enable interrupts */ /* ack = 0 ; interrupt was perhaps not our. Just enable interrupts */

View File

@ -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. * Copyright (c) 1997 Manuel Bouyer. All rights reserved.
@ -35,6 +35,12 @@
* available from www.ti.com * available from www.ti.com
*/ */
#include "rnd.h"
#if NRND > 0
#include <sys/rnd.h>
#endif
#include <dev/i2c/i2cvar.h> #include <dev/i2c/i2cvar.h>
struct tl_product_desc { struct tl_product_desc {
@ -83,6 +89,9 @@ struct tl_softc {
int oerr_carrloss; int oerr_carrloss;
int oerr_mcopy; int oerr_mcopy;
#endif #endif
#if NRND > 0
rndsource_element_t rnd_source;
#endif
}; };
#define tl_if tl_ec.ec_if #define tl_if tl_ec.ec_if
#define tl_bpf tl_if.if_bpf #define tl_bpf tl_if.if_bpf