summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2000-12-25 19:44:44 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2000-12-25 19:44:44 +0000
commit9bdc5ba3c26a775a05bf99ceb22c3452700afd99 (patch)
tree3af75d3829e264662878076e9d06b4a680f78a25 /sys/arch
parentcc9bd268e1bb1d2825337eb41a57ab11a8844267 (diff)
always read new byte from rng, then decide wheather to start a new cycle
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/i386/pci/pchb.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c
index bcab5f7bb48..b0ac4cfddfe 100644
--- a/sys/arch/i386/pci/pchb.c
+++ b/sys/arch/i386/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.24 2000/11/08 13:12:40 art Exp $ */
+/* $OpenBSD: pchb.c,v 1.25 2000/12/25 19:44:43 mickey Exp $ */
/* $NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
/*
@@ -370,23 +370,22 @@ pchb_rnd(v)
void *v;
{
struct pchb_softc *sc = v;
- int ret;
/*
* Don't wait for data to be ready. If it's not there, we'll check
* next time.
*/
- if (!(bus_space_read_1(sc->bt, sc->bh, I82802_RNG_RNGST) &
- I82802_RNG_RNGST_DATAV))
- goto out;
- ret = bus_space_read_1(sc->bt, sc->bh, I82802_RNG_DATA);
-
- if (sc->i--) {
- sc->ax = (sc->ax << 8) | ret;
- } else {
- sc->i = 4;
- add_true_randomness(sc->ax);
+ if ((bus_space_read_1(sc->bt, sc->bh, I82802_RNG_RNGST) &
+ I82802_RNG_RNGST_DATAV)) {
+
+ sc->ax = (sc->ax << 8) |
+ bus_space_read_1(sc->bt, sc->bh, I82802_RNG_DATA);
+
+ if (!sc->i--) {
+ sc->i = 4;
+ add_true_randomness(sc->ax);
+ }
}
-out:
+
timeout_add(&sc->sc_tmo, 1);
}