svn commit: r208411 - in head/sys: dev/syscons isa
Jung-uk Kim
jkim at FreeBSD.org
Sat May 22 07:35:17 UTC 2010
Author: jkim
Date: Sat May 22 07:35:17 2010
New Revision: 208411
URL: http://svn.freebsd.org/changeset/base/208411
Log:
Suspend screen updates when the video controller is powered down.
Modified:
head/sys/dev/syscons/syscons.c
head/sys/dev/syscons/syscons.h
head/sys/isa/syscons_isa.c
Modified: head/sys/dev/syscons/syscons.c
==============================================================================
--- head/sys/dev/syscons/syscons.c Sat May 22 07:32:47 2010 (r208410)
+++ head/sys/dev/syscons/syscons.c Sat May 22 07:35:17 2010 (r208411)
@@ -1692,7 +1692,7 @@ sccnupdate(scr_stat *scp)
{
/* this is a cut-down version of scrn_timer()... */
- if (scp->sc->font_loading_in_progress)
+ if (scp->sc->suspend_in_progress || scp->sc->font_loading_in_progress)
return;
if (debugger > 0 || panicstr || shutdown_in_progress) {
@@ -1742,7 +1742,7 @@ scrn_timer(void *arg)
return;
/* don't do anything when we are performing some I/O operations */
- if (sc->font_loading_in_progress) {
+ if (sc->suspend_in_progress || sc->font_loading_in_progress) {
if (again)
timeout(scrn_timer, sc, hz / 10);
return;
Modified: head/sys/dev/syscons/syscons.h
==============================================================================
--- head/sys/dev/syscons/syscons.h Sat May 22 07:32:47 2010 (r208410)
+++ head/sys/dev/syscons/syscons.h Sat May 22 07:35:17 2010 (r208411)
@@ -230,6 +230,7 @@ typedef struct sc_softc {
char switch_in_progress;
char write_in_progress;
char blink_in_progress;
+ char suspend_in_progress;
struct mtx video_mtx;
long scrn_time_stamp;
Modified: head/sys/isa/syscons_isa.c
==============================================================================
--- head/sys/isa/syscons_isa.c Sat May 22 07:32:47 2010 (r208410)
+++ head/sys/isa/syscons_isa.c Sat May 22 07:35:17 2010 (r208411)
@@ -114,21 +114,21 @@ scsuspend(device_t dev)
sc = &main_softc;
- if (sc->cur_scp == NULL)
+ if (sc->cur_scp == NULL || sc->suspend_in_progress)
return (0);
- sc_cur_scr = sc->cur_scp->index;
-
- if (sc_no_suspend_vtswitch)
- return (0);
+ if (!sc_no_suspend_vtswitch) {
+ sc_cur_scr = sc->cur_scp->index;
+ do {
+ sc_switch_scr(sc, 0);
+ if (!sc->switch_in_progress) {
+ break;
+ }
+ pause("scsuspend", hz);
+ } while (retry--);
+ }
- do {
- sc_switch_scr(sc, 0);
- if (!sc->switch_in_progress) {
- break;
- }
- pause("scsuspend", hz);
- } while (retry--);
+ sc->suspend_in_progress = TRUE;
return (0);
}
@@ -138,11 +138,15 @@ scresume(device_t dev)
{
sc_softc_t *sc;
- if (sc_no_suspend_vtswitch)
+ sc = &main_softc;
+
+ if (!sc->suspend_in_progress)
return (0);
- sc = &main_softc;
- sc_switch_scr(sc, sc_cur_scr);
+ sc->suspend_in_progress = FALSE;
+
+ if (!sc_no_suspend_vtswitch)
+ sc_switch_scr(sc, sc_cur_scr);
return (0);
}
@@ -303,3 +307,70 @@ static driver_t sc_driver = {
};
DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0);
+
+static devclass_t scpm_devclass;
+
+static void
+scpm_identify(driver_t *driver, device_t parent)
+{
+
+ device_add_child(parent, "scpm", 0);
+}
+
+static int
+scpm_probe(device_t dev)
+{
+
+ device_set_desc(dev, SC_DRIVER_NAME " suspend/resume");
+ device_quiet(dev);
+
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+scpm_attach(device_t dev)
+{
+
+ bus_generic_probe(dev);
+ bus_generic_attach(dev);
+
+ return (0);
+}
+
+static int
+scpm_suspend(device_t dev)
+{
+ int error;
+
+ error = bus_generic_suspend(dev);
+ if (error != 0)
+ return (error);
+
+ return (scsuspend(dev));
+}
+
+static int
+scpm_resume(device_t dev)
+{
+
+ scresume(dev);
+
+ return (bus_generic_resume(dev));
+}
+
+static device_method_t scpm_methods[] = {
+ DEVMETHOD(device_identify, scpm_identify),
+ DEVMETHOD(device_probe, scpm_probe),
+ DEVMETHOD(device_attach, scpm_attach),
+ DEVMETHOD(device_suspend, scpm_suspend),
+ DEVMETHOD(device_resume, scpm_resume),
+ { 0, 0 }
+};
+
+static driver_t scpm_driver = {
+ "scpm",
+ scpm_methods,
+ 0
+};
+
+DRIVER_MODULE(scpm, vgapm, scpm_driver, scpm_devclass, 0, 0);
More information about the svn-src-head
mailing list