diff options
author | Thomas Moestl <tmm@FreeBSD.org> | 2003-01-09 00:45:10 +0000 |
---|---|---|
committer | Thomas Moestl <tmm@FreeBSD.org> | 2003-01-09 00:45:10 +0000 |
commit | a0de7a9e73238e6631279bb78458035a45eaf510 (patch) | |
tree | 1f434fbb34b47f7e7f77bfa126173dc1155de01f /sys/dev/hme/if_hme_sbus.c | |
parent | 5f7d4c49d3ec3ed2876d0db8da2c02b1d48d16da (diff) | |
download | src-a0de7a9e73238e6631279bb78458035a45eaf510.tar.gz src-a0de7a9e73238e6631279bb78458035a45eaf510.zip |
Add detach, shutdown, suspend and resume methods.
Tested by: jake
Notes
Notes:
svn path=/head/; revision=108976
Diffstat (limited to 'sys/dev/hme/if_hme_sbus.c')
-rw-r--r-- | sys/dev/hme/if_hme_sbus.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sys/dev/hme/if_hme_sbus.c b/sys/dev/hme/if_hme_sbus.c index 46eaa4569e71..66456fe8b378 100644 --- a/sys/dev/hme/if_hme_sbus.c +++ b/sys/dev/hme/if_hme_sbus.c @@ -92,11 +92,19 @@ struct hme_sbus_softc { static int hme_sbus_probe(device_t); static int hme_sbus_attach(device_t); +static int hme_sbus_detach(device_t); +static int hme_sbus_suspend(device_t); +static int hme_sbus_resume(device_t); static device_method_t hme_sbus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, hme_sbus_probe), DEVMETHOD(device_attach, hme_sbus_attach), + DEVMETHOD(device_detach, hme_sbus_detach), + DEVMETHOD(device_suspend, hme_sbus_suspend), + DEVMETHOD(device_resume, hme_sbus_resume), + /* Can just use the suspend method here. */ + DEVMETHOD(device_shutdown, hme_sbus_suspend), /* bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -249,6 +257,7 @@ hme_sbus_attach(device_t dev) if ((error = bus_setup_intr(dev, hsc->hsc_ires, INTR_TYPE_NET, hme_intr, sc, &hsc->hsc_ih)) != 0) { device_printf(dev, "couldn't establish interrupt\n"); + hme_detach(sc); goto fail_ires; } return (0); @@ -274,3 +283,47 @@ fail_seb_res: hsc->hsc_seb_res); return (ENXIO); } + +static int +hme_sbus_detach(device_t dev) +{ + struct hme_sbus_softc *hsc = device_get_softc(dev); + struct hme_softc *sc = &hsc->hsc_hme; + + hme_detach(sc); + + bus_teardown_intr(dev, hsc->hsc_ires, hsc->hsc_ih); + if (hsc->hsc_mif_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mif_rid, + hsc->hsc_mif_res); + } + bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_mac_rid, + hsc->hsc_mac_res); + bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_erx_rid, + hsc->hsc_erx_res); + bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_etx_rid, + hsc->hsc_etx_res); + bus_release_resource(dev, SYS_RES_MEMORY, hsc->hsc_seb_rid, + hsc->hsc_seb_res); + return (0); +} + +static int +hme_sbus_suspend(device_t dev) +{ + struct hme_sbus_softc *hsc = device_get_softc(dev); + struct hme_softc *sc = &hsc->hsc_hme; + + hme_suspend(sc); + return (0); +} + +static int +hme_sbus_resume(device_t dev) +{ + struct hme_sbus_softc *hsc = device_get_softc(dev); + struct hme_softc *sc = &hsc->hsc_hme; + + hme_resume(sc); + return (0); +} |