Skip to content
Snippets Groups Projects
Commit 4ea5243a authored by Stephen Warren's avatar Stephen Warren Committed by Simon Glass
Browse files

fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT


PCI addresses are always represented as 3 cells in DT. (one cell for bus
and device, and two cells for a 64-bit addres). This does not vary based
on either the physical address size of the CPU, nor any #address-cells
property in DT (or more precisely, #address-cells must be set to 3 in any
PCIe controller's node).

Fix fdtdec_get_pci_addr() to use conversion functions that operate on
(fixed) cell-sized data rather than (varying) physical-address-sized
data, so that the function works on 64-bit systems.

Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarSimon Glass <sjg@chromium.org>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
parent 545dfd10
No related branches found
No related tags found
No related merge requests found
...@@ -219,13 +219,13 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type, ...@@ -219,13 +219,13 @@ int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type,
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
debug("pci address #%d: %08lx %08lx %08lx\n", i, debug("pci address #%d: %08lx %08lx %08lx\n", i,
(ulong)fdt_addr_to_cpu(cell[0]), (ulong)fdt32_to_cpu(cell[0]),
(ulong)fdt_addr_to_cpu(cell[1]), (ulong)fdt32_to_cpu(cell[1]),
(ulong)fdt_addr_to_cpu(cell[2])); (ulong)fdt32_to_cpu(cell[2]));
if ((fdt_addr_to_cpu(*cell) & type) == type) { if ((fdt32_to_cpu(*cell) & type) == type) {
addr->phys_hi = fdt_addr_to_cpu(cell[0]); addr->phys_hi = fdt32_to_cpu(cell[0]);
addr->phys_mid = fdt_addr_to_cpu(cell[1]); addr->phys_mid = fdt32_to_cpu(cell[1]);
addr->phys_lo = fdt_addr_to_cpu(cell[2]); addr->phys_lo = fdt32_to_cpu(cell[1]);
break; break;
} else { } else {
cell += (FDT_PCI_ADDR_CELLS + cell += (FDT_PCI_ADDR_CELLS +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment