aboutsummaryrefslogtreecommitdiff
path: root/sys/boot/userboot/userboot/userboot_cons.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/boot/userboot/userboot/userboot_cons.c')
-rw-r--r--sys/boot/userboot/userboot/userboot_cons.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/boot/userboot/userboot/userboot_cons.c b/sys/boot/userboot/userboot/userboot_cons.c
index 5ecb7c8b2ec1..6f73ad5633bb 100644
--- a/sys/boot/userboot/userboot/userboot_cons.c
+++ b/sys/boot/userboot/userboot/userboot_cons.c
@@ -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)
{