ACPI: SPCR: Consider baud rate 0 as preconfigured state
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 21 Nov 2018 13:43:37 +0000 (15:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:47:02 +0000 (19:47 +0100)
[ Upstream commit b413b1abeb21b4a152c0bf8d1379efa30759b6e3 ]

Since SPCR 1.04 [1] the baud rate of 0 means a preconfigured state of UART.
Assume firmware or bootloader configures console correctly.

[1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/acpi/spcr.c

index 9d52743..c336784 100644 (file)
@@ -148,6 +148,13 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
        }
 
        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;
@@ -196,6 +203,10 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
                 * UART so don't attempt to change to the baud rate state
                 * in the table because driver cannot calculate the dividers
                 */
+               baud_rate = 0;
+       }
+
+       if (!baud_rate) {
                snprintf(opts, sizeof(opts), "%s,%s,0x%llx", uart, iotype,
                         table->serial_port.address);
        } else {