public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chris Jones" <christopher.jones@arm.com>
To: <devel@edk2.groups.io>
Cc: <ray.ni@intel.com>, <zhichao.gao@intel.com>,
	<Sami.Mujawar@arm.com>, <Ben.Adderson@arm.com>,
	<Akanksha.Jain2@arm.com>, <Matteo.Carlini@arm.com>, <nd@arm.com>
Subject: [PATCH v1 2/2] ShellPkg: Add Type 5 PCC Subspace Structure parser
Date: Fri, 13 Aug 2021 18:02:45 +0100	[thread overview]
Message-ID: <20210813170245.4318-3-christopher.jones@arm.com> (raw)
In-Reply-To: <20210813170245.4318-1-christopher.jones@arm.com>

Bugzilla: 3563 (https://bugzilla.tianocore.org/show_bug.cgi?id=3563)

Update the Acpiview PCCT parser with the HW Registers based
Communications Subspace Structure (Type 5) as defined in Section 14.1.7
of the ACPI 6.4 specification.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
---
 ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c | 58 +++++++++++++++++++-
 1 file changed, 55 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
index 7d3a2dd10dc928265bad3711e929d96c1ed40b1d..6beee70b23a3b32992efa0edac48fe236591b9f5 100644
--- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c
@@ -77,7 +77,7 @@ ValidateRangeLength8 (
 }
 
 /**
-  This function validates address space for type 0 structure.
+  This function validates address space for Memory/IO GAS.
 
   @param [in] Ptr     Pointer to the start of the field data.
   @param [in] Context Pointer to context specific information e.g. this
@@ -86,7 +86,7 @@ ValidateRangeLength8 (
 STATIC
 VOID
 EFIAPI
-ValidatePccType0Gas (
+ValidatePccMemoryIoGas (
   IN UINT8* Ptr,
   IN VOID*  Context
   )
@@ -274,7 +274,7 @@ STATIC CONST ACPI_PARSER PccSubspaceType0Parser[] = {
   {L"Base Address", 8, 8, L"0x%lx", NULL, NULL, NULL, NULL},
   {L"Memory Range Length", 8, 16, L"0x%lx", NULL, NULL, ValidateRangeLength8,
     NULL},
-  {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccType0Gas,
+  {L"Doorbell Register", 12, 24, NULL, DumpGas, NULL, ValidatePccMemoryIoGas,
     NULL},
   {L"Doorbell Preserve", 8, 36, L"0x%lx", NULL, NULL, NULL, NULL},
   {L"Doorbell Write", 8, 44, L"0x%lx", NULL, NULL, NULL, NULL},
@@ -367,6 +367,29 @@ STATIC CONST ACPI_PARSER PccSubspaceType3Parser[] = {
   {L"Error Status Mask", 8, 156, L"0x%lx", NULL, NULL, NULL, NULL},
 };
 
+/**
+  An ACPI_PARSER array describing the HW Registers based Communications
+  Subspace Structure - Type 5
+*/
+STATIC CONST ACPI_PARSER PccSubspaceType5Parser[] = {
+  PCC_SUBSPACE_HEADER (),
+  {L"Version", 2, 2, L"0x%x", NULL, NULL, NULL, NULL},
+  {L"Base Address", 8, 4, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Shared Memory Range Length", 8, 12, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Doorbell Register", 12, 20, NULL, DumpGas, NULL,
+    ValidatePccMemoryIoGas, NULL},
+  {L"Doorbell Preserve", 8, 32, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Doorbell Write", 8, 40, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Command Complete Check Register", 12, 48, NULL, DumpGas, NULL,
+    ValidatePccMemoryIoGas, NULL},
+  {L"Command Complete Check Mask", 8, 60, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Error Status Register", 12, 68, NULL, DumpGas, NULL,
+    ValidatePccMemoryIoGas, NULL},
+  {L"Error Status Mask", 8, 80, L"0x%lx", NULL, NULL, NULL, NULL},
+  {L"Nominal Latency", 4, 88, L"0x%x", NULL, NULL, NULL, NULL},
+  {L"Minimum Request Turnaround Time", 4, 92, L"0x%x", NULL, NULL, NULL, NULL}
+};
+
 /**
   This function parses the PCC Subspace type 0.
 
@@ -482,6 +505,29 @@ DumpPccSubspaceType4 (
     );
 }
 
+/**
+  This function parses the PCC Subspace type 5.
+
+  @param [in] Ptr     Pointer to the start of the Subspace Structure.
+  @param [in] Length  Length of the Subspace Structure.
+**/
+STATIC
+VOID
+DumpPccSubspaceType5 (
+  IN UINT8* Ptr,
+  IN UINT8  Length
+  )
+{
+  ParseAcpi (
+    TRUE,
+    2,
+    "Subspace Type 5",
+    Ptr,
+    Length,
+    PARSER_PARAMS (PccSubspaceType5Parser)
+    );
+}
+
 /**
   This function parses the ACPI PCCT table including its sub-structures
   of type 0 through 4.
@@ -593,6 +639,12 @@ ParseAcpiPcct (
           *PccSubspaceLength
           );
         break;
+      case EFI_ACPI_6_4_PCCT_SUBSPACE_TYPE_5_HW_REGISTERS_COMMUNICATIONS:
+        DumpPccSubspaceType5 (
+          PccSubspacePtr,
+          *PccSubspaceLength
+          );
+        break;
       default:
         IncrementErrorCount ();
         Print (
-- 
Guid("CE165669-3EF3-493F-B85D-6190EE5B9759")


  parent reply	other threads:[~2021-08-13 17:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-13 17:02 [PATCH v1 0/2] Support ACPI 6.4 in Acpiview PCCT parser Chris Jones
2021-08-13 17:02 ` [PATCH v1 1/2] ShellPkg: Update Acpiview PCCT parser to ACPI 6.4 Chris Jones
2021-08-13 17:02 ` Chris Jones [this message]
2021-08-18 10:32 ` [PATCH v1 0/2] Support ACPI 6.4 in Acpiview PCCT parser Sami Mujawar
2021-09-08 14:28   ` Chris Jones
2021-09-09  2:00 ` Gao, Zhichao

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=20210813170245.4318-3-christopher.jones@arm.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