acpica-tools/SOURCES/CEDT-support_04.patch
2023-03-29 01:11:51 +00:00

279 lines
10 KiB
Diff

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