From nobody Fri Mar 31 10:17:49 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pnx7Z493lz42GfN for ; Fri, 31 Mar 2023 10:18:02 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pnx7Z0TnTz3JHj for ; Fri, 31 Mar 2023 10:18:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x535.google.com with SMTP id eg48so87530238edb.13 for ; Fri, 31 Mar 2023 03:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20210112.gappssmtp.com; s=20210112; t=1680257880; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=REyLu3OyMSUMDwiUUbHWmBuAEX3tTANEihNpeyKTC4g=; b=vQjgXLLHQ/FQAu9FuQRrcPNH0dDP5mOysFnNvzhOslOW4QxXLz4IulrL88L22zoAVR cZhr2QlMosljVJlnUtbfoOJdK1dm0LaLamLMoF67M/2KoKU6P/vXekglkMpuS7tTNnJW 9RLkPYPQK1joi2ikF3DEX4/UepSD3QGlSpVBXni6ID/v0oBLJ2jLepQbhLQjFROjG8Gx d0t+FoQAjIAOiQeY6NqL1tUxA/u22LleLFLJGBoYGMQPWqccWV31DTQ8+AkqjWd1vHE0 G7MbONoJlV8K48W0jp4wZFH0jkTp9oTKtpSz7aAi/6eTqAJGHUpMv0oVZErLveyrH6ND vnTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680257880; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=REyLu3OyMSUMDwiUUbHWmBuAEX3tTANEihNpeyKTC4g=; b=IlhxUDcPk3ZRdGW7a+ktZF9fUOGrSUwEhpiI6wCDKwUMWP3/I30fbmlymBjXa/97/z 658DUakR1KjjtUg18R3O2Ip6zvaycw+6OfhugEyZ1yrXiVK0cRHxrycFy5VdjeWYNXvN hz4SZp89LFmC/mJg6FEV+hTqYXbZZKYmd0slZ9vjbF/4mm+s/nzhW8dC80FDG7sPhu1N DMnC4x19ooHpoa1CpCblarXiA+J9K1tuvuk3SuU6Lvt/9KkO6kixFvVhtwEg3nVAhA0O sztQMC/+9fD2ROyEDb6lMPVLCLzfnZxpIPvyO+6DThZzjfjh08mBRmyOExIpE9Pm8a4F mMTg== X-Gm-Message-State: AAQBX9ehrF2R62syuCkp1e+0cl0c0dvnUxAm0snN69y5asKZohxU1nLT VGbh15TlG496b824nHjwS7bZbDTKz0R1BBVEVrKb8w== X-Google-Smtp-Source: AKy350bxL8irKOoon0PRgGRANzKIElG7DdGGiJkNweoqkDPbi0xkVqSol51xl1EFqJdDyVatod8dC7AwWFiT2uE/TvA= X-Received: by 2002:a17:906:9f0b:b0:8b1:38d6:9853 with SMTP id fy11-20020a1709069f0b00b008b138d69853mr12036464ejc.2.1680257880552; Fri, 31 Mar 2023 03:18:00 -0700 (PDT) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202303180720.32I7KXOc030612@gitrepo.freebsd.org> <256C0F87-8B73-4E5E-9B5E-E9BF00DEC019@me.com> In-Reply-To: <256C0F87-8B73-4E5E-9B5E-E9BF00DEC019@me.com> From: Warner Losh Date: Fri, 31 Mar 2023 04:17:49 -0600 Message-ID: Subject: Re: git: 927358dd98cb - main - amd64 loader: Use efiserialio for Hyper-V booted systems To: Toomas Soome Cc: Gleb Smirnoff , Wei Hu , src-committers , "" , "" , imp@freebsd.org, gallatin@freebsd.org, kevans@freebsd.org Content-Type: multipart/alternative; boundary="0000000000001a12e105f82f8633" X-Rspamd-Queue-Id: 4Pnx7Z0TnTz3JHj X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N --0000000000001a12e105f82f8633 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 31, 2023 at 12:22=E2=80=AFAM Toomas Soome wrote= : > > > On 31. Mar 2023, at 02:40, Warner Losh wrote: > > Let's back it out. I didn't get a chance to review it and the duplicated > name strikes me as massively unwise. > Of course, the efi serial driver never should have had the name comconsol= e > in the first place, imho. It was OK > on arm where we couldn't conflict. > > So let's back it out and talk about how we should do this, including the > need to possibly just rename the efi > version of the console driver to something else. IMHO, it never should > have been comconsole in the first > place because it's configured differently than comconsole.... > > Warner > > > ok, lets start from beginning. The loader device naming is total mess and > should not go this way - it is not understandable for users and not > understandable for developers. > > the config below is perfect example of the situation: > > First the config does set: > > console=3D"comconsole vidconsole efi=E2=80=9D > > > So, we do try to set serial console, bios video console and efi console. > So we have =E2=80=9Cshared=E2=80=9D config for BIOS and UEFI loader, whic= h should be > totally reasonable from user point of view, but is technically wrong, > because BIOS loader has no idea what is efi console and EFI loader has no > idea what is vidconsole. So this mixture ends up with message: > I strongly disagree this is wrong. You have a boot loader that may have one of many console devices. Not all may be present. > console vidconsole is invalid!" > > > And the user will get the similar error when booting BIOS setup. > Yes. This message is a bit bogus: it just means we don't have a comconsole configured. And that's fine. It's like if I had ifconfig_ixl0=3DDHCP and ifconfig_xe0=3DDHCP in my rc.co= nf file, imho. It says if they are there, use them. Otherwise don't. We don't have a eth device that's a generic thing. Nor should comconsole be all possible uarts. > Then we just set console=3D=E2=80=9Cefi=E2=80=9D. > > Then there is setting for uart=E2=80=A6 > This is an orthogonal issue. > With todays UEFI setups, the logic is that you set up your hardware, that > is, you configure serial port attributes from firmware setup, and the UEF= I > firmware will populate its internal structures with those values. > Agreed. Still orthogonal to the naming issue. > Now, first issue is, while developing uefi loader, it was easy path to > reuse bits from BIOS loader. smbios, acpi, and sadly, comconsole. Sadly, > because comconsole is built assuming x86 IO port features which are not > available on other platforms. > Agreed. However, we are stuck with comconsole =3D=3D talk to the hardware a= nd bypass the UEFI firmware. We need to have a efiserial and efivideo device, even for x86, so that we can specify things more closely. Overloading comconsole is unwise. > So yes, bios version of comconsole should not have been used to build UEF= I > loader at all. > Yes and no. It's in use today, so saying it shouldn't is about 10 years too late. > Now the fun part, even as UEFI does provide SIO API to access serial > ports, to read from port, write to port and set attributes, it turns out > there are UEFI implementation(s?), where changing some attributes will > cause system to hung. Which is the reason, why we need to set up hardware > properly from firmware, and our generic config should not try to enforce > some other value(s). Default should pick up values from the system. Sure, > if the machine operator has some reason to change those values and has > tested the change, we should have method to change the config, but again, > defaults should come from system setup. > Agreed. And it mostly does today. If you have serial redirect, the efi driver does all that automatically. > While I see the reasoning to try to create all those different names, > maybe the first thing should be to look on this as innocent end user, who > has no idea about those fine technical details and historical reasons and > is just trying to get system to behave=E2=80=A6. > It has to be a new name. You can't just overload comconsole and have it work reliably. The user has to understand the technical details. Part of the problem here too is that comconsole's interface says 'use the one at port 0x378' which is impossible without parsing ACPI tables, which the efi loader doesn't do. So there's already a new, kludgy interface to specify the UID of the efiserial device. This UID is just a number with no relationship to the port from machine to machine. So we're already forcing changes on the user. It's no longer transparent: it takes effort to configure and you already have to know the differences because the simple port simply doesn't work. This is why I've been advocating for efi (use CONOUT text interface), efiserial (use the efi's uart routines) and efivideo (use graphic frame buffer) for years. Having this separation will allow people to configure the consoles on their systems more deterministically. For those that have nice serial redirect, 'efi' is the way to go. It just does the right thing. For those that do not, then you can use one or more of efiserial and efivideo to get the combination you want. Plus we can move the graphics dependencies into efivideo and get rid of the crazy stubs that things like kboot need that can never ever have graphical video. I'm still mad that my desire for this was ignored when the graphics stuff was added When we bring this driver back, it absolutely must have a new name. It cannot try to 'fake' it by doing the games it's doing. That simply won't work and breaks many working configurations today. So my suggestion is that we have a new efiserial driver, hyperV uses it. We rename the current efi serial interface to be efiserial. On aarch64 (and on aarch64 only) we have a new comconsole driver that just redirects to efiserial. It doesn't try to change the name of anything, nor try to do anything else. Plus it should start warning when you are trying to use the x86-only configuration knobs of comconsole. And starting after the 14 branch, it should start warning people should use efiserial insteaed. And we never, ever ever again try to do aliases that aren't really the same device and have different configuration needs under the covers. Warner > just my 2 cents, > toomas > > > On Thu, Mar 30, 2023 at 5:31=E2=80=AFPM Gleb Smirnoff wrote: > >> Wei, Kyle, >> >> this commit hangs loader on real hardware, at least on some >> of it. The loader prints list of consoles and hangs hard: >> >> [Thu Mar 30 20:46:12 2023]^M|^HLoading /boot/loader.conf^M >> ^M/^Hconsole vidconsole is invalid!^M >> ^MAvailable consoles:^M >> ^M efi^M >> ^M comconsole^M >> ^M comconsole^M >> ^M nullconsole^M >> ^M spinconsole^M >> >> Machine is unrecoverable unless you got alternate boot media >> and access to BMC console. >> >> First, please DO NOT MFC this as scheduled. Second, let's try >> to fix it or back it out if we hear from any other CURRENT >> user. >> >> Our configuration isn't special. This is what we got in >> loader.conf, related to consoles: >> >> console=3D"comconsole vidconsole efi" >> comconsole_speed=3D115200 >> comconsole_port=3D0x3e8 >> console=3D"efi" >> hw.uart.console=3D"io:1016,br:115200" >> >> On Sat, Mar 18, 2023 at 07:20:33AM +0000, Wei Hu wrote: >> W> The branch main has been updated by whu: >> W> >> W> URL: >> https://cgit.FreeBSD.org/src/commit/?id=3D927358dd98cb902160093e0dc0bac0= 02d6b43858 >> >> W> >> W> commit 927358dd98cb902160093e0dc0bac002d6b43858 >> W> Author: Wei Hu >> W> AuthorDate: 2023-03-14 15:13:46 +0000 >> W> Commit: Wei Hu >> W> CommitDate: 2023-03-18 07:07:35 +0000 >> W> >> W> amd64 loader: Use efiserialio for Hyper-V booted systems >> W> >> W> UEFI provides ConIn/ConOut handles for consoles that it supports, >> W> which include the text-video and serial ports. When the serial po= rt >> W> is available, use the UEFI driver instead of direct io-port >> accesses >> W> to avoid conflicts between the firmware and direct hardware >> access, as >> W> happens on Hyper-V (Azure) setups. >> W> >> W> This change enables efiserialio to be built for efi-amd64 and has >> W> higher order priority vs comconsole, and only uses efiserialio >> W> if the hypervisor is Hyper-V. When efiserialio successfully >> W> probes, it will set efi_comconsole_avail=3Dtrue which will preven= t >> W> comconsole from probing in this setup. >> W> >> W> Tested on Hyper-V, ESXi and Azure VMs. >> W> >> W> PR: 264267 >> W> Reviewed by: kevans, whu >> W> Tested by: whu >> W> Obtained from: Rubicon Communications, LLC (Netgate) >> W> MFC after: 2 weeks >> W> Sponsored by: Rubicon Communications, LLC (Netgate) >> W> --- >> W> stand/efi/loader/arch/amd64/Makefile.inc | 1 + >> W> stand/efi/loader/bootinfo.c | 11 ++++++-- >> W> stand/efi/loader/conf.c | 6 +++++ >> W> stand/efi/loader/efiserialio.c | 43 >> ++++++++++++++++++++++++++++---- >> W> stand/i386/libi386/comconsole.c | 14 +++++++++++ >> W> 5 files changed, 68 insertions(+), 7 deletions(-) >> W> >> W> diff --git a/stand/efi/loader/arch/amd64/Makefile.inc >> b/stand/efi/loader/arch/amd64/Makefile.inc >> W> index 0d9e2648cb59..bd89044bd6c7 100644 >> W> --- a/stand/efi/loader/arch/amd64/Makefile.inc >> W> +++ b/stand/efi/loader/arch/amd64/Makefile.inc >> W> @@ -5,6 +5,7 @@ SRCS+=3D amd64_tramp.S \ >> W> elf64_freebsd.c \ >> W> trap.c \ >> W> multiboot2.c \ >> W> + efiserialio.c \ >> W> exc.S >> W> >> W> .PATH: ${BOOTSRC}/i386/libi386 >> W> diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.= c >> W> index 939f2cf4c3fe..d79f59343af1 100644 >> W> --- a/stand/efi/loader/bootinfo.c >> W> +++ b/stand/efi/loader/bootinfo.c >> W> @@ -119,10 +119,17 @@ bi_getboothowto(char *kargs) >> W> if (tmp !=3D NULL) >> W> speed =3D strtol(tmp, NULL, 0); >> W> tmp =3D getenv("efi_com_port"); >> W> - if (tmp =3D=3D NULL) >> W> - tmp =3D getenv("comconsole_port"); >> W> if (tmp !=3D NULL) >> W> port =3D strtol(tmp, NULL, 0); >> W> + if (port <=3D 0) { >> W> + tmp =3D getenv("comconsole_port"); >> W> + if (tmp !=3D NULL) >> W> + port =3D strtol(tmp, NULL, 0); >> W> + else { >> W> + if (port =3D=3D 0) >> W> + port =3D 0x3f8; >> W> + } >> W> + } >> W> if (speed !=3D -1 && port !=3D -1) { >> W> snprintf(buf, sizeof(buf), "io:%d,br:%d"= , >> port, >> W> speed); >> W> diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c >> W> index 863c9188c72c..051e1a3381d1 100644 >> W> --- a/stand/efi/loader/conf.c >> W> +++ b/stand/efi/loader/conf.c >> W> @@ -81,6 +81,9 @@ struct netif_driver *netif_drivers[] =3D { >> W> >> W> extern struct console efi_console; >> W> extern struct console comconsole; >> W> +#if defined(__amd64__) >> W> +extern struct console eficomconsole; >> W> +#endif >> W> #if defined(__amd64__) || defined(__i386__) >> W> extern struct console nullconsole; >> W> extern struct console spinconsole; >> W> @@ -88,6 +91,9 @@ extern struct console spinconsole; >> W> >> W> struct console *consoles[] =3D { >> W> &efi_console, >> W> +#if defined(__amd64__) >> W> + &eficomconsole, >> W> +#endif >> W> &comconsole, >> W> #if defined(__amd64__) || defined(__i386__) >> W> &nullconsole, >> W> diff --git a/stand/efi/loader/efiserialio.c >> b/stand/efi/loader/efiserialio.c >> W> index 375e679d2590..5fbc700f6ac2 100644 >> W> --- a/stand/efi/loader/efiserialio.c >> W> +++ b/stand/efi/loader/efiserialio.c >> W> @@ -69,6 +69,11 @@ static int comc_speed_set(struct env_var *, >> int, const void *); >> W> >> W> static struct serial *comc_port; >> W> extern struct console efi_console; >> W> +bool efi_comconsole_avail =3D false; >> W> + >> W> +#if defined(__amd64__) >> W> +#define comconsole eficomconsole >> W> +#endif >> W> >> W> struct console comconsole =3D { >> W> .c_name =3D "comconsole", >> W> @@ -254,11 +259,22 @@ comc_probe(struct console *sc) >> W> char *env, *buf, *ep; >> W> size_t sz; >> W> >> W> +#if defined(__amd64__) >> W> + /* >> W> + * For x86-64, don't use this driver if not running in Hyper-V. >> W> + */ >> W> + env =3D getenv("smbios.bios.version"); >> W> + if (env =3D=3D NULL || strncmp(env, "Hyper-V", 7) !=3D 0) { >> W> + return; >> W> + } >> W> +#endif >> W> + >> W> if (comc_port =3D=3D NULL) { >> W> comc_port =3D calloc(1, sizeof (struct serial)); >> W> if (comc_port =3D=3D NULL) >> W> return; >> W> } >> W> + >> W> /* Use defaults from firmware */ >> W> comc_port->databits =3D 8; >> W> comc_port->parity =3D DefaultParity; >> W> @@ -308,6 +324,10 @@ comc_probe(struct console *sc) >> W> comc_port_set, env_nounset); >> W> >> W> env =3D getenv("efi_com_speed"); >> W> + if (env =3D=3D NULL) >> W> + /* fallback to comconsole setting */ >> W> + env =3D getenv("comconsole_speed"); >> W> + >> W> if (comc_parse_intval(env, &val) =3D=3D CMD_OK) >> W> comc_port->baudrate =3D val; >> W> >> W> @@ -318,8 +338,13 @@ comc_probe(struct console *sc) >> W> comc_speed_set, env_nounset); >> W> >> W> comconsole.c_flags =3D 0; >> W> - if (comc_setup()) >> W> + if (comc_setup()) { >> W> sc->c_flags =3D C_PRESENTIN | C_PRESENTOUT; >> W> + efi_comconsole_avail =3D true; >> W> + } else { >> W> + /* disable being seen as "comconsole" */ >> W> + comconsole.c_name =3D "efiserialio"; >> W> + } >> W> } >> W> >> W> static int >> W> @@ -489,6 +514,7 @@ comc_setup(void) >> W> { >> W> EFI_STATUS status; >> W> UINT32 control; >> W> + char *ev; >> W> >> W> /* port is not usable */ >> W> if (comc_port->sio =3D=3D NULL) >> W> @@ -498,10 +524,17 @@ comc_setup(void) >> W> if (EFI_ERROR(status)) >> W> return (false); >> W> >> W> - status =3D comc_port->sio->SetAttributes(comc_port->sio, >> W> - comc_port->baudrate, comc_port->receivefifodepth, >> W> - comc_port->timeout, comc_port->parity, >> W> - comc_port->databits, comc_port->stopbits); >> W> + ev =3D getenv("smbios.bios.version"); >> W> + if (ev !=3D NULL && strncmp(ev, "Hyper-V", 7) =3D=3D 0) { >> W> + status =3D comc_port->sio->SetAttributes(comc_port->sio, >> W> + 0, 0, 0, DefaultParity, 0, DefaultStopBits); >> W> + } else { >> W> + status =3D comc_port->sio->SetAttributes(comc_port->sio, >> W> + comc_port->baudrate, comc_port->receivefifodepth, >> W> + comc_port->timeout, comc_port->parity, >> W> + comc_port->databits, comc_port->stopbits); >> W> + } >> W> + >> W> if (EFI_ERROR(status)) >> W> return (false); >> W> >> W> diff --git a/stand/i386/libi386/comconsole.c >> b/stand/i386/libi386/comconsole.c >> W> index ed1f1aa08ed7..3fbb6a292c19 100644 >> W> --- a/stand/i386/libi386/comconsole.c >> W> +++ b/stand/i386/libi386/comconsole.c >> W> @@ -85,6 +85,20 @@ comc_probe(struct console *cp) >> W> int speed, port; >> W> uint32_t locator; >> W> >> W> +#if defined(__amd64__) >> W> + extern bool efi_comconsole_avail; >> W> + >> W> + if (efi_comconsole_avail) { >> W> + /* >> W> + * If EFI provides serial I/O, then don't use this legac= y >> W> + * com driver to avoid conflicts with the firmware's >> driver. >> W> + * Change c_name so that it cannot be found in the looku= p. >> W> + */ >> W> + comconsole.c_name =3D "xcomconsole"; >> W> + return; >> W> + } >> W> +#endif >> W> + >> W> if (comc_curspeed =3D=3D 0) { >> W> comc_curspeed =3D COMSPEED; >> W> /* >> >> -- >> Gleb Smirnoff >> > > --0000000000001a12e105f82f8633 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Fri, Mar 31, 2023 at 12:22=E2=80= =AFAM Toomas Soome <tsoome@me.com&g= t; wrote:
<= br>

On 31. Mar 2023, at 02:40, Warne= r Losh <imp@bsdimp.c= om> wrote:

Let's back it out. I d= idn't get a chance to review it and the duplicated name strikes me as m= assively unwise.
Of course, the efi serial driver never should have had= the name comconsole in the first place, imho. It was OK
on arm w= here we couldn't conflict.

So let's back i= t out and talk about how we should do this, including the need to possibly = just rename the efi
version of the console driver to something el= se. IMHO, it never should have been comconsole in the first
place= because it's configured differently than comconsole....

Warner

<= div>ok, lets start from beginning. The loader device naming is total mess a= nd should not go this way - it is not understandable for users and not unde= rstandable for developers.

the config below is per= fect example of the situation:

First the config do= es set:=C2=A0

console= =3D"comconsole vidconsole efi=E2=80=9D
=
So, we do try to set serial console, bios video console and = efi console. So we have =E2=80=9Cshared=E2=80=9D config for BIOS and UEFI l= oader, which should be totally reasonable from user point of view, but is t= echnically wrong, because BIOS loader has no idea what is efi console and E= FI loader has no idea what is vidconsole. So this mixture ends up with mess= age:

I strongly disagree = this is wrong. You have a boot loader that may have one of many console dev= ices. Not all may be present.

=C2=A0
console vidconsole is invalid!"

And the user will get the similar error when bo= oting BIOS setup.

Yes. Th= is message is a bit bogus: it just means we don't have a comconsole con= figured. And that's fine.

It's like if I h= ad ifconfig_ixl0=3DDHCP and ifconfig_xe0=3DDHCP in my rc.conf file, imho. I= t says if they are there, use them. Otherwise don't. We don't have = a eth device that's a generic thing. Nor should comconsole be all possi= ble uarts.
=C2=A0
Then we just set console=3D=E2=80=9Cefi=E2=80=9D.

Then there is setting for uart=E2=80=A6=C2=A0
<= /div>

This is an orthogonal=C2=A0issu= e.
=C2=A0
=
With todays UEFI setups, the logic is that you set up your h= ardware, that is, you configure serial port attributes from firmware setup,= and the UEFI firmware will populate its internal structures with those val= ues.

Agreed. Still orthog= onal to the naming issue.
=C2=A0
Now, first issue is, while developing= uefi loader, it was easy path to reuse bits from BIOS loader. smbios, acpi= , and sadly, comconsole. Sadly, because comconsole is built assuming x86 IO= port features which are not available on other platforms.

Agreed. However, we are stuck with comcon= sole =3D=3D talk to the hardware and bypass the UEFI firmware. We need to h= ave a efiserial=C2=A0and efivideo=C2=A0device, even for x86, so that we can= specify things more closely. Overloading comconsole is unwise.
= =C2=A0
So yes, bios version of comconsole should not have been used to build UEF= I loader at all.

Yes and = no. It's in use today, so saying it shouldn't is about 10 years too= late.
=C2=A0
Now the fun part, even as UEFI does provide SIO API to a= ccess serial ports, to read from port, write to port and set attributes, it= turns out there are UEFI implementation(s?), where changing some attribute= s will cause system to hung. Which is the reason, why we need to set up har= dware properly from firmware, and our generic config should not try to enfo= rce some other value(s). Default should pick up values from the system. Sur= e, if the machine operator has some reason to change those values and has t= ested the change, we should have method to change the config, but again, de= faults should come from system setup.
Agreed. And it mostly does today. If you have serial redirect,= the efi driver does all that automatically.
=C2=A0
While I see the re= asoning to try to create all those different names, maybe the first thing s= hould be to look on this as innocent end user, who has no idea about those = fine technical details and historical reasons and is just trying to get sys= tem to behave=E2=80=A6.

I= t has to be a new name. You can't just overload comconsole and have it = work reliably. The user has to understand the technical details.
=
Part of the problem here too is that comconsole's=C2=A0i= nterface says 'use the one at port 0x378' which is impossible witho= ut parsing ACPI tables, which the efi loader doesn't do. So there's= already a new, kludgy interface to specify the UID of the efiserial device= . This UID is just a number with no relationship to the port from machine t= o machine. So we're already forcing changes on the user. It's no lo= nger transparent: it takes effort to configure and you already have to know= the differences because the simple port simply doesn't work.

This is why I've been advocating for efi (use CONOUT te= xt interface), efiserial=C2=A0(use the efi's uart routines) and efivide= o=C2=A0(use graphic frame buffer) for years. Having this separation will al= low people to configure the consoles on their systems more deterministicall= y. For those that have nice serial redirect, 'efi' is the way to go= . It just does the right thing. For those that do not, then you can use one= or more of efiserial=C2=A0and efivideo to get the combination you want. Pl= us we can move the graphics dependencies into efivideo=C2=A0and get rid of = the crazy stubs that things like kboot need that can never ever have graphi= cal video. I'm still mad that my desire for this was ignored when the g= raphics stuff was added

When we bring this driver = back, it absolutely must have a new name. It cannot try to 'fake' i= t by doing the games it's doing. That simply won't work and breaks = many working configurations today.

So my suggestio= n is that we have a new efiserial=C2=A0driver, hyperV uses it. We rename th= e current efi serial interface to be efiserial. On aarch64 (and on aarch64 = only) we have a new comconsole driver that just redirects to efiserial. It = doesn't try to change the name of anything, nor try to do anything else= . Plus it should start warning when you are trying to use the x86-only conf= iguration knobs of comconsole. And starting after the 14 branch, it should = start warning people should use efiserial=C2=A0insteaed. And we never, ever= ever again try to do aliases that aren't really the same device and ha= ve different configuration needs under the covers.

Warner
=C2=A0
just my 2 cents,
toomas

<= blockquote type=3D"cite">

On Thu, Mar 30, 2023 at 5:31=E2=80=AFPM Gleb Smirno= ff <glebius@fre= ebsd.org> wrote:
=C2=A0 Wei, Kyle,

this commit hangs loader on real hardware, at least on some
of it.=C2=A0 The loader prints list of consoles and hangs hard:

[Thu Mar 30 20:46:12 2023]^M|^HLoading /boot/loader.conf^M
^M/^Hconsole vidconsole is invalid!^M
^MAvailable consoles:^M
^M=C2=A0 =C2=A0 efi^M
^M=C2=A0 =C2=A0 comconsole^M
^M=C2=A0 =C2=A0 comconsole^M
^M=C2=A0 =C2=A0 nullconsole^M
^M=C2=A0 =C2=A0 spinconsole^M

Machine is unrecoverable unless you got alternate boot media
and access to BMC console.

First, please DO NOT MFC this as scheduled. Second, let's try
to fix it or back it out if we hear from any other CURRENT
user.

Our configuration isn't special. This is what we got in
loader.conf, related to consoles:

console=3D"comconsole vidconsole efi"
comconsole_speed=3D115200
comconsole_port=3D0x3e8
console=3D"efi"
hw.uart.console=3D"io:1016,br:115200"

On Sat, Mar 18, 2023 at 07:20:33AM +0000, Wei Hu wrote:
W> The branch main has been updated by whu:
W>
W> URL: https:/= /cgit.FreeBSD.org/src/commit/?id=3D927358dd98cb902160093e0dc0bac002d6b43858=
W>
W> commit 927358dd98cb902160093e0dc0bac002d6b43858
W> Author:=C2=A0 =C2=A0 =C2=A0Wei Hu <whu@FreeBSD.org>
W> AuthorDate: 2023-03-14 15:13:46 +0000
W> Commit:=C2=A0 =C2=A0 =C2=A0Wei Hu <whu@FreeBSD.org>
W> CommitDate: 2023-03-18 07:07:35 +0000
W>
W>=C2=A0 =C2=A0 =C2=A0amd64 loader: Use efiserialio for Hyper-V booted s= ystems
W>=C2=A0 =C2=A0 =C2=A0
W>=C2=A0 =C2=A0 =C2=A0UEFI provides ConIn/ConOut handles for consoles th= at it supports,
W>=C2=A0 =C2=A0 =C2=A0which include the text-video and serial ports. Whe= n the serial port
W>=C2=A0 =C2=A0 =C2=A0is available, use the UEFI driver instead of direc= t io-port accesses
W>=C2=A0 =C2=A0 =C2=A0to avoid conflicts between the firmware and direct= hardware access, as
W>=C2=A0 =C2=A0 =C2=A0happens on Hyper-V (Azure) setups.
W>=C2=A0 =C2=A0 =C2=A0
W>=C2=A0 =C2=A0 =C2=A0This change enables efiserialio to be built for ef= i-amd64 and has
W>=C2=A0 =C2=A0 =C2=A0higher order priority vs comconsole, and only uses= efiserialio
W>=C2=A0 =C2=A0 =C2=A0if the hypervisor is Hyper-V. When efiserialio suc= cessfully
W>=C2=A0 =C2=A0 =C2=A0probes, it will set efi_comconsole_avail=3Dtrue wh= ich will prevent
W>=C2=A0 =C2=A0 =C2=A0comconsole from probing in this setup.
W>=C2=A0 =C2=A0 =C2=A0
W>=C2=A0 =C2=A0 =C2=A0Tested on Hyper-V, ESXi and Azure VMs.
W>=C2=A0 =C2=A0 =C2=A0
W>=C2=A0 =C2=A0 =C2=A0PR:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0264267
W>=C2=A0 =C2=A0 =C2=A0Reviewed by:=C2=A0 =C2=A0 kevans, whu
W>=C2=A0 =C2=A0 =C2=A0Tested by:=C2=A0 =C2=A0 =C2=A0 whu
W>=C2=A0 =C2=A0 =C2=A0Obtained from:=C2=A0 Rubicon Communications, LLC (= Netgate)
W>=C2=A0 =C2=A0 =C2=A0MFC after:=C2=A0 =C2=A0 =C2=A0 2 weeks
W>=C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0Rubicon Communications, = LLC (Netgate)
W> ---
W>=C2=A0 stand/efi/loader/arch/amd64/Makefile.inc |=C2=A0 1 +
W>=C2=A0 stand/efi/loader/bootinfo.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 | 11 ++++++--
W>=C2=A0 stand/efi/loader/conf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 |=C2=A0 6 +++++
W>=C2=A0 stand/efi/loader/efiserialio.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0| 43 ++++++++++++++++++++++++++++----
W>=C2=A0 stand/i386/libi386/comconsole.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | 14 +++++++++++
W>=C2=A0 5 files changed, 68 insertions(+), 7 deletions(-)
W>
W> diff --git a/stand/efi/loader/arch/amd64/Makefile.inc b/stand/efi/loa= der/arch/amd64/Makefile.inc
W> index 0d9e2648cb59..bd89044bd6c7 100644
W> --- a/stand/efi/loader/arch/amd64/Makefile.inc
W> +++ b/stand/efi/loader/arch/amd64/Makefile.inc
W> @@ -5,6 +5,7 @@ SRCS+=3D=C2=A0 =C2=A0 =C2=A0 =C2=A0amd64_tramp.S \ W>=C2=A0 =C2=A0 =C2=A0 elf64_freebsd.c \
W>=C2=A0 =C2=A0 =C2=A0 trap.c \
W>=C2=A0 =C2=A0 =C2=A0 multiboot2.c \
W> +=C2=A0 =C2=A0 efiserialio.c \
W>=C2=A0 =C2=A0 =C2=A0 exc.S
W>=C2=A0
W>=C2=A0 .PATH:=C2=A0 =C2=A0 =C2=A0 ${BOOTSRC}/i386/libi386
W> diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.= c
W> index 939f2cf4c3fe..d79f59343af1 100644
W> --- a/stand/efi/loader/bootinfo.c
W> +++ b/stand/efi/loader/bootinfo.c
W> @@ -119,10 +119,17 @@ bi_getboothowto(char *kargs)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (tmp !=3D NULL)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 speed =3D strtol(tmp, NULL, 0);
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 tmp =3D getenv("efi_com_port");
W> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 if (tmp =3D=3D NULL)
W> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tmp =3D getenv("comconsole_port")= ;
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (tmp !=3D NULL)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 port =3D strtol(tmp, NULL, 0);
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 if (port <=3D 0) {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tmp =3D getenv("comconsole_port")= ;
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (tmp !=3D NULL)
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 port =3D strtol= (tmp, NULL, 0);
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (port =3D=3D= 0)
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 port =3D 0x3f8;
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 }
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (speed !=3D -1 && port !=3D -1) {
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 snprintf(buf, sizeof(buf), "io:%d,b= r:%d", port,
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 speed);
W> diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c
W> index 863c9188c72c..051e1a3381d1 100644
W> --- a/stand/efi/loader/conf.c
W> +++ b/stand/efi/loader/conf.c
W> @@ -81,6 +81,9 @@ struct netif_driver *netif_drivers[] =3D {
W>=C2=A0
W>=C2=A0 extern struct console efi_console;
W>=C2=A0 extern struct console comconsole;
W> +#if defined(__amd64__)
W> +extern struct console eficomconsole;
W> +#endif
W>=C2=A0 #if defined(__amd64__) || defined(__i386__)
W>=C2=A0 extern struct console nullconsole;
W>=C2=A0 extern struct console spinconsole;
W> @@ -88,6 +91,9 @@ extern struct console spinconsole;
W>=C2=A0
W>=C2=A0 struct console *consoles[] =3D {
W>=C2=A0 =C2=A0 =C2=A0 &efi_console,
W> +#if defined(__amd64__)
W> +=C2=A0 =C2=A0 &eficomconsole,
W> +#endif
W>=C2=A0 =C2=A0 =C2=A0 &comconsole,
W>=C2=A0 #if defined(__amd64__) || defined(__i386__)
W>=C2=A0 =C2=A0 =C2=A0 &nullconsole,
W> diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efiser= ialio.c
W> index 375e679d2590..5fbc700f6ac2 100644
W> --- a/stand/efi/loader/efiserialio.c
W> +++ b/stand/efi/loader/efiserialio.c
W> @@ -69,6 +69,11 @@ static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_speed_s= et(struct env_var *, int, const void *);
W>=C2=A0
W>=C2=A0 static struct serial=C2=A0 =C2=A0 =C2=A0 =C2=A0 *comc_port;
W>=C2=A0 extern struct console efi_console;
W> +bool efi_comconsole_avail =3D false;
W> +
W> +#if defined(__amd64__)
W> +#define comconsole eficomconsole
W> +#endif
W>=C2=A0
W>=C2=A0 struct console comconsole =3D {
W>=C2=A0 =C2=A0 =C2=A0 .c_name =3D "comconsole",
W> @@ -254,11 +259,22 @@ comc_probe(struct console *sc)
W>=C2=A0 =C2=A0 =C2=A0 char *env, *buf, *ep;
W>=C2=A0 =C2=A0 =C2=A0 size_t sz;
W>=C2=A0
W> +#if defined(__amd64__)
W> +=C2=A0 =C2=A0 /*
W> +=C2=A0 =C2=A0 =C2=A0* For x86-64, don't use this driver if not r= unning in Hyper-V.
W> +=C2=A0 =C2=A0 =C2=A0*/
W> +=C2=A0 =C2=A0 env =3D getenv("smbios.bios.version");
W> +=C2=A0 =C2=A0 if (env =3D=3D NULL || strncmp(env, "Hyper-V"= ;, 7) !=3D 0) {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
W> +=C2=A0 =C2=A0 }
W> +#endif
W> +
W>=C2=A0 =C2=A0 =C2=A0 if (comc_port =3D=3D NULL) {
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port =3D calloc(= 1, sizeof (struct serial));
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (comc_port =3D=3D = NULL)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 return;
W>=C2=A0 =C2=A0 =C2=A0 }
W> +
W>=C2=A0 =C2=A0 =C2=A0 /* Use defaults from firmware */
W>=C2=A0 =C2=A0 =C2=A0 comc_port->databits =3D 8;
W>=C2=A0 =C2=A0 =C2=A0 comc_port->parity =3D DefaultParity;
W> @@ -308,6 +324,10 @@ comc_probe(struct console *sc)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port_set, env_nounset);
W>=C2=A0
W>=C2=A0 =C2=A0 =C2=A0 env =3D getenv("efi_com_speed");
W> +=C2=A0 =C2=A0 if (env =3D=3D NULL)
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* fallback to comconsole = setting */
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 env =3D getenv("comco= nsole_speed");
W> +
W>=C2=A0 =C2=A0 =C2=A0 if (comc_parse_intval(env, &val) =3D=3D CMD_O= K)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port->baudrat= e =3D val;
W>=C2=A0
W> @@ -318,8 +338,13 @@ comc_probe(struct console *sc)
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_speed_set, env_nounset);
W>=C2=A0
W>=C2=A0 =C2=A0 =C2=A0 comconsole.c_flags =3D 0;
W> -=C2=A0 =C2=A0 if (comc_setup())
W> +=C2=A0 =C2=A0 if (comc_setup()) {
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sc->c_flags =3D C_= PRESENTIN | C_PRESENTOUT;
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 efi_comconsole_avail =3D t= rue;
W> +=C2=A0 =C2=A0 } else {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* disable being seen as &= quot;comconsole" */
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comconsole.c_name =3D &quo= t;efiserialio";
W> +=C2=A0 =C2=A0 }
W>=C2=A0 }
W>=C2=A0
W>=C2=A0 static int
W> @@ -489,6 +514,7 @@ comc_setup(void)
W>=C2=A0 {
W>=C2=A0 =C2=A0 =C2=A0 EFI_STATUS status;
W>=C2=A0 =C2=A0 =C2=A0 UINT32 control;
W> +=C2=A0 =C2=A0 char *ev;
W>=C2=A0
W>=C2=A0 =C2=A0 =C2=A0 /* port is not usable */
W>=C2=A0 =C2=A0 =C2=A0 if (comc_port->sio =3D=3D NULL)
W> @@ -498,10 +524,17 @@ comc_setup(void)
W>=C2=A0 =C2=A0 =C2=A0 if (EFI_ERROR(status))
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);
W>=C2=A0
W> -=C2=A0 =C2=A0 status =3D comc_port->sio->SetAttributes(comc_po= rt->sio,
W> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port->baudrate, comc_port->re= ceivefifodepth,
W> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port->timeout, comc_port->par= ity,
W> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port->databits, comc_port->st= opbits);
W> +=C2=A0 =C2=A0 ev =3D getenv("smbios.bios.version");
W> +=C2=A0 =C2=A0 if (ev !=3D NULL && strncmp(ev, "Hyper-V&= quot;, 7) =3D=3D 0) {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port->s= io->SetAttributes(comc_port->sio,
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0, 0, 0, Def= aultParity, 0, DefaultStopBits);
W> +=C2=A0 =C2=A0 } else {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port->s= io->SetAttributes(comc_port->sio,
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g= t;baudrate, comc_port->receivefifodepth,
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g= t;timeout, comc_port->parity,
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g= t;databits, comc_port->stopbits);
W> +=C2=A0 =C2=A0 }
W> +
W>=C2=A0 =C2=A0 =C2=A0 if (EFI_ERROR(status))
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);
W>=C2=A0
W> diff --git a/stand/i386/libi386/comconsole.c b/stand/i386/libi386/com= console.c
W> index ed1f1aa08ed7..3fbb6a292c19 100644
W> --- a/stand/i386/libi386/comconsole.c
W> +++ b/stand/i386/libi386/comconsole.c
W> @@ -85,6 +85,20 @@ comc_probe(struct console *cp)
W>=C2=A0 =C2=A0 =C2=A0 int speed, port;
W>=C2=A0 =C2=A0 =C2=A0 uint32_t locator;
W>=C2=A0
W> +#if defined(__amd64__)
W> +=C2=A0 =C2=A0 extern bool efi_comconsole_avail;
W> +
W> +=C2=A0 =C2=A0 if (efi_comconsole_avail) {
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If EFI provides se= rial I/O, then don't use this legacy
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* com driver to avoi= d conflicts with the firmware's driver.
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* Change c_name so t= hat it cannot be found in the lookup.
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comconsole.c_name =3D &quo= t;xcomconsole";
W> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
W> +=C2=A0 =C2=A0 }
W> +#endif
W> +
W>=C2=A0 =C2=A0 =C2=A0 if (comc_curspeed =3D=3D 0) {
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_curspeed =3D COM= SPEED;
W>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*

--
Gleb Smirnoff

--0000000000001a12e105f82f8633--