-/* $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
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;
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 = {
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");
config_found(self, &pba, pchb_print);
}
+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)
{
-/* $OpenBSD: pchb.c,v 1.82 2010/06/24 00:06:57 kettenis Exp $ */
+/* $OpenBSD: pchb.c,v 1.83 2010/08/07 06:10:06 deraadt Exp $ */
/* $NetBSD: pchb.c,v 1.65 2007/08/15 02:26:13 markd Exp $ */
/*
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;
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 = {
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");
config_found(self, &pba, pchb_print);
}
+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)
{