lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iZmHCOzcTD6b4XGNXWUWEoO0v_qLMDFNtA43XLAOmhZQ@mail.gmail.com>
Date: Fri, 12 Sep 2025 11:29:44 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: cp0613@...ux.alibaba.com
Cc: rafael@...nel.org, lenb@...nel.org, guoren@...nel.org, 
	jeeheng.sia@...rfivetech.com, linux-acpi@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ACPI: SPCR: Support Precise Baud Rate filed

On Fri, Sep 12, 2025 at 10:58 AM <cp0613@...ux.alibaba.com> wrote:
>
> From: Chen Pei <cp0613@...ux.alibaba.com>
>
> The Microsoft Serial Port Console Redirection (SPCR) specification
> revision 1.09 comprises additional field: Precise Baud Rate [1].
>
> It is used to describe non-traditional baud rates (such as those
> used by high-speed UARTs).
>
> It contains a specific non-zero baud rate which overrides the value
> of the Configured Baud Rate field. If this field is zero or not
> present, Configured Baud Rate is used.
>
> Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table # 1
>
> Signed-off-by: Chen Pei <cp0613@...ux.alibaba.com>
> ---
>  drivers/acpi/spcr.c | 56 ++++++++++++++++++++++++++-------------------
>  1 file changed, 33 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index cd36a97b0ea2..69142c2ac4b3 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -146,29 +146,39 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
>                 goto done;
>         }
>
> -       switch (table->baud_rate) {
> -       case 0:
> -               /*
> -                * SPCR 1.04 defines 0 as a preconfigured state of UART.
> -                * Assume firmware or bootloader configures console correctly.
> -                */
> -               baud_rate = 0;
> -               break;
> -       case 3:
> -               baud_rate = 9600;
> -               break;
> -       case 4:
> -               baud_rate = 19200;
> -               break;
> -       case 6:
> -               baud_rate = 57600;
> -               break;
> -       case 7:
> -               baud_rate = 115200;
> -               break;
> -       default:
> -               err = -ENOENT;
> -               goto done;
> +       /*
> +        * SPCR 1.09 defines Precise Baud Rate Filed contains a specific
> +        * non-zero baud rate which overrides the value of the Configured
> +        * Baud Rate field. If this field is zero or not present, Configured
> +        * Baud Rate is used.
> +        */
> +       if (table->precise_baudrate)
> +               baud_rate = table->precise_baudrate;
> +       else {

The outer braces here are redundant and if you combined the "else"
above with the "switch ()" statement below in one line, the patch
would be smaller.

> +               switch (table->baud_rate) {
> +               case 0:
> +                       /*
> +                        * SPCR 1.04 defines 0 as a preconfigured state of UART.
> +                        * Assume firmware or bootloader configures console correctly.
> +                        */
> +                       baud_rate = 0;
> +                       break;
> +               case 3:
> +                       baud_rate = 9600;
> +                       break;
> +               case 4:
> +                       baud_rate = 19200;
> +                       break;
> +               case 6:
> +                       baud_rate = 57600;
> +                       break;
> +               case 7:
> +                       baud_rate = 115200;
> +                       break;
> +               default:
> +                       err = -ENOENT;
> +                       goto done;
> +               }
>         }
>
>         /*
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ