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