public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeff Brasen" <jbrasen@nvidia.com>
To: <devel@edk2.groups.io>
Cc: <Pierre.Gondois@arm.com>, <Sami.Mujawar@arm.com>,
	<Alexei.Fedorov@arm.com>, Jeff Brasen <jbrasen@nvidia.com>
Subject: [PATCH 2/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID
Date: Thu, 30 Jun 2022 09:48:49 -0600	[thread overview]
Message-ID: <cb7ba9fc7a01d3b4190bfc1960f1e764c1be425e.1656603839.git.jbrasen@nvidia.com> (raw)
In-Reply-To: <cover.1656603839.git.jbrasen@nvidia.com>

Add support for selecting to use index or segment number as UID and name.
This allows the path of the nodes to be well known.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 DynamicTablesPkg/DynamicTablesPkg.dec         |  3 +++
 .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c    | 19 ++++++++++++++++++-
 .../Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf |  3 +++
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/DynamicTablesPkg.dec b/DynamicTablesPkg/DynamicTablesPkg.dec
index 9b74c5a671..a890a048be 100644
--- a/DynamicTablesPkg/DynamicTablesPkg.dec
+++ b/DynamicTablesPkg/DynamicTablesPkg.dec
@@ -57,5 +57,8 @@
   # Non BSA Compliant 16550 Serial HID
   gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdNonBsaCompliant16550SerialHid|""|VOID*|0x40000008
 
+  # Use PCI segment numbers as UID
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid|FALSE|BOOLEAN|0x40000009
+
 [Guids]
   gEdkiiDynamicTablesPkgTokenSpaceGuid = { 0xab226e66, 0x31d8, 0x4613, { 0x87, 0x9d, 0xd2, 0xfa, 0xb6, 0x10, 0x26, 0x3c } }
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index f0d15f69a4..85782af380 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -996,6 +996,7 @@ BuildSsdtPciTableEx (
   UINTN                         Index;
   EFI_ACPI_DESCRIPTION_HEADER   **TableList;
   ACPI_PCI_GENERATOR            *Generator;
+  UINT32                        Uid;
 
   ASSERT (This != NULL);
   ASSERT (AcpiTableInfo != NULL);
@@ -1051,13 +1052,29 @@ BuildSsdtPciTableEx (
   *Table = TableList;
 
   for (Index = 0; Index < PciCount; Index++) {
+    if (PcdGetBool (PcdPciUseSegmentAsUid)) {
+      Uid = PciInfo[Index].PciSegmentGroupNumber;
+      if (Uid > MAX_PCI_ROOT_COMPLEXES_SUPPORTED) {
+        DEBUG ((
+          DEBUG_ERROR,
+          "ERROR: SSDT-PCI: Pci root complexes segment number: %d."
+          " Greater than maximum number of Pci root complexes supported = %d.\n",
+          Uid,
+          MAX_PCI_ROOT_COMPLEXES_SUPPORTED
+          ));
+        return EFI_INVALID_PARAMETER;
+      }
+    } else {
+      Uid = Index;
+    }
+
     // Build a SSDT table describing the Pci devices.
     Status = BuildSsdtPciTable (
                Generator,
                CfgMgrProtocol,
                AcpiTableInfo,
                &PciInfo[Index],
-               Index,
+               Uid,
                &TableList[Index]
                );
     if (EFI_ERROR (Status)) {
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
index 283b564801..431e32a777 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieLibArm.inf
@@ -30,3 +30,6 @@
   AcpiHelperLib
   AmlLib
   BaseLib
+
+[Pcd]
+  gEdkiiDynamicTablesPkgTokenSpaceGuid.PcdPciUseSegmentAsUid
-- 
2.25.1


  parent reply	other threads:[~2022-06-30 15:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 15:48 [PATCH 0/4] DynamicTablesPkg: Pcie generation updates Jeff Brasen
2022-06-30 15:48 ` [PATCH 1/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value Jeff Brasen
2022-07-01 12:40   ` PierreGondois
2022-07-01 15:48     ` Jeff Brasen
2022-06-30 15:48 ` Jeff Brasen [this message]
2022-07-01 12:42   ` [PATCH 2/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID PierreGondois
2022-07-01 15:54     ` Jeff Brasen
2022-07-04  8:37       ` PierreGondois
2022-07-08 15:24         ` Jeff Brasen
2022-06-30 15:48 ` [PATCH 3/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xF Jeff Brasen
2022-06-30 15:48 ` [PATCH 4/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Add support for override protocol Jeff Brasen
2022-07-01 12:39   ` PierreGondois
2022-07-01 15:52     ` Jeff Brasen
2022-07-04  8:47       ` PierreGondois
2022-07-08 15:36         ` Jeff Brasen
2022-07-11 15:01           ` PierreGondois
2022-07-11 15:32             ` Jeff Brasen
2022-07-11 17:14               ` PierreGondois
2022-07-11 17:56                 ` Jeff Brasen

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=cb7ba9fc7a01d3b4190bfc1960f1e764c1be425e.1656603839.git.jbrasen@nvidia.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