--- dev/usb/ohci.c.orig Fri Aug 23 03:40:53 2002 +++ dev/usb/ohci.c Fri Aug 23 22:46:42 2002 @@ -982,7 +982,6 @@ /* * Shut down the controller when the system is going down. */ -#if defined(__NetBSD__) || defined(__OpenBSD__) void ohci_shutdown(void *v) { @@ -1014,7 +1013,9 @@ s = splhardusb(); switch (why) { case PWR_SUSPEND: +#if 0 case PWR_STANDBY: +#endif sc->sc_bus.use_polling++; ctl = OREAD4(sc, OHCI_CONTROL) & ~OHCI_HCFS_MASK; if (sc->sc_control == 0) { @@ -1052,14 +1053,15 @@ sc->sc_control = sc->sc_intre = 0; sc->sc_bus.use_polling--; break; +#if 0 case PWR_SOFTSUSPEND: case PWR_SOFTSTANDBY: case PWR_SOFTRESUME: break; +#endif } splx(s); } -#endif #ifdef USB_DEBUG void --- dev/usb/ohcivar.h.orig Mon Apr 8 00:16:31 2002 +++ dev/usb/ohcivar.h Fri Aug 23 22:46:42 2002 @@ -157,4 +157,9 @@ int ohci_activate(device_ptr_t, enum devact); #endif +#if defined(__FreeBSD__) +void ohci_power(int state, void *); +void ohci_shutdown(void *); +#endif + #define MS_TO_TICKS(ms) ((ms) * hz / 1000) --- pci/ohci_pci.c.orig Fri Aug 23 03:41:57 2002 +++ pci/ohci_pci.c Fri Aug 23 22:46:42 2002 @@ -114,6 +114,48 @@ static int ohci_pci_attach(device_t self); static int ohci_pci_detach(device_t self); +static int ohci_pci_suspend(device_t self); +static int ohci_pci_resume(device_t self); +static int ohci_pci_shutdown(device_t self); + +static int +ohci_pci_suspend(device_t self) +{ + ohci_softc_t *sc = device_get_softc(self); + int err; + + err = bus_generic_suspend(self); + if (err) + return err; + ohci_power(PWR_SUSPEND, sc); + + return 0; +} + +static int +ohci_pci_resume(device_t self) +{ + ohci_softc_t *sc = device_get_softc(self); + + ohci_power(PWR_RESUME, sc); + bus_generic_resume(self); + + return 0; +} + +static int +ohci_pci_shutdown(device_t self) +{ + ohci_softc_t *sc = device_get_softc(self); + int err; + + err = bus_generic_shutdown(self); + if (err) + return err; + ohci_shutdown(sc); + + return 0; +} static const char * ohci_pci_match(device_t self) @@ -295,9 +337,11 @@ static device_method_t ohci_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ohci_pci_probe), - DEVMETHOD(device_attach, ohci_pci_attach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), + DEVMETHOD(device_probe, ohci_pci_probe), + DEVMETHOD(device_attach, ohci_pci_attach), + DEVMETHOD(device_suspend, ohci_pci_suspend), + DEVMETHOD(device_resume, ohci_pci_resume), + DEVMETHOD(device_shutdown, ohci_pci_shutdown), /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child),