Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2017 10:57:17 +0000 (UTC)
From:      Bruce Evans <bde@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322884 - head/sys/dev/syscons
Message-ID:  <201708251057.v7PAvHFf024426@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <machine/stdarg.h>
 
+#if defined(__amd64__) || defined(__i386__)
+#include <machine/vmparam.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+#endif
+
 #include <dev/kbd/kbdreg.h>
 #include <dev/fb/fbreg.h>
 #include <dev/fb/splashreg.h>
@@ -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)]);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708251057.v7PAvHFf024426>