diff options
author | tmm <tmm@FreeBSD.org> | 2003-01-08 20:12:45 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2003-01-08 20:12:45 +0000 |
commit | 9544452611e2a3828dacd20186fc3c21e3f1527e (patch) | |
tree | 7f1bdfd08a76f7c21692493db199849d0d80874f /sys/dev/gem/if_gem.c | |
parent | 03f7564d9e62f81ebe5702c3294d62c1ef3a644f (diff) | |
download | FreeBSD-src-9544452611e2a3828dacd20186fc3c21e3f1527e.zip FreeBSD-src-9544452611e2a3828dacd20186fc3c21e3f1527e.tar.gz |
Add detach, shutdown, suspend and resume methods. The latter two are
not really tested, but are derived from the original NetBSD version.
Diffstat (limited to 'sys/dev/gem/if_gem.c')
-rw-r--r-- | sys/dev/gem/if_gem.c | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/sys/dev/gem/if_gem.c b/sys/dev/gem/if_gem.c index 12550cc..635bd27 100644 --- a/sys/dev/gem/if_gem.c +++ b/sys/dev/gem/if_gem.c @@ -350,6 +350,55 @@ fail_ptag: return (error); } +void +gem_detach(sc) + struct gem_softc *sc; +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + int i; + + ether_ifdetach(ifp); + gem_stop(ifp, 1); + device_delete_child(sc->sc_dev, sc->sc_miibus); + + for (i = 0; i < GEM_NRXDESC; i++) { + if (sc->sc_rxsoft[i].rxs_dmamap != NULL) + bus_dmamap_destroy(sc->sc_rdmatag, + sc->sc_rxsoft[i].rxs_dmamap); + } + for (i = 0; i < GEM_TXQUEUELEN; i++) { + if (sc->sc_txsoft[i].txs_dmamap != NULL) + bus_dmamap_destroy(sc->sc_tdmatag, + sc->sc_txsoft[i].txs_dmamap); + } + bus_dmamap_unload(sc->sc_cdmatag, sc->sc_cddmamap); + bus_dmamem_free(sc->sc_cdmatag, sc->sc_control_data, + sc->sc_cddmamap); + bus_dma_tag_destroy(sc->sc_cdmatag); + bus_dma_tag_destroy(sc->sc_tdmatag); + bus_dma_tag_destroy(sc->sc_rdmatag); + bus_dma_tag_destroy(sc->sc_pdmatag); +} + +void +gem_suspend(sc) + struct gem_softc *sc; +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + gem_stop(ifp, 0); +} + +void +gem_resume(sc) + struct gem_softc *sc; +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + if (ifp->if_flags & IFF_UP) + gem_init(ifp); +} + static void gem_cddma_callback(xsc, segs, nsegs, error) void *xsc; @@ -1833,43 +1882,3 @@ gem_setladrf(sc) chipit: bus_space_write_4(t, h, GEM_MAC_RX_CONFIG, v); } - -#if notyet - -/* - * gem_power: - * - * Power management (suspend/resume) hook. - */ -void -static gem_power(why, arg) - int why; - void *arg; -{ - struct gem_softc *sc = arg; - struct ifnet *ifp = &sc->sc_arpcom.ac_if; - int s; - - s = splnet(); - switch (why) { - case PWR_SUSPEND: - case PWR_STANDBY: - gem_stop(ifp, 1); - if (sc->sc_power != NULL) - (*sc->sc_power)(sc, why); - break; - case PWR_RESUME: - if (ifp->if_flags & IFF_UP) { - if (sc->sc_power != NULL) - (*sc->sc_power)(sc, why); - gem_init(ifp); - } - break; - case PWR_SOFTSUSPEND: - case PWR_SOFTSTANDBY: - case PWR_SOFTRESUME: - break; - } - splx(s); -} -#endif |