Blame SOURCES/CEDT-support_04.patch

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