9897bb
Index: acpica-unix2-20210604/source/common/dmtable.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/common/dmtable.c
9897bb
+++ acpica-unix2-20210604/source/common/dmtable.c
9897bb
@@ -979,6 +979,12 @@ AcpiDmDumpTable (
9897bb
             ByteLength = 128;
9897bb
             break;
9897bb
 
9897bb
+        case ACPI_DMT_WPBT_UNICODE:
9897bb
+
9897bb
+            ByteLength = SubtableLength;
9897bb
+            CurrentOffset = sizeof (ACPI_TABLE_WPBT);
9897bb
+            break;
9897bb
+
9897bb
         case ACPI_DMT_UNICODE:
9897bb
         case ACPI_DMT_BUFFER:
9897bb
         case ACPI_DMT_RAW_BUFFER:
9897bb
@@ -1596,6 +1602,7 @@ AcpiDmDumpTable (
9897bb
             break;
9897bb
 
9897bb
         case ACPI_DMT_UNICODE:
9897bb
+        case ACPI_DMT_WPBT_UNICODE:
9897bb
 
9897bb
             if (ByteLength == 0)
9897bb
             {
9897bb
Index: acpica-unix2-20210604/source/common/dmtbdump3.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/common/dmtbdump3.c
9897bb
+++ acpica-unix2-20210604/source/common/dmtbdump3.c
9897bb
@@ -753,8 +753,11 @@ AcpiDmDumpWpbt (
9897bb
     Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table);
9897bb
     ArgumentsLength = AcpiUtReadUint16 (&Subtable->ArgumentsLength);
9897bb
 
9897bb
-    /* Dump the arguments buffer */
9897bb
+    /* Dump the arguments buffer if present */
9897bb
 
9897bb
-    (void) AcpiDmDumpTable (TableLength, 0, Table, ArgumentsLength,
9897bb
-        AcpiDmTableInfoWpbt0);
9897bb
+    if (ArgumentsLength)
9897bb
+    {
9897bb
+        (void) AcpiDmDumpTable (Table->Length, 0, Table, ArgumentsLength,
9897bb
+            AcpiDmTableInfoWpbt0);
9897bb
+    }
9897bb
 }
9897bb
Index: acpica-unix2-20210604/source/common/dmtbinfo3.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/common/dmtbinfo3.c
9897bb
+++ acpica-unix2-20210604/source/common/dmtbinfo3.c
9897bb
@@ -651,7 +651,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableI
9897bb
 
9897bb
 ACPI_DMTABLE_INFO           AcpiDmTableInfoWpbt0[] =
9897bb
 {
9897bb
-    {ACPI_DMT_UNICODE,     sizeof (ACPI_TABLE_WPBT),                "Command-line Arguments", 0},
9897bb
+    {ACPI_DMT_WPBT_UNICODE, ACPI_WPBT2_OFFSET (UnicodeString),      "Command-line Arguments", DT_DESCRIBES_OPTIONAL},
9897bb
     ACPI_DMT_TERMINATOR
9897bb
 };
9897bb
 
9897bb
Index: acpica-unix2-20210604/source/compiler/dttable2.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/compiler/dttable2.c
9897bb
+++ acpica-unix2-20210604/source/compiler/dttable2.c
9897bb
@@ -2615,13 +2615,11 @@ DtCompileWpbt (
9897bb
     DT_SUBTABLE             *ParentTable;
9897bb
     ACPI_TABLE_WPBT         *Table;
9897bb
     ACPI_STATUS             Status;
9897bb
-    UINT16                  Length;
9897bb
 
9897bb
 
9897bb
     /* Compile the main table */
9897bb
 
9897bb
-    Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt,
9897bb
-        &Subtable);
9897bb
+    Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt, &Subtable);
9897bb
     if (ACPI_FAILURE (Status))
9897bb
     {
9897bb
         return (Status);
9897bb
@@ -2629,11 +2627,23 @@ DtCompileWpbt (
9897bb
 
9897bb
     ParentTable = DtPeekSubtable ();
9897bb
     DtInsertSubtable (ParentTable, Subtable);
9897bb
+    Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
9897bb
+
9897bb
+    /*
9897bb
+     * Exit now if there are no arguments specified. This is indicated by:
9897bb
+     * The "Command-line Arguments" field has not been specified (if specified,
9897bb
+     * it will be the last field in the field list -- after the main table).
9897bb
+     * Set the Argument Length in the main table to zero.
9897bb
+     */
9897bb
+    if (!*PFieldList)
9897bb
+    {
9897bb
+        Table->ArgumentsLength = 0;
9897bb
+        return (AE_OK);
9897bb
+    }
9897bb
 
9897bb
     /* Compile the argument list subtable */
9897bb
 
9897bb
-    Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0,
9897bb
-        &Subtable);
9897bb
+    Status = DtCompileTable (PFieldList, AcpiDmTableInfoWpbt0, &Subtable);
9897bb
     if (ACPI_FAILURE (Status))
9897bb
     {
9897bb
         return (Status);
9897bb
@@ -2641,12 +2651,8 @@ DtCompileWpbt (
9897bb
 
9897bb
     /* Extract the length of the Arguments buffer, insert into main table */
9897bb
 
9897bb
-    AcpiUtWriteUint (&Length, sizeof (UINT16),
9897bb
+    AcpiUtWriteUint (&Table->ArgumentsLength, sizeof (UINT16),
9897bb
            &Subtable->TotalLength, sizeof (UINT32));
9897bb
-    Table = ACPI_CAST_PTR (ACPI_TABLE_WPBT, ParentTable->Buffer);
9897bb
-    Table->ArgumentsLength = AcpiUtReadUint16 (&Length);
9897bb
-
9897bb
-    ParentTable = DtPeekSubtable ();
9897bb
     DtInsertSubtable (ParentTable, Subtable);
9897bb
     return (AE_OK);
9897bb
 }
9897bb
Index: acpica-unix2-20210604/source/compiler/dtutils.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/compiler/dtutils.c
9897bb
+++ acpica-unix2-20210604/source/compiler/dtutils.c
9897bb
@@ -344,6 +344,7 @@ DtGetFieldType (
9897bb
         break;
9897bb
 
9897bb
     case ACPI_DMT_UNICODE:
9897bb
+    case ACPI_DMT_WPBT_UNICODE:
9897bb
 
9897bb
         Type = DT_FIELD_TYPE_UNICODE;
9897bb
         break;
9897bb
@@ -626,12 +627,13 @@ DtGetFieldLength (
9897bb
         break;
9897bb
 
9897bb
     case ACPI_DMT_UNICODE:
9897bb
+    case ACPI_DMT_WPBT_UNICODE:
9897bb
 
9897bb
         Value = DtGetFieldValue (Field);
9897bb
 
9897bb
         /* TBD: error if Value is NULL? (as below?) */
9897bb
 
9897bb
-        ByteLength = (strlen (Value) + 1) * sizeof(UINT16);
9897bb
+        ByteLength = (strlen (Value) + 1) * sizeof (UINT16);
9897bb
         break;
9897bb
 
9897bb
     default:
9897bb
Index: acpica-unix2-20210604/source/include/acdisasm.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/acdisasm.h
9897bb
+++ acpica-unix2-20210604/source/include/acdisasm.h
9897bb
@@ -175,6 +175,7 @@ typedef enum
9897bb
     ACPI_DMT_SRAT,
9897bb
     ACPI_DMT_TPM2,
9897bb
     ACPI_DMT_VIOT,
9897bb
+    ACPI_DMT_WPBT_UNICODE,
9897bb
 
9897bb
     /* Special opcodes */
9897bb
 
9897bb
Index: acpica-unix2-20210604/source/include/actbinfo.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/actbinfo.h
9897bb
+++ acpica-unix2-20210604/source/include/actbinfo.h
9897bb
@@ -97,6 +97,7 @@
9897bb
 #define ACPI_WDDT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f)
9897bb
 #define ACPI_WDRT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
9897bb
 #define ACPI_WPBT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f)
9897bb
+#define ACPI_WPBT2_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_WPBT_UNICODE,f)
9897bb
 #define ACPI_WSMT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_WSMT,f)
9897bb
 #define ACPI_XENV_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f)
9897bb
 
9897bb
Index: acpica-unix2-20210604/source/include/actbl3.h
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/include/actbl3.h
9897bb
+++ acpica-unix2-20210604/source/include/actbl3.h
9897bb
@@ -847,6 +847,12 @@ typedef struct acpi_table_wpbt
9897bb
 
9897bb
 } ACPI_TABLE_WPBT;
9897bb
 
9897bb
+typedef struct acpi_wpbt_unicode
9897bb
+{
9897bb
+    UINT16                  *UnicodeString;
9897bb
+
9897bb
+} ACPI_WPBT_UNICODE;
9897bb
+
9897bb
 
9897bb
 /*******************************************************************************
9897bb
  *
9897bb
Index: acpica-unix2-20210604/source/tools/acpisrc/astable.c
9897bb
===================================================================
9897bb
--- acpica-unix2-20210604.orig/source/tools/acpisrc/astable.c
9897bb
+++ acpica-unix2-20210604/source/tools/acpisrc/astable.c
9897bb
@@ -772,6 +772,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           Ac
9897bb
     {"ACPI_VIOT_VIRTIO_IOMMU_PCI",          SRC_TYPE_STRUCT},
9897bb
     {"ACPI_VIOT_VIRTIO_IOMMU_MMIO",         SRC_TYPE_STRUCT},
9897bb
     {"ACPI_WDAT_ENTRY",                     SRC_TYPE_STRUCT},
9897bb
+    {"ACPI_WPBT_UNICODE",                   SRC_TYPE_STRUCT},
9897bb
 
9897bb
     /* Data Table compiler */
9897bb