From owner-svn-src-all@freebsd.org Sat Jan 9 21:28:57 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1D44A6AB5D; Sat, 9 Jan 2016 21:28:57 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A8E3152D; Sat, 9 Jan 2016 21:28:57 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u09LSupW031176; Sat, 9 Jan 2016 21:28:56 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u09LSuSF031175; Sat, 9 Jan 2016 21:28:56 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201601092128.u09LSuSF031175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Sat, 9 Jan 2016 21:28:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r293614 - head/sys/dev/vt/hw/ofwfb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jan 2016 21:28:57 -0000 Author: nwhitehorn Date: Sat Jan 9 21:28:56 2016 New Revision: 293614 URL: https://svnweb.freebsd.org/changeset/base/293614 Log: Make graphical consoles work under PowerKVM. Without using hypercalls, it is not possible to write the framebuffer before pmap is up. Solve this by deferring initialization until that happens, like on PS3. MFC after: 1 week Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c ============================================================================== --- head/sys/dev/vt/hw/ofwfb/ofwfb.c Sat Jan 9 20:18:53 2016 (r293613) +++ head/sys/dev/vt/hw/ofwfb/ofwfb.c Sat Jan 9 21:28:56 2016 (r293614) @@ -57,6 +57,7 @@ struct ofwfb_softc { int iso_palette; }; +static void ofwfb_initialize(struct vt_device *vd); static vd_probe_t ofwfb_probe; static vd_init_t ofwfb_init; static vd_bitblt_text_t ofwfb_bitblt_text; @@ -124,6 +125,18 @@ ofwfb_bitblt_bitmap(struct vt_device *vd uint8_t c[4]; } ch1, ch2; +#ifdef __powerpc__ + /* Deal with unmapped framebuffers */ + if (sc->fb_flags & FB_FLAG_NOWRITE) { + if (pmap_bootstrapped) { + sc->fb_flags &= ~FB_FLAG_NOWRITE; + ofwfb_initialize(vd); + } else { + return; + } + } +#endif + fgc = sc->fb_cmap[fg]; bgc = sc->fb_cmap[bg]; b = m = 0; @@ -271,6 +284,11 @@ ofwfb_initialize(struct vt_device *vd) cell_t retval; uint32_t oldpix; + sc->fb.fb_cmsize = 16; + + if (sc->fb.fb_flags & FB_FLAG_NOWRITE) + return; + /* * Set up the color map */ @@ -318,8 +336,6 @@ ofwfb_initialize(struct vt_device *vd) panic("Unknown color space depth %d", sc->fb.fb_bpp); break; } - - sc->fb.fb_cmsize = 16; } static int @@ -466,6 +482,11 @@ ofwfb_init(struct vt_device *vd) #if defined(__powerpc__) OF_decode_addr(node, fb_phys, &sc->sc_memt, &sc->fb.fb_vbase); sc->fb.fb_pbase = sc->fb.fb_vbase; /* 1:1 mapped */ + #ifdef __powerpc64__ + /* Real mode under a hypervisor probably doesn't cover FB */ + if (!(mfmsr() & (PSL_HV | PSL_DR))) + sc->fb.fb_flags |= FB_FLAG_NOWRITE; + #endif #else /* No ability to interpret assigned-addresses otherwise */ return (CN_DEAD);