public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Zhichao" <zhichao.gao@intel.com>
To: Jeff Brasen <jbrasen@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	"Ni, Ray" <ray.ni@intel.com>, "nd@arm.com" <nd@arm.com>,
	"sami.mujawar@arm.com" <sami.mujawar@arm.com>
Subject: Re: [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser
Date: Tue, 15 Nov 2022 04:06:48 +0000	[thread overview]
Message-ID: <PH7PR11MB6377B6E8D20F59CC5731D443F6049@PH7PR11MB6377.namprd11.prod.outlook.com> (raw)
In-Reply-To: <83aca131985fd3f88a3df723d05d16535689539b.1667577844.git.jbrasen@nvidia.com>

Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

Thanks,
Zhichao

> -----Original Message-----
> From: Jeff Brasen <jbrasen@nvidia.com>
> Sent: Saturday, November 5, 2022 12:05 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Gao,
> Zhichao <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; nd@arm.com;
> sami.mujawar@arm.com; Jeff Brasen <jbrasen@nvidia.com>
> 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 <jbrasen@nvidia.com>
> 
> ---
> 
>  .../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 UINT8    AcpiTableRevision
> 
>    );
> 
> 
> 
> +/**
> 
> +  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] Ptr                Pointer to the start of the buffer.
> 
> +  @param [in] AcpiTableLength    Length 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 UINT8    AcpiTableRevision
> 
> +  );
> 
> +
> 
>  /**
> 
>    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 0000000000..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 <IndustryStandard/Acpi.h>
> 
> +#include <IndustryStandard/ArmPerformanceMonitoringUnitTable.h>
> 
> +#include <Library/UefiLib.h>
> 
> +#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 (&AcpiHdrInfo)
> 
> +};
> 
> +
> 
> +/**
> 
> +  An ACPI_PARSER array describing the ACPI Arm PMU Node.
> 
> +**/
> 
> +STATIC CONST ACPI_PARSER  ArmPmuNodeParser[] = {
> 
> +  { L"Length",                   2, 0,  L"0x%x",  NULL, (VOID **)&NodeLength, 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] Ptr                Pointer to the start of the buffer.
> 
> +  @param [in] AcpiTableLength    Length 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 UINT8    AcpiTableRevision
> 
> +  )
> 
> +{
> 
> +  UINT32  Offset;
> 
> +
> 
> +  if (!Trace) {
> 
> +    return;
> 
> +  }
> 
> +
> 
> +  ParseAcpi (
> 
> +    Trace,
> 
> +    0,
> 
> +    "APMT",
> 
> +    Ptr,
> 
> +    AcpiTableLength,
> 
> +    PARSER_PARAMS (ApmtParser)
> 
> +    );
> 
> +  Offset = sizeof (EFI_ACPI_DESCRIPTION_HEADER);
> 
> +
> 
> +  while (Offset < AcpiTableLength) {
> 
> +    ParseAcpi (
> 
> +      Trace,
> 
> +      2,
> 
> +      "Arm PMU node",
> 
> +      Ptr + Offset,
> 
> +      (AcpiTableLength - Offset),
> 
> +      PARSER_PARAMS (ArmPmuNodeParser)
> 
> +      );
> 
> +    if (NodeLength == NULL) {
> 
> +      Print (
> 
> +        L"ERROR: Insufficient remaining table buffer length to read the " \
> 
> +        L"Node structure. Length = %d.\n",
> 
> +        (AcpiTableLength - Offset)
> 
> +        );
> 
> +      IncrementErrorCount ();
> 
> +      break;
> 
> +    }
> 
> +
> 
> +    Offset += *NodeLength;
> 
> +  }
> 
> +}
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.c
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.c
> 
> index 09bdddb56e..53f06fc757 100644
> 
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.c
> 
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.c
> 
> @@ -48,6 +48,7 @@ STATIC
> 
>  CONST
> 
>  ACPI_TABLE_PARSER  ParserList[] = {
> 
>    { EFI_ACPI_6_3_ARM_ERROR_SOURCE_TABLE_SIGNATURE,
> ParseAcpiAest },
> 
> +
> { EFI_ACPI_6_4_ARM_PERFORMANCE_MONITORING_UNIT_TABLE_SIGNAT
> URE,                                        ParseAcpiApmt },
> 
>    { EFI_ACPI_6_2_BOOT_GRAPHICS_RESOURCE_TABLE_SIGNATURE,
> ParseAcpiBgrt },
> 
>    { EFI_ACPI_6_2_DEBUG_PORT_2_TABLE_SIGNATURE,
> ParseAcpiDbg2 },
> 
> 
> { EFI_ACPI_6_2_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATUR
> E,
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.inf
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.inf
> 
> index 63fc5a1281..b03ec1a31b 100644
> 
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.inf
> 
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.inf
> 
> @@ -28,6 +28,7 @@
> 
>    AcpiViewConfig.c
> 
>    AcpiViewConfig.h
> 
>    Parsers/Aest/AestParser.c
> 
> +  Parsers/Apmt/ApmtParser.c
> 
>    Parsers/Bgrt/BgrtParser.c
> 
>    Parsers/Dbg2/Dbg2Parser.c
> 
>    Parsers/Dsdt/DsdtParser.c
> 
> diff --git
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.uni
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.uni
> 
> index 393110e0ee..e4a9dd5b40 100644
> 
> ---
> a/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.uni
> 
> +++
> b/ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewComm
> andLib.uni
> 
> @@ -80,6 +80,7 @@
> 
>  "     Extra A. Particular types:\r\n"
> 
>  "       AEST  - Arm Error Source Table\r\n"
> 
>  "       APIC  - Multiple APIC Description Table (MADT)\r\n"
> 
> +"       APMT  - Arm Performance Monitoring Unit Table\r\n"
> 
>  "       BGRT  - Boot Graphics Resource Table\r\n"
> 
>  "       DBG2  - Debug Port Table 2\r\n"
> 
>  "       DSDT  - Differentiated System Description Table\r\n"
> 
> --
> 
> 2.25.1
> 
> 


  reply	other threads:[~2022-11-15  4:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 16:04 [PATCH v2 1/2] MdePkg/IndustryStandard: add definitions for ACPI APMT Jeff Brasen
2022-11-04 16:04 ` [PATCH v2 2/2] ShellPkg/AcpiView: APMT Parser Jeff Brasen
2022-11-15  4:06   ` Gao, Zhichao [this message]
2022-12-13 16:52     ` [edk2-devel] " Sami Mujawar
2022-12-13 16:52 ` [edk2-devel] [PATCH v2 1/2] MdePkg/IndustryStandard: add definitions for ACPI APMT Sami Mujawar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH7PR11MB6377B6E8D20F59CC5731D443F6049@PH7PR11MB6377.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox