diff options
author | tmm <tmm@FreeBSD.org> | 2003-01-09 00:45:10 +0000 |
---|---|---|
committer | tmm <tmm@FreeBSD.org> | 2003-01-09 00:45:10 +0000 |
commit | c1f62b116da233e3f8b8c4cf1b84df4f40ca2633 (patch) | |
tree | 1f434fbb34b47f7e7f77bfa126173dc1155de01f /sys/dev/hme/if_hme.c | |
parent | 186300a2ca9c50556d656c3ae2dba83969a65d7f (diff) | |
download | FreeBSD-src-c1f62b116da233e3f8b8c4cf1b84df4f40ca2633.zip FreeBSD-src-c1f62b116da233e3f8b8c4cf1b84df4f40ca2633.tar.gz |
Add detach, shutdown, suspend and resume methods.
Tested by: jake
Diffstat (limited to 'sys/dev/hme/if_hme.c')
-rw-r--r-- | sys/dev/hme/if_hme.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/sys/dev/hme/if_hme.c b/sys/dev/hme/if_hme.c index 694fef3..779141b6 100644 --- a/sys/dev/hme/if_hme.c +++ b/sys/dev/hme/if_hme.c @@ -90,9 +90,6 @@ static void hme_stop(struct hme_softc *); static int hme_ioctl(struct ifnet *, u_long, caddr_t); static void hme_tick(void *); static void hme_watchdog(struct ifnet *); -#if 0 -static void hme_shutdown(void *); -#endif static void hme_init(void *); static int hme_add_rxbuf(struct hme_softc *, unsigned int, int); static int hme_meminit(struct hme_softc *); @@ -345,6 +342,49 @@ fail_ptag: return (error); } +void +hme_detach(struct hme_softc *sc) +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + int i; + + ether_ifdetach(ifp); + hme_stop(sc); + device_delete_child(sc->sc_dev, sc->sc_miibus); + + for (i = 0; i < HME_NTXQ; i++) { + bus_dmamap_destroy(sc->sc_tdmatag, + sc->sc_rb.rb_txdesc[i].htx_dmamap); + } + bus_dmamap_destroy(sc->sc_rdmatag, sc->sc_rb.rb_spare_dmamap); + for (i = 0; i < HME_NRXDESC; i++) { + bus_dmamap_destroy(sc->sc_rdmatag, + sc->sc_rb.rb_rxdesc[i].hrx_dmamap); + } + bus_dmamap_unload(sc->sc_cdmatag, sc->sc_cdmamap); + bus_dmamem_free(sc->sc_cdmatag, sc->sc_rb.rb_membase, sc->sc_cdmamap); + bus_dma_tag_destroy(sc->sc_tdmatag); + bus_dma_tag_destroy(sc->sc_rdmatag); + bus_dma_tag_destroy(sc->sc_cdmatag); + bus_dma_tag_destroy(sc->sc_pdmatag); +} + +void +hme_suspend(struct hme_softc *sc) +{ + + hme_stop(sc); +} + +void +hme_resume(struct hme_softc *sc) +{ + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + if ((ifp->if_flags & IFF_UP) != 0) + hme_init(ifp); +} + static void hme_cdma_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) { @@ -1342,15 +1382,6 @@ hme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } -#if 0 -static void -hme_shutdown(void *arg) -{ - - hme_stop((struct hme_softc *)arg); -} -#endif - /* * Set up the logical address filter. */ |