Blame SOURCES/CEDT-support_04.patch

88c41d
commit 1e6dded267b13c4aa0c3e16de0fa89d3b9c880e9
88c41d
Author: Robert Moore <Robert.Moore@intel.com>
88c41d
Date:   Thu Mar 11 13:12:08 2021 -0800
88c41d
88c41d
    iASL/TableCompiler: Add compilation support for CEDT table.
88c41d
    Also, update the CEDT template.
88c41d
88c41d
diff --git a/source/common/dmtable.c b/source/common/dmtable.c
88c41d
index 5b204a8..530e872 100644
88c41d
--- a/source/common/dmtable.c
88c41d
+++ b/source/common/dmtable.c
88c41d
@@ -76,6 +76,12 @@ static const char           *AcpiDmAsfSubnames[] =
88c41d
     "Unknown Subtable Type"         /* Reserved */
88c41d
 };
88c41d
 
88c41d
+static const char           *AcpiDmCedtSubnames[] =
88c41d
+{
88c41d
+    "CXL Host Bridge Structure",
88c41d
+    "Unknown Subtable Type"         /* Reserved */
88c41d
+};
88c41d
+
88c41d
 static const char           *AcpiDmDmarSubnames[] =
88c41d
 {
88c41d
     "Hardware Unit Definition",
88c41d
@@ -376,7 +382,7 @@ const ACPI_DMTABLE_DATA     AcpiDmTableData[] =
88c41d
     {ACPI_SIG_BERT, AcpiDmTableInfoBert,    NULL,           NULL,           TemplateBert},
88c41d
     {ACPI_SIG_BGRT, AcpiDmTableInfoBgrt,    NULL,           NULL,           TemplateBgrt},
88c41d
     {ACPI_SIG_BOOT, AcpiDmTableInfoBoot,    NULL,           NULL,           TemplateBoot},
88c41d
-    {ACPI_SIG_CEDT, NULL,                   AcpiDmDumpCedt, NULL,           TemplateCedt},
88c41d
+    {ACPI_SIG_CEDT, NULL,                   AcpiDmDumpCedt, DtCompileCedt,  TemplateCedt},
88c41d
     {ACPI_SIG_CPEP, NULL,                   AcpiDmDumpCpep, DtCompileCpep,  TemplateCpep},
88c41d
     {ACPI_SIG_CSRT, NULL,                   AcpiDmDumpCsrt, DtCompileCsrt,  TemplateCsrt},
88c41d
     {ACPI_SIG_DBG2, AcpiDmTableInfoDbg2,    AcpiDmDumpDbg2, DtCompileDbg2,  TemplateDbg2},
88c41d
@@ -830,6 +836,7 @@ AcpiDmDumpTable (
88c41d
         case ACPI_DMT_CHKSUM:
88c41d
         case ACPI_DMT_SPACEID:
88c41d
         case ACPI_DMT_ACCWIDTH:
88c41d
+        case ACPI_DMT_CEDT:
88c41d
         case ACPI_DMT_IVRS:
88c41d
         case ACPI_DMT_GTDT:
88c41d
         case ACPI_DMT_MADT:
88c41d
@@ -1240,6 +1247,20 @@ AcpiDmDumpTable (
88c41d
             AcpiOsPrintf (UINT8_FORMAT, *Target, AcpiDmAsfSubnames[Temp16]);
88c41d
             break;
88c41d
 
88c41d
+        case ACPI_DMT_CEDT:
88c41d
+
88c41d
+            /* CEDT subtable types */
88c41d
+
88c41d
+            Temp8 = *Target;
88c41d
+            if (Temp8 > ACPI_CEDT_TYPE_RESERVED)
88c41d
+            {
88c41d
+                Temp8 = ACPI_CEDT_TYPE_RESERVED;
88c41d
+            }
88c41d
+
88c41d
+            AcpiOsPrintf (UINT8_FORMAT, *Target,
88c41d
+                AcpiDmCedtSubnames[Temp8]);
88c41d
+            break;
88c41d
+
88c41d
         case ACPI_DMT_DMAR:
88c41d
 
88c41d
             /* DMAR subtable types */
88c41d
diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c
88c41d
index cb41915..fb1c19a 100644
88c41d
--- a/source/common/dmtbinfo1.c
88c41d
+++ b/source/common/dmtbinfo1.c
88c41d
@@ -244,7 +244,7 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoBoot[] =
88c41d
 
88c41d
 ACPI_DMTABLE_INFO           AcpiDmTableInfoCedtHdr[] =
88c41d
 {
88c41d
-    {ACPI_DMT_UINT8,    ACPI_CEDT_OFFSET (Type),               "Subtable Type", 0},
88c41d
+    {ACPI_DMT_CEDT,     ACPI_CEDT_OFFSET (Type),               "Subtable Type", 0},
88c41d
     {ACPI_DMT_UINT8,    ACPI_CEDT_OFFSET (Reserved),           "Reserved", 0},
88c41d
     {ACPI_DMT_UINT16,   ACPI_CEDT_OFFSET (Length),             "Length", DT_LENGTH},
88c41d
     ACPI_DMT_TERMINATOR
88c41d
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h
88c41d
index fd20109..9a78519 100644
88c41d
--- a/source/compiler/dtcompiler.h
88c41d
+++ b/source/compiler/dtcompiler.h
88c41d
@@ -419,6 +419,10 @@ ACPI_STATUS
88c41d
 DtCompileCpep (
88c41d
     void                    **PFieldList);
88c41d
 
88c41d
+ACPI_STATUS
88c41d
+DtCompileCedt (
88c41d
+    void                    **PFieldList);
88c41d
+
88c41d
 ACPI_STATUS
88c41d
 DtCompileCsrt (
88c41d
     void                    **PFieldList);
88c41d
diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c
88c41d
index 24d33c1..a3240f8 100644
88c41d
--- a/source/compiler/dttable1.c
88c41d
+++ b/source/compiler/dttable1.c
88c41d
@@ -234,6 +234,80 @@ DtCompileAsf (
88c41d
 }
88c41d
 
88c41d
 
88c41d
+/******************************************************************************
88c41d
+ *
88c41d
+ * FUNCTION:    DtCompileCedt
88c41d
+ *
88c41d
+ * PARAMETERS:  List                - Current field list pointer
88c41d
+ *
88c41d
+ * RETURN:      Status
88c41d
+ *
88c41d
+ * DESCRIPTION: Compile CEDT.
88c41d
+ *
88c41d
+ *****************************************************************************/
88c41d
+
88c41d
+ACPI_STATUS
88c41d
+DtCompileCedt (
88c41d
+    void                    **List)
88c41d
+{
88c41d
+    ACPI_STATUS             Status;
88c41d
+    DT_SUBTABLE             *Subtable;
88c41d
+    DT_SUBTABLE             *ParentTable;
88c41d
+    DT_FIELD                **PFieldList = (DT_FIELD **) List;
88c41d
+    ACPI_CEDT_HEADER        *CedtHeader;
88c41d
+    DT_FIELD                *SubtableStart;
88c41d
+
88c41d
+
88c41d
+    /* Walk the parse tree */
88c41d
+
88c41d
+    while (*PFieldList)
88c41d
+    {
88c41d
+        SubtableStart = *PFieldList;
88c41d
+
88c41d
+        /* CEDT Header */
88c41d
+
88c41d
+        Status = DtCompileTable (PFieldList, AcpiDmTableInfoCedtHdr,
88c41d
+            &Subtable);
88c41d
+        if (ACPI_FAILURE (Status))
88c41d
+        {
88c41d
+            return (Status);
88c41d
+        }
88c41d
+
88c41d
+        ParentTable = DtPeekSubtable ();
88c41d
+        DtInsertSubtable (ParentTable, Subtable);
88c41d
+        DtPushSubtable (Subtable);
88c41d
+
88c41d
+        CedtHeader = ACPI_CAST_PTR (ACPI_CEDT_HEADER, Subtable->Buffer);
88c41d
+
88c41d
+        switch (CedtHeader->Type)
88c41d
+        {
88c41d
+        case ACPI_CEDT_TYPE_CHBS:
88c41d
+
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
+        }
88c41d
+
88c41d
+        ParentTable = DtPeekSubtable ();
88c41d
+        DtInsertSubtable (ParentTable, Subtable);
88c41d
+        DtPopSubtable ();
88c41d
+    }
88c41d
+
88c41d
+    return (AE_OK);
88c41d
+}
88c41d
+
88c41d
+
88c41d
 /******************************************************************************
88c41d
  *
88c41d
  * FUNCTION:    DtCompileCpep
88c41d
diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h
88c41d
index 275003c..82f352a 100644
88c41d
--- a/source/compiler/dttemplate.h
88c41d
+++ b/source/compiler/dttemplate.h
88c41d
@@ -98,16 +98,23 @@ const unsigned char TemplateBoot[] =
88c41d
 
88c41d
 const unsigned char TemplateCedt[] =
88c41d
 {
88c41d
-    /* FIXME: This is from QEMU */
88c41d
-    0x43,0x45,0x44,0x54,0x44,0x00,0x00,0x00,  /* 00000000    "CEDTD..." */
88c41d
-    0x01,0x3E,0x42,0x4F,0x43,0x48,0x53,0x20,  /* 00000008    ".>BOCHS " */
88c41d
-    0x42,0x58,0x50,0x43,0x20,0x20,0x20,0x20,  /* 00000010    "BXPC    " */
88c41d
-    0x01,0x00,0x00,0x00,0x42,0x58,0x50,0x43,  /* 00000018    "....BXPC" */
88c41d
-    0x01,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000020    "...... ." */
88c41d
-    0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,  /* 00000028    "........" */
88c41d
-    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xD0,  /* 00000030    "........" */
88c41d
-    0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,  /* 00000038    "........" */
88c41d
-    0x00,0x00,0x00,0x00                       /* 00000040    "...."     */
88c41d
+    0x43,0x45,0x44,0x54,0x84,0x00,0x00,0x00,  /* 00000000    "CEDT...." */
88c41d
+    0x01,0x8B,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */
88c41d
+    0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */
88c41d
+    0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
88c41d
+    0x05,0x01,0x21,0x20,0x00,0x00,0x20,0x00,  /* 00000020    "..! .. ." */
88c41d
+    0x33,0x33,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000028    "33......" */
88c41d
+    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xD5,  /* 00000030    ".....!C." */
88c41d
+    0x00,0x00,0x00,0x00,0x45,0x23,0x01,0x00,  /* 00000038    "....E#.." */
88c41d
+    0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000040    "...... ." */
88c41d
+    0x44,0x44,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000048    "DD......" */
88c41d
+    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xA5,  /* 00000050    ".....!C." */
88c41d
+    0x00,0x00,0x00,0x00,0x45,0x23,0xB1,0x00,  /* 00000058    "....E#.." */
88c41d
+    0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x00,  /* 00000060    "...... ." */
88c41d
+    0x55,0x55,0xCD,0xAB,0x01,0x00,0x00,0x00,  /* 00000068    "UU......" */
88c41d
+    0x00,0x00,0x00,0x00,0x00,0x21,0x43,0xB5,  /* 00000070    ".....!C." */
88c41d
+    0x00,0x00,0x00,0x00,0x45,0x23,0xB1,0x00,  /* 00000078    "....E#.." */
88c41d
+    0x00,0x00,0x00,0x00                       /* 00000080    "...."     */
88c41d
 };
88c41d
 
88c41d
 const unsigned char TemplateCpep[] =
88c41d
diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c
88c41d
index 658726b..a5ef782 100644
88c41d
--- a/source/compiler/dtutils.c
88c41d
+++ b/source/compiler/dtutils.c
88c41d
@@ -455,6 +455,7 @@ DtGetFieldLength (
88c41d
     case ACPI_DMT_CHKSUM:
88c41d
     case ACPI_DMT_SPACEID:
88c41d
     case ACPI_DMT_ACCWIDTH:
88c41d
+    case ACPI_DMT_CEDT:
88c41d
     case ACPI_DMT_IVRS:
88c41d
     case ACPI_DMT_GTDT:
88c41d
     case ACPI_DMT_MADT:
88c41d
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
88c41d
index d7f348f..f50adef 100644
88c41d
--- a/source/include/acdisasm.h
88c41d
+++ b/source/include/acdisasm.h
88c41d
@@ -143,6 +143,7 @@ typedef enum
88c41d
     /* Types that are specific to particular ACPI tables */
88c41d
 
88c41d
     ACPI_DMT_ASF,
88c41d
+    ACPI_DMT_CEDT,
88c41d
     ACPI_DMT_DMAR,
88c41d
     ACPI_DMT_DMAR_SCOPE,
88c41d
     ACPI_DMT_EINJACT,
88c41d
diff --git a/source/include/actbl1.h b/source/include/actbl1.h
88c41d
index ce4737d..a551303 100644
88c41d
--- a/source/include/actbl1.h
88c41d
+++ b/source/include/actbl1.h
88c41d
@@ -384,6 +384,7 @@ typedef struct acpi_table_boot
88c41d
 
88c41d
 } ACPI_TABLE_BOOT;
88c41d
 
88c41d
+
88c41d
 /*******************************************************************************
88c41d
  *
88c41d
  * CEDT - CXL Early Discovery Table
88c41d
@@ -414,6 +415,7 @@ typedef struct acpi_cedt_header
88c41d
 enum AcpiCedtType
88c41d
 {
88c41d
     ACPI_CEDT_TYPE_CHBS                 = 0,
88c41d
+    ACPI_CEDT_TYPE_RESERVED             = 1
88c41d
 };
88c41d
 
88c41d
 
88c41d
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
88c41d
index 8aa35fe..5fc0ab5 100644
88c41d
--- a/source/tools/acpisrc/astable.c
88c41d
+++ b/source/tools/acpisrc/astable.c
88c41d
@@ -534,6 +534,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
88c41d
     {"ACPI_TABLE_CSRT",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_TABLE_DBG2",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_TABLE_DBGP",                     SRC_TYPE_STRUCT},
88c41d
+    {"ACPI_TABLE_CEDT",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_TABLE_DMAR",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_TABLE_DRTM",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_TABLE_ECDT",                     SRC_TYPE_STRUCT},
88c41d
@@ -592,6 +593,8 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
88c41d
     {"ACPI_ASF_REMOTE",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_ASF_RMCP",                       SRC_TYPE_STRUCT},
88c41d
     {"ACPI_BERT_REGION",                    SRC_TYPE_STRUCT},
88c41d
+    {"ACPI_CEDT_CHBS",                      SRC_TYPE_STRUCT},
88c41d
+    {"ACPI_CEDT_HEADER",                    SRC_TYPE_STRUCT},
88c41d
     {"ACPI_CPEP_POLLING",                   SRC_TYPE_STRUCT},
88c41d
     {"ACPI_CSRT_GROUP",                     SRC_TYPE_STRUCT},
88c41d
     {"ACPI_CSRT_DESCRIPTOR",                SRC_TYPE_STRUCT},