7c403d
commit 0b03aa8ebd7a5b2b9407893f123ee587af45926f
7c403d
Author: Ben Widawsky <ben@bwidawsk.net>
7c403d
Date:   Thu Feb 25 13:54:56 2021 -0800
7c403d
7c403d
    CXL 2.0: CEDT: Add new CEDT table
7c403d
    
7c403d
    This sets up all of the boilerplate without actually doing anything.
7c403d
    
7c403d
    Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
7c403d
7c403d
diff --git a/source/common/ahtable.c b/source/common/ahtable.c
7c403d
index a313c7f..2679fae 100644
7c403d
--- a/source/common/ahtable.c
7c403d
+++ b/source/common/ahtable.c
7c403d
@@ -95,6 +95,7 @@ const AH_TABLE      Gbl_AcpiSupportedTables[] =
7c403d
     {ACPI_SIG_BERT, "Boot Error Record Table"},
7c403d
     {ACPI_SIG_BGRT, "Boot Graphics Resource Table"},
7c403d
     {ACPI_SIG_BOOT, "Simple Boot Flag Table"},
7c403d
+    {ACPI_SIG_CEDT, "CXL Early Discovery Table"},
7c403d
     {ACPI_SIG_CPEP, "Corrected Platform Error Polling table"},
7c403d
     {ACPI_SIG_CSRT, "Core System Resource Table"},
7c403d
     {ACPI_SIG_DBG2, "Debug Port table type 2"},
7c403d
diff --git a/source/common/dmtable.c b/source/common/dmtable.c
7c403d
index 0908e44..137b5b9 100644
7c403d
--- a/source/common/dmtable.c
7c403d
+++ b/source/common/dmtable.c
7c403d
@@ -376,6 +376,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,                   NULL,           NULL,           NULL},
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
diff --git a/source/common/dmtbinfo1.c b/source/common/dmtbinfo1.c
7c403d
index 4adb42a..cb41915 100644
7c403d
--- a/source/common/dmtbinfo1.c
7c403d
+++ b/source/common/dmtbinfo1.c
7c403d
@@ -236,6 +236,33 @@ ACPI_DMTABLE_INFO           AcpiDmTableInfoBoot[] =
7c403d
 };
7c403d
 
7c403d
 
7c403d
+/*******************************************************************************
7c403d
+ *
7c403d
+ * CEDT - CXL Early Discovery Table
7c403d
+ *
7c403d
+ ******************************************************************************/
7c403d
+
7c403d
+ACPI_DMTABLE_INFO           AcpiDmTableInfoCedtHdr[] =
7c403d
+{
7c403d
+    {ACPI_DMT_UINT8,    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
+};
7c403d
+
7c403d
+/* 0: CXL Host Bridge Structure */
7c403d
+
7c403d
+ACPI_DMTABLE_INFO           AcpiDmTableInfoCedt0[] =
7c403d
+{
7c403d
+    {ACPI_DMT_UINT32,   ACPI_CEDT0_OFFSET (Uid),               "Associated host bridge", 0},
7c403d
+    {ACPI_DMT_UINT32,   ACPI_CEDT0_OFFSET (CxlVersion),        "Specification version", 0},
7c403d
+    {ACPI_DMT_UINT32,   ACPI_CEDT0_OFFSET (Reserved),          "Reserved", 0},
7c403d
+    {ACPI_DMT_UINT64,   ACPI_CEDT0_OFFSET (Base),              "Register base", 0},
7c403d
+    {ACPI_DMT_UINT64,   ACPI_CEDT0_OFFSET (Length),            "Register length", 0},
7c403d
+    ACPI_DMT_TERMINATOR
7c403d
+};
7c403d
+
7c403d
+
7c403d
 /*******************************************************************************
7c403d
  *
7c403d
  * CPEP - Corrected Platform Error Polling table
7c403d
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
7c403d
index e9b7a48..5e94ee3 100644
7c403d
--- a/source/include/acdisasm.h
7c403d
+++ b/source/include/acdisasm.h
7c403d
@@ -256,6 +256,8 @@ extern ACPI_DMTABLE_INFO        AcpiDmTableInfoAsfHdr[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBoot[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBert[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoBgrt[];
7c403d
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedtHdr[];
7c403d
+extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCedt0[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCpep0[];
7c403d
 extern ACPI_DMTABLE_INFO        AcpiDmTableInfoCsrt0[];
7c403d
diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h
7c403d
index 8a1fd74..9735f22 100644
7c403d
--- a/source/include/actbinfo.h
7c403d
+++ b/source/include/actbinfo.h
7c403d
@@ -104,6 +104,8 @@
7c403d
 #define ACPI_ASF2a_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f)
7c403d
 #define ACPI_ASF3_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_ASF_RMCP,f)
7c403d
 #define ACPI_ASF4_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
7c403d
+#define ACPI_CEDT_OFFSET(f)             (UINT16) ACPI_OFFSET (ACPI_CEDT_HEADER, f)
7c403d
+#define ACPI_CEDT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CEDT_CHBS, f)
7c403d
 #define ACPI_CPEP0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
7c403d
 #define ACPI_CSRT0_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CSRT_GROUP,f)
7c403d
 #define ACPI_CSRT1_OFFSET(f)            (UINT16) ACPI_OFFSET (ACPI_CSRT_SHARED_INFO,f)
7c403d
diff --git a/source/include/actbl1.h b/source/include/actbl1.h
7c403d
index b76195f..ce4737d 100644
7c403d
--- a/source/include/actbl1.h
7c403d
+++ b/source/include/actbl1.h
7c403d
@@ -64,6 +64,7 @@
7c403d
 #define ACPI_SIG_BERT           "BERT"      /* Boot Error Record Table */
7c403d
 #define ACPI_SIG_BGRT           "BGRT"      /* Boot Graphics Resource Table */
7c403d
 #define ACPI_SIG_BOOT           "BOOT"      /* Simple Boot Flag Table */
7c403d
+#define ACPI_SIG_CEDT           "CEDT"      /* CXL Early Discovery Table */
7c403d
 #define ACPI_SIG_CPEP           "CPEP"      /* Corrected Platform Error Polling table */
7c403d
 #define ACPI_SIG_CSRT           "CSRT"      /* Core System Resource Table */
7c403d
 #define ACPI_SIG_DBG2           "DBG2"      /* Debug Port table type 2 */
7c403d
@@ -383,6 +384,56 @@ typedef struct acpi_table_boot
7c403d
 
7c403d
 } ACPI_TABLE_BOOT;
7c403d
 
7c403d
+/*******************************************************************************
7c403d
+ *
7c403d
+ * CEDT - CXL Early Discovery Table
7c403d
+ *        Version 1
7c403d
+ *
7c403d
+ * Conforms to the "CXL Early Discovery Table" (CXL 2.0)
7c403d
+ *
7c403d
+ ******************************************************************************/
7c403d
+
7c403d
+typedef struct acpi_table_cedt
7c403d
+{
7c403d
+    ACPI_TABLE_HEADER       Header;             /* Common ACPI table header */
7c403d
+
7c403d
+} ACPI_TABLE_CEDT;
7c403d
+
7c403d
+/* CEDT subtable header (Performance Record Structure) */
7c403d
+
7c403d
+typedef struct acpi_cedt_header
7c403d
+{
7c403d
+    UINT8                   Type;
7c403d
+    UINT8                   Reserved;
7c403d
+    UINT16                  Length;
7c403d
+
7c403d
+} ACPI_CEDT_HEADER;
7c403d
+
7c403d
+/* Values for Type field above */
7c403d
+
7c403d
+enum AcpiCedtType
7c403d
+{
7c403d
+    ACPI_CEDT_TYPE_CHBS                 = 0,
7c403d
+};
7c403d
+
7c403d
+
7c403d
+/*
7c403d
+ * CEDT subtables
7c403d
+ */
7c403d
+
7c403d
+/* 0: CXL Host Bridge Structure */
7c403d
+
7c403d
+typedef struct acpi_cedt_chbs
7c403d
+{
7c403d
+    ACPI_CEDT_HEADER        Header;
7c403d
+    UINT32                  Uid;
7c403d
+    UINT32                  CxlVersion;
7c403d
+    UINT32                  Reserved;
7c403d
+    UINT64                  Base;
7c403d
+    UINT64                  Length;
7c403d
+
7c403d
+} ACPI_CEDT_CHBS;
7c403d
+
7c403d
 
7c403d
 /*******************************************************************************
7c403d
  *
7c403d
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
7c403d
index ef74f17..8aa35fe 100644
7c403d
--- a/source/tools/acpisrc/astable.c
7c403d
+++ b/source/tools/acpisrc/astable.c
7c403d
@@ -529,6 +529,7 @@ ACPI_TYPED_IDENTIFIER_TABLE           AcpiIdentifiers[] = {
7c403d
     {"ACPI_TABLE_BERT",                     SRC_TYPE_STRUCT},
7c403d
     {"ACPI_TABLE_BGRT",                     SRC_TYPE_STRUCT},
7c403d
     {"ACPI_TABLE_BOOT",                     SRC_TYPE_STRUCT},
7c403d
+    {"ACPI_TABLE_CEDT",                     SRC_TYPE_STRUCT},
7c403d
     {"ACPI_TABLE_CPEP",                     SRC_TYPE_STRUCT},
7c403d
     {"ACPI_TABLE_CSRT",                     SRC_TYPE_STRUCT},
7c403d
     {"ACPI_TABLE_DBG2",                     SRC_TYPE_STRUCT},