From owner-svn-src-all@freebsd.org Fri Aug 25 10:57:19 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 2F577DD4FD1; Fri, 25 Aug 2017 10:57:19 +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 0B18E81011; Fri, 25 Aug 2017 10:57:18 +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 v7PAvHPl024427; Fri, 25 Aug 2017 10:57:17 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PAvHFf024426; Fri, 25 Aug 2017 10:57:17 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201708251057.v7PAvHFf024426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans Date: Fri, 25 Aug 2017 10:57:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322884 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 322884 X-SVN-Commit-Repository: base 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: Fri, 25 Aug 2017 10:57:19 -0000 Author: bde Date: Fri Aug 25 10:57:17 2017 New Revision: 322884 URL: https://svnweb.freebsd.org/changeset/base/322884 Log: Fix bugs in (mostly) not-yet-activated parts of early/emergency output: - map the hard-coded frame buffer address above KERNBASE. Using the physical address only worked because of larger mapping bugs. The hard-coded frame buffer address only works on x86. Use messy ifdefs to try to avoid warnings about unused code for other arches. - remove the sysctl for reading and writing the table kernel console attributes. Writing only worked for emergency output since normal output uses unalterd copies. - fix the test for the emergency console being usable - explain why a hard-coded attribute is used very early. Emergency output works on x86 even before the pcpu pointer is initialized. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Aug 25 09:51:22 2017 (r322883) +++ head/sys/dev/syscons/syscons.c Fri Aug 25 10:57:17 2017 (r322884) @@ -76,6 +76,13 @@ __FBSDID("$FreeBSD$"); #endif #include +#if defined(__amd64__) || defined(__i386__) +#include + +#include +#include +#endif + #include #include #include @@ -137,8 +144,6 @@ static int sc_no_suspend_vtswitch = 0; static int sc_susp_scr; static SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); -SYSCTL_OPAQUE(_hw_syscons, OID_AUTO, kattr, CTLFLAG_RW, - &sc_kattrtab, sizeof(sc_kattrtab), "CU", "kernel console attributes"); static SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW, &sc_saver_keyb_only, 0, "screen saver interrupted by input only"); @@ -277,16 +282,17 @@ ec_putc(int c) if (sc_console == NULL) { #if !defined(__amd64__) && !defined(__i386__) return; -#endif +#else /* * This is enough for ec_putc() to work very early on x86 * if the kernel starts in normal color text mode. */ - fb = 0xb8000; + fb = KERNBASE + 0xb8000; xsize = 80; ysize = 25; +#endif } else { - if (main_console.status & GRAPHICS_MODE) + if (!ISTEXTSC(&main_console)) return; fb = main_console.sc->adp->va_window; xsize = main_console.xsize; @@ -4159,7 +4165,7 @@ static int sc_kattr(void) { if (sc_console == NULL) - return (SC_KERNEL_CONS_ATTR); + return (SC_KERNEL_CONS_ATTR); /* for very early, before pcpu */ return (sc_kattrtab[PCPU_GET(cpuid) % nitems(sc_kattrtab)]); }