summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2000-11-08 13:12:41 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2000-11-08 13:12:41 +0000
commit0ab93195b43512a80e05a2ab66e6da055e4749e8 (patch)
treeebe8d82c7c6fd0fa4010abf61b093677f41e568f
parent4edca3903ed3b42449f294c73abfbcc856fde1e5 (diff)
Don't busy-wait for random data.
Remove unnecessary splhigh.
-rw-r--r--sys/arch/i386/pci/pchb.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/arch/i386/pci/pchb.c b/sys/arch/i386/pci/pchb.c
index 7ecfbf81b6d..bcab5f7bb48 100644
--- a/sys/arch/i386/pci/pchb.c
+++ b/sys/arch/i386/pci/pchb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pchb.c,v 1.23 2000/10/23 20:07:30 deraadt Exp $ */
+/* $OpenBSD: pchb.c,v 1.24 2000/11/08 13:12:40 art Exp $ */
/* $NetBSD: pchb.c,v 1.6 1997/06/06 23:29:16 thorpej Exp $ */
/*
@@ -370,20 +370,23 @@ pchb_rnd(v)
void *v;
{
struct pchb_softc *sc = v;
- int s, ret;
+ int ret;
- s = splhigh();
- while (!(bus_space_read_1(sc->bt, sc->bh, I82802_RNG_RNGST) &
- I82802_RNG_RNGST_DATAV));
+ /*
+ * 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;
- splx(s);
} else {
sc->i = 4;
- splx(s);
add_true_randomness(sc->ax);
}
+out:
timeout_add(&sc->sc_tmo, 1);
}