Subject: test pmfified ex(4) please - patch attached
To: None <current-users@netbsd.org>
From: S.P.Zeidler <spz@serpens.de>
List: current-users
Date: 12/20/2007 15:55:23
--x+6KMIRAuhnl3hBn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
the attached patch may pmfify the ex ethernet devices.
While I talk my lapdog into resuming without a screen of pretty stripes
or measles, could other people with an ex whose machine generally
is not acting so difficult try if the patch works for them, ie if suspend
and resume work as expected (and if the ethernet works after resume, too :) ?
Especially people with a cardbus ex since I don't have one of these
(mine's PCI).
regards,
spz
--
spz@serpens.de (S.P.Zeidler)
--x+6KMIRAuhnl3hBn
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="elinkxl.c.diff"
Index: elinkxl.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/elinkxl.c,v
retrieving revision 1.99
diff -u -r1.99 elinkxl.c
--- elinkxl.c 19 Oct 2007 11:59:51 -0000 1.99
+++ elinkxl.c 20 Dec 2007 13:59:10 -0000
@@ -106,13 +106,17 @@
void ex_tick(void *);
void ex_power(int, void *);
+bool ex_resume(device_t dev);
+bool ex_suspend(device_t dev);
static int ex_eeprom_busy(struct ex_softc *);
static int ex_add_rxbuf(struct ex_softc *, struct ex_rxdesc *);
static void ex_init_txdescs(struct ex_softc *);
static void ex_setup_tx(struct ex_softc *);
+#if oldpowerhook
static void ex_shutdown(void *);
+#endif
static void ex_start(struct ifnet *);
static void ex_txstat(struct ex_softc *);
@@ -462,6 +466,7 @@
RND_TYPE_NET, 0);
#endif
+#if oldpowerhook
/* Establish callback to reset card when we reboot. */
sc->sc_sdhook = shutdownhook_establish(ex_shutdown, sc);
if (sc->sc_sdhook == NULL)
@@ -474,6 +479,11 @@
if (sc->sc_powerhook == NULL)
aprint_error("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
+#endif
+ if (!pmf_device_register(&(sc->sc_dev), ex_suspend, ex_resume))
+ aprint_error_dev(&(sc->sc_dev), "couldn't establish power handler\n");
+ else
+ pmf_class_network_register(&(sc->sc_dev), &sc->sc_ethercom.ec_if);
/* The attach is successful. */
sc->ex_flags |= EX_FLAGS_ATTACHED;
@@ -1796,12 +1806,16 @@
EX_NUPD * sizeof (struct ex_upd));
bus_dmamem_free(sc->sc_dmat, &sc->sc_useg, sc->sc_urseg);
+#if oldpowerhook
shutdownhook_disestablish(sc->sc_sdhook);
powerhook_disestablish(sc->sc_powerhook);
+#endif
+ pmf_device_deregister((device_t) sc);
return (0);
}
+#if oldpowerhook
/*
* Before reboots, reset card completely.
*/
@@ -1818,6 +1832,7 @@
*/
(void) ex_enable(sc);
}
+#endif
/*
* Read EEPROM data.
@@ -2083,3 +2098,20 @@
}
splx(s);
}
+
+bool
+ex_resume(device_t dev)
+{
+ ex_power(PWR_RESUME, (void *) dev);
+
+ return true;
+}
+
+bool
+ex_suspend(device_t dev)
+{
+ ex_power(PWR_SUSPEND, (void *) dev);
+
+ return true;
+}
+
--x+6KMIRAuhnl3hBn--