git: 63f3afe497ff - stable/13 - uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 11:19:59 UTC
The branch stable/13 has been updated by mw:

URL: https://cgit.FreeBSD.org/src/commit/?id=63f3afe497ffa17cae3fa7a1c21aad076ff292e1

commit 63f3afe497ffa17cae3fa7a1c21aad076ff292e1
Author:     Marcin Wojtas <mw@FreeBSD.org>
AuthorDate: 2021-05-20 21:37:02 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-03-07 11:19:29 +0000

    uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs
    
    DBG2 ACPI table description [1] specifies three subtypes
    related to 16550 UART:
    0x0 - 16550 compatible
    0x1 - 16550 subset
    0x12 - 16550 compatible with parameters defined in Generic Address Structure (GAS)
    
    It turned out however, that the Windows OS treats 0x0 subtype as
    legacy x86 UART with 8-bit access. ARM SoCs can use types 0x1 (16550 with
    fixed mmio32 access) or 0x12 (16550 with fully respected GAS contents).
    
    Switch Marvell SoCs ACPI UART subtype to 0x1 - thanks to that the same firmware
    can run properly with UART output in FreeBSD, Windows 10, Linux and ESXI
    hypervisor. Tests showed the older firmware versions that use 0x0
    UART subtype in SPCR table continue to display output properly.
    
    [1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table
    
    Obtained from: Semihalf
    Sponsored by: ARM
    Differential revision: https://reviews.freebsd.org/D30386
    MFC after: 2 weeks
    
    (cherry picked from commit 9cf66a0458f4913d34cb3c5f6b653c78f70de8a8)
---
 sys/dev/uart/uart_dev_ns8250.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c
index 2b2f75cf5336..3950941d92b9 100644
--- a/sys/dev/uart/uart_dev_ns8250.c
+++ b/sys/dev/uart/uart_dev_ns8250.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include <dev/uart/uart_ppstypes.h>
 #ifdef DEV_ACPI
 #include <dev/uart/uart_cpu_acpi.h>
+#include <contrib/dev/acpica/include/acpi.h>
 #endif
 
 #include <dev/ic/ns16550.h>
@@ -415,7 +416,7 @@ struct uart_class uart_ns8250_class = {
 static struct acpi_uart_compat_data acpi_compat_data[] = {
 	{"AMD0020",	&uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"},
 	{"AMDI0020", &uart_ns8250_class, 0, 2, 0, 48000000, UART_F_BUSY_DETECT, "AMD / Synopsys Designware UART"},
-	{"MRVL0001", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"},
+	{"MRVL0001", &uart_ns8250_class, ACPI_DBG2_16550_SUBSET, 2, 0, 200000000, UART_F_BUSY_DETECT, "Marvell / Synopsys Designware UART"},
 	{"SCX0006",  &uart_ns8250_class, 0, 2, 0, 62500000, UART_F_BUSY_DETECT, "SynQuacer / Synopsys Designware UART"},
 	{"HISI0031", &uart_ns8250_class, 0, 2, 0, 200000000, UART_F_BUSY_DETECT, "HiSilicon / Synopsys Designware UART"},
 	{"PNP0500", &uart_ns8250_class, 0, 0, 0, 0, 0, "Standard PC COM port"},