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