Skip to contentSkip to conversation

fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

PATCH New Stephen Warren 3 participants 6 messages Oct 2, 2015 – Oct 26, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

From: Stephen Warren <[email protected]>

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.

---
 lib/fdtdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
lib/fdtdec.c +7 -7
index 1fdb4f0d9ce9..275971d40096 100644
@@ -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++) {
 			debug("pci address #%d: %08lx %08lx %08lx\n", i,
-			      (ulong)fdt_addr_to_cpu(cell[0]),
-			      (ulong)fdt_addr_to_cpu(cell[1]),
-			      (ulong)fdt_addr_to_cpu(cell[2]));
-			if ((fdt_addr_to_cpu(*cell) & type) == type) {
-				addr->phys_hi = fdt_addr_to_cpu(cell[0]);
-				addr->phys_mid = fdt_addr_to_cpu(cell[1]);
-				addr->phys_lo = fdt_addr_to_cpu(cell[2]);
+			      (ulong)fdt32_to_cpu(cell[0]),
+			      (ulong)fdt32_to_cpu(cell[1]),
+			      (ulong)fdt32_to_cpu(cell[2]));
+			if ((fdt32_to_cpu(*cell) & type) == type) {
+				addr->phys_hi = fdt32_to_cpu(cell[0]);
+				addr->phys_mid = fdt32_to_cpu(cell[1]);
+				addr->phys_lo = fdt32_to_cpu(cell[1]);
 				break;
 			} else {
 				cell += (FDT_PCI_ADDR_CELLS +
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

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).

Quoted 8 lines

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.

---
 lib/fdtdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
#2 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

Quoted 13 lines · Simon Glass
Quoted 12 lines · Stephen Warren

From: Stephen Warren <[email protected]>

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.

Quoted 6 lines
Quoted 4 lines
---
  lib/fdtdec.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)

Simon, this patch appears to be assigned to you in patchwork. Will you apply it now the merge window is open, or are you assuming it will go through the Tegra tree with all the PCIe patches?

#3 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

Hi Stephen,

Quoted 23 lines · Stephen Warren
Quoted 21 lines · Simon Glass
Quoted 17 lines · Stephen Warren

From: Stephen Warren <[email protected]>

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.

---
  lib/fdtdec.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
Quoted 5 lines
Quoted 1 line

Simon, this patch appears to be assigned to you in patchwork. Will you apply it now the merge window is open, or are you assuming it will go through the Tegra tree with all the PCIe patches?

I can pick it up.

Regards,
Simon

#4 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

Quoted 27 lines · Simon Glass

Hi Stephen,

Quoted 23 lines · Stephen Warren
Quoted 21 lines · Simon Glass
Quoted 17 lines · Stephen Warren

From: Stephen Warren <[email protected]>

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.

---
  lib/fdtdec.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Simon, this patch appears to be assigned to you in patchwork. Will you apply it now the merge window is open, or are you assuming it will go through the Tegra tree with all the PCIe patches?

I can pick it up.

Applied to u-boot-dm.

#5 lore raw

PATCH 1/1 fdt: fix fdtdec_get_pci_addr() for CONFIG_PHYS_64BIT

In reply to Stephen Warren
Quoted 8 lines · Stephen Warren

From: Stephen Warren <[email protected]>

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).

Quoted 8 lines

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.

---
 lib/fdtdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

This looks very familiar. I think I used to have an equivalent patch in my tree, but possibly never sent it out because I never managed to get PCIe to work. Anyway:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20151006/2aba454e/attachment.sig>