diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-07 06:10:07 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2010-08-07 06:10:07 +0000 |
commit | e5b528dadb9394ee08b04373a1b2845b9fc301ba (patch) | |
tree | f30a40099c12fb814562d1330d1ca04704e84632 /sys/arch/amd64/pci | |
parent | eb95cc9da073c2c7f556ff2c8c2a63c319881bfb (diff) |
On resume, re-activate the host RNG on the host bridges that need it.
ok kettenis
Diffstat (limited to 'sys/arch/amd64/pci')
-rw-r--r-- | sys/arch/amd64/pci/pchb.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sys/arch/amd64/pci/pchb.c b/sys/arch/amd64/pci/pchb.c index f42b042f042..e715e3097c4 100644 --- a/sys/arch/amd64/pci/pchb.c +++ b/sys/arch/amd64/pci/pchb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pchb.c,v 1.34 2010/06/24 00:06:57 kettenis Exp $ */ +/* $OpenBSD: pchb.c,v 1.35 2010/08/07 06:10:04 deraadt Exp $ */ /* $NetBSD: pchb.c,v 1.1 2003/04/26 18:39:50 fvdl Exp $ */ /* * Copyright (c) 2000 Michael Shalayeff @@ -108,6 +108,7 @@ struct pchb_softc { bus_space_handle_t sc_bh; /* rng stuff */ + int sc_rng_active; int sc_rng_ax; int sc_rng_i; struct timeout sc_rng_to; @@ -115,10 +116,11 @@ struct pchb_softc { int pchbmatch(struct device *, void *, void *); void pchbattach(struct device *, struct device *, void *); +int pchbactivate(struct device *, int); struct cfattach pchb_ca = { sizeof(struct pchb_softc), pchbmatch, pchbattach, NULL, - config_activate_children + pchbactivate }; struct cfdriver pchb_cd = { @@ -202,6 +204,7 @@ pchbattach(struct device *parent, struct device *self, void *aux) timeout_set(&sc->sc_rng_to, pchb_rnd, sc); sc->sc_rng_i = 4; pchb_rnd(sc); + sc->sc_rng_active = 1; break; } printf("\n"); @@ -270,6 +273,29 @@ pchbattach(struct device *parent, struct device *self, void *aux) } int +pchbactivate(struct device *self, int act) +{ + struct pchb_softc *sc = (struct pchb_softc *)self; + + switch (act) { + case DVACT_SUSPEND: + config_activate_children(self, act); + break; + case DVACT_RESUME: + /* re-enable RNG, if we have it */ + if (sc->sc_rng_active) + bus_space_write_1(sc->sc_bt, sc->sc_bh, + I82802_RNG_HWST, + bus_space_read_1(sc->sc_bt, sc->sc_bh, + I82802_RNG_HWST) | I82802_RNG_HWST_ENABLE); + config_activate_children(self, act); + break; + } + return (0); +} + + +int pchb_print(void *aux, const char *pnp) { struct pcibus_attach_args *pba = aux; |