diff mbox series

[v2,1/1] pci: definition of pci_addr_t and pci_size_t

Message ID 20200205205912.32814-1-xypron.glpk@gmx.de
State Accepted
Commit 58fc2b54f5b9102d593f3b98c370b6cbaeb97ac2
Headers show
Series [v2,1/1] pci: definition of pci_addr_t and pci_size_t | expand

Commit Message

Heinrich Schuchardt Feb. 5, 2020, 8:59 p.m. UTC
Currently the size of pci_addr_t and pci_size_t depends on
CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
to an error

    pci_hose_phys_to_bus: invalid physical address

which is due to the truncation of the bus address in _dm_pci_phys_to_bus.

Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error

   PCI: Failed autoconfig bar 10

So let's use unsigned long for pci_addr_t and pci_size_t if
CONFIG_SYS_PCI_64BIT is not defined.

Considering that 32bit U-Boot is used to launch some 64bit x86 systems we
cannot do without CONFIG_SYS_PCI_64BIT requiring u64 as type.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
v2
	Do not change CONFIG_SYS_PCI_64BIT=y case.
---
 include/pci.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.24.1

Comments

Simon Glass Feb. 5, 2020, 9:36 p.m. UTC | #1
On Wed, 5 Feb 2020 at 13:59, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> Currently the size of pci_addr_t and pci_size_t depends on
> CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
> to an error
>
>     pci_hose_phys_to_bus: invalid physical address
>
> which is due to the truncation of the bus address in _dm_pci_phys_to_bus.
>
> Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error
>
>    PCI: Failed autoconfig bar 10
>
> So let's use unsigned long for pci_addr_t and pci_size_t if
> CONFIG_SYS_PCI_64BIT is not defined.
>
> Considering that 32bit U-Boot is used to launch some 64bit x86 systems we
> cannot do without CONFIG_SYS_PCI_64BIT requiring u64 as type.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> v2
>         Do not change CONFIG_SYS_PCI_64BIT=y case.
> ---
>  include/pci.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>
Tom Rini Feb. 13, 2020, 10:12 p.m. UTC | #2
On Wed, Feb 05, 2020 at 09:59:12PM +0100, Heinrich Schuchardt wrote:

> Currently the size of pci_addr_t and pci_size_t depends on
> CONFIG_SYS_PCI_64BIT. For qemu_arm64_defconfig with 4 GiB RAM this leads
> to an error
> 
>     pci_hose_phys_to_bus: invalid physical address
> 
> which is due to the truncation of the bus address in _dm_pci_phys_to_bus.
> 
> Defining CONFIG_SYS_PCI_64BIT is not a solution as this results in an error
> 
>    PCI: Failed autoconfig bar 10
> 
> So let's use unsigned long for pci_addr_t and pci_size_t if
> CONFIG_SYS_PCI_64BIT is not defined.
> 
> Considering that 32bit U-Boot is used to launch some 64bit x86 systems we
> cannot do without CONFIG_SYS_PCI_64BIT requiring u64 as type.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/include/pci.h b/include/pci.h
index 8c761d8da3..06a09f8987 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -488,8 +488,8 @@ 
 typedef u64 pci_addr_t;
 typedef u64 pci_size_t;
 #else
-typedef u32 pci_addr_t;
-typedef u32 pci_size_t;
+typedef unsigned long pci_addr_t;
+typedef unsigned long pci_size_t;
 #endif

 struct pci_region {