Skip to content

Commit

Permalink
DynamicTablesPkg: AcpiSsdtPcieLibArm: Correct translation value
Browse files Browse the repository at this point in the history
The translation value in ACPI should be the difference between the CPU and PCIe address.

Signed-off-by: Jeff Brasen <[email protected]>
Reviewed-by: Pierre Gondois <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
  • Loading branch information
jbrasen authored and mergify[bot] committed Jul 19, 2022
1 parent f0064ac commit 6cda306
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -609,19 +610,24 @@ GeneratePciCrs (
}

Translation = (AddrMapInfo->CpuAddress != AddrMapInfo->PciAddress);
if (AddrMapInfo->CpuAddress >= AddrMapInfo->PciAddress) {
IsPosDecode = TRUE;
} else {
IsPosDecode = FALSE;
}

switch (AddrMapInfo->SpaceCode) {
case PCI_SS_IO:
Status = AmlCodeGenRdDWordIo (
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,
Expand All @@ -635,15 +641,15 @@ GeneratePciCrs (
case PCI_SS_M32:
Status = AmlCodeGenRdDWordMemory (
FALSE,
TRUE,
IsPosDecode,
TRUE,
TRUE,
TRUE,
TRUE,
0,
AddrMapInfo->PciAddress,
AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
Translation ? AddrMapInfo->CpuAddress : 0,
Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
AddrMapInfo->AddressSize,
0,
NULL,
Expand All @@ -657,15 +663,15 @@ GeneratePciCrs (
case PCI_SS_M64:
Status = AmlCodeGenRdQWordMemory (
FALSE,
TRUE,
IsPosDecode,
TRUE,
TRUE,
TRUE,
TRUE,
0,
AddrMapInfo->PciAddress,
AddrMapInfo->PciAddress + AddrMapInfo->AddressSize - 1,
Translation ? AddrMapInfo->CpuAddress : 0,
Translation ? AddrMapInfo->CpuAddress - AddrMapInfo->PciAddress : 0,
AddrMapInfo->AddressSize,
0,
NULL,
Expand Down

0 comments on commit 6cda306

Please sign in to comment.