From owner-svn-src-head@FreeBSD.ORG Sat Dec 13 20:53:58 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 549041065688; Sat, 13 Dec 2008 20:53:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 425A28FC13; Sat, 13 Dec 2008 20:53:58 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBDKrwNn039465; Sat, 13 Dec 2008 20:53:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBDKrw70039464; Sat, 13 Dec 2008 20:53:58 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200812132053.mBDKrw70039464@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 13 Dec 2008 20:53:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186055 - head/sys/powerpc/ofw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 Dec 2008 20:53:58 -0000 Author: nwhitehorn Date: Sat Dec 13 20:53:57 2008 New Revision: 186055 URL: http://svn.freebsd.org/changeset/base/186055 Log: 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). Modified: head/sys/powerpc/ofw/ofw_syscons.c Modified: head/sys/powerpc/ofw/ofw_syscons.c ============================================================================== --- head/sys/powerpc/ofw/ofw_syscons.c Sat Dec 13 20:34:41 2008 (r186054) +++ head/sys/powerpc/ofw/ofw_syscons.c Sat Dec 13 20:53:57 2008 (r186055) @@ -308,36 +308,14 @@ ofwfb_init(int unit, video_adapter_t *ad { 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 *ad */ 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, v 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); }