]> git.proxmox.com Git - mirror_edk2.git/commitdiff
DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
authorJeff Brasen <jbrasen@nvidia.com>
Fri, 8 Jul 2022 20:59:01 +0000 (14:59 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 19 Jul 2022 16:15:35 +0000 (16:15 +0000)
The translation value in ACPI should be the difference between the CPU and PCIe address.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c

index 626e53d70205159ebbf75ea3fe8887a04c2b4b04..3c20d928ce8cad3ed545bda4e3804410a53cb8ac 100644 (file)
@@ -540,6 +540,7 @@ GeneratePciCrs (
   UINT32                       RefCount;\r
   CM_ARM_PCI_ADDRESS_MAP_INFO  *AddrMapInfo;\r
   AML_OBJECT_NODE_HANDLE       CrsNode;\r
+  BOOLEAN                      IsPosDecode;\r
 \r
   ASSERT (Generator != NULL);\r
   ASSERT (CfgMgrProtocol != NULL);\r
@@ -609,6 +610,11 @@ GeneratePciCrs (
     }\r
 \r
     Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress);\r
+    if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) {\r
+      IsPosDecode = TRUE;\r
+    } else {\r
+      IsPosDecode = FALSE;\r
+    }\r
 \r
     switch (AddrMapInfo->SpaceCode) {\r
       case PCI_SS_IO:\r
@@ -616,12 +622,12 @@ GeneratePciCrs (
                    FALSE,\r
                    TRUE,\r
                    TRUE,\r
-                   TRUE,\r
+                   IsPosDecode,\r
                    3,\r
                    0,\r
                    AddrMapInfo->PciAddress,\r
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,\r
-                   Translation ? AddrMapInfo->CpuAddress : 0,\r
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,\r
                    AddrMapInfo->AddressSize,\r
                    0,\r
                    NULL,\r
@@ -635,7 +641,7 @@ GeneratePciCrs (
       case PCI_SS_M32:\r
         Status = AmlCodeGenRdDWordMemory (\r
                    FALSE,\r
-                   TRUE,\r
+                   IsPosDecode,\r
                    TRUE,\r
                    TRUE,\r
                    TRUE,\r
@@ -643,7 +649,7 @@ GeneratePciCrs (
                    0,\r
                    AddrMapInfo->PciAddress,\r
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,\r
-                   Translation ? AddrMapInfo->CpuAddress : 0,\r
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,\r
                    AddrMapInfo->AddressSize,\r
                    0,\r
                    NULL,\r
@@ -657,7 +663,7 @@ GeneratePciCrs (
       case PCI_SS_M64:\r
         Status = AmlCodeGenRdQWordMemory (\r
                    FALSE,\r
-                   TRUE,\r
+                   IsPosDecode,\r
                    TRUE,\r
                    TRUE,\r
                    TRUE,\r
@@ -665,7 +671,7 @@ GeneratePciCrs (
                    0,\r
                    AddrMapInfo->PciAddress,\r
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,\r
-                   Translation ? AddrMapInfo->CpuAddress : 0,\r
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,\r
                    AddrMapInfo->AddressSize,\r
                    0,\r
                    NULL,\r