diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-05 20:21:37 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2010-08-05 20:21:37 +0000 |
commit | a9368e40d779aa514284ed1d60e4293893045eea (patch) | |
tree | a6b209a3b0bcf15a53306670d7f2963611090e0f /sys | |
parent | f48b051e4a3031b3d756062639cae3054a2490d6 (diff) |
Suspend/resume support for sili(4). Not perfect yet, but prevents us from
getting stuck. Based on an initial diff from deraadt@.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/sili.c | 15 | ||||
-rw-r--r-- | sys/dev/ic/silivar.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/sili_pci.c | 25 |
3 files changed, 40 insertions, 4 deletions
diff --git a/sys/dev/ic/sili.c b/sys/dev/ic/sili.c index 59410879076..f8caf97ccf2 100644 --- a/sys/dev/ic/sili.c +++ b/sys/dev/ic/sili.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili.c,v 1.45 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: sili.c,v 1.46 2010/08/05 20:21:36 kettenis Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -223,6 +223,19 @@ sili_detach(struct sili_softc *sc, int flags) return (0); } +void +sili_resume(struct sili_softc *sc) +{ + int i; + + /* bounce the controller */ + sili_write(sc, SILI_REG_GC, SILI_REG_GC_GR); + sili_write(sc, SILI_REG_GC, 0x0); + + for (i = 0; i < sc->sc_nports; i++) + sili_ata_probe(sc, i); +} + u_int32_t sili_port_intr(struct sili_port *sp, int timeout_slot) { diff --git a/sys/dev/ic/silivar.h b/sys/dev/ic/silivar.h index dab11d6f338..be30842435a 100644 --- a/sys/dev/ic/silivar.h +++ b/sys/dev/ic/silivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: silivar.h,v 1.6 2008/11/23 12:46:51 dlg Exp $ */ +/* $OpenBSD: silivar.h,v 1.7 2010/08/05 20:21:36 kettenis Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -41,4 +41,6 @@ struct sili_softc { int sili_attach(struct sili_softc *); int sili_detach(struct sili_softc *, int); +void sili_resume(struct sili_softc *); + int sili_intr(void *); diff --git a/sys/dev/pci/sili_pci.c b/sys/dev/pci/sili_pci.c index 05817ab7de0..199fb6c21be 100644 --- a/sys/dev/pci/sili_pci.c +++ b/sys/dev/pci/sili_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sili_pci.c,v 1.10 2009/05/13 08:35:29 jsg Exp $ */ +/* $OpenBSD: sili_pci.c,v 1.11 2010/08/05 20:21:36 kettenis Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -37,6 +37,7 @@ int sili_pci_match(struct device *, void *, void *); void sili_pci_attach(struct device *, struct device *, void *); int sili_pci_detach(struct device *, int); +int sili_pci_activate(struct device *, int); struct sili_pci_softc { struct sili_softc psc_sili; @@ -51,7 +52,8 @@ struct cfattach sili_pci_ca = { sizeof(struct sili_pci_softc), sili_pci_match, sili_pci_attach, - sili_pci_detach + sili_pci_detach, + sili_pci_activate }; struct sili_device { @@ -196,3 +198,22 @@ sili_pci_detach(struct device *self, int flags) return (0); } + +int +sili_pci_activate(struct device *self, int act) +{ + struct sili_softc *sc = (struct sili_softc *)self; + int rv = 0; + + switch (act) { + case DVACT_SUSPEND: + rv = config_activate_children(self, act); + break; + case DVACT_RESUME: + sili_resume(sc); + rv = config_activate_children(self, act); + break; + } + + return (rv); +} |