From 0ab93195b43512a80e05a2ab66e6da055e4749e8 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Wed, 8 Nov 2000 13:12:41 +0000 Subject: Don't busy-wait for random data. Remove unnecessary splhigh. --- sys/arch/i386/pci/pchb.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'sys/arch/i386/pci/pchb.c') 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); } -- cgit v1.2.3