stand: add comconsole backwards compatibility shim for aarch64

Add a compat shim for the "comconsole" name so that people with a
"console=comconsole" in their loader.conf on aarch64 will continue to
work (though with a warning).

This is only aarch64: it will never be there for amd64 (where comconsole
always means talk to the hardware directly). To do that is too hard.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D39983
This commit is contained in:
Warner Losh 2023-05-11 14:03:30 -06:00
parent 2f131435bc
commit f93416d677
2 changed files with 32 additions and 0 deletions

View File

@ -81,6 +81,10 @@ struct netif_driver *netif_drivers[] = {
extern struct console efi_console;
extern struct console eficom;
#if defined(__aarch64__) && __FreeBSD_version < 1500000
/* Hack for backward compatibility -- but only for a while */
extern struct console comconsole;
#endif
#if defined(__amd64__) || defined(__i386__)
extern struct console comconsole;
extern struct console nullconsole;
@ -90,6 +94,9 @@ extern struct console spinconsole;
struct console *consoles[] = {
&efi_console,
&eficom,
#if defined(__aarch64__) && __FreeBSD_version < 1500000
&comconsole,
#endif
#if defined(__amd64__) || defined(__i386__)
&comconsole,
&nullconsole,

View File

@ -81,6 +81,20 @@ struct console eficom = {
.c_ready = comc_ischar,
};
#if defined(__aarch64__) && __FreeBSD_version < 1500000
static void comc_probe_compat(struct console *);
struct console comconsole = {
.c_name = "comconsole",
.c_desc = "serial port",
.c_flags = 0,
.c_probe = comc_probe_compat,
.c_init = comc_init,
.c_out = comc_putchar,
.c_in = comc_getchar,
.c_ready = comc_ischar,
};
#endif
static EFI_STATUS
efi_serial_init(EFI_HANDLE **handlep, int *nhandles)
{
@ -328,6 +342,17 @@ comc_probe(struct console *sc)
}
}
#if defined(__aarch64__) && __FreeBSD_version < 1500000
static void
comc_probe_compat(struct console *sc)
{
comc_probe(sc);
if (sc->c_flags & (C_PRESENTIN | C_PRESENTOUT)) {
printf("comconsole: comconsole device name is deprecated, switch to eficom\n");
}
}
#endif
static int
comc_init(int arg __unused)
{