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 v2 3/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xF
Date: Fri, 1 Jul 2022 10:32:36 -0600	[thread overview]
Message-ID: <7e64a840aeaa98da9ea1f6257c808b56040c8cd0.1656693003.git.jbrasen@nvidia.com> (raw)
In-Reply-To: <cover.1656693003.git.jbrasen@nvidia.com>

Add support for PCIe devices with UID > 0xF.
This is done by using the next value in the name so
PCI5, PC26, etc

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 .../Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c   | 11 +++++++----
 .../Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h   |  2 +-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index 80776ceb79..9f785ca5ac 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -824,7 +824,10 @@ GeneratePciDevice (
 
   // Write the name of the PCI device.
   CopyMem (AslName, "PCIx", AML_NAME_SEG_SIZE + 1);
-  AslName[AML_NAME_SEG_SIZE - 1] = AsciiFromHex (Uid);
+  AslName[AML_NAME_SEG_SIZE - 1] = AsciiFromHex (Uid & 0xF);
+  if (Uid > 0xF) {
+    AslName[AML_NAME_SEG_SIZE - 2] = AsciiFromHex ((Uid >> 4) & 0xF);
+  }
 
   // ASL: Device (PCIx) {}
   Status = AmlCodeGenDevice (AslName, ScopeNode, &PciNode);
@@ -1060,13 +1063,13 @@ BuildSsdtPciTableEx (
   for (Index = 0; Index < PciCount; Index++) {
     if (PcdGetBool (PcdPciUseSegmentAsUid)) {
       Uid = PciInfo[Index].PciSegmentGroupNumber;
-      if (Uid > MAX_PCI_ROOT_COMPLEXES_SUPPORTED) {
+      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",
+          " Greater than maximum supported value = %d.\n",
           Uid,
-          MAX_PCI_ROOT_COMPLEXES_SUPPORTED
+          MAX_PCI_ROOT_COMPLEXES_SUPPORTED - 1
           ));
         return EFI_INVALID_PARAMETER;
       }
diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h
index 59a0d601a3..515a3e1785 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.h
@@ -31,7 +31,7 @@
         Corresponding changes would be needed to support the Name and
         UID fields describing the Pci root complexes.
 */
-#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED  16
+#define MAX_PCI_ROOT_COMPLEXES_SUPPORTED  256
 
 // _SB scope of the AML namespace.
 #define SB_SCOPE  "\\_SB_"
-- 
2.25.1


  parent reply	other threads:[~2022-07-01 16:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 16:32 [PATCH v2 0/4] DynamicTablesPkg: Pcie generation updates Jeff Brasen
2022-07-01 16:32 ` [PATCH v2 1/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value Jeff Brasen
2022-07-01 16:32 ` [PATCH v2 2/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Allow use of segment number as UID Jeff Brasen
2022-07-01 16:32 ` Jeff Brasen [this message]
2022-07-01 16:32 ` [PATCH v2 4/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Add support for override protocol Jeff Brasen
2022-07-07 16:59 ` [PATCH v2 0/4] DynamicTablesPkg: Pcie generation updates Jeff Brasen
2022-07-08  7:31   ` PierreGondois
2022-07-08 15:13     ` 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=7e64a840aeaa98da9ea1f6257c808b56040c8cd0.1656693003.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