git: 8056c665574e - main - acpica: Update the SPCR table to version 4

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 11 Oct 2024 18:07:00 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=8056c665574e2bca135658764773281893e8fc27

commit 8056c665574e2bca135658764773281893e8fc27
Author:     Sia Jee Heng <jeeheng.sia@starfivetech.com>
AuthorDate: 2024-02-29 06:39:50 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-10-11 18:06:33 +0000

    acpica: Update the SPCR table to version 4
    
    cherry pick 1eeff52124a45d5cd887ba5687bbad0116e4d211 from acpica:
    
    SPCR: Update the SPCR table to version 4
    
    The Microsoft Serial Port Console Redirection (SPCR) specification
    revision 1.09 comprises additional fields [1]. The newly added fields
    are:
    - RISC-V SBI
    - Precise Baud Rate
    - NamespaceStringLength
    - NamespaceStringOffset
    - NamespaceString
    
    Additionaly, this code will support up to SPCR revision 1.10, as it
    includes only minor wording changes.
    
    [1] https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
    
    Signed-off-by: Sia Jee Heng <jeeheng.sia@starfivetech.com>
---
 sys/contrib/dev/acpica/common/dmtbinfo3.c    |  8 ++++++--
 sys/contrib/dev/acpica/compiler/dttemplate.h |  8 +++++---
 sys/contrib/dev/acpica/include/actbl3.h      | 12 ++++++++----
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/sys/contrib/dev/acpica/common/dmtbinfo3.c b/sys/contrib/dev/acpica/common/dmtbinfo3.c
index 702cdc0133b3..7a482ba0ffa9 100644
--- a/sys/contrib/dev/acpica/common/dmtbinfo3.c
+++ b/sys/contrib/dev/acpica/common/dmtbinfo3.c
@@ -255,7 +255,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoSpcr[] =
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (StopBits),                "Stop Bits", 0},
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (FlowControl),             "Flow Control", 0},
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (TerminalType),            "Terminal Type", 0},
-    {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (Reserved2),               "Reserved", 0},
+    {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (Language),                "Language", 0},
     {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (PciDeviceId),             "PCI Device ID", 0},
     {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (PciVendorId),             "PCI Vendor ID", 0},
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (PciBus),                  "PCI Bus", 0},
@@ -263,7 +263,11 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoSpcr[] =
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (PciFunction),             "PCI Function", 0},
     {ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (PciFlags),                "PCI Flags", 0},
     {ACPI_DMT_UINT8,    ACPI_SPCR_OFFSET (PciSegment),              "PCI Segment", 0},
-    {ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (Reserved2),               "Reserved", 0},
+    {ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (UartClkFreq),             "Uart Clock Freq", 0},
+    {ACPI_DMT_UINT32,   ACPI_SPCR_OFFSET (PreciseBaudrate),         "Precise Baud rate", 0},
+    {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (NameSpaceStringLength),   "NameSpaceStringLength", 0},
+    {ACPI_DMT_UINT16,   ACPI_SPCR_OFFSET (NameSpaceStringOffset),   "NameSpaceStringOffset", 0},
+    {ACPI_DMT_STRING,   ACPI_SPCR_OFFSET (NameSpaceString),         "NamespaceString", 0},
     ACPI_DMT_TERMINATOR
 };
 
diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h
index c97a8ed24eee..1560f2008cfa 100644
--- a/sys/contrib/dev/acpica/compiler/dttemplate.h
+++ b/sys/contrib/dev/acpica/compiler/dttemplate.h
@@ -1956,8 +1956,8 @@ const unsigned char TemplateSlit[] =
 
 const unsigned char TemplateSpcr[] =
 {
-    0x53,0x50,0x43,0x52,0x50,0x00,0x00,0x00,  /* 00000000    "SPCRP..." */
-    0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
+    0x53,0x50,0x43,0x52,0x5A,0x00,0x00,0x00,  /* 00000000    "SPCRZ..." */
+    0x04,0x4E,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
     0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
     0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
     0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00,  /* 00000020    "(.. ...." */
@@ -1965,7 +1965,9 @@ const unsigned char TemplateSpcr[] =
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000030    "........" */
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000040    "........" */
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00   /* 00000048    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000048    "........" */
+    0x00,0x00,0x00,0x00,0x02,0x00,0x58,0x00,  /* 00000050    "......X." */
+    0x2E,0x00                                 /* 00000058    ".." */
 };
 
 const unsigned char TemplateSpmi[] =
diff --git a/sys/contrib/dev/acpica/include/actbl3.h b/sys/contrib/dev/acpica/include/actbl3.h
index 1438c1db507c..81a022544a4a 100644
--- a/sys/contrib/dev/acpica/include/actbl3.h
+++ b/sys/contrib/dev/acpica/include/actbl3.h
@@ -243,10 +243,10 @@ typedef struct acpi_table_slit
 /*******************************************************************************
  *
  * SPCR - Serial Port Console Redirection table
- *        Version 2
+ *        Version 4
  *
  * Conforms to "Serial Port Console Redirection Table",
- * Version 1.03, August 10, 2015
+ * Version 1.10, Jan 5, 2023
  *
  ******************************************************************************/
 
@@ -264,7 +264,7 @@ typedef struct acpi_table_spcr
     UINT8                   StopBits;
     UINT8                   FlowControl;
     UINT8                   TerminalType;
-    UINT8                   Reserved1;
+    UINT8                   Language;
     UINT16                  PciDeviceId;
     UINT16                  PciVendorId;
     UINT8                   PciBus;
@@ -272,7 +272,11 @@ typedef struct acpi_table_spcr
     UINT8                   PciFunction;
     UINT32                  PciFlags;
     UINT8                   PciSegment;
-    UINT32                  Reserved2;
+    UINT32                  UartClkFreq;
+    UINT32                  PreciseBaudrate;
+    UINT16                  NameSpaceStringLength;
+    UINT16                  NameSpaceStringOffset;
+    char                    NameSpaceString[];
 
 } ACPI_TABLE_SPCR;