Index: isa/syscons_isa.c =================================================================== RCS file: /home/ncvs/src/sys/isa/syscons_isa.c,v retrieving revision 1.17 diff -u -r1.17 syscons_isa.c --- isa/syscons_isa.c 30 Jun 2001 10:15:06 -0000 1.17 +++ isa/syscons_isa.c 16 Feb 2002 13:11:50 -0000 @@ -88,6 +88,39 @@ return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); } +static int sc_cur_scr; + +static int +scsuspend(device_t dev) +{ + int retry = 10; + static int dummy; + sc_softc_t *sc; + + sc = &main_softc; + sc_cur_scr = sc->cur_scp->index; + do { + sc_switch_scr(sc, 0); + if (!sc->switch_in_progress) { + break; + } + tsleep(&dummy, 0, "scsuspend", 100); + } while (retry--); + + return (0); +} + +static int +scresume(device_t dev) +{ + sc_softc_t *sc; + + sc = &main_softc; + sc_switch_scr(sc, sc_cur_scr); + + return (0); +} + int sc_max_unit(void) { @@ -230,6 +263,8 @@ DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_suspend, scsuspend), + DEVMETHOD(device_resume, scresume), { 0, 0 } }; Index: dev/usb/ohci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/ohci.c,v retrieving revision 1.108 diff -u -r1.108 ohci.c --- dev/usb/ohci.c 28 May 2002 20:51:43 -0000 1.108 +++ dev/usb/ohci.c 13 Jun 2002 04:39:06 -0000 @@ -974,7 +974,6 @@ /* * Shut down the controller when the system is going down. */ -#if defined(__NetBSD__) || defined(__OpenBSD__) void ohci_shutdown(void *v) { @@ -1006,7 +1005,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) { @@ -1044,14 +1045,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 OHCI_DEBUG void Index: dev/usb/ohcivar.h =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/ohcivar.h,v retrieving revision 1.32 diff -u -r1.32 ohcivar.h --- dev/usb/ohcivar.h 7 Apr 2002 15:16:31 -0000 1.32 +++ dev/usb/ohcivar.h 9 Apr 2002 20:17:55 -0000 @@ -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) Index: pci/ohci_pci.c =================================================================== RCS file: /home/ncvs/src/sys/pci/ohci_pci.c,v retrieving revision 1.27 diff -u -r1.27 ohci_pci.c --- pci/ohci_pci.c 17 Feb 2002 11:58:58 -0000 1.27 +++ pci/ohci_pci.c 20 Feb 2002 11:26:26 -0000 @@ -106,6 +106,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) @@ -301,9 +343,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),