summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorart <art@openbsd.org>2000-11-08 13:12:40 +0000
committerart <art@openbsd.org>2000-11-08 13:12:40 +0000
commitccee4f88a59b78c6c444d58ce6ffebc7554148f5 (patch)
tree139056a72c6294531a0c1f633a3a3f39f9641ef1 /sys
parentEnable UVM for amiga. (diff)
downloadwireguard-openbsd-ccee4f88a59b78c6c444d58ce6ffebc7554148f5.tar.xz
wireguard-openbsd-ccee4f88a59b78c6c444d58ce6ffebc7554148f5.zip
Don't busy-wait for random data.
Remove unnecessary splhigh.
Diffstat (limited to 'sys')
-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);
}