Skip to content

Commit

Permalink
iASL/TableCompiler: Add compilation support for CEDT table.
Browse files Browse the repository at this point in the history
Also, update the CEDT template.
  • Loading branch information
acpibob committed Mar 11, 2021
1 parent d7e6add commit 1e6dded
Show file tree
Hide file tree
Showing 9 changed files with 125 additions and 12 deletions.
23 changes: 22 additions & 1 deletion source/common/dmtable.c
Expand Up @@ -184,6 +184,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",
Expand Down Expand Up @@ -494,7 +500,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},
Expand Down Expand Up @@ -948,6 +954,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:
Expand Down Expand Up @@ -1370,6 +1377,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 */
Expand Down
2 changes: 1 addition & 1 deletion source/common/dmtbinfo1.c
Expand Up @@ -352,7 +352,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
Expand Down
4 changes: 4 additions & 0 deletions source/compiler/dtcompiler.h
Expand Up @@ -573,6 +573,10 @@ ACPI_STATUS
DtCompileCpep (
void **PFieldList);

ACPI_STATUS
DtCompileCedt (
void **PFieldList);

ACPI_STATUS
DtCompileCsrt (
void **PFieldList);
Expand Down
74 changes: 74 additions & 0 deletions source/compiler/dttable1.c
Expand Up @@ -342,6 +342,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
Expand Down
27 changes: 17 additions & 10 deletions source/compiler/dttemplate.h
Expand Up @@ -206,16 +206,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[] =
Expand Down
1 change: 1 addition & 0 deletions source/compiler/dtutils.c
Expand Up @@ -574,6 +574,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:
Expand Down
1 change: 1 addition & 0 deletions source/include/acdisasm.h
Expand Up @@ -251,6 +251,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,
Expand Down
2 changes: 2 additions & 0 deletions source/include/actbl1.h
Expand Up @@ -492,6 +492,7 @@ typedef struct acpi_table_boot

} ACPI_TABLE_BOOT;


/*******************************************************************************
*
* CEDT - CXL Early Discovery Table
Expand Down Expand Up @@ -522,6 +523,7 @@ typedef struct acpi_cedt_header
enum AcpiCedtType
{
ACPI_CEDT_TYPE_CHBS = 0,
ACPI_CEDT_TYPE_RESERVED = 1
};


Expand Down
3 changes: 3 additions & 0 deletions source/tools/acpisrc/astable.c
Expand Up @@ -648,6 +648,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},
Expand Down Expand Up @@ -710,6 +711,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},
Expand Down

0 comments on commit 1e6dded

Please sign in to comment.