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
This commit is contained in:
Peter Grehan 2014-05-01 00:12:24 +00:00
parent b251c17a97
commit b32074cd44
2 changed files with 46 additions and 0 deletions

View File

@ -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
};

View File

@ -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)
{
@ -64,6 +83,31 @@ userboot_cons_init(int arg)
return (0);
}
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)
{