Blame SOURCES/CEDT-support_08.patch

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