82efdd
commit 19b11f91660b1a38a8e9655b0b1a4ad51ec4db1e
82efdd
Author: Lawrence Hileman <larry.hileman@xconn-tech.com>
82efdd
Date:   Fri Jan 7 16:33:40 2022 -0800
82efdd
82efdd
    Add the subtable CFMWS to the CEDT table
82efdd
82efdd
diff --git a/source/common/dmtbdump1.c b/source/common/dmtbdump1.c
82efdd
index 105a88e..6abe8bc 100644
82efdd
--- a/source/common/dmtbdump1.c
82efdd
+++ b/source/common/dmtbdump1.c
82efdd
@@ -244,7 +244,6 @@ AcpiDmDumpCedt (
82efdd
     ACPI_CEDT_HEADER        *Subtable;
82efdd
     UINT32                  Length = Table->Length;
82efdd
     UINT32                  Offset = sizeof (ACPI_TABLE_CEDT);
82efdd
-    ACPI_DMTABLE_INFO       *InfoTable;
82efdd
 
82efdd
 
82efdd
     /* There is no main table (other than the standard ACPI header) */
82efdd
@@ -265,35 +264,50 @@ AcpiDmDumpCedt (
82efdd
         switch (Subtable->Type)
82efdd
         {
82efdd
         case ACPI_CEDT_TYPE_CHBS:
82efdd
+            Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
+                Subtable->Length, AcpiDmTableInfoCedt0);
82efdd
+            if (ACPI_FAILURE (Status)) {
82efdd
+                return;
82efdd
+            }
82efdd
+            break;
82efdd
+
82efdd
+        case ACPI_CEDT_TYPE_CFMWS: {
82efdd
+            ACPI_CEDT_CFMWS *ptr = (ACPI_CEDT_CFMWS *) Subtable;
82efdd
+            unsigned int i, max = 0x01 << (ptr->InterleaveWays);
82efdd
+
82efdd
+            // print out table with first "Interleave target"
82efdd
+            Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
+                Subtable->Length, AcpiDmTableInfoCedt1);
82efdd
+            if (ACPI_FAILURE (Status)) {
82efdd
+                return;
82efdd
+            }
82efdd
 
82efdd
-            InfoTable = AcpiDmTableInfoCedt0;
82efdd
+            // Now, print out any interleave targets beyond the first.
82efdd
+            for (i = 1; i < max; i++) {
82efdd
+                unsigned int loc_offset = Offset + (i * 4) + ACPI_OFFSET(ACPI_CEDT_CFMWS, InterleaveTargets);
82efdd
+                unsigned int *trg = &(ptr->InterleaveTargets[i]);
82efdd
+                Status = AcpiDmDumpTable (Length, loc_offset, trg,
82efdd
+                        Subtable->Length, AcpiDmTableInfoCedt1_te);
82efdd
+                if (ACPI_FAILURE (Status)) {
82efdd
+                    return;
82efdd
+                }
82efdd
+            }
82efdd
             break;
82efdd
+        }
82efdd
 
82efdd
         default:
82efdd
-
82efdd
             AcpiOsPrintf ("\n**** Unknown CEDT subtable type 0x%X\n\n",
82efdd
                 Subtable->Type);
82efdd
 
82efdd
             /* Attempt to continue */
82efdd
-
82efdd
             if (!Subtable->Length)
82efdd
             {
82efdd
                 AcpiOsPrintf ("Invalid zero length subtable\n");
82efdd
                 return;
82efdd
             }
82efdd
-            goto NextSubtable;
82efdd
-        }
82efdd
-
82efdd
-        Status = AcpiDmDumpTable (Length, Offset, Subtable,
82efdd
-            Subtable->Length, InfoTable);
82efdd
-        if (ACPI_FAILURE (Status))
82efdd
-        {
82efdd
-            return;
82efdd
         }
82efdd
 
82efdd
-NextSubtable:
82efdd
         /* Point to next subtable */
82efdd
-
82efdd
         Offset += Subtable->Length;
82efdd
         Subtable = ACPI_ADD_PTR (ACPI_CEDT_HEADER, Subtable,
82efdd
             Subtable->Length);
82efdd
diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c
82efdd
index 5b8ffe6..ac8e79e 100644
82efdd
--- a/source/common/dmtbinfo1.c
82efdd
+++ b/source/common/dmtbinfo1.c
82efdd
@@ -275,6 +275,28 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoCedt0[] =
82efdd
     ACPI_DMT_TERMINATOR
82efdd
 };
82efdd
 
82efdd
+/* 1: CXL Fixed Memory Window Structure */
82efdd
+
82efdd
+ACPI_DMTABLE_INFO           AcpiDmTableInfoCedt1[] =
82efdd
+{
82efdd
+    {ACPI_DMT_UINT32,   ACPI_CEDT1_OFFSET (Reserved1),            "Reserved", 0},
82efdd
+    {ACPI_DMT_UINT64,   ACPI_CEDT1_OFFSET (BaseHpa),              "Window base address", 0},
82efdd
+    {ACPI_DMT_UINT64,   ACPI_CEDT1_OFFSET (WindowSize),           "Window size", 0},
82efdd
+    {ACPI_DMT_UINT8,    ACPI_CEDT1_OFFSET (InterleaveWays),       "Interleave Members (2^n)", 0},
82efdd
+    {ACPI_DMT_UINT8,    ACPI_CEDT1_OFFSET (InterleaveArithmetic), "Interleave Arithmetic", 0},
82efdd
+    {ACPI_DMT_UINT16,   ACPI_CEDT1_OFFSET (Reserved2),            "Reserved", 0},
82efdd
+    {ACPI_DMT_UINT32,   ACPI_CEDT1_OFFSET (Granularity),          "Granularity", 0},
82efdd
+    {ACPI_DMT_UINT16,   ACPI_CEDT1_OFFSET (Restrictions),         "Restrictions", 0},
82efdd
+    {ACPI_DMT_UINT16,   ACPI_CEDT1_OFFSET (QtgId),                "QtgId", 0},
82efdd
+    {ACPI_DMT_UINT32,   ACPI_CEDT1_OFFSET (InterleaveTargets),    "First Target", 0},
82efdd
+    ACPI_DMT_TERMINATOR
82efdd
+};
82efdd
+
82efdd
+ACPI_DMTABLE_INFO           AcpiDmTableInfoCedt1_te[] =
82efdd
+{
82efdd
+    {ACPI_DMT_UINT32,   ACPI_CEDT1_TE_OFFSET (InterleaveTarget),  "Next Target", 0},
82efdd
+    ACPI_DMT_TERMINATOR
82efdd
+};
82efdd
 
82efdd
 /*******************************************************************************
82efdd
  *
82efdd
diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c
82efdd
index c56f61c..972be5f 100644
82efdd
--- a/source/compiler/dttable1.c
82efdd
+++ b/source/compiler/dttable1.c
82efdd
@@ -282,18 +282,18 @@ DtCompileCedt (
82efdd
         switch (CedtHeader->Type)
82efdd
         {
82efdd
         case ACPI_CEDT_TYPE_CHBS:
82efdd
-
82efdd
+            Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt0, &Subtable);
82efdd
+            break;
82efdd
+        case ACPI_CEDT_TYPE_CFMWS:
82efdd
+            Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt1, &Subtable);
82efdd
             break;
82efdd
 
82efdd
         default:
82efdd
-
82efdd
             DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "CEDT");
82efdd
             return (AE_ERROR);
82efdd
         }
82efdd
 
82efdd
         /* CEDT Subtable */
82efdd
-
82efdd
-        Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedt0, &Subtable);
82efdd
         if (ACPI_FAILURE (Status))
82efdd
         {
82efdd
             return (Status);
82efdd
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
82efdd
index 4e7c02f..c165ba0 100644
82efdd
--- a/source/include/acdisasm.h
82efdd
+++ b/source/include/acdisasm.h
82efdd
@@ -267,6 +267,8 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBert[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBgrt[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedtHdr[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedt0[];
82efdd
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedt1[];
82efdd
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedt1_te[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep0[];
82efdd
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt0[];
82efdd
diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h
82efdd
index 80bd806..6b9f5c1 100644
82efdd
--- a/source/include/actbinfo.h
82efdd
+++ b/source/include/actbinfo.h
82efdd
@@ -112,6 +112,8 @@
82efdd
 #define ACPI_ASF4_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
82efdd
 #define ACPI_CEDT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_CEDT_HEADER, f)
82efdd
 #define ACPI_CEDT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CEDT_CHBS, f)
82efdd
+#define ACPI_CEDT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CEDT_CFMWS, f)
82efdd
+#define ACPI_CEDT1_TE_OFFSET(f)         (UINT16) ACPI_OFFSET (ACPI_CEDT_CFMWS_TARGET_ELEMENT, f)
82efdd
 #define ACPI_CPEP0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
82efdd
 #define ACPI_CSRT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f)
82efdd
 #define ACPI_CSRT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CSRT_SHARED_INFO,f)
82efdd
diff --git a/source/include/actbl1.h b/source/include/actbl1.h
82efdd
index 420189e..359861f 100644
82efdd
--- a/source/include/actbl1.h
82efdd
+++ b/source/include/actbl1.h
82efdd
@@ -465,6 +465,11 @@ typedef struct acpi_cedt_cfmws
82efdd
 
82efdd
 } ACPI_CEDT_CFMWS;
82efdd
 
82efdd
+typedef struct acpi_cedt_cfmws_target_element
82efdd
+{
82efdd
+    UINT32                  InterleaveTarget;
82efdd
+} ACPI_CEDT_CFMWS_TARGET_ELEMENT;
82efdd
+
82efdd
 /* Values for Interleave Arithmetic field above */
82efdd
 
82efdd
 #define ACPI_CEDT_CFMWS_ARITHMETIC_MODULO	(0)