[edk2-devel] [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value

Jeff Brasen via groups.io posted 3 patches 3 years, 7 months ago
[edk2-devel] [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Posted by Jeff Brasen via groups.io 3 years, 7 months ago
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





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91192): https://edk2.groups.io/g/devel/message/91192
Mute This Topic: https://groups.io/mt/92260870/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH v3 1/3] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Posted by Sami Mujawar 3 years, 6 months ago
Hi Jeff,

Thank you for this fix.
This patch looks good to me.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>

Regards,

Sami Mujawar


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#91536): https://edk2.groups.io/g/devel/message/91536
Mute This Topic: https://groups.io/mt/92260870/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-