*** sys/dev/em/if_em.c.old Sat Nov 29 21:33:34 2003 --- sys/dev/em/if_em.c Sat Nov 29 22:58:17 2003 *************** *** 125,130 **** --- 125,132 ---- static void em_init(void *); static void em_init_locked(struct adapter *); static void em_stop(void *); + static int em_suspend(device_t); + static int em_resume(device_t); static void em_media_status(struct ifnet *, struct ifmediareq *); static int em_media_change(struct ifnet *); static void em_identify_hardware(struct adapter *); *************** *** 193,198 **** --- 195,202 ---- DEVMETHOD(device_attach, em_attach), DEVMETHOD(device_detach, em_detach), DEVMETHOD(device_shutdown, em_shutdown), + DEVMETHOD(device_suspend, em_suspend), + DEVMETHOD(device_resume, em_resume), {0, 0} }; *************** *** 1622,1627 **** --- 1626,1664 ---- return; } + /********************************************************************* + * + * Prepares the interface for suspend by stopping it. + * + ***********************************************************************/ + + static int + em_suspend(device_t dev) + { + struct adapter *adapter = device_get_softc(dev); + EM_LOCK(adapter); + em_stop(adapter); + EM_UNLOCK(adapter); + return(0); + } + + /********************************************************************* + * + * Reinitializes the interface (called when resuming from suspended + * state). + * + ***********************************************************************/ + + static int + em_resume(device_t dev) + { + struct adapter *adapter = device_get_softc(dev); + + EM_LOCK(adapter); + em_init_locked(adapter); + EM_UNLOCK(adapter); + return(0); + } /********************************************************************* *