From owner-svn-src-all@freebsd.org Thu Mar 16 07:40:34 2017 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 DD61FD0F510; Thu, 16 Mar 2017 07:40:34 +0000 (UTC) (envelope-from bde@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 932DE14A7; Thu, 16 Mar 2017 07:40:34 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2G7eXnZ008214; Thu, 16 Mar 2017 07:40:33 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2G7eXXI008213; Thu, 16 Mar 2017 07:40:33 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201703160740.v2G7eXXI008213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Thu, 16 Mar 2017 07:40:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r315390 - head/sys/dev/syscons 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.23 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: Thu, 16 Mar 2017 07:40:35 -0000 Author: bde Date: Thu Mar 16 07:40:33 2017 New Revision: 315390 URL: https://svnweb.freebsd.org/changeset/base/315390 Log: The previous fix didn't ifdef out enough for sparc64 to actually work. Fix this by using more dynamic initialization with simpler ifdefs for the machine dependencies. Find a frame buffer address in a more portable way that at least compiles on sparc64. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Thu Mar 16 07:20:32 2017 (r315389) +++ head/sys/dev/syscons/syscons.c Thu Mar 16 07:40:33 2017 (r315390) @@ -260,40 +260,36 @@ static struct cdevsw consolectl_devsw = static u_int ec_scroffset; -/* - * Fake enough of main_console for ec_putc() to work very early on x86 if - * the kernel starts in normal color text mode. On non-x86, scribbling - * to the x86 normal color text frame buffer's addresses is unsafe, so - * set (likely non-fake) graphics mode to get a null initial ec_putc(). - */ -static scr_stat fake_main_console = { -#ifndef __sparc64__ - .scr.vtb_buffer = 0xb8000, -#endif - .xsize = 80, - .ysize = 25, -#if !defined(__amd64__) && !defined(__i386__) - .status = GRAPHICS_MODE, -#endif -}; - -#define main_console (sc_console == NULL ? fake_main_console : main_console) - static void ec_putc(int c) { -#ifndef __sparc64__ + uintptr_t fb; u_short *scrptr; u_int ind; int attr, column, mysize, width, xsize, yborder, ysize; - if (main_console.status & GRAPHICS_MODE || - c < 0 || c > 0xff || c == '\a') + if (c < 0 || c > 0xff || c == '\a') return; - xsize = main_console.xsize; - ysize = main_console.ysize; + if (sc_console == NULL) { +#if !defined(__amd64__) && !defined(__i386__) + return; +#endif + /* + * This is enough for ec_putc() to work very early on x86 + * if the kernel starts in normal color text mode. + */ + fb = 0xb8000; + xsize = 80; + ysize = 25; + } else { + if (main_console.status & GRAPHICS_MODE) + return; + fb = main_console.sc->adp->va_window; + xsize = main_console.xsize; + ysize = main_console.ysize; + } yborder = ysize / 5; - scrptr = (u_short *)main_console.scr.vtb_buffer + xsize * yborder; + scrptr = (u_short *)(void *)fb + xsize * yborder; mysize = xsize * (ysize - 2 * yborder); do { ind = ec_scroffset; @@ -314,11 +310,8 @@ ec_putc(int c) do scrptr[ind++ % mysize] = (attr << 8) | c; while (--width != 0); -#endif /* !__sparc64__ */ } -#undef main_console - int sc_probe_unit(int unit, int flags) {