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