Blame SOURCES/CEDT-support_04.patch

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