diff options
author | Besar Wicaksono <bwicaksono@nvidia.com> | 2022-01-25 20:49:32 -0600 |
---|---|---|
committer | Besar Wicaksono <bwicaksono@nvidia.com> | 2022-03-08 18:18:59 -0600 |
commit | 002165ecc0a3dc703bb24c789aaa02fdada01675 (patch) | |
tree | e16481b2cb574b85fda6bf8a89a616b00f756591 /source/compiler | |
parent | 0914618b553d6f3366e568409cebf2656891ca69 (diff) | |
download | acpica-002165ecc0a3dc703bb24c789aaa02fdada01675.tar.gz |
Add support for ARM Performance Monitoring Unit Table.
The specification of this table is described in
"ARM Performance Monitoring Unit Architecture 1.0 Platform Design Document"
ARM DEN0117.
This patch adds the necessary types and support for
compiling/disassembling APMT.
Signed-off-by: Besar Wicaksono <bwicaksono@nvidia.com>
Diffstat (limited to 'source/compiler')
-rw-r--r-- | source/compiler/dtcompiler.h | 5 | ||||
-rw-r--r-- | source/compiler/dttable1.c | 96 | ||||
-rw-r--r-- | source/compiler/dttemplate.h | 23 |
3 files changed, 124 insertions, 0 deletions
diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 7dad85e80..3b3683cc6 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -570,6 +570,10 @@ DtCompileAest ( void **PFieldList); ACPI_STATUS +DtCompileApmt ( + void **PFieldList); + +ACPI_STATUS DtCompileAsf ( void **PFieldList); @@ -763,6 +767,7 @@ DtGetGenericTableInfo ( extern const unsigned char TemplateAest[]; extern const unsigned char TemplateAgdi[]; +extern const unsigned char TemplateApmt[]; extern const unsigned char TemplateAsf[]; extern const unsigned char TemplateBoot[]; extern const unsigned char TemplateBdat[]; diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index 66348535e..1df24d49f 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -389,6 +389,102 @@ DtCompileAest ( /****************************************************************************** * + * FUNCTION: DtCompileApmt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile APMT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileApmt ( + void **List) +{ + ACPI_STATUS Status; + ACPI_TABLE_HEADER *Header; + ACPI_APMT_NODE *ApmtNode; + ACPI_APMT_NODE *PeerApmtNode; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *PeerSubtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD**)List; + DT_FIELD *SubtableStart; + UINT32 CurLength; + char MsgBuffer[64] = ""; + + ParentTable = DtPeekSubtable(); + + Header = ACPI_CAST_PTR(ACPI_TABLE_HEADER, ParentTable->Buffer); + + CurLength = sizeof(ACPI_TABLE_HEADER); + + /* Walk the parse tree */ + + while (*PFieldList) + { + /* APMT Node Subtable */ + + SubtableStart = *PFieldList; + + Status = DtCompileTable(PFieldList, AcpiDmTableInfoApmtNode, &Subtable); + + if (ACPI_FAILURE(Status)) + { + return (Status); + } + + ApmtNode = ACPI_CAST_PTR(ACPI_APMT_NODE, Subtable->Buffer); + + if (ApmtNode->Length != sizeof(ACPI_APMT_NODE)) + { + DtFatal(ASL_MSG_INVALID_LENGTH, SubtableStart, "APMT"); + return (AE_ERROR); + } + + if (ApmtNode->Type >= ACPI_APMT_NODE_TYPE_COUNT) + { + snprintf(MsgBuffer, 64, "Node Type : 0x%X", ApmtNode->Type); + DtFatal(ASL_MSG_INVALID_TYPE, SubtableStart, MsgBuffer); + return (AE_ERROR); + } + + PeerSubtable = DtGetNextSubtable(ParentTable, NULL); + + /* Validate the node id needs to be unique. */ + while(PeerSubtable) + { + PeerApmtNode = ACPI_CAST_PTR(ACPI_APMT_NODE, PeerSubtable->Buffer); + if (PeerApmtNode->Id == ApmtNode->Id) + { + snprintf(MsgBuffer, 64, "Node Id : 0x%X existed", ApmtNode->Id); + DtFatal(ASL_MSG_DUPLICATE_ITEM, SubtableStart, MsgBuffer); + return (AE_ERROR); + } + + PeerSubtable = DtGetNextSubtable(ParentTable, PeerSubtable); + } + + CurLength += ApmtNode->Length; + + DtInsertSubtable(ParentTable, Subtable); + } + + if (Header->Length != CurLength) + { + snprintf(MsgBuffer, 64, " - APMT Length : %u (expected: %u)", + Header->Length, CurLength); + DtFatal(ASL_MSG_INVALID_LENGTH, NULL, MsgBuffer); + return (AE_ERROR); + } + + return (AE_OK); +} + +/****************************************************************************** + * * FUNCTION: DtCompileAsf * * PARAMETERS: List - Current field list pointer diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 08c76f6cb..9c46e33b2 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -259,6 +259,29 @@ const unsigned char TemplateAgdi[] = 0x01,0x00,0x00,0x40,0x00,0x00,0x00,0x00 /* 00000028 "...@...." */ }; +const unsigned char TemplateApmt[] = +{ + 0x41,0x50,0x4D,0x54,0x94,0x00,0x00,0x00, /* 00000000 "APMT...." */ + 0x00,0x79,0x4E,0x56,0x49,0x44,0x49,0x41, /* 00000008 ".yNVIDIA" */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x17,0x12,0x21,0x20,0x38,0x00,0x04,0x03, /* 00000020 "..! 8..." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 ". ......" */ + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 ". ......" */ + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000050 "........" */ + 0x6B,0x03,0x00,0x00,0x38,0x00,0x06,0x03, /* 00000058 "k...8..." */ + 0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 ".0......" */ + 0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 ".0......" */ + 0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000088 "........" */ + 0x6B,0x03,0x00,0x00 /* 00000090 "k..." */ +}; + const unsigned char TemplateAsf[] = { 0x41,0x53,0x46,0x21,0x72,0x00,0x00,0x00, /* 00000000 "ASF!r..." */ |