diff options
-rw-r--r-- | sys/pc98/cbus/syscons_cbus.c | 35 | ||||
-rw-r--r-- | sys/pc98/pc98/syscons_pc98.c | 35 |
2 files changed, 70 insertions, 0 deletions
diff --git a/sys/pc98/cbus/syscons_cbus.c b/sys/pc98/cbus/syscons_cbus.c index e45dbf7..10a90be 100644 --- a/sys/pc98/cbus/syscons_cbus.c +++ b/sys/pc98/cbus/syscons_cbus.c @@ -74,6 +74,39 @@ scattach(device_t dev) 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) { @@ -199,6 +232,8 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_suspend, scsuspend), + DEVMETHOD(device_resume, scresume), { 0, 0 } }; diff --git a/sys/pc98/pc98/syscons_pc98.c b/sys/pc98/pc98/syscons_pc98.c index e45dbf7..10a90be 100644 --- a/sys/pc98/pc98/syscons_pc98.c +++ b/sys/pc98/pc98/syscons_pc98.c @@ -74,6 +74,39 @@ scattach(device_t dev) 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) { @@ -199,6 +232,8 @@ static device_method_t sc_methods[] = { DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), + DEVMETHOD(device_suspend, scsuspend), + DEVMETHOD(device_resume, scresume), { 0, 0 } }; |