Author: emaste
Date: Wed Jul  2 13:24:21 2014
New Revision: 268158
URL: http://svnweb.freebsd.org/changeset/base/268158

Log:
  Prefer vt(4) for UEFI boot
  
  The UEFI framebuffer driver vt_efifb requires vt(4), so add a mechanism
  for the startup routine to set the preferred console.  This change is
  ugly because console init happens very early in the boot, making a
  cleaner interface difficult.  This change is intended only to facilitate
  the sc(4) / vt(4) transition, and can be reverted once vt(4) is the
  default.

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/kern/kern_cons.c
  head/sys/sys/cons.h

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c      Wed Jul  2 13:09:26 2014        
(r268157)
+++ head/sys/amd64/amd64/machdep.c      Wed Jul  2 13:24:21 2014        
(r268158)
@@ -1955,6 +1955,14 @@ hammer_time(u_int64_t modulep, u_int64_t
        clock_init();
 
        /*
+        * Use vt(4) by default for UEFI boot (during the sc(4)/vt(4)
+        * transition).
+        */
+       if (preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_MAP) !=
+           NULL)
+               vty_set_preferred(VTY_VT);
+
+       /*
         * Initialize the console before we print anything out.
         */
        cninit();

Modified: head/sys/kern/kern_cons.c
==============================================================================
--- head/sys/kern/kern_cons.c   Wed Jul  2 13:09:26 2014        (r268157)
+++ head/sys/kern/kern_cons.c   Wed Jul  2 13:24:21 2014        (r268158)
@@ -652,6 +652,7 @@ sysbeep(int pitch __unused, int period _
 /*
  * Temporary support for sc(4) to vt(4) transition.
  */
+static unsigned vty_prefer;
 static char vty_name[16];
 SYSCTL_STRING(_kern, OID_AUTO, vty, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, vty_name,
     0, "Console vty driver");
@@ -676,6 +677,10 @@ vty_enabled(unsigned vty)
                                break;
                        }
 #endif
+                       if (vty_prefer != 0) {
+                               vty_selected = vty_prefer;
+                               break;
+                       }
 #if defined(DEV_SC)
                        vty_selected = VTY_SC;
 #elif defined(DEV_VT)
@@ -691,3 +696,16 @@ vty_enabled(unsigned vty)
        return ((vty_selected & vty) != 0);
 }
 
+void
+vty_set_preferred(unsigned vty)
+{
+
+       vty_prefer = vty;
+#if !defined(DEV_SC)
+       vty_prefer &= ~DEV_SC;
+#endif
+#if !defined(DEV_VT)
+       vty_prefer &= ~DEV_VT;
+#endif
+}
+

Modified: head/sys/sys/cons.h
==============================================================================
--- head/sys/sys/cons.h Wed Jul  2 13:09:26 2014        (r268157)
+++ head/sys/sys/cons.h Wed Jul  2 13:24:21 2014        (r268158)
@@ -137,6 +137,7 @@ void        constty_clear(void);
 #define        VTY_SC 0x01
 #define        VTY_VT 0x02
 int    vty_enabled(unsigned int);
+void   vty_set_preferred(unsigned int);
 
 #endif /* _KERNEL */
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to