Skip to content

Commit

Permalink
iASL: Add support for TCPA Server Table.
Browse files Browse the repository at this point in the history
In addition to the existing support for the client table.
  • Loading branch information
acpibob committed Jul 2, 2015
1 parent 6505bbc commit 55fa955
Show file tree
Hide file tree
Showing 9 changed files with 226 additions and 15 deletions.
2 changes: 1 addition & 1 deletion source/common/dmtable.c
Expand Up @@ -440,7 +440,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] =
{ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi},
{ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat},
{ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao},
{ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa},
{ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa},
{ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2},
{ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi},
{ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc},
Expand Down
71 changes: 71 additions & 0 deletions source/common/dmtbdump.c
Expand Up @@ -3485,6 +3485,77 @@ AcpiDmDumpStao (
}


/*******************************************************************************
*
* FUNCTION: AcpiDmDumpTcpa
*
* PARAMETERS: Table - A TCPA table
*
* RETURN: None
*
* DESCRIPTION: Format the contents of a TCPA.
*
* NOTE: There are two versions of the table with the same signature:
* the client version and the server version. The common
* PlatformClass field is used to differentiate the two types of
* tables.
*
******************************************************************************/

void
AcpiDmDumpTcpa (
ACPI_TABLE_HEADER *Table)
{
UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR);
ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR (
ACPI_TABLE_TCPA_HDR, Table);
ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR (
ACPI_TABLE_TCPA_HDR, Table, Offset);
ACPI_STATUS Status;


/* Main table */

Status = AcpiDmDumpTable (Table->Length, 0, Table,
0, AcpiDmTableInfoTcpaHdr);
if (ACPI_FAILURE (Status))
{
return;
}

/*
* Examine the PlatformClass field to determine the table type.
* Either a client or server table. Only one.
*/
switch (CommonHeader->PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:

Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
Table->Length - Offset, AcpiDmTableInfoTcpaClient);
break;

case ACPI_TCPA_SERVER_TABLE:

Status = AcpiDmDumpTable (Table->Length, Offset, SubTable,
Table->Length - Offset, AcpiDmTableInfoTcpaServer);
break;

default:

AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
CommonHeader->PlatformClass);
Status = AE_ERROR;
break;
}

if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("\n**** Cannot disassemble TCPA table\n");
}
}


/*******************************************************************************
*
* FUNCTION: AcpiDmDumpVrtc
Expand Down
45 changes: 42 additions & 3 deletions source/common/dmtbinfo.c
Expand Up @@ -185,7 +185,7 @@
#define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
#define ACPI_SRAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
#define ACPI_STAO_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_STAO,f)
#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f)
#define ACPI_TCPA_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_HDR,f)
#define ACPI_TPM2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TPM2,f)
#define ACPI_UEFI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_UEFI,f)
#define ACPI_WAET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WAET,f)
Expand Down Expand Up @@ -302,6 +302,8 @@
#define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
#define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f)
#define ACPI_SRAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f)
#define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f)
#define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f)
#define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f)
#define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f)

Expand Down Expand Up @@ -2685,16 +2687,53 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[] =
*
* TCPA - Trusted Computing Platform Alliance table (Client)
*
* NOTE: There are two versions of the table with the same signature --
* the client version and the server version. The common PlatformClass
* field is used to differentiate the two types of tables.
*
******************************************************************************/

ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[] =
{
{ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (PlatformClass), "Platform Class", 0},
ACPI_DMT_TERMINATOR
};

ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[] =
{
{ACPI_DMT_UINT16, ACPI_TCPA_CLIENT_OFFSET (PlatformClass), "Platform Class", 0},
{ACPI_DMT_UINT32, ACPI_TCPA_CLIENT_OFFSET (MinimumLogLength), "Min Event Log Length", 0},
{ACPI_DMT_UINT64, ACPI_TCPA_CLIENT_OFFSET (LogAddress), "Event Log Address", 0},
ACPI_DMT_TERMINATOR
};

ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[] =
{
{ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (Reserved), "Reserved", 0},
{ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (MinimumLogLength), "Min Event Log Length", 0},
{ACPI_DMT_UINT64, ACPI_TCPA_SERVER_OFFSET (LogAddress), "Event Log Address", 0},
{ACPI_DMT_UINT16, ACPI_TCPA_SERVER_OFFSET (SpecRevision), "Specification Revision", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Device Flags (decoded below)", DT_FLAG},
{ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Pci Device", 0},
{ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Bus is Pnp", 0},
{ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (DeviceFlags), "Address Valid", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Interrupt Flags (decoded below)", DT_FLAG},
{ACPI_DMT_FLAG0, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Mode", 0},
{ACPI_DMT_FLAG1, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Polarity", 0},
{ACPI_DMT_FLAG2, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "GPE SCI Triggered", 0},
{ACPI_DMT_FLAG3, ACPI_TCPA_SERVER_OFFSET (InterruptFlags), "Global System Interrupt", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (GpeNumber), "Gpe Number", 0},
{ACPI_DMT_UINT24, ACPI_TCPA_SERVER_OFFSET (Reserved2[0]), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (GlobalInterrupt), "Global Interrupt", 0},
{ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (Address), "Address", 0},
{ACPI_DMT_UINT32, ACPI_TCPA_SERVER_OFFSET (Reserved3), "Reserved", 0},
{ACPI_DMT_GAS, ACPI_TCPA_SERVER_OFFSET (ConfigAddress), "Configuration Address", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Group), "Pci Group", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Bus), "Pci Bus", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Device), "Pci Device", 0},
{ACPI_DMT_UINT8, ACPI_TCPA_SERVER_OFFSET (Function), "Pci Function", 0},
ACPI_DMT_TERMINATOR
};


/*******************************************************************************
*
Expand Down
4 changes: 4 additions & 0 deletions source/compiler/dtcompiler.h
Expand Up @@ -608,6 +608,10 @@ ACPI_STATUS
DtCompileStao (
void **PFieldList);

ACPI_STATUS
DtCompileTcpa (
void **PFieldList);

ACPI_STATUS
DtCompileUefi (
void **PFieldList);
Expand Down
71 changes: 71 additions & 0 deletions source/compiler/dttable.c
Expand Up @@ -3192,6 +3192,77 @@ DtCompileStao (
}


/******************************************************************************
*
* FUNCTION: DtCompileTcpa
*
* PARAMETERS: PFieldList - Current field list pointer
*
* RETURN: Status
*
* DESCRIPTION: Compile TCPA.
*
*****************************************************************************/

ACPI_STATUS
DtCompileTcpa (
void **List)
{
DT_FIELD **PFieldList = (DT_FIELD **) List;
DT_SUBTABLE *Subtable;
ACPI_TABLE_TCPA_HDR *TcpaHeader;
DT_SUBTABLE *ParentTable;
ACPI_STATUS Status;


/* Compile the main table */

Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaHdr,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
{
return (Status);
}

ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);

/*
* Examine the PlatformClass field to determine the table type.
* Either a client or server table. Only one.
*/
TcpaHeader = ACPI_CAST_PTR (ACPI_TABLE_TCPA_HDR, ParentTable->Buffer);

switch (TcpaHeader->PlatformClass)
{
case ACPI_TCPA_CLIENT_TABLE:

Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaClient,
&Subtable, TRUE);
break;

case ACPI_TCPA_SERVER_TABLE:

Status = DtCompileTable (PFieldList, AcpiDmTableInfoTcpaServer,
&Subtable, TRUE);
break;

default:

AcpiOsPrintf ("\n**** Unknown TCPA Platform Class 0x%X\n",
TcpaHeader->PlatformClass);
Status = AE_ERROR;
break;
}


ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);

return (Status);
}


/******************************************************************************
*
* FUNCTION: DtGetGenericTableInfo
Expand Down
18 changes: 12 additions & 6 deletions source/compiler/dttemplate.h
Expand Up @@ -1216,13 +1216,19 @@ const unsigned char TemplateStao[] =

const unsigned char TemplateTcpa[] =
{
0x54,0x43,0x50,0x41,0x32,0x00,0x00,0x00, /* 00000000 "TCPA2..." */
0x01,0x67,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".gINTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x54,0x43,0x50,0x41,0x64,0x00,0x00,0x00, /* 00000000 "TCPAd..." */
0x02,0xFF,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x80,0x31,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 ".1..INTL" */
0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x00,0x00 /* 00000030 ".." */
0x19,0x06,0x15,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */
0x11,0x00,0xFF,0xEE,0xDD,0xCC,0xBB,0xAA, /* 00000030 "........" */
0x02,0x01,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000040 "..... .." */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */
0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x03, /* 00000050 "..... .." */
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */
0x01,0x01,0x01,0x01 /* 00000060 "...." */
};

const unsigned char TemplateTpm2[] =
Expand Down
8 changes: 7 additions & 1 deletion source/include/acdisasm.h
Expand Up @@ -471,7 +471,9 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[];
Expand Down Expand Up @@ -666,6 +668,10 @@ void
AcpiDmDumpStao (
ACPI_TABLE_HEADER *Table);

void
AcpiDmDumpTcpa (
ACPI_TABLE_HEADER *Table);

void
AcpiDmDumpVrtc (
ACPI_TABLE_HEADER *Table);
Expand Down
20 changes: 16 additions & 4 deletions source/include/actbl2.h
Expand Up @@ -1447,23 +1447,35 @@ enum AcpiSpmiInterfaceTypes
* December 19, 2014
*
* NOTE: There are two versions of the table with the same signature --
* the client version and the server version.
* the client version and the server version. The common PlatformClass
* field is used to differentiate the two types of tables.
*
******************************************************************************/

typedef struct acpi_table_tcpa_client
typedef struct acpi_table_tcpa_hdr
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT16 PlatformClass;

} ACPI_TABLE_TCPA_HDR;

/*
* Values for PlatformClass above.
* This is how the client and server subtables are differentiated
*/
#define ACPI_TCPA_CLIENT_TABLE 0
#define ACPI_TCPA_SERVER_TABLE 1


typedef struct acpi_table_tcpa_client
{
UINT32 MinimumLogLength; /* Minimum length for the event log area */
UINT64 LogAddress; /* Address of the event log area */

} ACPI_TABLE_TCPA_CLIENT;

typedef struct acpi_table_tcpa_server
{
ACPI_TABLE_HEADER Header; /* Common ACPI table header */
UINT16 PlatformClass;
UINT16 Reserved;
UINT64 MinimumLogLength; /* Minimum length for the event log area */
UINT64 LogAddress; /* Address of the event log area */
Expand Down
2 changes: 2 additions & 0 deletions source/tools/acpisrc/astable.c
Expand Up @@ -742,6 +742,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_SRAT_MEM_AFFINITY", SRC_TYPE_STRUCT},
{"ACPI_SRAT_X2APIC_CPU_AFFINITY", SRC_TYPE_STRUCT},
{"ACPI_SRAT_GICC_AFFINITY", SRC_TYPE_STRUCT},
{"ACPI_TABLE_TCPA_CLIENT", SRC_TYPE_STRUCT},
{"ACPI_TABLE_TCPA_SERVER", SRC_TYPE_STRUCT},
{"ACPI_TPM2_CONTROL", SRC_TYPE_STRUCT},
{"ACPI_WDAT_ENTRY", SRC_TYPE_STRUCT},

Expand Down

0 comments on commit 55fa955

Please sign in to comment.