Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/broadcom Use bus_space_read_multi_4 to drain th...
details: https://anonhg.NetBSD.org/src/rev/fa60e4b3c3cc
branches: trunk
changeset: 784565:fa60e4b3c3cc
user: matt <matt%NetBSD.org@localhost>
date: Fri Feb 01 19:27:47 2013 +0000
description:
Use bus_space_read_multi_4 to drain the RNG's FIFO.
diffstat:
sys/arch/arm/broadcom/bcm53xx_rng.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diffs (48 lines):
diff -r c811f2f3357e -r fa60e4b3c3cc sys/arch/arm/broadcom/bcm53xx_rng.c
--- a/sys/arch/arm/broadcom/bcm53xx_rng.c Fri Feb 01 16:10:16 2013 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_rng.c Fri Feb 01 19:27:47 2013 +0000
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.3 2012/10/27 17:24:37 matt Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.4 2013/02/01 19:27:47 matt Exp $");
#include <sys/bus.h>
#include <sys/callout.h>
@@ -91,6 +91,13 @@
}
static inline void
+bcmrng_read_multi_4(struct bcmrng_softc *sc, bus_size_t o, uint32_t *p,
+ size_t c)
+{
+ return bus_space_read_multi_4(sc->sc_bst, sc->sc_bsh, o, p, c);
+}
+
+static inline void
bcmrng_write_4(struct bcmrng_softc *sc, bus_size_t o, uint32_t v)
{
bus_space_write_4(sc->sc_bst, sc->sc_bsh, o, v);
@@ -162,16 +169,13 @@
}
uint32_t data[nwords];
- while (nwords-- > 0) {
- /*
- * It's random data, who cares what order we load it in?
- */
- data[nwords] = bcmrng_read_4(sc, RNG_DATA);
- }
+
+ bcmrng_read_multi_4(sc, RNG_DATA, data, nwords);
+
rnd_add_data(&sc->sc_rnd_source, data, sizeof(data), sizeof(data) * 8);
mutex_exit(sc->sc_lock);
- //aprint_debug_dev(sc->sc_dev, "added %zu words\n", __arraycount(data));
- return __arraycount(data);
+ //aprint_debug_dev(sc->sc_dev, "added %zu words\n", nwords);
+ return nwords;
}
void
Home |
Main Index |
Thread Index |
Old Index