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

Jeff Brasen via groups.io posted 4 patches 3 years, 7 months ago
There is a newer version of this series
[edk2-devel] [PATCH 1/4] 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>
---
 .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
index a34018151f..f0d15f69a4 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
@@ -621,7 +621,7 @@ GeneratePciCrs (
                    0,
                    AddrMapInfo->PciAddress,
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
-                   Translation ? AddrMapInfo->CpuAddress : 0,
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
                    AddrMapInfo->AddressSize,
                    0,
                    NULL,
@@ -643,7 +643,7 @@ GeneratePciCrs (
                    0,
                    AddrMapInfo->PciAddress,
                    AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
-                   Translation ? AddrMapInfo->CpuAddress : 0,
+                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
                    AddrMapInfo->AddressSize,
                    0,
                    NULL,
@@ -665,7 +665,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 (#90930): https://edk2.groups.io/g/devel/message/90930
Mute This Topic: https://groups.io/mt/92089318/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Posted by PierreGondois 3 years, 7 months ago
Hello Jeff,
The patch is correct, but there will be an issue if
AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress < 0

AmlCodeGenRdDWordIo() takes an 'IsPosDecode' argment,
would it be possible to set IsPosDecode to FALSE in such case ?

Regards,
Pierre

On 6/30/22 17:48, Jeff Brasen wrote:
> The translation value in ACPI should be the difference between the CPU and PCIe address.
> 
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
>   .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> index a34018151f..f0d15f69a4 100644
> --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c
> @@ -621,7 +621,7 @@ GeneratePciCrs (
>                      0,
>                      AddrMapInfo->PciAddress,
>                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> -                   Translation ? AddrMapInfo->CpuAddress : 0,
> +                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
>                      AddrMapInfo->AddressSize,
>                      0,
>                      NULL,
> @@ -643,7 +643,7 @@ GeneratePciCrs (
>                      0,
>                      AddrMapInfo->PciAddress,
>                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> -                   Translation ? AddrMapInfo->CpuAddress : 0,
> +                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
>                      AddrMapInfo->AddressSize,
>                      0,
>                      NULL,
> @@ -665,7 +665,7 @@ GeneratePciCrs (
>                      0,
>                      AddrMapInfo->PciAddress,
>                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> -                   Translation ? AddrMapInfo->CpuAddress : 0,
> +                   Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
>                      AddrMapInfo->AddressSize,
>                      0,
>                      NULL,


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#90976): https://edk2.groups.io/g/devel/message/90976
Mute This Topic: https://groups.io/mt/92089318/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH 1/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Posted by Jeff Brasen via groups.io 3 years, 7 months ago
Yes, I'll try to add a v2 patch for this shortly.

Thanks,
Jeff

> -----Original Message-----
> From: Pierre Gondois <pierre.gondois@arm.com>
> Sent: Friday, July 1, 2022 6:40 AM
> To: Jeff Brasen <jbrasen@nvidia.com>; devel@edk2.groups.io
> Cc: Sami.Mujawar@arm.com; Alexei.Fedorov@arm.com
> Subject: Re: [PATCH 1/4] DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct
> translation value
> 
> External email: Use caution opening links or attachments
> 
> 
> Hello Jeff,
> The patch is correct, but there will be an issue if
> AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress < 0
> 
> AmlCodeGenRdDWordIo() takes an 'IsPosDecode' argment, would it be
> possible to set IsPosDecode to FALSE in such case ?
> 
> Regards,
> Pierre
> 
> On 6/30/22 17:48, Jeff Brasen wrote:
> > The translation value in ACPI should be the difference between the CPU
> and PCIe address.
> >
> > Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> > ---
> >   .../Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git
> >
> a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera
> t
> > or.c
> >
> b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera
> t
> > or.c
> > index a34018151f..f0d15f69a4 100644
> > ---
> >
> a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera
> t
> > or.c
> > +++
> b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGen
> > +++ erator.c
> > @@ -621,7 +621,7 @@ GeneratePciCrs (
> >                      0,
> >                      AddrMapInfo->PciAddress,
> >                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> > -                   Translation ? AddrMapInfo->CpuAddress : 0,
> > +                   Translation ? AddrMapInfo->CpuAddress -
> > + AddrMapInfo->PciAddress : 0,
> >                      AddrMapInfo->AddressSize,
> >                      0,
> >                      NULL,
> > @@ -643,7 +643,7 @@ GeneratePciCrs (
> >                      0,
> >                      AddrMapInfo->PciAddress,
> >                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> > -                   Translation ? AddrMapInfo->CpuAddress : 0,
> > +                   Translation ? AddrMapInfo->CpuAddress -
> > + AddrMapInfo->PciAddress : 0,
> >                      AddrMapInfo->AddressSize,
> >                      0,
> >                      NULL,
> > @@ -665,7 +665,7 @@ GeneratePciCrs (
> >                      0,
> >                      AddrMapInfo->PciAddress,
> >                      AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
> > -                   Translation ? AddrMapInfo->CpuAddress : 0,
> > +                   Translation ? AddrMapInfo->CpuAddress -
> > + AddrMapInfo->PciAddress : 0,
> >                      AddrMapInfo->AddressSize,
> >                      0,
> >                      NULL,


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