Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 May 2023 20:19:25 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Gleb Smirnoff <glebius@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>,  "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>,  "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org>
Subject:   Re: HEADS UP: broken boot! Was: git: 2f131435bc22 - main - stand: efi create eficom console device.
Message-ID:  <CANCZdfq%2BFx-nU5eCzhjF0=ujCAepVFw09_VpwXSRAQYRoRDiPA@mail.gmail.com>
In-Reply-To: <ZGQ4GuTLcQhv9avt@FreeBSD.org>
References:  <202305112006.34BK6kPw019492@gitrepo.freebsd.org> <ZGQ4GuTLcQhv9avt@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000bbea4f05fbda5104
Content-Type: text/plain; charset="UTF-8"

On Tue, May 16, 2023, 10:12 PM Gleb Smirnoff <glebius@freebsd.org> wrote:

>   Hi,
>
> this commit breaks boot on some machines with EFI. Warner already knows
> and he
> provided a quick hack to make it bootable. The proper fix will be
> available later.
>
> Meanwhile you are advised to not update your loader past 2f131435bc22, or
> use the patch (attached).
>

It breaks dual console loaders. I should have a fix in the morning. Too
much bsdcan cheer tonight to think straight.

Warner

On Thu, May 11, 2023 at 08:06:46PM +0000, Warner Losh wrote:
> W> The branch main has been updated by imp:
> W>
> W> URL:
> https://cgit.FreeBSD.org/src/commit/?id=2f131435bc22540db2d3f6bf97e5f9fe7039f889
> W>
> W> commit 2f131435bc22540db2d3f6bf97e5f9fe7039f889
> W> Author:     Warner Losh <imp@FreeBSD.org>
> W> AuthorDate: 2023-05-11 20:03:17 +0000
> W> Commit:     Warner Losh <imp@FreeBSD.org>
> W> CommitDate: 2023-05-11 20:06:03 +0000
> W>
> W>     stand: efi create eficom console device.
> W>
> W>     Fix the 'renaming kludge' that we absolutely cannot do going forward
> W>     (it's cost us days of engineering time).
> W>
> W>     console=comconsole talks to the hardware directly. This is available
> W>     only on amd64. It is not available anywhere else (and so requires
> W>     changes for people doing comconsole on aarch64)
> W>
> W>     console=eficom talks to the console via EFI protocols.  It's
> available
> W>     on amd64, aarch64 and riscv64. It's the first port that we find,
> though
> W>     it can be overriden by efi_com_port (which should be set to the UID
> of
> W>     the serial port, not the I/O port, despite the name). devinfo -v
> W>     will give the UID to uartX mapping.
> W>
> W>     This is an incompatible change for HYPER-V on amd64. It only works
> with
> W>     eficom console, so you'll need to change your configuration in
> W>     loader.conf. No compatibility hack will ever be provided for this
> (since
> W>     it requires renamig, which the loader cannot reliably do).
> W>
> W>     It's also an incompatible change for aarch64. comconsole will need
> to
> W>     change to eficom. There might be a comconsole "shim" for this.
> W>
> W>     All the interlock to keep only eficom and comconsole from both
> attaching
> W>     have been removed.
> W>
> W>     RelNotes:               Yes
> W>     Sponsored by:           Netflix
> W>     Discussed with:         kevans
> W>     Differential Revision:  https://reviews.freebsd.org/D39982
> W> ---
> W>  stand/efi/loader/conf.c         | 12 ++----
> W>  stand/efi/loader/efiserialio.c  | 85
> +++++++++++++++++------------------------
> W>  stand/i386/libi386/comconsole.c | 14 -------
> W>  3 files changed, 39 insertions(+), 72 deletions(-)
> W>
> W> diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c
> W> index 051e1a3381d1..e9ae01d19270 100644
> W> --- a/stand/efi/loader/conf.c
> W> +++ b/stand/efi/loader/conf.c
> W> @@ -80,22 +80,18 @@ struct netif_driver *netif_drivers[] = {
> W>  };
> W>
> W>  extern struct console efi_console;
> W> -extern struct console comconsole;
> W> -#if defined(__amd64__)
> W> -extern struct console eficomconsole;
> W> -#endif
> W> +extern struct console eficom;
> W>  #if defined(__amd64__) || defined(__i386__)
> W> +extern struct console comconsole;
> W>  extern struct console nullconsole;
> W>  extern struct console spinconsole;
> W>  #endif
> W>
> W>  struct console *consoles[] = {
> W>      &efi_console,
> W> -#if defined(__amd64__)
> W> -    &eficomconsole,
> W> -#endif
> W> -    &comconsole,
> W> +    &eficom,
> W>  #if defined(__amd64__) || defined(__i386__)
> W> +    &comconsole,
> W>      &nullconsole,
> W>      &spinconsole,
> W>  #endif
> W> diff --git a/stand/efi/loader/efiserialio.c
> b/stand/efi/loader/efiserialio.c
> W> index 0f37ef8b87dd..de4d6b3e34c1 100644
> W> --- a/stand/efi/loader/efiserialio.c
> W> +++ b/stand/efi/loader/efiserialio.c
> W> @@ -69,14 +69,9 @@ 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 = false;
> W>
> W> -#if defined(__amd64__)
> W> -#define comconsole eficomconsole
> W> -#endif
> W> -
> W> -struct console comconsole = {
> W> -    .c_name = "comconsole",
> W> +struct console eficom = {
> W> +    .c_name = "eficom",
> W>      .c_desc = "serial port",
> W>      .c_flags = 0,
> W>      .c_probe = comc_probe,
> W> @@ -259,18 +254,6 @@ 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 = getenv("smbios.bios.version");
> W> -    if (env == NULL || strncmp(env, "Hyper-V", 7) != 0) {
> W> -            /* Disable being seen as "comconsole". */
> W> -            comconsole.c_name = "efiserialio";
> W> -            return;
> W> -    }
> W> -#endif
> W> -
> W>      if (comc_port == NULL) {
> W>              comc_port = calloc(1, sizeof (struct serial));
> W>              if (comc_port == NULL)
> W> @@ -339,13 +322,9 @@ comc_probe(struct console *sc)
> W>      env_setenv("efi_com_speed", EV_VOLATILE, value,
> W>          comc_speed_set, env_nounset);
> W>
> W> -    comconsole.c_flags = 0;
> W> +    eficom.c_flags = 0;
> W>      if (comc_setup()) {
> W>              sc->c_flags = C_PRESENTIN | C_PRESENTOUT;
> W> -            efi_comconsole_avail = true;
> W> -    } else {
> W> -            /* disable being seen as "comconsole" */
> W> -            comconsole.c_name = "efiserialio";
> W>      }
> W>  }
> W>
> W> @@ -356,7 +335,7 @@ comc_init(int arg __unused)
> W>      if (comc_setup())
> W>              return (CMD_OK);
> W>
> W> -    comconsole.c_flags = 0;
> W> +    eficom.c_flags = 0;
> W>      return (CMD_ERROR);
> W>  }
> W>
> W> @@ -522,35 +501,41 @@ comc_setup(void)
> W>      if (comc_port->sio == NULL)
> W>              return (false);
> W>
> W> -    status = comc_port->sio->Reset(comc_port->sio);
> W> -    if (EFI_ERROR(status))
> W> -            return (false);
> W> -
> W> -    ev = getenv("smbios.bios.version");
> W> -    if (ev != NULL && strncmp(ev, "Hyper-V", 7) == 0) {
> W> -            status = comc_port->sio->SetAttributes(comc_port->sio,
> W> -                0, 0, 0, DefaultParity, 0, DefaultStopBits);
> W> -    } else {
> W> -            status = 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> +    if (comc_port->sio->Reset != NULL) {
> W> +            status = comc_port->sio->Reset(comc_port->sio);
> W> +            if (EFI_ERROR(status))
> W> +                    return (false);
> W>      }
> W>
> W> -    if (EFI_ERROR(status))
> W> -            return (false);
> W> +    if (comc_port->sio->SetAttributes != NULL) {
> W> +            ev = getenv("smbios.bios.version");
> W> +            if (ev != NULL && strncmp(ev, "Hyper-V", 7) == 0) {
> W> +                    status =
> comc_port->sio->SetAttributes(comc_port->sio,
> W> +                        0, 0, 0, DefaultParity, 0, DefaultStopBits);
> W> +            } else {
> W> +                    status =
> 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> -    status = comc_port->sio->GetControl(comc_port->sio, &control);
> W> -    if (EFI_ERROR(status))
> W> -            return (false);
> W> -    if (comc_port->rtsdtr_off) {
> W> -            control &= ~(EFI_SERIAL_REQUEST_TO_SEND |
> W> -                EFI_SERIAL_DATA_TERMINAL_READY);
> W> -    } else {
> W> -            control |= EFI_SERIAL_REQUEST_TO_SEND;
> W> +            if (EFI_ERROR(status))
> W> +                    return (false);
> W> +    }
> W> +
> W> +    if (comc_port->sio->GetControl != NULL &&
> comc_port->sio->SetControl != NULL) {
> W> +            status = comc_port->sio->GetControl(comc_port->sio,
> &control);
> W> +            if (EFI_ERROR(status))
> W> +                    return (false);
> W> +            if (comc_port->rtsdtr_off) {
> W> +                    control &= ~(EFI_SERIAL_REQUEST_TO_SEND |
> W> +                        EFI_SERIAL_DATA_TERMINAL_READY);
> W> +            } else {
> W> +                    control |= EFI_SERIAL_REQUEST_TO_SEND;
> W> +            }
> W> +            (void) comc_port->sio->SetControl(comc_port->sio, control);
> W>      }
> W> -    (void) comc_port->sio->SetControl(comc_port->sio, control);
> W>      /* Mark this port usable. */
> W> -    comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
> W> +    eficom.c_flags |= (C_PRESENTIN | C_PRESENTOUT);
> W>      return (true);
> W>  }
> W> diff --git a/stand/i386/libi386/comconsole.c
> b/stand/i386/libi386/comconsole.c
> W> index 507cd0ec922f..6d48e876fa37 100644
> W> --- a/stand/i386/libi386/comconsole.c
> W> +++ b/stand/i386/libi386/comconsole.c
> W> @@ -85,20 +85,6 @@ 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 legacy
> W> -             * com driver to avoid conflicts with the firmware's
> driver.
> W> -             * Change c_name so that it cannot be found in the lookup.
> W> -             */
> W> -            comconsole.c_name = "xcomconsole";
> W> -            return;
> W> -    }
> W> -#endif
> W> -
> W>      if (comc_curspeed == 0) {
> W>              comc_curspeed = COMSPEED;
> W>              /*
>
> --
> Gleb Smirnoff
>

--000000000000bbea4f05fbda5104
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Tue, May 16, 2023, 10:12 PM Gleb Smirnoff &lt;<a hr=
ef=3D"mailto:glebius@freebsd.org">glebius@freebsd.org</a>&gt; wrote:<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex">=C2=A0 Hi,<br>
<br>
this commit breaks boot on some machines with EFI. Warner already knows and=
 he<br>
provided a quick hack to make it bootable. The proper fix will be available=
 later.<br>
<br>
Meanwhile you are advised to not update your loader past 2f131435bc22, or <=
br>
use the patch (attached).<br></blockquote></div></div><div dir=3D"auto"><br=
></div><div dir=3D"auto">It breaks dual console loaders. I should have a fi=
x in the morning. Too much bsdcan cheer tonight to think straight.=C2=A0</d=
iv><div dir=3D"auto"><br></div><div dir=3D"auto">Warner=C2=A0</div><div dir=
=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex">
On Thu, May 11, 2023 at 08:06:46PM +0000, Warner Losh wrote:<br>
W&gt; The branch main has been updated by imp:<br>
W&gt; <br>
W&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D2f131435bc2=
2540db2d3f6bf97e5f9fe7039f889" rel=3D"noreferrer noreferrer" target=3D"_bla=
nk">https://cgit.FreeBSD.org/src/commit/?id=3D2f131435bc22540db2d3f6bf97e5f=
9fe7039f889</a><br>
W&gt; <br>
W&gt; commit 2f131435bc22540db2d3f6bf97e5f9fe7039f889<br>
W&gt; Author:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
W&gt; AuthorDate: 2023-05-11 20:03:17 +0000<br>
W&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
W&gt; CommitDate: 2023-05-11 20:06:03 +0000<br>
W&gt; <br>
W&gt;=C2=A0 =C2=A0 =C2=A0stand: efi create eficom console device.<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0Fix the &#39;renaming kludge&#39; that we absolute=
ly cannot do going forward<br>
W&gt;=C2=A0 =C2=A0 =C2=A0(it&#39;s cost us days of engineering time).<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0console=3Dcomconsole talks to the hardware directl=
y. This is available<br>
W&gt;=C2=A0 =C2=A0 =C2=A0only on amd64. It is not available anywhere else (=
and so requires<br>
W&gt;=C2=A0 =C2=A0 =C2=A0changes for people doing comconsole on aarch64)<br=
>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0console=3Deficom talks to the console via EFI prot=
ocols.=C2=A0 It&#39;s available<br>
W&gt;=C2=A0 =C2=A0 =C2=A0on amd64, aarch64 and riscv64. It&#39;s the first =
port that we find, though<br>
W&gt;=C2=A0 =C2=A0 =C2=A0it can be overriden by efi_com_port (which should =
be set to the UID of<br>
W&gt;=C2=A0 =C2=A0 =C2=A0the serial port, not the I/O port, despite the nam=
e). devinfo -v<br>
W&gt;=C2=A0 =C2=A0 =C2=A0will give the UID to uartX mapping.<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0This is an incompatible change for HYPER-V on amd6=
4. It only works with<br>
W&gt;=C2=A0 =C2=A0 =C2=A0eficom console, so you&#39;ll need to change your =
configuration in<br>
W&gt;=C2=A0 =C2=A0 =C2=A0loader.conf. No compatibility hack will ever be pr=
ovided for this (since<br>
W&gt;=C2=A0 =C2=A0 =C2=A0it requires renamig, which the loader cannot relia=
bly do).<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0It&#39;s also an incompatible change for aarch64. =
comconsole will need to<br>
W&gt;=C2=A0 =C2=A0 =C2=A0change to eficom. There might be a comconsole &quo=
t;shim&quot; for this.<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0All the interlock to keep only eficom and comconso=
le from both attaching<br>
W&gt;=C2=A0 =C2=A0 =C2=A0have been removed.<br>
W&gt;=C2=A0 =C2=A0 =C2=A0<br>
W&gt;=C2=A0 =C2=A0 =C2=A0RelNotes:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0Yes<br>
W&gt;=C2=A0 =C2=A0 =C2=A0Sponsored by:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0Netflix<br>
W&gt;=C2=A0 =C2=A0 =C2=A0Discussed with:=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0k=
evans<br>
W&gt;=C2=A0 =C2=A0 =C2=A0Differential Revision:=C2=A0 <a href=3D"https://re=
views.freebsd.org/D39982" rel=3D"noreferrer noreferrer" target=3D"_blank">h=
ttps://reviews.freebsd.org/D39982</a><br>
W&gt; ---<br>
W&gt;=C2=A0 stand/efi/loader/conf.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 12 +=
+----<br>
W&gt;=C2=A0 stand/efi/loader/efiserialio.c=C2=A0 | 85 +++++++++++++++++----=
--------------------<br>
W&gt;=C2=A0 stand/i386/libi386/comconsole.c | 14 -------<br>
W&gt;=C2=A0 3 files changed, 39 insertions(+), 72 deletions(-)<br>
W&gt; <br>
W&gt; diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c<br>
W&gt; index 051e1a3381d1..e9ae01d19270 100644<br>
W&gt; --- a/stand/efi/loader/conf.c<br>
W&gt; +++ b/stand/efi/loader/conf.c<br>
W&gt; @@ -80,22 +80,18 @@ struct netif_driver *netif_drivers[] =3D {<br>
W&gt;=C2=A0 };<br>
W&gt;=C2=A0 <br>
W&gt;=C2=A0 extern struct console efi_console;<br>
W&gt; -extern struct console comconsole;<br>
W&gt; -#if defined(__amd64__)<br>
W&gt; -extern struct console eficomconsole;<br>
W&gt; -#endif<br>
W&gt; +extern struct console eficom;<br>
W&gt;=C2=A0 #if defined(__amd64__) || defined(__i386__)<br>
W&gt; +extern struct console comconsole;<br>
W&gt;=C2=A0 extern struct console nullconsole;<br>
W&gt;=C2=A0 extern struct console spinconsole;<br>
W&gt;=C2=A0 #endif<br>
W&gt;=C2=A0 <br>
W&gt;=C2=A0 struct console *consoles[] =3D {<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 &amp;efi_console,<br>
W&gt; -#if defined(__amd64__)<br>
W&gt; -=C2=A0 =C2=A0 &amp;eficomconsole,<br>
W&gt; -#endif<br>
W&gt; -=C2=A0 =C2=A0 &amp;comconsole,<br>
W&gt; +=C2=A0 =C2=A0 &amp;eficom,<br>
W&gt;=C2=A0 #if defined(__amd64__) || defined(__i386__)<br>
W&gt; +=C2=A0 =C2=A0 &amp;comconsole,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 &amp;nullconsole,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 &amp;spinconsole,<br>
W&gt;=C2=A0 #endif<br>
W&gt; diff --git a/stand/efi/loader/efiserialio.c b/stand/efi/loader/efiser=
ialio.c<br>
W&gt; index 0f37ef8b87dd..de4d6b3e34c1 100644<br>
W&gt; --- a/stand/efi/loader/efiserialio.c<br>
W&gt; +++ b/stand/efi/loader/efiserialio.c<br>
W&gt; @@ -69,14 +69,9 @@ static int=C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_speed_s=
et(struct env_var *, int, const void *);<br>
W&gt;=C2=A0 <br>
W&gt;=C2=A0 static struct serial=C2=A0 =C2=A0 =C2=A0 =C2=A0 *comc_port;<br>
W&gt;=C2=A0 extern struct console efi_console;<br>
W&gt; -bool efi_comconsole_avail =3D false;<br>
W&gt;=C2=A0 <br>
W&gt; -#if defined(__amd64__)<br>
W&gt; -#define comconsole eficomconsole<br>
W&gt; -#endif<br>
W&gt; -<br>
W&gt; -struct console comconsole =3D {<br>
W&gt; -=C2=A0 =C2=A0 .c_name =3D &quot;comconsole&quot;,<br>
W&gt; +struct console eficom =3D {<br>
W&gt; +=C2=A0 =C2=A0 .c_name =3D &quot;eficom&quot;,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 .c_desc =3D &quot;serial port&quot;,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 .c_flags =3D 0,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 .c_probe =3D comc_probe,<br>
W&gt; @@ -259,18 +254,6 @@ comc_probe(struct console *sc)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 char *env, *buf, *ep;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 size_t sz;<br>
W&gt;=C2=A0 <br>
W&gt; -#if defined(__amd64__)<br>
W&gt; -=C2=A0 =C2=A0 /*<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0* For x86-64, don&#39;t use this driver if not r=
unning in Hyper-V.<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0*/<br>
W&gt; -=C2=A0 =C2=A0 env =3D getenv(&quot;smbios.bios.version&quot;);<br>
W&gt; -=C2=A0 =C2=A0 if (env =3D=3D NULL || strncmp(env, &quot;Hyper-V&quot=
;, 7) !=3D 0) {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Disable being seen as &=
quot;comconsole&quot;. */<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comconsole.c_name =3D &quo=
t;efiserialio&quot;;<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
W&gt; -=C2=A0 =C2=A0 }<br>
W&gt; -#endif<br>
W&gt; -<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 if (comc_port =3D=3D NULL) {<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port =3D calloc(=
1, sizeof (struct serial));<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (comc_port =3D=3D =
NULL)<br>
W&gt; @@ -339,13 +322,9 @@ comc_probe(struct console *sc)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 env_setenv(&quot;efi_com_speed&quot;, EV_VOLATILE=
, value,<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_speed_set, env_nounset);<br>
W&gt;=C2=A0 <br>
W&gt; -=C2=A0 =C2=A0 comconsole.c_flags =3D 0;<br>
W&gt; +=C2=A0 =C2=A0 eficom.c_flags =3D 0;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 if (comc_setup()) {<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sc-&gt;c_flags =3D C_=
PRESENTIN | C_PRESENTOUT;<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 efi_comconsole_avail =3D t=
rue;<br>
W&gt; -=C2=A0 =C2=A0 } else {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* disable being seen as &=
quot;comconsole&quot; */<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comconsole.c_name =3D &quo=
t;efiserialio&quot;;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 }<br>
W&gt;=C2=A0 }<br>
W&gt;=C2=A0 <br>
W&gt; @@ -356,7 +335,7 @@ comc_init(int arg __unused)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 if (comc_setup())<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (CMD_OK);<br>
W&gt;=C2=A0 <br>
W&gt; -=C2=A0 =C2=A0 comconsole.c_flags =3D 0;<br>
W&gt; +=C2=A0 =C2=A0 eficom.c_flags =3D 0;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 return (CMD_ERROR);<br>
W&gt;=C2=A0 }<br>
W&gt;=C2=A0 <br>
W&gt; @@ -522,35 +501,41 @@ comc_setup(void)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 if (comc_port-&gt;sio =3D=3D NULL)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);<br>
W&gt;=C2=A0 <br>
W&gt; -=C2=A0 =C2=A0 status =3D comc_port-&gt;sio-&gt;Reset(comc_port-&gt;s=
io);<br>
W&gt; -=C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);<br>
W&gt; -<br>
W&gt; -=C2=A0 =C2=A0 ev =3D getenv(&quot;smbios.bios.version&quot;);<br>
W&gt; -=C2=A0 =C2=A0 if (ev !=3D NULL &amp;&amp; strncmp(ev, &quot;Hyper-V&=
quot;, 7) =3D=3D 0) {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port-&gt;s=
io-&gt;SetAttributes(comc_port-&gt;sio,<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 0, 0, 0, Def=
aultParity, 0, DefaultStopBits);<br>
W&gt; -=C2=A0 =C2=A0 } else {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port-&gt;s=
io-&gt;SetAttributes(comc_port-&gt;sio,<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g=
t;baudrate, comc_port-&gt;receivefifodepth,<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g=
t;timeout, comc_port-&gt;parity,<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_port-&g=
t;databits, comc_port-&gt;stopbits);<br>
W&gt; +=C2=A0 =C2=A0 if (comc_port-&gt;sio-&gt;Reset !=3D NULL) {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port-&gt;s=
io-&gt;Reset(comc_port-&gt;sio);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 return (false);<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 }<br>
W&gt;=C2=A0 <br>
W&gt; -=C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);<br>
W&gt; +=C2=A0 =C2=A0 if (comc_port-&gt;sio-&gt;SetAttributes !=3D NULL) {<b=
r>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ev =3D getenv(&quot;smbios=
.bios.version&quot;);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ev !=3D NULL &amp;&amp=
; strncmp(ev, &quot;Hyper-V&quot;, 7) =3D=3D 0) {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 status =3D comc_port-&gt;sio-&gt;SetAttributes(comc_port-&gt;sio,<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 0, 0, 0, DefaultParity, 0, DefaultStopBits);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 status =3D comc_port-&gt;sio-&gt;SetAttributes(comc_port-&gt;sio,<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 comc_port-&gt;baudrate, comc_port-&gt;receivefifodepth,<b=
r>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 comc_port-&gt;timeout, comc_port-&gt;parity,<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 comc_port-&gt;databits, comc_port-&gt;stopbits);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
W&gt;=C2=A0 <br>
W&gt; -=C2=A0 =C2=A0 status =3D comc_port-&gt;sio-&gt;GetControl(comc_port-=
&gt;sio, &amp;control);<br>
W&gt; -=C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (false);<br>
W&gt; -=C2=A0 =C2=A0 if (comc_port-&gt;rtsdtr_off) {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 control &amp;=3D ~(EFI_SER=
IAL_REQUEST_TO_SEND |<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 EFI_SERIAL_D=
ATA_TERMINAL_READY);<br>
W&gt; -=C2=A0 =C2=A0 } else {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 control |=3D EFI_SERIAL_RE=
QUEST_TO_SEND;<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 return (false);<br>
W&gt; +=C2=A0 =C2=A0 }<br>
W&gt; +<br>
W&gt; +=C2=A0 =C2=A0 if (comc_port-&gt;sio-&gt;GetControl !=3D NULL &amp;&a=
mp; comc_port-&gt;sio-&gt;SetControl !=3D NULL) {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 status =3D comc_port-&gt;s=
io-&gt;GetControl(comc_port-&gt;sio, &amp;control);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (EFI_ERROR(status))<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 return (false);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (comc_port-&gt;rtsdtr_o=
ff) {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 control &amp;=3D ~(EFI_SERIAL_REQUEST_TO_SEND |<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 EFI_SERIAL_DATA_TERMINAL_READY);<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } else {<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 control |=3D EFI_SERIAL_REQUEST_TO_SEND;<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
W&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (void) comc_port-&gt;sio-&=
gt;SetControl(comc_port-&gt;sio, control);<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 }<br>
W&gt; -=C2=A0 =C2=A0 (void) comc_port-&gt;sio-&gt;SetControl(comc_port-&gt;=
sio, control);<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 /* Mark this port usable. */<br>
W&gt; -=C2=A0 =C2=A0 comconsole.c_flags |=3D (C_PRESENTIN | C_PRESENTOUT);<=
br>
W&gt; +=C2=A0 =C2=A0 eficom.c_flags |=3D (C_PRESENTIN | C_PRESENTOUT);<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 return (true);<br>
W&gt;=C2=A0 }<br>
W&gt; diff --git a/stand/i386/libi386/comconsole.c b/stand/i386/libi386/com=
console.c<br>
W&gt; index 507cd0ec922f..6d48e876fa37 100644<br>
W&gt; --- a/stand/i386/libi386/comconsole.c<br>
W&gt; +++ b/stand/i386/libi386/comconsole.c<br>
W&gt; @@ -85,20 +85,6 @@ comc_probe(struct console *cp)<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 int speed, port;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 uint32_t locator;<br>
W&gt;=C2=A0 <br>
W&gt; -#if defined(__amd64__)<br>
W&gt; -=C2=A0 =C2=A0 extern bool efi_comconsole_avail;<br>
W&gt; -<br>
W&gt; -=C2=A0 =C2=A0 if (efi_comconsole_avail) {<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* If EFI provides se=
rial I/O, then don&#39;t use this legacy<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0* com driver to avoi=
d conflicts with the firmware&#39;s driver.<br>
W&gt; -=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.<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*/<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comconsole.c_name =3D &quo=
t;xcomconsole&quot;;<br>
W&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return;<br>
W&gt; -=C2=A0 =C2=A0 }<br>
W&gt; -#endif<br>
W&gt; -<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 if (comc_curspeed =3D=3D 0) {<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 comc_curspeed =3D COM=
SPEED;<br>
W&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /*<br>
<br>
-- <br>
Gleb Smirnoff<br>
</blockquote></div></div></div>

--000000000000bbea4f05fbda5104--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfq%2BFx-nU5eCzhjF0=ujCAepVFw09_VpwXSRAQYRoRDiPA>