summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/ofw
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2008-12-13 20:53:57 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2008-12-13 20:53:57 +0000
commit1d585eec2563a0e5077fe0c6f7c32e6d74edc663 (patch)
treee267e3d3ca0832acc1dfdbb7136fec8138b61218 /sys/powerpc/ofw
parent6e26928458973cf00859aca8c2a1e570cd9e0248 (diff)
downloadFreeBSD-src-1d585eec2563a0e5077fe0c6f7c32e6d74edc663.zip
FreeBSD-src-1d585eec2563a0e5077fe0c6f7c32e6d74edc663.tar.gz
Allow OFW syscons to restore itself when the X server exits or there is a VT switch
by redoing the Open Firmware card initialization calls in ofwfb_set_mode(). This uses the same trick (setting V_ADP_MODECHANGE) to arrange this as machfb(4) and creatorfb(4).
Diffstat (limited to 'sys/powerpc/ofw')
-rw-r--r--sys/powerpc/ofw/ofw_syscons.c64
1 files changed, 38 insertions, 26 deletions
diff --git a/sys/powerpc/ofw/ofw_syscons.c b/sys/powerpc/ofw/ofw_syscons.c
index 0ef95ee..1080dad 100644
--- a/sys/powerpc/ofw/ofw_syscons.c
+++ b/sys/powerpc/ofw/ofw_syscons.c
@@ -308,36 +308,14 @@ ofwfb_init(int unit, video_adapter_t *adp, int flags)
{
struct ofwfb_softc *sc;
video_info_t *vi;
- char name[64];
- ihandle_t ih;
- int i;
int cborder;
int font_height;
- int retval;
sc = (struct ofwfb_softc *)adp;
vi = &adp->va_info;
vid_init_struct(adp, "ofwfb", -1, unit);
- if (sc->sc_depth == 8) {
- /*
- * Install the ISO6429 colormap - older OFW systems
- * don't do this by default
- */
- memset(name, 0, sizeof(name));
- OF_package_to_path(sc->sc_node, name, sizeof(name));
- ih = OF_open(name);
- for (i = 0; i < 16; i++) {
- OF_call_method("color!", ih, 4, 1,
- ofwfb_cmap[i].red,
- ofwfb_cmap[i].green,
- ofwfb_cmap[i].blue,
- i,
- &retval);
- }
- }
-
/* The default font size can be overridden by loader */
font_height = 16;
TUNABLE_INT_FETCH("hw.syscons.fsize", &font_height);
@@ -379,10 +357,13 @@ ofwfb_init(int unit, video_adapter_t *adp, int flags)
*/
adp->va_window = (vm_offset_t) ofwfb_static_window;
- /* Enable future font-loading and flag color support */
- adp->va_flags |= V_ADP_FONT | V_ADP_COLOR;
-
- ofwfb_blank_display(&sc->sc_va, V_DISPLAY_ON);
+ /*
+ * Enable future font-loading and flag color support, as well as
+ * adding V_ADP_MODECHANGE so that we ofwfb_set_mode() gets called
+ * when the X server shuts down. This enables us to get the console
+ * back when X disappears.
+ */
+ adp->va_flags |= V_ADP_FONT | V_ADP_COLOR | V_ADP_MODECHANGE;
ofwfb_set_mode(&sc->sc_va, 0);
@@ -408,6 +389,37 @@ ofwfb_query_mode(video_adapter_t *adp, video_info_t *info)
static int
ofwfb_set_mode(video_adapter_t *adp, int mode)
{
+ struct ofwfb_softc *sc;
+ char name[64];
+ ihandle_t ih;
+ int i, retval;
+
+ sc = (struct ofwfb_softc *)adp;
+
+ /*
+ * Open the display device, which will initialize it.
+ */
+
+ memset(name, 0, sizeof(name));
+ OF_package_to_path(sc->sc_node, name, sizeof(name));
+ ih = OF_open(name);
+
+ if (sc->sc_depth == 8) {
+ /*
+ * Install the ISO6429 colormap - older OFW systems
+ * don't do this by default
+ */
+ for (i = 0; i < 16; i++) {
+ OF_call_method("color!", ih, 4, 1,
+ ofwfb_cmap[i].red,
+ ofwfb_cmap[i].green,
+ ofwfb_cmap[i].blue,
+ i,
+ &retval);
+ }
+ }
+
+ ofwfb_blank_display(&sc->sc_va, V_DISPLAY_ON);
return (0);
}
OpenPOWER on IntegriCloud