Author: grehan
Date: Thu May  1 00:12:24 2014
New Revision: 265165
URL: http://svnweb.freebsd.org/changeset/base/265165

Log:
  Provide an alias for the userboot console and name it 'comconsole'.
  This allows existing loader.conf files that set "console=comconsole"
  to work without failing. No functional difference otherwise.
  
  Reported by:  Michael Dexter, pfSense install.
  Reviewed by:  neel
  MFC after:    3 weeks

Modified:
  head/sys/boot/userboot/userboot/conf.c
  head/sys/boot/userboot/userboot/userboot_cons.c

Modified: head/sys/boot/userboot/userboot/conf.c
==============================================================================
--- head/sys/boot/userboot/userboot/conf.c      Wed Apr 30 21:19:46 2014        
(r265164)
+++ head/sys/boot/userboot/userboot/conf.c      Thu May  1 00:12:24 2014        
(r265165)
@@ -97,8 +97,10 @@ struct file_format *file_formats[] = {
  * data structures from bootstrap.h as well.
  */
 extern struct console userboot_console;
+extern struct console userboot_comconsole;
 
 struct console *consoles[] = {
        &userboot_console,
+       &userboot_comconsole,
        NULL
 };

Modified: head/sys/boot/userboot/userboot/userboot_cons.c
==============================================================================
--- head/sys/boot/userboot/userboot/userboot_cons.c     Wed Apr 30 21:19:46 
2014        (r265164)
+++ head/sys/boot/userboot/userboot/userboot_cons.c     Thu May  1 00:12:24 
2014        (r265165)
@@ -33,8 +33,12 @@ __FBSDID("$FreeBSD$");
 
 int console;
 
+static struct console *userboot_comconsp;
+
 static void userboot_cons_probe(struct console *cp);
 static int userboot_cons_init(int);
+static void userboot_comcons_probe(struct console *cp);
+static int userboot_comcons_init(int);
 static void userboot_cons_putchar(int);
 static int userboot_cons_getchar(void);
 static int userboot_cons_poll(void);
@@ -50,6 +54,21 @@ struct console userboot_console = {
        userboot_cons_poll,
 };
 
+/*
+ * Provide a simple alias to allow loader scripts to set the
+ * console to comconsole without resulting in an error
+ */
+struct console userboot_comconsole = {
+       "comconsole",
+       "comconsole",
+       0,
+       userboot_comcons_probe,
+       userboot_comcons_init,
+       userboot_cons_putchar,
+       userboot_cons_getchar,
+       userboot_cons_poll,
+};
+
 static void
 userboot_cons_probe(struct console *cp)
 {
@@ -65,6 +84,31 @@ userboot_cons_init(int arg)
 }
 
 static void
+userboot_comcons_probe(struct console *cp)
+{
+
+       /*
+        * Save the console pointer so the comcons_init routine
+        * can set the C_PRESENT* flags. They are not set
+        * here to allow the existing userboot console to
+        * be elected the default.
+        */
+       userboot_comconsp = cp;
+}
+
+static int
+userboot_comcons_init(int arg)
+{
+
+       /*
+        * Set the C_PRESENT* flags to allow the comconsole
+        * to be selected as the active console
+        */
+       userboot_comconsp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
+       return (0);
+}
+
+static void
 userboot_cons_putchar(int c)
 {
 
_______________________________________________
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