public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Jeff Brasen" <jbrasen@nvidia.com>
To: <devel@edk2.groups.io>, <pierre.gondois@arm.com>
Cc: <Sami.Mujawar@arm.com>, <Alexei.Fedorov@arm.com>,
	Jeff Brasen <jbrasen@nvidia.com>
Subject: [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Date: Fri, 8 Jul 2022 14:59:01 -0600	[thread overview]
Message-ID: <9cbfc2c4fdca71cd042cda4dcec1a029e767141a.1657313523.git.jbrasen@nvidia.com> (raw)
In-Reply-To: <cover.1657313523.git.jbrasen@nvidia.com>

The translation value in ACPI should be the difference between the CPU and PCIe address.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
---
 .../Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index a34018151f..d4c5f47b07 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -540,6 +540,7 @@ GeneratePciCrs (
   UINT32                       RefCount;
   CM_ARM_PCI_ADDRESS_MAP_INFO  *AddrMapInfo;
   AML_OBJECT_NODE_HANDLE       CrsNode;
+  BOOLEAN                      IsPosDecode;
 
   ASSERT (Generator != NULL);
   ASSERT (CfgMgrProtocol != NULL);
@@ -609,6 +610,11 @@ GeneratePciCrs (
     }
 
     Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress);
+    if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) {
+      IsPosDecode = TRUE;
+    } else {
+      IsPosDecode = FALSE;
+    }
 
     switch (AddrMapInfo->SpaceCode) {
       case PCI_SS_IO:
@@ -616,12 +622,12 @@ GeneratePciCrs (
                    FALSE,
                    TRUE,
                    TRUE,
-                   TRUE,
+                   IsPosDecode,
                    3,
                    0,
                    AddrMapInfo->PciAddress,
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
-                   Translation ? AddrMapInfo->CpuAddress : 0,
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
                    AddrMapInfo->AddressSize,
                    0,
                    NULL,
@@ -635,7 +641,7 @@ GeneratePciCrs (
       case PCI_SS_M32:
         Status = AmlCodeGenRdDWordMemory (
                    FALSE,
-                   TRUE,
+                   IsPosDecode,
                    TRUE,
                    TRUE,
                    TRUE,
@@ -643,7 +649,7 @@ GeneratePciCrs (
                    0,
                    AddrMapInfo->PciAddress,
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
-                   Translation ? AddrMapInfo->CpuAddress : 0,
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
                    AddrMapInfo->AddressSize,
                    0,
                    NULL,
@@ -657,7 +663,7 @@ GeneratePciCrs (
       case PCI_SS_M64:
         Status = AmlCodeGenRdQWordMemory (
                    FALSE,
-                   TRUE,
+                   IsPosDecode,
                    TRUE,
                    TRUE,
                    TRUE,
@@ -665,7 +671,7 @@ GeneratePciCrs (
                    0,
                    AddrMapInfo->PciAddress,
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
-                   Translation ? AddrMapInfo->CpuAddress : 0,
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
                    AddrMapInfo->AddressSize,
                    0,
                    NULL,
-- 
2.25.1


  reply	other threads:[~2022-07-08 20:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-08 20:59 [PATCH v3 0/3] DynamicTablesPkg: Pcie generation updates Jeff Brasen
2022-07-08 20:59 ` Jeff Brasen [this message]
2022-07-19 15:15   ` [edk2-devel] [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value Sami Mujawar
2022-07-08 20:59 ` [PATCH v3 2/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Support UID > 0xF Jeff Brasen
2022-07-19 15:17   ` [edk2-devel] " Sami Mujawar
2022-07-08 20:59 ` [PATCH v3 3/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Create support library Jeff Brasen
2022-07-19 15:22   ` [edk2-devel] " Sami Mujawar
2022-07-12  7:46 ` [PATCH v3 0/3] DynamicTablesPkg: Pcie generation updates PierreGondois
2022-07-20  8:03   ` [edk2-devel] " 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=9cbfc2c4fdca71cd042cda4dcec1a029e767141a.1657313523.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