Re: [edk2-devel] [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser
Merged as 11ce7a2de754..1fd8d08970a9 Thanks. Regards, Sami Mujawar -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97318): https://edk2.groups.io/g/devel/message/97318 Mute This Topic: https://groups.io/mt/94808914/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser
Reviewed-by: Zhichao Gao Thanks, Zhichao > -Original Message- > From: Jeff Brasen > Sent: Saturday, November 5, 2022 12:05 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D ; Gao, Liming > ; Liu, Zhiguang ; Gao, > Zhichao ; Ni, Ray ; n...@arm.com; > sami.muja...@arm.com; Jeff Brasen > Subject: [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser > > Add a new parser for the Arm Performance Monitoring Unit Table. > > The APMT table describes the properties of PMU support > > implemented by components in an Arm-based system. > > > > Signed-off-by: Jeff Brasen > > --- > > .../UefiShellAcpiViewCommandLib/AcpiParser.h | 21 > > .../Parsers/Apmt/ApmtParser.c | 106 ++ > > .../UefiShellAcpiViewCommandLib.c | 1 + > > .../UefiShellAcpiViewCommandLib.inf | 1 + > > .../UefiShellAcpiViewCommandLib.uni | 1 + > > 5 files changed, 130 insertions(+) > > create mode 100644 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser. > c > > > > diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > index db8c88f6df..6a1de4e12b 100644 > > --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h > > @@ -531,6 +531,27 @@ ParseAcpiAest ( > >IN UINT8AcpiTableRevision > >); > > > > +/** > > + This function parses the ACPI APMT table. > > + When trace is enabled this function parses the APMT table and > > + traces the ACPI table fields. > > + > > + This function also performs validation of the ACPI table fields. > > + > > + @param [in] Trace If TRUE, trace the ACPI fields. > > + @param [in] PtrPointer to the start of the buffer. > > + @param [in] AcpiTableLengthLength of the ACPI table. > > + @param [in] AcpiTableRevision Revision of the ACPI table. > > +**/ > > +VOID > > +EFIAPI > > +ParseAcpiApmt ( > > + IN BOOLEAN Trace, > > + IN UINT8*Ptr, > > + IN UINT32 AcpiTableLength, > > + IN UINT8AcpiTableRevision > > + ); > > + > > /** > >This function parses the ACPI BGRT table. > >When trace is enabled this function parses the BGRT table and > > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtPars > er.c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtPars > er.c > > new file mode 100644 > > index 00..ad64adbb0a > > --- /dev/null > > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtPars > er.c > > @@ -0,0 +1,106 @@ > > +/** @file > > + APMT table parser > > + > > + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. > > + Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > + @par Reference(s): > > +- ACPI 6.2 Specification - Errata A, September 2017 > > +**/ > > + > > +#include > > +#include > > +#include > > +#include "AcpiParser.h" > > +#include "AcpiTableParser.h" > > + > > +// Local variables > > +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; > > +STATIC CONST UINT16 *NodeLength; > > + > > +/** > > + An ACPI_PARSER array describing the ACPI APMT Table. > > +**/ > > +STATIC CONST ACPI_PARSER ApmtParser[] = { > > + PARSE_ACPI_HEADER () > > +}; > > + > > +/** > > + An ACPI_PARSER array describing the ACPI Arm PMU Node. > > +**/ > > +STATIC CONST ACPI_PARSER ArmPmuNodeParser[] = { > > + { L"Length", 2, 0, L"0x%x", NULL, (VOID > **), NULL, > NULL }, > > + { L"Node flags", 1, 2, L"0x%x", NULL, NULL, > NULL, NULL }, > > + { L"Node type",1, 3, L"0x%x", NULL, NULL, > NULL, NULL }, > > + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, > NULL, NULL }, > > + { L"Node Instance primary",8, 8, L"0x%lx", NULL, NULL, > NULL, > NULL }, > > + { L"Node Instance secondary", 4, 16, L"0x%x", NULL, NULL, > NULL, > NULL }, > > + { L"Base address 0", 8, 20, L"0x%lx", NULL, NULL, > NULL, NULL }, > > + { L"Base address 1", 8, 28, L"0x%lx", NULL, NULL, > NULL, NULL }, > > + { L"Overflow interrupt", 4, 36, L"0x%x", NULL, NULL, > NULL, > NULL }, > > + { L"Reserved1",4, 40, L"0x%x", NULL, NULL, > NULL, NULL }, > > + { L"Overflow interrupt flags", 4, 44, L"0x%x", NULL, NULL, > NULL, > NULL }, > > + { L"Processor affinity", 4, 48, L"0x%x", NULL, NULL, > NULL, > NULL }, > > + { L"Implementation ID",4, 52, L"0x%x", NULL, NULL, > NULL, > NULL } > > +}; > > + > > +/** > > + This function parses
[edk2-devel] [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser
Add a new parser for the Arm Performance Monitoring Unit Table. The APMT table describes the properties of PMU support implemented by components in an Arm-based system. Signed-off-by: Jeff Brasen --- .../UefiShellAcpiViewCommandLib/AcpiParser.h | 21 .../Parsers/Apmt/ApmtParser.c | 106 ++ .../UefiShellAcpiViewCommandLib.c | 1 + .../UefiShellAcpiViewCommandLib.inf | 1 + .../UefiShellAcpiViewCommandLib.uni | 1 + 5 files changed, 130 insertions(+) create mode 100644 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index db8c88f6df..6a1de4e12b 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -531,6 +531,27 @@ ParseAcpiAest ( IN UINT8AcpiTableRevision ); +/** + This function parses the ACPI APMT table. + When trace is enabled this function parses the APMT table and + traces the ACPI table fields. + + This function also performs validation of the ACPI table fields. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] PtrPointer to the start of the buffer. + @param [in] AcpiTableLengthLength of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiApmt ( + IN BOOLEAN Trace, + IN UINT8*Ptr, + IN UINT32 AcpiTableLength, + IN UINT8AcpiTableRevision + ); + /** This function parses the ACPI BGRT table. When trace is enabled this function parses the BGRT table and diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c new file mode 100644 index 00..ad64adbb0a --- /dev/null +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Apmt/ApmtParser.c @@ -0,0 +1,106 @@ +/** @file + APMT table parser + + Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. + Copyright (c) 2017 - 2018, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Reference(s): +- ACPI 6.2 Specification - Errata A, September 2017 +**/ + +#include +#include +#include +#include "AcpiParser.h" +#include "AcpiTableParser.h" + +// Local variables +STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; +STATIC CONST UINT16 *NodeLength; + +/** + An ACPI_PARSER array describing the ACPI APMT Table. +**/ +STATIC CONST ACPI_PARSER ApmtParser[] = { + PARSE_ACPI_HEADER () +}; + +/** + An ACPI_PARSER array describing the ACPI Arm PMU Node. +**/ +STATIC CONST ACPI_PARSER ArmPmuNodeParser[] = { + { L"Length", 2, 0, L"0x%x", NULL, (VOID **), NULL, NULL }, + { L"Node flags", 1, 2, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Node type",1, 3, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Identifier", 4, 4, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Node Instance primary",8, 8, L"0x%lx", NULL, NULL, NULL, NULL }, + { L"Node Instance secondary", 4, 16, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Base address 0", 8, 20, L"0x%lx", NULL, NULL, NULL, NULL }, + { L"Base address 1", 8, 28, L"0x%lx", NULL, NULL, NULL, NULL }, + { L"Overflow interrupt", 4, 36, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Reserved1",4, 40, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Overflow interrupt flags", 4, 44, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Processor affinity", 4, 48, L"0x%x", NULL, NULL, NULL, NULL }, + { L"Implementation ID",4, 52, L"0x%x", NULL, NULL, NULL, NULL } +}; + +/** + This function parses the ACPI APMT table. + When trace is enabled this function parses the APMT table and + traces the ACPI table fields. + + This function also performs validation of the ACPI table fields. + + @param [in] Trace If TRUE, trace the ACPI fields. + @param [in] PtrPointer to the start of the buffer. + @param [in] AcpiTableLengthLength of the ACPI table. + @param [in] AcpiTableRevision Revision of the ACPI table. +**/ +VOID +EFIAPI +ParseAcpiApmt ( + IN BOOLEAN Trace, + IN UINT8*Ptr, + IN UINT32 AcpiTableLength, + IN UINT8AcpiTableRevision + ) +{ + UINT32 Offset; + + if (!Trace) { +return; + } + + ParseAcpi ( +Trace, +0, +"APMT", +Ptr, +AcpiTableLength, +PARSER_PARAMS (ApmtParser) +); +