summaryrefslogtreecommitdiff
path: root/source/compiler
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2022-03-25 09:20:39 -0700
committerGitHub <noreply@github.com>2022-03-25 09:20:39 -0700
commitc7b6dd94b19ec1fcc4d6eba156a283ab414a39b2 (patch)
treea52abce8eb432ed3093772e3a95aede538aa49a6 /source/compiler
parent504d69a9f353f68b00e82f6583ffaa2e0181815a (diff)
parent002165ecc0a3dc703bb24c789aaa02fdada01675 (diff)
downloadacpica-c7b6dd94b19ec1fcc4d6eba156a283ab414a39b2.tar.gz
Merge pull request #758 from bwicaksononv/apmt
Add support for ARM Performance Monitoring Unit Table.
Diffstat (limited to 'source/compiler')
-rw-r--r--source/compiler/dtcompiler.h5
-rw-r--r--source/compiler/dttable1.c96
-rw-r--r--source/compiler/dttemplate.h23
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..." */