7c403d
commit b980be9b7fd364f62f62655e458325581a4f239c
7c403d
Author: Ben Widawsky <ben@bwidawsk.net>
7c403d
Date:   Thu Feb 25 14:11:46 2021 -0800
7c403d
7c403d
    CXL 2.0: CEDT: Add table and subtable dumping
7c403d
    
7c403d
    Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
7c403d
7c403d
diff --git a/source/common/dmtable.c b/source/common/dmtable.c
7c403d
index 137b5b9..f483a78 100644
7c403d
--- a/source/common/dmtable.c
7c403d
+++ b/source/common/dmtable.c
7c403d
@@ -376,7 +376,7 @@ const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
7c403d
     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
7c403d
     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
7c403d
     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
7c403d
-    {ACPI_SIG_CEDT, NULL,                   NULL,           NULL,           NULL},
7c403d
+    {ACPI_SIG_CEDT, NULL,                   AcpiDmDumpCedt, NULL,           NULL},
7c403d
     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
7c403d
     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
7c403d
     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
7c403d
diff --git a/source/common/dmtbdump1.c b/source/common/dmtbdump1.c
7c403d
index 0103a6c..19a810f 100644
7c403d
--- a/source/common/dmtbdump1.c
7c403d
+++ b/source/common/dmtbdump1.c
7c403d
@@ -221,6 +221,82 @@ AcpiDmDumpAsf (
7c403d
     }
7c403d
 }
7c403d
 
7c403d
+/*******************************************************************************
7c403d
+ *
7c403d
+ * FUNCTION:    AcpiDmDumpCedt
7c403d
+ *
7c403d
+ * PARAMETERS:  Table               - A CEDT table
7c403d
+ *
7c403d
+ * RETURN:      None
7c403d
+ *
7c403d
+ * DESCRIPTION: Format the contents of a CEDT. This table type consists
7c403d
+ *              of an open-ended number of subtables.
7c403d
+ *
7c403d
+ ******************************************************************************/
7c403d
+
7c403d
+void
7c403d
+AcpiDmDumpCedt (
7c403d
+    ACPI_TABLE_HEADER       *Table)
7c403d
+{
7c403d
+    ACPI_STATUS             Status;
7c403d
+    ACPI_CEDT_HEADER        *Subtable;
7c403d
+    UINT32                  Length = Table->Length;
7c403d
+    UINT32                  Offset = sizeof (ACPI_TABLE_CEDT);
7c403d
+    ACPI_DMTABLE_INFO       *InfoTable;
7c403d
+
7c403d
+
7c403d
+    /* There is no main table (other than the standard ACPI header) */
7c403d
+
7c403d
+    Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Table, Offset);
7c403d
+    while (Offset < Table->Length)
7c403d
+    {
7c403d
+        /* Common subtable header */
7c403d
+
7c403d
+        AcpiOsPrintf ("\n");
7c403d
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
7c403d
+            Subtable->Length, AcpiDmTableInfoCedtHdr);
7c403d
+        if (ACPI_FAILURE (Status))
7c403d
+        {
7c403d
+            return;
7c403d
+        }
7c403d
+
7c403d
+        switch (Subtable->Type)
7c403d
+        {
7c403d
+        case ACPI_CEDT_TYPE_CHBS:
7c403d
+
7c403d
+            InfoTable = AcpiDmTableInfoCedt0;
7c403d
+            break;
7c403d
+
7c403d
+        default:
7c403d
+
7c403d
+            AcpiOsPrintf ("\n**** Unknown CEDT subtable type 0x%X\n\n",
7c403d
+                Subtable->Type);
7c403d
+
7c403d
+            /* Attempt to continue */
7c403d
+
7c403d
+            if (!Subtable->Length)
7c403d
+            {
7c403d
+                AcpiOsPrintf ("Invalid zero length subtable\n");
7c403d
+                return;
7c403d
+            }
7c403d
+            goto NextSubtable;
7c403d
+        }
7c403d
+
7c403d
+        Status = AcpiDmDumpTable (Length, Offset, Subtable,
7c403d
+            Subtable->Length, InfoTable);
7c403d
+        if (ACPI_FAILURE (Status))
7c403d
+        {
7c403d
+            return;
7c403d
+        }
7c403d
+
7c403d
+NextSubtable:
7c403d
+        /* Point to next subtable */
7c403d
+
7c403d
+        Offset += Subtable->Length;
7c403d
+        Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable,
7c403d
+            Subtable->Length);
7c403d
+    }
7c403d
+}
7c403d
 
7c403d
 /*******************************************************************************
7c403d
  *
7c403d
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
7c403d
index 5e94ee3..d7f348f 100644
7c403d
--- a/source/include/acdisasm.h
7c403d
+++ b/source/include/acdisasm.h
7c403d
@@ -533,6 +533,10 @@ void
7c403d
 AcpiDmDumpAsf (
7c403d
     ACPI_TABLE_HEADER       *Table);
7c403d
 
7c403d
+void
7c403d
+AcpiDmDumpCedt (
7c403d
+    ACPI_TABLE_HEADER       *Table);
7c403d
+
7c403d
 void
7c403d
 AcpiDmDumpCpep (
7c403d
     ACPI_TABLE_HEADER       *Table);