summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2009-11-24 15:56:04 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2009-11-24 15:56:04 +0000
commitb35761230ca0b41d2fb8fb84fa4a2389356da6b0 (patch)
tree81da58fdca4b958954d0731ecec14b0004e34923 /sys/dev/pci
parentd12a0653654450d96f6c9b410db79791df40934c (diff)
Thoroughly reset the chip upon suspend and give the PHY a chance to
re-initialise itself afterward. ok deraadt@, mlarkin@, claudio@, pirofti@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_msk.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c
index 5ee135bb7dc..551f786f1ed 100644
--- a/sys/dev/pci/if_msk.c
+++ b/sys/dev/pci/if_msk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_msk.c,v 1.81 2009/11/24 14:21:26 claudio Exp $ */
+/* $OpenBSD: if_msk.c,v 1.82 2009/11/24 15:56:03 kettenis Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -134,11 +134,13 @@
int mskc_probe(struct device *, void *, void *);
void mskc_attach(struct device *, struct device *self, void *aux);
int mskc_detach(struct device *, int);
+int mskc_activate(struct device *, int);
void mskc_reset(struct sk_softc *);
void mskc_shutdown(void *);
int msk_probe(struct device *, void *, void *);
void msk_attach(struct device *, struct device *self, void *aux);
int msk_detach(struct device *, int);
+int msk_activate(struct device *, int);
void msk_reset(struct sk_if_softc *);
int mskcprint(void *, const char *);
int msk_intr(void *);
@@ -1042,6 +1044,26 @@ msk_detach(struct device *self, int flags)
}
int
+msk_activate(struct device *self, int act)
+{
+ struct sk_if_softc *sc_if = (void *)self;
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ rv = config_activate_children(self, act);
+ break;
+ case DVACT_RESUME:
+ msk_reset(sc_if);
+ rv = config_activate_children(self, act);
+ msk_init(sc_if);
+ break;
+ }
+
+ return (rv);
+}
+
+int
mskcprint(void *aux, const char *pnp)
{
struct skc_attach_args *sa = aux;
@@ -1377,6 +1399,25 @@ mskc_detach(struct device *self, int flags)
}
int
+mskc_activate(struct device *self, int act)
+{
+ struct sk_softc *sc = (void *)self;
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ rv = config_activate_children(self, act);
+ break;
+ case DVACT_RESUME:
+ mskc_reset(sc);
+ rv = config_activate_children(self, act);
+ break;
+ }
+
+ return (rv);
+}
+
+int
msk_encap(struct sk_if_softc *sc_if, struct mbuf *m_head, u_int32_t *txidx)
{
struct sk_softc *sc = sc_if->sk_softc;
@@ -2131,7 +2172,8 @@ msk_stop(struct sk_if_softc *sc_if, int softonly)
}
struct cfattach mskc_ca = {
- sizeof(struct sk_softc), mskc_probe, mskc_attach, mskc_detach
+ sizeof(struct sk_softc), mskc_probe, mskc_attach, mskc_detach,
+ mskc_activate
};
struct cfdriver mskc_cd = {
@@ -2139,7 +2181,8 @@ struct cfdriver mskc_cd = {
};
struct cfattach msk_ca = {
- sizeof(struct sk_if_softc), msk_probe, msk_attach, msk_detach
+ sizeof(struct sk_if_softc), msk_probe, msk_attach, msk_detach,
+ msk_activate
};
struct cfdriver msk_cd = {